- Redesigned lores in DeliveryManMenu
This commit is contained in:
parent
38b6fc34a2
commit
f6fd0427a5
@ -93,7 +93,7 @@ public class DeliveryManManager extends MiniAccount<DeliveryManClient> {
|
|||||||
return;
|
return;
|
||||||
repository.claim(optionalAccount.get().getId(), reward);
|
repository.claim(optionalAccount.get().getId(), reward);
|
||||||
deliveryManClient.claim(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."));
|
player.sendMessage(Style.main(DELIVERY_MAN_NAME, "You claimed §b" + reward.getDisplayName() + "§7."));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,12 +1,14 @@
|
|||||||
package zone.themcgamer.core.deliveryMan;
|
package zone.themcgamer.core.deliveryMan;
|
||||||
|
|
||||||
import com.cryptomorin.xseries.XMaterial;
|
import com.cryptomorin.xseries.XMaterial;
|
||||||
|
import com.cryptomorin.xseries.XSound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import zone.themcgamer.common.TimeUtils;
|
import zone.themcgamer.common.TimeUtils;
|
||||||
import zone.themcgamer.core.account.Account;
|
import zone.themcgamer.core.account.Account;
|
||||||
import zone.themcgamer.core.account.AccountManager;
|
import zone.themcgamer.core.account.AccountManager;
|
||||||
import zone.themcgamer.core.common.ItemBuilder;
|
import zone.themcgamer.core.common.ItemBuilder;
|
||||||
import zone.themcgamer.core.common.SkullTexture;
|
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.Button;
|
||||||
import zone.themcgamer.core.common.menu.MenuType;
|
import zone.themcgamer.core.common.menu.MenuType;
|
||||||
import zone.themcgamer.core.common.menu.UpdatableMenu;
|
import zone.themcgamer.core.common.menu.UpdatableMenu;
|
||||||
@ -61,18 +63,18 @@ public class DeliveryManMenu extends UpdatableMenu {
|
|||||||
String[] rewardNames = reward.getRewardPackage().getRewardNames(player, account);
|
String[] rewardNames = reward.getRewardPackage().getRewardNames(player, account);
|
||||||
|
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> 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("");
|
lore.add("");
|
||||||
if (reward == DeliveryManReward.MONTHLY) {
|
if (reward == DeliveryManReward.MONTHLY) {
|
||||||
if (account.hasRank(reward.getRequiredRank()))
|
if (account.hasRank(reward.getRequiredRank()))
|
||||||
lore.add("§7Your Rank: §b" + account.getPrimaryRankName());
|
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("");
|
||||||
}
|
}
|
||||||
|
|
||||||
lore.add("§7Rewards:");
|
lore.add("§6&lRewards:");
|
||||||
if (rewardNames.length < 1)
|
if (rewardNames.length < 1)
|
||||||
lore.add("§cNone");
|
lore.add(" §b▪ &7None");
|
||||||
else lore.addAll(Arrays.asList(rewardNames));
|
else lore.addAll(Arrays.asList(rewardNames));
|
||||||
|
|
||||||
if (!deliveryManClient.canClaim(reward)) {
|
if (!deliveryManClient.canClaim(reward)) {
|
||||||
@ -80,12 +82,17 @@ public class DeliveryManMenu extends UpdatableMenu {
|
|||||||
lore.add("§7Next Delivery: §b" + TimeUtils.formatIntoDetailedString((deliveryManClient.getLastClaim(reward)
|
lore.add("§7Next Delivery: §b" + TimeUtils.formatIntoDetailedString((deliveryManClient.getLastClaim(reward)
|
||||||
+ reward.getClaimCooldown()) - System.currentTimeMillis(), true));
|
+ reward.getClaimCooldown()) - System.currentTimeMillis(), true));
|
||||||
}
|
}
|
||||||
set(1, slot, new Button(new ItemBuilder(XMaterial.PLAYER_HEAD)
|
ItemBuilder itemBuilder = new ItemBuilder(canClaim ? XMaterial.PLAYER_HEAD : XMaterial.MINECART);
|
||||||
.setSkullOwner(canClaim ? reward.getRewardPackage().getIconTexture(player, account) : SkullTexture.COAL_BLOCK)
|
if (canClaim)
|
||||||
.setName((canClaim ? "§a" : "§c") + "§l" + reward.getDisplayName())
|
itemBuilder.setSkullOwner(reward.getRewardPackage().getIconTexture(player, account));
|
||||||
.setLore(lore).toItemStack(), event -> {
|
itemBuilder.setName((canClaim ? "§a" : "§c") + "§l" + reward.getDisplayName());
|
||||||
if (!canClaim)
|
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;
|
return;
|
||||||
|
}
|
||||||
close();
|
close();
|
||||||
deliveryManManager.claimReward(player, reward);
|
deliveryManManager.claimReward(player, reward);
|
||||||
}));
|
}));
|
||||||
|
@ -24,8 +24,8 @@ public class DailyRewardPackage extends RewardPackage {
|
|||||||
@Override
|
@Override
|
||||||
public String[] getRewardNames(Player player, Account account) {
|
public String[] getRewardNames(Player player, Account account) {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
"§aExample",
|
" §b▪ &7Example",
|
||||||
"§bSomething else"
|
" §b▪ &7Something else"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user