From f6fd0427a5c34077c2993da13ca9e05e589c53ff Mon Sep 17 00:00:00 2001 From: Joel Date: Sun, 21 Feb 2021 17:42:43 +0100 Subject: [PATCH] - Redesigned lores in DeliveryManMenu --- .../core/deliveryMan/DeliveryManManager.java | 2 +- .../core/deliveryMan/DeliveryManMenu.java | 25 ++++++++++++------- .../impl/DailyRewardPackage.java | 4 +-- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/core/src/main/java/zone/themcgamer/core/deliveryMan/DeliveryManManager.java b/core/src/main/java/zone/themcgamer/core/deliveryMan/DeliveryManManager.java index 53ba23f..d1fbade 100644 --- a/core/src/main/java/zone/themcgamer/core/deliveryMan/DeliveryManManager.java +++ b/core/src/main/java/zone/themcgamer/core/deliveryMan/DeliveryManManager.java @@ -93,7 +93,7 @@ public class DeliveryManManager extends MiniAccount { return; repository.claim(optionalAccount.get().getId(), reward); deliveryManClient.claim(reward); - player.playSound(player.getEyeLocation(), XSound.ENTITY_PLAYER_LEVELUP.parseSound(), 0.9f, 1f); + player.playSound(player.getEyeLocation(), XSound.ENTITY_HORSE_ARMOR.parseSound(), 0.9f, 1f); player.sendMessage(Style.main(DELIVERY_MAN_NAME, "You claimed §b" + reward.getDisplayName() + "§7.")); } } \ No newline at end of file diff --git a/core/src/main/java/zone/themcgamer/core/deliveryMan/DeliveryManMenu.java b/core/src/main/java/zone/themcgamer/core/deliveryMan/DeliveryManMenu.java index f384328..7c6f379 100644 --- a/core/src/main/java/zone/themcgamer/core/deliveryMan/DeliveryManMenu.java +++ b/core/src/main/java/zone/themcgamer/core/deliveryMan/DeliveryManMenu.java @@ -1,12 +1,14 @@ package zone.themcgamer.core.deliveryMan; import com.cryptomorin.xseries.XMaterial; +import com.cryptomorin.xseries.XSound; import org.bukkit.entity.Player; import zone.themcgamer.common.TimeUtils; import zone.themcgamer.core.account.Account; import zone.themcgamer.core.account.AccountManager; import zone.themcgamer.core.common.ItemBuilder; import zone.themcgamer.core.common.SkullTexture; +import zone.themcgamer.core.common.Style; import zone.themcgamer.core.common.menu.Button; import zone.themcgamer.core.common.menu.MenuType; import zone.themcgamer.core.common.menu.UpdatableMenu; @@ -61,18 +63,18 @@ public class DeliveryManMenu extends UpdatableMenu { String[] rewardNames = reward.getRewardPackage().getRewardNames(player, account); List lore = new ArrayList<>(); - lore.add("§7Claimable: " + (canClaim ? "§aYes" : "§cNo")); + lore.add((canClaim ? "§7You haven't claimed this reward!" : "&7You already claimed this reward!")); lore.add(""); if (reward == DeliveryManReward.MONTHLY) { if (account.hasRank(reward.getRequiredRank())) lore.add("§7Your Rank: §b" + account.getPrimaryRankName()); - else lore.add("§cOnly §f" + reward.getRequiredRank().getPrefix() + " §ccan claim this reward!"); + else lore.add("§7Only §f" + reward.getRequiredRank().getPrefix() + " §7can claim this reward!"); lore.add(""); } - lore.add("§7Rewards:"); + lore.add("§6&lRewards:"); if (rewardNames.length < 1) - lore.add("§cNone"); + lore.add(" §b▪ &7None"); else lore.addAll(Arrays.asList(rewardNames)); if (!deliveryManClient.canClaim(reward)) { @@ -80,12 +82,17 @@ public class DeliveryManMenu extends UpdatableMenu { lore.add("§7Next Delivery: §b" + TimeUtils.formatIntoDetailedString((deliveryManClient.getLastClaim(reward) + reward.getClaimCooldown()) - System.currentTimeMillis(), true)); } - set(1, slot, new Button(new ItemBuilder(XMaterial.PLAYER_HEAD) - .setSkullOwner(canClaim ? reward.getRewardPackage().getIconTexture(player, account) : SkullTexture.COAL_BLOCK) - .setName((canClaim ? "§a" : "§c") + "§l" + reward.getDisplayName()) - .setLore(lore).toItemStack(), event -> { - if (!canClaim) + ItemBuilder itemBuilder = new ItemBuilder(canClaim ? XMaterial.PLAYER_HEAD : XMaterial.MINECART); + if (canClaim) + itemBuilder.setSkullOwner(reward.getRewardPackage().getIconTexture(player, account)); + itemBuilder.setName((canClaim ? "§a" : "§c") + "§l" + reward.getDisplayName()); + itemBuilder.setLore(lore); + set(1, slot, new Button(itemBuilder.toItemStack(), event -> { + if (!canClaim) { + player.sendMessage(Style.main("Harold", "You can not claim this reward right now!")); + player.playSound(player.getLocation(), XSound.ENTITY_ENDERMITE_AMBIENT.parseSound(), 0.9f, 1f); return; + } close(); deliveryManManager.claimReward(player, reward); })); diff --git a/core/src/main/java/zone/themcgamer/core/deliveryMan/rewardPackage/impl/DailyRewardPackage.java b/core/src/main/java/zone/themcgamer/core/deliveryMan/rewardPackage/impl/DailyRewardPackage.java index 927e32d..3f06bbe 100644 --- a/core/src/main/java/zone/themcgamer/core/deliveryMan/rewardPackage/impl/DailyRewardPackage.java +++ b/core/src/main/java/zone/themcgamer/core/deliveryMan/rewardPackage/impl/DailyRewardPackage.java @@ -24,8 +24,8 @@ public class DailyRewardPackage extends RewardPackage { @Override public String[] getRewardNames(Player player, Account account) { return new String[] { - "§aExample", - "§bSomething else" + " §b▪ &7Example", + " §b▪ &7Something else" }; } } \ No newline at end of file