Improve flag name formatting

This commit is contained in:
Graphica 2017-07-29 22:24:19 -04:00 committed by cnr
parent c2ab6f9dd4
commit 488e8af998

View File

@ -5,6 +5,7 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.banner.CountryFlag;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.flag.FlagType;
import org.bukkit.Material;
@ -12,7 +13,9 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BannerMeta;
import org.bukkit.inventory.meta.ItemMeta;
/**
@ -24,8 +27,8 @@ public class FlagGadget extends Gadget
public FlagGadget(GadgetManager manager, FlagType flag)
{
super(manager, GadgetType.FLAG, flag.getFlag().getCountryAdjective() + " Flag",
UtilText.splitLineToArray(C.cGray + "The flag of " + C.cWhite + flag.getFlag().getCountryName(), LineFormat.LORE),
super(manager, GadgetType.FLAG, "Flag of " + flag.getFlag().getCountryName(),
UtilText.splitLineToArray(C.cGray + "Fly the " + flag.getFlag().getCountryAdjective() + " flag atop your head!", LineFormat.LORE),
flag.getCost(), Material.WOOL, (byte) 0);
setDisplayItem(flag.getFlag().getBanner());
@ -36,13 +39,14 @@ public class FlagGadget extends Gadget
{
Manager.removeGadgetType(player, GadgetType.MORPH, this);
Manager.removeGadgetType(player, GadgetType.FLAG, this);
Manager.removeGadgetType(player, GadgetType.HAT, this);
Manager.removeOutfit(player, OutfitGadget.ArmorSlot.HELMET);
_active.add(player);
if (message)
{
UtilPlayer.message(player, F.main("Gadget", "You unfurled your " + F.elem(getName()) + "."));
UtilPlayer.message(player, F.main("Gadget", "You unfurled the " + F.elem(getName()) + "."));
}
}
@ -50,7 +54,7 @@ public class FlagGadget extends Gadget
{
if (_active.remove(player))
{
UtilPlayer.message(player, F.main("Gadget", "You put away your " + F.elem(getName()) + "."));
UtilPlayer.message(player, F.main("Gadget", "You took down the " + F.elem(getName()) + "."));
}
}
@ -60,7 +64,8 @@ public class FlagGadget extends Gadget
applyArmor(player, message);
ItemStack flag = _flag.getFlag().getBanner();
ItemMeta meta = flag.getItemMeta();
meta.setDisplayName(getDisplayName());
meta.setDisplayName(C.cGreenB + getDisplayName());
meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
flag.setItemMeta(meta);
player.getInventory().setHelmet(flag);
player.updateInventory();