diff --git a/libs/CMILib1.0.2.2.jar b/libs/CMILib1.0.2.2.jar new file mode 100644 index 00000000..ff793baa Binary files /dev/null and b/libs/CMILib1.0.2.2.jar differ diff --git a/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGui.java b/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGui.java deleted file mode 100644 index adf04bb3..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGui.java +++ /dev/null @@ -1,392 +0,0 @@ -package com.gamingmesh.jobs.CMIGUI; - -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.Map.Entry; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; - -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMIGUI.GUIManager.CmiInventoryType; -import com.gamingmesh.jobs.CMIGUI.GUIManager.CommandType; -import com.gamingmesh.jobs.CMIGUI.GUIManager.GUIButtonLocation; -import com.gamingmesh.jobs.CMIGUI.GUIManager.GUIClickType; -import com.gamingmesh.jobs.CMIGUI.GUIManager.GUIFieldType; -import com.gamingmesh.jobs.CMIGUI.GUIManager.GUIRows; -import com.gamingmesh.jobs.CMIGUI.GUIManager.InvType; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.Version; -import com.gamingmesh.jobs.commands.JobsCommands; -import com.gamingmesh.jobs.stuff.PageInfo; - -public class CMIGui { - - private InventoryType invType; - private GUIRows gUIRows; - private Player player; - private Inventory inv; - private String title; - private HashMap buttons = new HashMap(); - private LinkedHashSet noSlotButtons = new LinkedHashSet(); - - private HashMap lock = new HashMap(); - private HashMap permLock = new HashMap(); - - private CmiInventoryType type = CmiInventoryType.regular; - private Object whatShows; - - private boolean allowShift = false; - - public CMIGui() { - } - - public CMIGui(Player player) { - this.player = player; - } - - @Override - public CMIGui clone() { - CMIGui g = new CMIGui(player); - g.setInvSize(gUIRows); - g.setButtons(buttons); - g.setInv(inv); - g.setInvType(invType); - g.setTitle(title); - g.setCmiInventoryType(type); - g.setWhatShows(whatShows); - return g; - } - - public boolean isSimilar(CMIGui gui) { - - if (this.getInvSize() != gui.getInvSize()) - return false; - - if (this.getInvType() != gui.getInvType()) - return false; - - return true; - } - - public CMIGui open() { - GUIManager.openGui(this); - return this; - } - - public CMIGui update() { - GUIManager.softUpdateContent(this); - return this; - } - - public InventoryType getInvType() { - if (invType == null) - invType = InventoryType.CHEST; - return invType; - } - - public void setInvType(InventoryType invType) { - this.invType = invType; - } - - public GUIRows getInvSize() { - if (gUIRows == null) - autoResize(); - return gUIRows; - } - - public void setInvSize(GUIRows GUIRows) { - this.gUIRows = GUIRows; - } - - public void setInvSize(int rows) { - this.gUIRows = GUIRows.getByRows(rows); - } - - public void autoResize() { - this.combineButtons(); - int max = 0; - for (Entry one : this.buttons.entrySet()) { - if (one.getKey() > max) - max = one.getKey(); - } - - if (max < 9) { - this.gUIRows = GUIRows.r1; - } else if (max < 18) { - this.gUIRows = GUIRows.r2; - } else if (max < 27) { - this.gUIRows = GUIRows.r3; - } else if (max < 36) { - this.gUIRows = GUIRows.r4; - } else if (max < 45) { - this.gUIRows = GUIRows.r5; - } else { - this.gUIRows = GUIRows.r6; - } - } - - public Player getPlayer() { - return player; - } - - public void setPlayer(Player player) { - this.player = player; - } - - public Inventory getInv() { - if (inv == null) - GUIManager.generateInventory(this); - return inv; - } - - public void setInv(Inventory inv) { - this.inv = inv; - } - - public String getTitle() { - if (title == null) - title = ""; - return CMIChatColor.translate(title); - } - - public void updateTitle(String title) { - setTitle(title); -// Jobs.getNms().updateInventoryTitle(player, this.title); - } - - public void setTitle(String title) { - if (Version.isCurrentEqualOrHigher(Version.v1_16_R1)) { - if (CMIChatColor.stripColor(title).length() > 64) { - title = title.substring(0, 63) + "~"; - } - } else { - if (title.length() > 32) { - title = title.substring(0, 31) + "~"; - } - } - this.title = title; - } - - - public HashMap getButtons() { - combineButtons(); - return buttons; - } - - public CMIGui addButton(CMIGuiButton button) { - return addButton(button, 54); - } - - public CMIGui addButton(CMIGuiButton button, int maxSlot) { - if (button.getSlot() != null && buttons.get(button.getSlot()) != null) { - for (int ii = button.getSlot(); ii < maxSlot; ii++) { - CMIGuiButton b = buttons.get(ii); - if (b == null) { - buttons.put(ii, button); - break; - } - } - return this; - } - - if (button.getSlot() == null) { - noSlotButtons.add(button); - return this; - } - buttons.put(button.getSlot(), button); - setInv(null); - return this; - } - - public CMIGui updateButton(CMIGuiButton button) { - buttons.put(button.getSlot(), button); - setInv(null); - return this; - } - - private void combineButtons() { - for (CMIGuiButton button : noSlotButtons) { - for (int ii = 0; ii < 54; ii++) { - CMIGuiButton b = buttons.get(ii); - if (b == null) { - buttons.put(ii, button); - break; - } - } - } - noSlotButtons.clear(); - } - - public void fillEmptyButtons() { - combineButtons(); - for (int i = 0; i < this.getInvSize().getFields(); i++) { - if (this.buttons.containsKey(i)) - continue; - addEmptyButton(i); - } - } - - private CMIMaterial filler = CMIMaterial.BLACK_STAINED_GLASS_PANE; - - public void addEmptyButton(int slot) { - ItemStack MiscInfo = filler.newItemStack(); - if (!CMIMaterial.isAir(MiscInfo.getType())) { - ItemMeta MiscInfoMeta = MiscInfo.getItemMeta(); - if (MiscInfoMeta != null) { - MiscInfoMeta.setDisplayName(" "); - MiscInfo.setItemMeta(MiscInfoMeta); - } - } - addButton(new CMIGuiButton(slot, GUIFieldType.Locked, MiscInfo)); - } - - public void setButtons(HashMap buttons) { -// for (Entry one : buttons.entrySet()) { -// CMIGuiButton old = this.buttons.get(one.getKey()); -// if (old == null) -// old = one.getValue(); -// buttons.put(one.getKey(), old); -// } - this.buttons = buttons; - } - - public boolean isLocked(InvType type) { - return lock.containsKey(type) ? (lock.get(type) == GUIFieldType.Locked) : false; - } - - public void addLock(InvType type) { - addLock(type, GUIFieldType.Locked); - } - - public void addLock(InvType type, GUIFieldType lock) { - this.lock.put(type, lock); - } - - public boolean isPermLocked(InvType type) { - return permLock.containsKey(type) ? (!this.player.hasPermission(permLock.get(type))) : true; - } - - public void addPermLock(InvType type, String perm) { - this.permLock.put(type, perm); - } - - public CmiInventoryType getType() { - return type; - } - - public void setCmiInventoryType(CmiInventoryType type) { - this.type = type; - } - - public Object getWhatShows() { - return whatShows; - } - - public void setWhatShows(Object whatShows) { - this.whatShows = whatShows; - } - - public Integer getSlot(GUIButtonLocation place) { - GUIRows size = this.getInvSize(); - int v = place.getCollumn() * 9; - v = place.getCollumn() > 0 ? v - 1 : v; - Integer value = (((place.getRow() * (size.getRows())) * 9) - 8) + v; - value = place.getRow() > 0 ? value : value + 9; - return value - 1; - } - - public void onClose() { - - } - - public boolean click(int slot) { - return click(slot, null, null); - } - - public boolean click(int slot, GUIClickType type, ItemStack currentItem) { - return true; - } - - public void addPagination(PageInfo pi, Object cmd, String pagePref) { - addPagination(pi, JobsCommands.LABEL + " " + cmd.getClass().getSimpleName(), pagePref); - } - - public void addPagination(PageInfo pi, String cmd, String pagePref) { - - if (!cmd.startsWith("/")) - cmd = "/" + cmd; -// String separator = this.getMsg(LC.info_fliperSimbols); - - int CurrentPage = pi.getCurrentPage(); - int pageCount = pi.getTotalPages(); - int totalEntries = pi.getTotalEntries(); - - if (pageCount == 1) - return; - if (this.getInvSize().getRows() < 6) - this.setInvSize(GUIRows.r6); - - Integer prevSlot = this.getSlot(GUIButtonLocation.bottomLeft); - Integer nextSlot = this.getSlot(GUIButtonLocation.bottomRight); - Integer midSlot = this.getSlot(GUIButtonLocation.bottomRight) - 4; - - String pagePrefix = pagePref == null ? "" : pagePref; - - int NextPage = CurrentPage + 1; - NextPage = CurrentPage < pageCount ? NextPage : CurrentPage; - int Prevpage = CurrentPage - 1; - Prevpage = CurrentPage > 1 ? Prevpage : CurrentPage; - -// RawMessage rm = new RawMessage(); - - if (pageCount != 0) { - - for (int i = GUIRows.r5.getFields(); i < GUIRows.r6.getFields(); i++) { - this.getButtons().remove(i); - } - - CMIGuiButton button = new CMIGuiButton(midSlot, CMIMaterial.WHITE_WOOL.newItemStack()); - button.setName(Jobs.getLanguage().getMessage("command.help.output.pageCount", "[current]", CurrentPage, "[total]", pageCount)); - button.addLore(Jobs.getLanguage().getMessage("pageCountHover", "[totalEntries]", totalEntries)); - this.addButton(button); - - if (this.getButtons().get(prevSlot) == null && CurrentPage > 1) { - button = new CMIGuiButton(prevSlot, CMIMaterial.WHITE_WOOL.newItemStack()); - button.setName(Jobs.getLanguage().getMessage("command.help.output.prevPageGui")); - button.addLore(Jobs.getLanguage().getMessage("command.help.output.pageCount", "[current]", CurrentPage, "[total]", pageCount)); - button.addCommand(cmd + " " + pagePrefix + Prevpage, CommandType.silent); - this.addButton(button); - } - - if (this.getButtons().get(nextSlot) == null && pageCount > CurrentPage) { - button = new CMIGuiButton(nextSlot, CMIMaterial.WHITE_WOOL.newItemStack()); - button.setName(Jobs.getLanguage().getMessage("command.help.output.nextPageGui")); - button.addLore(Jobs.getLanguage().getMessage("command.help.output.pageCount", "[current]", CurrentPage, "[total]", pageCount)); - button.addCommand(cmd + " " + pagePrefix + NextPage, CommandType.silent); - this.addButton(button); - } - - } - } - - public boolean isAllowShift() { - return allowShift; - } - - public void setAllowShift(boolean allowShift) { - this.allowShift = allowShift; - } - - public CMIMaterial getFiller() { - return filler; - } - - public void setFiller(CMIMaterial filler) { - this.filler = filler; - } -} diff --git a/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGuiButton.java b/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGuiButton.java deleted file mode 100644 index f6ace65e..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMIGUI/CMIGuiButton.java +++ /dev/null @@ -1,301 +0,0 @@ -package com.gamingmesh.jobs.CMIGUI; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; - -import com.gamingmesh.jobs.CMIGUI.GUIManager.CommandType; -import com.gamingmesh.jobs.CMIGUI.GUIManager.GUIClickType; -import com.gamingmesh.jobs.CMIGUI.GUIManager.GUIFieldType; -import com.gamingmesh.jobs.CMILib.CMIItemStack; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.CMIReflections; - -public class CMIGuiButton { - - private Integer slot = null; - private GUIFieldType fieldType = GUIFieldType.Locked; - private boolean closeInv = false; - - private HashMap> commandMap = new HashMap<>(); - - private List permissions = new ArrayList(); - private ItemStack item = null; - - @Override - public CMIGuiButton clone() { - CMIGuiButton b = new CMIGuiButton(slot, fieldType, item); - b.setPermissions(new ArrayList(permissions)); - b.setCommandMap(new HashMap>(commandMap)); - return b; - } - - public CMIGuiButton(Integer slot, GUIFieldType fieldType, ItemStack item) { - this.slot = slot; - this.fieldType = fieldType; - this.item = item == null ? null : item.clone(); - } - - public CMIGuiButton(Integer slot) { - this.slot = slot; - } - - public CMIGuiButton(ItemStack item) { - this.item = item == null ? null : item.clone(); - } - - public CMIGuiButton(Integer slot, CMIItemStack item) { - this(slot, item.getItemStack()); - } - - public CMIGuiButton(Integer slot, ItemStack item) { - this.slot = slot; - this.item = item == null ? null : item.clone(); - if (this.item != null && this.item.getDurability() == 32767) { - CMIMaterial d = CMIMaterial.getRandom(CMIMaterial.get(this.item)); - if (d != null && d.getLegacyData() != -1) - this.item.setDurability((short) d.getLegacyData()); - } - } - - public CMIGuiButton(Integer slot, Material material) { - this.slot = slot; - this.item = new ItemStack(material); - } - - public CMIGuiButton(Integer slot, CMIMaterial material) { - this.slot = slot; - this.item = material.newItemStack(); - } - - public CMIGuiButton(Integer slot, Material material, int data) { - this(slot, material, data, null); - } - - public CMIGuiButton(Integer slot, Material material, String name) { - this(slot, material, 0, name); - } - - public CMIGuiButton(Integer slot, CMIMaterial material, String name) { - this(slot, material.getMaterial(), material.getLegacyData() != -1 ? material.getLegacyData() : 0, name); - } - - public CMIGuiButton(Integer slot, Material material, int data, String name) { - this.slot = slot; - this.item = new ItemStack(material, 1, (short) data); - if (name != null) { - ItemMeta meta = this.item.getItemMeta(); - meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name)); - this.item.setItemMeta(meta); - } - } - - public Integer getSlot() { - return slot; - } - - public CMIGuiButton setSlot(Integer slot) { - this.slot = slot; - return this; - } - - public GUIFieldType getFieldType() { - return fieldType; - } - - public CMIGuiButton setFieldType(GUIFieldType fieldType) { - this.fieldType = fieldType; - return this; - } - - public CMIGuiButton lockField() { - this.fieldType = GUIFieldType.Locked; - return this; - } - - public CMIGuiButton unlockField() { - this.fieldType = GUIFieldType.Free; - return this; - } - - public boolean isLocked() { - return this.fieldType.equals(GUIFieldType.Locked); - } - - public List getPermissions() { - return permissions; - } - - public CMIGuiButton addPermission(String perm) { - this.permissions.add(perm); - return this; - } - - public void setPermissions(List permissions) { - this.permissions = permissions; - } - - public List getCommands(GUIClickType type) { - List list = commandMap.get(type); - if (list == null) - list = new ArrayList(); - return list; - } - - public CMIGuiButton setName(String name) { - if (this.item == null) - return this; - ItemMeta meta = this.item.getItemMeta(); - if (meta != null) { - meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name)); - this.item.setItemMeta(meta); - } - return this; - } - - public CMIGuiButton addLore(List l) { - l = spreadList(l); - for (String one : l) { - addLore(one); - } - return this; - } - - public List spreadList(List ls) { - List s = new ArrayList(); - for (int i = 0; i < ls.size(); i++) { - if (ls.get(i).contains(" \\n")) { - s.addAll(Arrays.asList(ls.get(i).split(" \\\\n"))); - } else - s.add(ls.get(i)); - } - return s; - } - - public CMIGuiButton addLore(String l) { - if (this.item == null) - return this; - ItemMeta meta = this.item.getItemMeta(); - if (meta != null) { - List lore = meta.getLore(); - if (lore == null) - lore = new ArrayList(); - lore.add(ChatColor.translateAlternateColorCodes('&', l)); - meta.setLore(lore); - this.item.setItemMeta(meta); - } - return this; - } - - public CMIGuiButton addItemName(String name) { - if (this.item == null) - return this; - ItemMeta meta = this.item.getItemMeta(); - meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name)); - this.item.setItemMeta(meta); - return this; - } - - public CMIGuiButton addCommand(String command) { - return addCommand(null, command); - } - - public CMIGuiButton addCommand(String command, CommandType vis) { - return addCommand(null, command, vis); - } - - public CMIGuiButton addCommand(GUIClickType type, String command) { - return addCommand(type, command, CommandType.gui); - } - - public CMIGuiButton addCommand(GUIClickType type, String command, CommandType vis) { - if (type == null) { - for (GUIClickType one : GUIClickType.values()) { - List list = commandMap.get(one); - if (list == null) - list = new ArrayList(); - list.add(new GUIButtonCommand(command, vis)); - commandMap.put(one, list); - } - } else { - List list = commandMap.get(type); - if (list == null) - list = new ArrayList(); - list.add(new GUIButtonCommand(command, vis)); - commandMap.put(type, list); - } - return this; - } - - public void click() { - - } - - public void click(GUIClickType type) { - - } - - public CMIGuiButton addCommand(Location loc) { - if (loc == null) - return this; - addCommand("cmi tppos " + loc.getWorld().getName() + " " + loc.getX() + " " + loc.getY() + " " + loc.getBlockZ() + " " + loc.getPitch() + " " + loc.getYaw()); - return this; - } - - public ItemStack getItem() { - return getItem(null); - } - - public ItemStack getItem(Player player) { - - if (item != null) { - ItemStack i = item.clone(); - - if (isLocked()) { - i = CMIReflections.setNbt(item, GUIManager.CMIGUIIcon, GUIManager.LIProtection); - } - - ItemMeta meta = i.getItemMeta(); - - if (player != null) { -// if (meta != null && meta.hasDisplayName()) { -// meta.setDisplayName(CMI.getInstance().getPlaceholderAPIManager().updatePlaceHolders(player, meta.getDisplayName())); -// } -// -// if (meta != null && meta.hasLore()) { -// meta.setLore(CMI.getInstance().getPlaceholderAPIManager().updatePlaceHolders(player, meta.getLore())); -// } - } - i.setItemMeta(meta); - return i; - } - - return item; - } - - public CMIGuiButton setItem(ItemStack item) { - this.item = item == null ? null : item.clone(); - return this; - } - - public void setCommandMap(HashMap> commandMap) { - this.commandMap = commandMap; - } - - public boolean isCloseInv() { - return closeInv; - } - - public void setCloseInv(boolean closeInv) { - this.closeInv = closeInv; - } - -} diff --git a/src/main/java/com/gamingmesh/jobs/CMIGUI/GUIButtonCommand.java b/src/main/java/com/gamingmesh/jobs/CMIGUI/GUIButtonCommand.java deleted file mode 100644 index d37fcb44..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMIGUI/GUIButtonCommand.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.gamingmesh.jobs.CMIGUI; - -import com.gamingmesh.jobs.CMIGUI.GUIManager.CommandType; - -class GUIButtonCommand { - private String command; - private CommandType vis = CommandType.gui; - - public GUIButtonCommand(String command) { - this.command = command; - } - - public GUIButtonCommand(String command, CommandType vis) { - this.command = command; - this.vis = vis; - } - - public String getCommand() { - return command; - } - - public void setCommand(String command) { - this.command = command; - } - - public CommandType getCommandType() { - return vis; - } - - public void setCommandType(CommandType vis) { - this.vis = vis; - } - -} diff --git a/src/main/java/com/gamingmesh/jobs/CMIGUI/GUIListener.java b/src/main/java/com/gamingmesh/jobs/CMIGUI/GUIListener.java deleted file mode 100644 index 50a0ce77..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMIGUI/GUIListener.java +++ /dev/null @@ -1,160 +0,0 @@ -package com.gamingmesh.jobs.CMIGUI; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryCloseEvent; -import org.bukkit.event.inventory.InventoryDragEvent; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.inventory.ItemStack; - -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIReflections; - -public class GUIListener implements Listener { - Jobs plugin; - - public GUIListener(Jobs plugin) { - this.plugin = plugin; - } - - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) - public void onNormalInventoryClose(InventoryCloseEvent event) { - final Player player = (Player) event.getPlayer(); - if (GUIManager.isOpenedGui(player)) { - if (GUIManager.removePlayer(player)) { - player.updateInventory(); - clearIconItems(player); - } - } - } - - private static void clearIconItems(Player player) { - for (ItemStack one : player.getInventory().getContents()) { - Object res = CMIReflections.getNbt(one, GUIManager.CMIGUIIcon); - if (res == null || !(res instanceof String) || !((String) res).equalsIgnoreCase(GUIManager.LIProtection)) - continue; - player.getInventory().remove(one); - } - } - - private HashMap LastClick = new HashMap<>(); - - private boolean canClickByTimer(UUID uuid) { - Long time = LastClick.get(uuid); - if (time == null) { - LastClick.put(uuid, System.currentTimeMillis()); - return true; - } - - if (time + 51 > System.currentTimeMillis()) { - LastClick.put(uuid, System.currentTimeMillis()); - return false; - } - - LastClick.put(uuid, System.currentTimeMillis()); - return true; - } - - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) - public void onInventoryClick(final InventoryClickEvent event) { - final Player player = (Player) event.getWhoClicked(); - - if (!GUIManager.isOpenedGui(player)) - return; - - CMIGui gui = GUIManager.getGui(player); - if (event.getClick() == ClickType.DOUBLE_CLICK || event.getHotbarButton() != -1) { - event.setCancelled(true); - return; - } - - if (!gui.isAllowShift() && event.isShiftClick()) - event.setCancelled(true); - - if (!event.getAction().equals(InventoryAction.PICKUP_ALL) && - !event.getAction().equals(InventoryAction.PICKUP_ONE) && - !event.getAction().equals(InventoryAction.PICKUP_HALF) && - !event.getAction().equals(InventoryAction.PICKUP_SOME) && - !event.getAction().equals(InventoryAction.PLACE_ALL) && - !event.getAction().equals(InventoryAction.PLACE_ONE) && - !event.getAction().equals(InventoryAction.PLACE_SOME) && - !gui.isAllowShift() && !event.getAction().equals(InventoryAction.MOVE_TO_OTHER_INVENTORY)) - event.setCancelled(true); - - if (!canClickByTimer(player.getUniqueId())) { - event.setCancelled(true); - return; - } - - final List buttons = new ArrayList<>(); - buttons.add(event.getRawSlot()); - if (!GUIManager.canClick(player, buttons)) { - event.setCancelled(true); - } - - if (GUIManager.isLockedPart(player, buttons)) - event.setCancelled(true); - - InventoryAction action = event.getAction(); - if (!GUIManager.processClick(player, event.getCurrentItem(), buttons, GUIManager.getClickType(event.isLeftClick(), event.isShiftClick(), action))) { - event.setCancelled(true); - return; - } - - if (gui.isAllowShift() && event.getAction().equals(InventoryAction.MOVE_TO_OTHER_INVENTORY) && event.getClickedInventory().getType().equals(InventoryType.PLAYER)) { - - event.setCancelled(true); - - ItemStack item = event.getCurrentItem().clone(); - - for (int i = 0; i < gui.getInvSize().getFields(); i++) { - CMIGuiButton b = gui.getButtons().get(i); - - if ((b == null || !b.isLocked() && b.getItem() == null) && gui.getInv().getItem(i) == null) { - gui.getInv().setItem(i, item); - event.setCurrentItem(null); - break; - } - } - } - } - - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) - public void onInventoryMove(final InventoryDragEvent event) { - final Player player = (Player) event.getWhoClicked(); - - if (!GUIManager.isOpenedGui(player)) - return; - - if (!canClickByTimer(player.getUniqueId())) { - event.setCancelled(true); - return; - } - - final List buttons = new ArrayList<>(); - buttons.addAll(event.getRawSlots()); - if (!GUIManager.canClick(player, buttons)) { - event.setCancelled(true); - } - - if (GUIManager.isLockedPart(player, buttons)) { - event.setCancelled(true); - } - - if (!GUIManager.processClick(player, null, buttons, GUIManager.getClickType(true, false, null))) { - event.setCancelled(true); - return; - - } - } -} \ No newline at end of file diff --git a/src/main/java/com/gamingmesh/jobs/CMIGUI/GUIManager.java b/src/main/java/com/gamingmesh/jobs/CMIGUI/GUIManager.java deleted file mode 100644 index be39a137..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMIGUI/GUIManager.java +++ /dev/null @@ -1,431 +0,0 @@ -package com.gamingmesh.jobs.CMIGUI; - -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; -import java.util.UUID; -import java.util.logging.Level; - -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.server.ServerCommandEvent; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; - -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIReflections; - -public class GUIManager { - - private static HashMap map = new HashMap<>(); - - public final static String CMIGUIIcon = "CMIGUIIcon"; - public final static String LIProtection = "LIProtection"; - - static { - registerListener(); - } - - public static void registerListener() { - Jobs plugin = org.bukkit.plugin.java.JavaPlugin.getPlugin(Jobs.class); - plugin.getServer().getPluginManager().registerEvents(new GUIListener(plugin), plugin); - } - - public enum GUIButtonLocation { - topLeft(0, 0), topRight(0, 1), bottomLeft(1, 0), bottomRight(1, 1); - - private Integer row; - private Integer collumn; - - GUIButtonLocation(Integer row, Integer collumn) { - this.collumn = collumn; - this.row = row; - } - - public Integer getRow() { - return row; - } - - public Integer getCollumn() { - return collumn; - } - - } - - public enum GUIRows { - r1(1), r2(2), r3(3), r4(4), r5(5), r6(6); - - private int rows; - - GUIRows(int rows) { - this.rows = rows; - } - - public Integer getFields() { - return rows * 9; - } - - public Integer getRows() { - return rows; - } - - public static GUIRows getByRows(Integer rows) { - if (rows > 9) - rows = rows / 9; - for (GUIRows one : GUIRows.values()) { - if (one.getRows().equals(rows)) - return one; - } - return GUIRows.r6; - } - } - - public enum GUIFieldType { - Free, Locked - } - - public enum InvType { - Gui, Main, Quickbar - } - - public enum CmiInventoryType { - regular, SavedInv, EditableInv, RecipeCreator, ArmorStandEditor, EntityInventoryEditor, Recipes, SellHand - } - - public enum GUIClickType { - Left, LeftShift, Right, RightShift, MiddleMouse; - - public boolean isShiftClick() { - switch (this) { - case Left: - case MiddleMouse: - case Right: - break; - case RightShift: - case LeftShift: - return true; - default: - break; - } - return false; - } - - public boolean isLeftClick() { - switch (this) { - case MiddleMouse: - case Right: - case RightShift: - break; - case Left: - case LeftShift: - return true; - default: - break; - } - return false; - } - - public boolean isRightClick() { - switch (this) { - case Right: - case RightShift: - return true; - case Left: - case LeftShift: - case MiddleMouse: - default: - break; - } - return false; - } - - public boolean isMiddleClick() { - switch (this) { - case MiddleMouse: - return true; - case Right: - case RightShift: - case Left: - case LeftShift: - default: - break; - } - return false; - } - } - - public void closeAll() { - for (Entry one : map.entrySet()) { - Player player = Bukkit.getPlayer(one.getKey()); - if (player == null) - continue; - player.closeInventory(); - } - } - - public static GUIClickType getClickType(boolean left, boolean shift, InventoryAction action) { - - if (!left && !shift && (action.equals(InventoryAction.NOTHING) || action.equals(InventoryAction.CLONE_STACK))) - return GUIClickType.MiddleMouse; - - if (left && !shift) { - return GUIClickType.Left; - } else if (left && shift) { - return GUIClickType.LeftShift; - } else if (!left && !shift) { - return GUIClickType.Right; - } else { - return GUIClickType.RightShift; - } - } - - public static boolean processClick(final Player player, ItemStack currentItem, List buttons, final GUIClickType clickType) { - CMIGui gui = map.get(player.getUniqueId()); - if (gui == null) - return true; - - for (Integer one : buttons) { - - final CMIGuiButton button = gui.getButtons().get(one); - - if (!gui.click(one, clickType, currentItem)) - return false; - - if (button == null) - continue; - boolean canClick = true; - for (String oneC : button.getPermissions()) { - if (!player.hasPermission(oneC)) - canClick = false; - } - - if (canClick) { - Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(org.bukkit.plugin.java.JavaPlugin.getPlugin(Jobs.class), new Runnable() { - @Override - public void run() { - - for (GUIButtonCommand oneC : button.getCommands(clickType)) { - performCommand(player, oneC.getCommand(), oneC.getCommandType()); - } - } - }, 1); - } - - button.click(); - button.click(clickType); - - if (button.isCloseInv()) - player.closeInventory(); - - if (!button.getCommands(clickType).isEmpty()) - break; - } - - return true; - } - - public void performCommand(CommandSender sender, String command, CommandType type) { - if (sender instanceof Player) { - performCommand((Player) sender, command, type); - } else { - ServerCommandEvent event = new ServerCommandEvent(sender, command.startsWith("/") ? command : "/" + command); - Bukkit.getServer().getPluginManager().callEvent(event); - if (!event.isCancelled()) { - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), event.getCommand().startsWith("/") ? event.getCommand().substring(1, event.getCommand().length()) : event.getCommand()); - } - if (!type.equals(CommandType.silent)) - Bukkit.getLogger().log(Level.INFO, sender.getName() + " issued " + type.name() + " command: /" + command); - } - } - - public static void performCommand(Player player, String command, CommandType type) { - PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, command.startsWith("/") ? command : "/" + command); - Bukkit.getServer().getPluginManager().callEvent(event); - if (!event.isCancelled()) { - player.performCommand(event.getMessage().startsWith("/") ? event.getMessage().substring(1, event.getMessage().length()) : event.getMessage()); - } - if (!type.equals(CommandType.silent)) - Bukkit.getLogger().log(Level.INFO, player.getName() + " issued " + type.name() + " command: /" + command); - } - - public enum CommandType { - gui, warmup, acmd, rank, silent - } - - public static boolean isLockedPart(Player player, List buttons) { - CMIGui gui = map.get(player.getUniqueId()); - if (gui == null) - return false; - - int size = gui.getInv().getSize(); - int mainInvMax = size + 36 - 9; - int quickbar = size + 36; - - for (Integer one : buttons) { - if (one > quickbar || quickbar < 0) - continue; - if (one < size && (gui.isLocked(InvType.Gui) && gui.isPermLocked(InvType.Gui))) { - return true; - } else if (one >= size && one < mainInvMax && (gui.isLocked(InvType.Main) && gui.isPermLocked(InvType.Main))) { - return true; - } else if (one >= mainInvMax && one < quickbar && ((gui.isLocked(InvType.Quickbar) && gui.isPermLocked(InvType.Quickbar)) || (gui.isLocked(InvType.Main) && gui.isPermLocked(InvType.Main)))) { - return true; - } - } - - return false; - } - - public static boolean canClick(Player player, List buttons) { - try { - CMIGui gui = map.get(player.getUniqueId()); - if (gui == null) - return true; - - for (Integer one : buttons) { - CMIGuiButton button = gui.getButtons().get(one); - if (button == null) - continue; - if (button.getFieldType() == GUIFieldType.Locked) - return false; - } - } catch (Exception e) { - return false; - } - return true; - } - - public static CMIGui getGui(Player player) { - return map.get(player.getUniqueId()); - } - - public static boolean isOpenedGui(Player player) { - CMIGui gui = map.get(player.getUniqueId()); - if (gui == null) - return false; - if (player.getOpenInventory() == null) - return false; -// if (!player.getOpenInventory().getTopInventory().equals(gui.getInv())) -// return false; - return true; - } - - public static boolean removePlayer(Player player) { - CMIGui removed = map.remove(player.getUniqueId()); - if (removed == null) - return false; - - removed.onClose(); - - if (player.getOpenInventory() != null && player.getOpenInventory().getTopInventory().equals(removed.getInv())) - player.closeInventory(); - -// CMIGUICloseEvent event = new CMIGUICloseEvent(player, removed); -// Bukkit.getServer().getPluginManager().callEvent(event); - - return true; - } - - public static void generateInventory(CMIGui gui) { - - Inventory GuiInv = null; - if (gui.getInvSize() != null) - GuiInv = Bukkit.createInventory(null, gui.getInvSize().getFields(), gui.getTitle()); - else - GuiInv = Bukkit.createInventory(null, gui.getInvType(), gui.getTitle()); - - if (GuiInv == null) - return; - - for (Entry one : gui.getButtons().entrySet()) { - if (one.getKey() > GuiInv.getSize()) - continue; - try { - ItemStack item = one.getValue().getItem(gui.getPlayer()); - item = item == null ? null : item.clone(); - if (item != null && one.getValue().isLocked()) { - item = CMIReflections.setNbt(item, CMIGUIIcon, LIProtection); - } - GuiInv.setItem(one.getKey(), item); - } catch (ArrayIndexOutOfBoundsException e) { - break; - } - } - gui.setInv(GuiInv); - } - -// public void updateInventory(CMIGui old, CMIGui gui) { -// -// Inventory GuiInv = gui.getInv(); -// if (GuiInv == null) -// return; -// -// plugin.getNMS().updateInventoryTitle(gui.getPlayer(), gui.getTitle()); -// -// for (Entry one : gui.getButtons().entrySet()) { -// if (one.getKey() > GuiInv.getSize()) -// continue; -// GuiInv.setItem(one.getKey(), one.getValue().getItem()); -// } -// gui.setInv(GuiInv); -// } - - public static void openGui(CMIGui gui) { - Player player = gui.getPlayer(); - if (player.isSleeping()) - return; - - CMIGui oldGui = null; - if (isOpenedGui(player)) { - oldGui = getGui(player); - if (!gui.isSimilar(oldGui)) { - oldGui = null; - } - } - if (oldGui == null) { - generateInventory(gui); - player.closeInventory(); - player.openInventory(gui.getInv()); - map.put(player.getUniqueId(), gui); - } else { - updateContent(gui); - } - - } - - public static void updateContent(CMIGui gui) { - Player player = gui.getPlayer(); - if (player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null) { - player.closeInventory(); - } - -// Jobs.getNms().updateInventoryTitle(player, gui.getTitle()); - player.getOpenInventory().getTopInventory().setContents(gui.getInv().getContents()); - gui.setInv(player.getOpenInventory().getTopInventory()); - map.put(player.getUniqueId(), gui); - } - - public static void softUpdateContent(CMIGui gui) { - Player player = gui.getPlayer(); - if (player.getOpenInventory() == null || player.getOpenInventory().getTopInventory() == null) { - player.closeInventory(); - } - -// plugin.getNMS().updateInventoryTitle(player, gui.getTitle()); - - for (int i = 0; i < player.getOpenInventory().getTopInventory().getSize(); i++) { - CMIGuiButton button = gui.getButtons().get(i); - if (button == null) - continue; - if (!button.isLocked()) - continue; - player.getOpenInventory().getTopInventory().setItem(i, button.getItem(gui.getPlayer())); - } - gui.setInv(player.getOpenInventory().getTopInventory()); - map.put(player.getUniqueId(), gui); - player.updateInventory(); - } -} \ No newline at end of file diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/ActionBarManager.java b/src/main/java/com/gamingmesh/jobs/CMILib/ActionBarManager.java deleted file mode 100644 index 93367533..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/ActionBarManager.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class ActionBarManager { - private static Object packet; - private static Method getHandle; - private static Method sendPacket; - private static Field playerConnection; - private static Class nmsChatSerializer; - private static Class nmsIChatBaseComponent; - private static Class packetType; - - private static Class ChatMessageclz; - private static Class sub; - private static Object[] consts; - - static { - if (Version.isCurrentHigher(Version.v1_7_R4)) { - Version version = Version.getCurrent(); - try { - packetType = Class.forName("net.minecraft.server." + version + ".PacketPlayOutChat"); - Class typeCraftPlayer = Class.forName("org.bukkit.craftbukkit." + version + ".entity.CraftPlayer"); - Class typeNMSPlayer = Class.forName("net.minecraft.server." + version + ".EntityPlayer"); - Class typePlayerConnection = Class.forName("net.minecraft.server." + version + ".PlayerConnection"); - nmsChatSerializer = Class.forName(getChatSerializerClasspath()); - nmsIChatBaseComponent = Class.forName("net.minecraft.server." + version + ".IChatBaseComponent"); - getHandle = typeCraftPlayer.getMethod("getHandle"); - playerConnection = typeNMSPlayer.getField("playerConnection"); - sendPacket = typePlayerConnection.getMethod("sendPacket", Class.forName("net.minecraft.server." + version + ".Packet")); - if (Version.isCurrentHigher(Version.v1_11_R1)) { - ChatMessageclz = Class.forName("net.minecraft.server." + version + ".ChatMessageType"); - consts = ChatMessageclz.getEnumConstants(); - sub = consts[2].getClass(); - } - } catch (Exception ex) { - Bukkit.getConsoleSender().sendMessage(ex.toString()); - } - } - } - - public static void send(CommandSender receivingPacket, String msg) { - if (receivingPacket instanceof Player) - send((Player) receivingPacket, msg); - else - receivingPacket.sendMessage(msg); - } - - public static void send(Player receivingPacket, String msg) { - if (receivingPacket == null || !receivingPacket.isOnline() || msg == null) - return; - - try { - if (!Version.getCurrent().isHigher(Version.v1_7_R4) || nmsChatSerializer == null) { - receivingPacket.sendMessage(CMIChatColor.translate(msg)); - return; - } - - RawMessage rm = new RawMessage().addText(msg); - Object serialized = nmsChatSerializer.getMethod("a", String.class).invoke(null, CMIChatColor.translate(rm.getRaw())); - if (Version.isCurrentHigher(Version.v1_15_R1)) - packet = packetType.getConstructor(nmsIChatBaseComponent, sub, UUID.class).newInstance(serialized, consts[2], receivingPacket.getUniqueId()); - else if (Version.isCurrentHigher(Version.v1_11_R1)) { - packet = packetType.getConstructor(nmsIChatBaseComponent, sub).newInstance(serialized, consts[2]); - } else if (Version.isCurrentHigher(Version.v1_7_R4)) { - packet = packetType.getConstructor(nmsIChatBaseComponent, byte.class).newInstance(serialized, (byte) 2); - } else { - packet = packetType.getConstructor(nmsIChatBaseComponent, int.class).newInstance(serialized, 2); - } - Object player = getHandle.invoke(receivingPacket); - Object connection = playerConnection.get(player); - - sendPacket.invoke(connection, packet); - - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - private static String getChatSerializerClasspath() { - if (!Version.isCurrentHigher(Version.v1_8_R2)) - return "net.minecraft.server." + Version.getCurrent() + ".ChatSerializer"; - return "net.minecraft.server." + Version.getCurrent() + ".IChatBaseComponent$ChatSerializer";// 1_8_R2 moved to IChatBaseComponent - } -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMIAsyncHead.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMIAsyncHead.java deleted file mode 100644 index 16340034..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMIAsyncHead.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import org.bukkit.inventory.ItemStack; - -public class CMIAsyncHead { - private boolean head = false; - private boolean force = false; - - public void afterAsyncUpdate(ItemStack item) { - - } - - public boolean isAsyncHead() { - return head; - } - - public void setAsyncHead(boolean head) { - this.head = head; - } - - public boolean isForce() { - return force; - } - - public void setForce(boolean force) { - this.force = force; - } -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMIChatColor.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMIChatColor.java deleted file mode 100644 index 57d962d2..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMIChatColor.java +++ /dev/null @@ -1,611 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Random; -import java.util.TreeMap; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.bukkit.ChatColor; -import org.bukkit.Color; - -public class CMIChatColor { - - private static final Map BY_CHAR = new HashMap<>(); - private static final Map BY_NAME = new HashMap<>(); - private static final LinkedHashMap CUSTOM_BY_NAME = new LinkedHashMap<>(); - private static final Map CUSTOM_BY_HEX = new HashMap<>(); - private static final TreeMap CUSTOM_BY_RGB = new TreeMap<>(); - - static { - for (CMICustomColors one : CMICustomColors.values()) { - CUSTOM_BY_NAME.put(one.name().toLowerCase().replace("_", ""), new CMIChatColor(one.toString(), one.getHex())); - CUSTOM_BY_HEX.put(one.getHex().toLowerCase(), new CMIChatColor(one.toString(), one.getHex())); - if (one.getExtra() != null) { - for (String extra : one.getExtra()) { - CUSTOM_BY_NAME.put(extra.toLowerCase().replace("_", ""), new CMIChatColor(extra.replace(' ', '_'), one.getHex())); - } - } - } - - for (float x = 0.0F; x <= 1; x += 0.1) { - for (float z = 0.1F; z <= 1; z += 0.1) { - for (float y = 0; y <= 1; y += 0.03) { - java.awt.Color color = java.awt.Color.getHSBColor(y, x, z); - String hex = Integer.toHexString((color.getRed() << 16) + (color.getGreen() << 8) + color.getBlue() & 0xffffff); - while (hex.length() < 6) { - hex = "0" + hex; - } - CMIChatColor.getClosest(hex); - } - } - } - } - - public final static String colorReplacerPlaceholder = "\uFF06"; - - public static final String colorFontPrefix = "{@"; - public static final String colorCodePrefix = "{#"; - public static final String colorCodeSuffix = "}"; - - private static String escape(String text) { - return text.replace("#", "\\#").replace("{", "\\{").replace("}", "\\}"); - } - - public static final String hexColorRegex = "(\\" + colorCodePrefix + ")([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})(\\" + colorCodeSuffix + ")"; - public static final Pattern hexColorRegexPattern = Pattern.compile(CMIChatColor.hexColorRegex); - public static final Pattern hexColorRegexPatternLast = Pattern.compile(CMIChatColor.hexColorRegex + "(?!.*\\{#)"); - public static final Pattern hexDeColorNamePattern = Pattern.compile("(&x)((&[0-9A-Fa-f]){6})"); - public static final String ColorNameRegex = "(\\" + colorCodePrefix + ")([a-zA-Z_]{3,})(\\" + colorCodeSuffix + ")"; - public static final Pattern hexColorNamePattern = Pattern.compile(CMIChatColor.ColorNameRegex); - public static final Pattern hexColorNamePatternLast = Pattern.compile(ColorNameRegex + "(?!.*\\{#)"); - - public static final String ColorFontRegex = "(\\" + colorFontPrefix + ")([a-zA-Z_]{3,})(\\" + colorCodeSuffix + ")"; - - public static final Pattern gradientPattern = Pattern.compile("(\\{(#[^\\{]*?)>\\})(.*?)(\\{(#.*?)<(>?)\\})"); - - public static final String hexColorDecolRegex = "(&x)(&[0-9A-Fa-f]){6}"; - - public static final Pattern postGradientPattern = Pattern.compile("(" + CMIChatColor.hexColorRegex + "|" + CMIChatColor.ColorNameRegex + ")" + "(.)" + "(" + CMIChatColor.hexColorRegex + "|" - + CMIChatColor.ColorNameRegex + ")"); - public static final Pattern fullPattern = Pattern.compile("(&[0123456789abcdefklmnorABCDEFKLMNOR])|" + CMIChatColor.hexColorRegex + "|" + CMIChatColor.ColorNameRegex + "|" - + CMIChatColor.ColorFontRegex); - - public static final CMIChatColor BLACK = new CMIChatColor("Black", '0', 0, 0, 0); - public static final CMIChatColor DARK_BLUE = new CMIChatColor("Dark_Blue", '1', 0, 0, 170); - public static final CMIChatColor DARK_GREEN = new CMIChatColor("Dark_Green", '2', 0, 170, 0); - public static final CMIChatColor DARK_AQUA = new CMIChatColor("Dark_Aqua", '3', 0, 170, 170); - public static final CMIChatColor DARK_RED = new CMIChatColor("Dark_Red", '4', 170, 0, 0); - public static final CMIChatColor DARK_PURPLE = new CMIChatColor("Dark_Purple", '5', 170, 0, 170); - public static final CMIChatColor GOLD = new CMIChatColor("Gold", '6', 255, 170, 0); - public static final CMIChatColor GRAY = new CMIChatColor("Gray", '7', 170, 170, 170); - public static final CMIChatColor DARK_GRAY = new CMIChatColor("Dark_Gray", '8', 85, 85, 85); - public static final CMIChatColor BLUE = new CMIChatColor("Blue", '9', 85, 85, 255); - public static final CMIChatColor GREEN = new CMIChatColor("Green", 'a', 85, 255, 85); - public static final CMIChatColor AQUA = new CMIChatColor("Aqua", 'b', 85, 255, 255); - public static final CMIChatColor RED = new CMIChatColor("Red", 'c', 255, 85, 85); - public static final CMIChatColor LIGHT_PURPLE = new CMIChatColor("Light_Purple", 'd', 255, 85, 255); - public static final CMIChatColor YELLOW = new CMIChatColor("Yellow", 'e', 255, 255, 85); - public static final CMIChatColor WHITE = new CMIChatColor("White", 'f', 255, 255, 255); - public static final CMIChatColor OBFUSCATED = new CMIChatColor("Obfuscated", 'k', false); - public static final CMIChatColor BOLD = new CMIChatColor("Bold", 'l', false); - public static final CMIChatColor STRIKETHROUGH = new CMIChatColor("Strikethrough", 'm', false); - public static final CMIChatColor UNDERLINE = new CMIChatColor("Underline", 'n', false); - public static final CMIChatColor ITALIC = new CMIChatColor("Italic", 'o', false); - public static final CMIChatColor RESET = new CMIChatColor("Reset", 'r', false, true); - public static final CMIChatColor HEX = new CMIChatColor("Hex", 'x', false, false); - - private char c; - private boolean color = true; - private boolean reset = false; - private Pattern pattern = null; - private int red; - private int green; - private int blue; - private String hex = null; - private String name; - - public CMIChatColor(String name, char c, int red, int green, int blue) { - this(name, c, true, false, red, green, blue); - } - - public CMIChatColor(String hex) { - this(null, hex); - } - - public CMIChatColor(String name, String hex) { - if (hex.startsWith("#")) - hex = hex.substring(1); - this.hex = hex; - this.name = name; - - try { - red = Integer.valueOf(this.hex.substring(0, 2), 16); - green = Integer.valueOf(this.hex.substring(2, 4), 16); - blue = Integer.parseInt(this.hex.substring(4, 6), 16); - } catch (Throwable e) { - this.hex = null; - } - } - - public CMIChatColor(String name, char c, Boolean color) { - this(name, c, color, false); - } - - public CMIChatColor(String name, char c, Boolean color, Boolean reset) { - this(name, c, color, reset, -1, -1, -1); - } - - public CMIChatColor(String name, char c, Boolean color, Boolean reset, int red, int green, int blue) { - this.name = name; - this.c = c; - this.color = color; - this.reset = reset; - this.pattern = Pattern.compile("(?i)(&[" + c + "])"); - this.red = red; - this.green = green; - this.blue = blue; - - if (Version.isCurrentLower(Version.v1_16_R1) && name.equalsIgnoreCase("Hex")) - return; - BY_CHAR.put(Character.valueOf(c), this); - BY_NAME.put(this.getName().toLowerCase().replace("_", ""), this); - } - - public static String processGradient(String text) { - - Matcher gradientMatch = gradientPattern.matcher(text); - - while (gradientMatch.find()) { - String fullmatch = gradientMatch.group(); - CMIChatColor c1 = CMIChatColor.getColor(CMIChatColor.colorCodePrefix + gradientMatch.group(2).replace("#", "") + CMIChatColor.colorCodeSuffix); - CMIChatColor c2 = CMIChatColor.getColor(CMIChatColor.colorCodePrefix + gradientMatch.group(5).replace("#", "") + CMIChatColor.colorCodeSuffix); - - if (c1 == null || c2 == null) { - continue; - } - - String gtext = gradientMatch.group(3); - - boolean continuous = !gradientMatch.group(6).isEmpty(); - - String updated = ""; - - gtext = stripColor(gtext); - - if (gtext != null) - for (int i = 0; i < gtext.length(); i++) { - char ch = gtext.charAt(i); - int length = gtext.length(); - length = length < 2 ? 2 : length; - double percent = (i * 100D) / (length - 1); - CMIChatColor mix = CMIChatColor.mixColors(c1, c2, percent); - updated += CMIChatColor.colorCodePrefix + mix.getHex() + CMIChatColor.colorCodeSuffix; - updated += String.valueOf(ch); - } - - if (continuous) { - updated += CMIChatColor.colorCodePrefix + gradientMatch.group(5).replace("#", "") + ">" + CMIChatColor.colorCodeSuffix; - } - - text = text.replace(fullmatch, updated); - - if (continuous) { - text = processGradient(text); - } - } - - return text; - } - - public static String translate(String text) { - - if (text == null) - return null; - - text = processGradient(text); - - if (text.contains(colorCodePrefix)) { - - Matcher match = hexColorRegexPattern.matcher(text); - while (match.find()) { - String string = match.group(); - - StringBuilder magic = new StringBuilder("§x"); - for (char c : string.substring(2, string.length() - 1).toCharArray()) { - magic.append('§').append(c); - if (string.substring(2, string.length() - 1).length() == 3) - magic.append('§').append(c); - } - text = text.replace(string, magic.toString()); - } - - Matcher nameMatch = hexColorNamePattern.matcher(text); - while (nameMatch.find()) { - String string = nameMatch.group(2); - CMIChatColor cn = getByCustomName(string.toLowerCase().replace("_", "")); - if (cn == null) - continue; - String gex = cn.getHex(); - StringBuilder magic = new StringBuilder("§x"); - for (char c : gex.toCharArray()) { - magic.append('§').append(c); - } - text = text.replace(nameMatch.group(), magic.toString()); - } - } - - return ChatColor.translateAlternateColorCodes('&', text); - } - - public static String applyEqualGradient(String text, List gradients) { - if (gradients == null || gradients.isEmpty()) - return text; - int size = text.length() / gradients.size(); - StringBuilder messageWithGradient = new StringBuilder(); - messageWithGradient.append(gradients.get(0).getFormatedHex(">")); - for (int y = 0; y <= gradients.size() - 1; y++) { - if (y > 0 && size > 0) - messageWithGradient.append(gradients.get(y).getFormatedHex("<>")); - for (int i = 0; i < size; i++) { - messageWithGradient.append(text.charAt(0)); - text = text.substring(1); - } - } - messageWithGradient.append(text + gradients.get(gradients.size() - 1).getFormatedHex("<")); - return messageWithGradient.toString(); - } - - @Deprecated - public static String translateAlternateColorCodes(String text) { - return translate(text); - } - - public static String colorize(String text) { - if (text == null) - return null; - return translate(text); - } - - public static String deColorize(String text) { - if (text == null) - return null; - text = CMIChatColor.translate(text); - text = text.replace("§", "&"); - - if (text.contains("&x")) { - Matcher match = hexDeColorNamePattern.matcher(text); - while (match.find()) { - String reg = match.group(2).replace("&", ""); - CMIChatColor custom = CUSTOM_BY_HEX.get(reg.toLowerCase()); - if (custom != null) { - text = text.replace(match.group(), colorCodePrefix + custom.getName().toLowerCase().replace("_", "") + colorCodeSuffix); - } else { - text = text.replace(match.group(), colorCodePrefix + reg + colorCodeSuffix); - } - } - } - - return text; - } - - public static List deColorize(List lore) { - for (int i = 0; i < lore.size(); i++) { - lore.set(i, deColorize(lore.get(i))); - } - return lore; - } - - public static String stripColor(String text) { - if (text == null) - return null; - text = CMIChatColor.translate(text); - return ChatColor.stripColor(text); - } - - public static String getLastColors(String text) { - if (text == null) - return null; - - text = deColorize(text); - Matcher match = hexColorRegexPatternLast.matcher(text); - if (match.find()) { - String colorByHex = match.group(0); - if (text.endsWith(colorByHex)) - return colorByHex; - String[] split = text.split(escape(colorByHex), 2); - if (split == null) - return colorByHex; - String last = getLastColors(split[1]); - return last == null || last.isEmpty() ? colorByHex : last; - - } - - match = hexColorNamePatternLast.matcher(text); - if (match.find()) { - String colorByName = match.group(); - if (text.endsWith(colorByName)) - return colorByName; - String[] split = text.split(escape(colorByName), 2); - if (split == null) - return colorByName; - String last = getLastColors(split[1]); - return last == null || last.isEmpty() ? colorByName : last; - } - - return ChatColor.getLastColors(translate(text)); - } - - public String getColorCode() { - if (hex != null) - return colorCodePrefix + hex + colorCodeSuffix; - return "&" + c; - } - - public String getBukkitColorCode() { - if (hex != null) - return translate(colorCodePrefix + hex + colorCodeSuffix); - return "§" + c; - } - - @Override - public String toString() { - return getBukkitColorCode(); - } - - public char getChar() { - return c; - } - - public void setChar(char c) { - this.c = c; - } - - public boolean isColor() { - return color; - } - - public boolean isFormat() { - return !color && !reset; - } - - public boolean isReset() { - return reset; - } - - public ChatColor getColor() { - return ChatColor.getByChar(this.getChar()); - } - - public static CMIChatColor getColor(String text) { - - if (text == null) - return null; - - String or = deColorize(text); - - if (or.contains(colorCodePrefix)) { - Matcher match = hexColorRegexPatternLast.matcher(or); - if (match.find()) { - return new CMIChatColor(match.group(2)); - } - match = hexColorNamePatternLast.matcher(or); - if (match.find()) { - return CMIChatColor.getByCustomName(match.group(2)); - } - } - - text = deColorize(text).replace("&", ""); - - if (text.length() > 1) { - String formated = text.toLowerCase().replace("_", ""); - CMIChatColor got = BY_NAME.get(formated); - if (got != null) - return got; - - got = CUSTOM_BY_NAME.get(formated); - if (got != null) - return got; - } - - if (or.length() > 1 && String.valueOf(or.charAt(or.length() - 2)).equalsIgnoreCase("&")) { - text = text.substring(text.length() - 1, text.length()); - - for (Entry one : BY_CHAR.entrySet()) { - if (String.valueOf(one.getKey()).equalsIgnoreCase(text)) { - return one.getValue(); - } - } - } - - return null; - } - - public static CMIChatColor getRandomColor() { - List ls = new ArrayList<>(); - for (CMIChatColor one : BY_NAME.values()) { - if (!one.isColor()) - continue; - ls.add(one); - } - Collections.shuffle(ls); - return ls.get(0); - } - - public Pattern getPattern() { - return pattern; - } - - public Color getRGBColor() { - if (blue < 0) - return null; - return Color.fromRGB(red, green, blue); - } - - public String getHex() { - return hex; - } - - public String getFormatedHex() { - return getFormatedHex(null); - } - - public String getFormatedHex(String subSuffix) { - return colorCodePrefix + hex + (subSuffix == null ? "" : subSuffix) + colorCodeSuffix; - } - - public String getName() { - return name; - } - - public String getCleanName() { - return name.replace("_", ""); - } - - public static CMIChatColor getByCustomName(String name) { - if (name.equalsIgnoreCase("random")) { - List valuesList = new ArrayList<>(CUSTOM_BY_NAME.values()); - int randomIndex = new Random().nextInt(valuesList.size()); - return valuesList.get(randomIndex); - } - - return CUSTOM_BY_NAME.get(name.toLowerCase().replace("_", "")); - } - - public static CMIChatColor getByHex(String hex) { - if (hex.startsWith(colorCodePrefix)) - hex = hex.substring(colorCodePrefix.length()); - if (hex.endsWith(colorCodeSuffix)) - hex = hex.substring(0, hex.length() - colorCodeSuffix.length()); - return CUSTOM_BY_HEX.get(hex.toLowerCase().replace("_", "")); - } - - public static Map getByName() { - return BY_NAME; - } - - public static Map getByCustomName() { - return CUSTOM_BY_NAME; - } - - public static String getHexFromCoord(int x, int y) { - x = x < 0 ? 0 : x > 255 ? 255 : x; - y = y < 0 ? 0 : y > 255 ? 255 : y; - - int blue = (int) (255 - y * 255 * (1.0 + Math.sin(6.3 * x)) / 2); - int green = (int) (255 - y * 255 * (1.0 + Math.cos(6.3 * x)) / 2); - int red = (int) (255 - y * 255 * (1.0 - Math.sin(6.3 * x)) / 2); - String hex = Integer.toHexString((red << 16) + (green << 8) + blue & 0xffffff); - while (hex.length() < 6) { - hex = "0" + hex; - } - return "#" + hex; - } - - public static String getHexRedGreenByPercent(int percentage, int parts) { - float percent = (percentage * 33F / 100F) / 100F; - - java.awt.Color color = java.awt.Color.getHSBColor(percent, 1, 1); - String hex = Integer.toHexString((color.getRed() << 16) + (color.getGreen() << 8) + color.getBlue() & 0xffffff); - while (hex.length() < 6) { - hex = "0" + hex; - } - return "#" + hex; - } - - public int getRed() { - return red; - } - - public int getGreen() { - return green; - } - - public int getBlue() { - return blue; - } - - public static CMIChatColor getClosest(String hex) { - if (hex.startsWith("#")) - hex = hex.substring(1); - - CMIChatColor closest = CUSTOM_BY_RGB.get(hex); - if (closest != null) - return closest; - - java.awt.Color c2 = null; - try { - c2 = new java.awt.Color( - Integer.valueOf(hex.substring(0, 2), 16), - Integer.valueOf(hex.substring(2, 4), 16), - Integer.valueOf(hex.substring(4, 6), 16)); - } catch (Throwable e) { - return null; - } - double distance = Double.MAX_VALUE; - for (CMIChatColor one : CUSTOM_BY_HEX.values()) { - - java.awt.Color c1 = new java.awt.Color( - Integer.valueOf(one.hex.substring(0, 2), 16), - Integer.valueOf(one.hex.substring(2, 4), 16), - Integer.valueOf(one.hex.substring(4, 6), 16)); - - int red1 = c1.getRed(); - int red2 = c2.getRed(); - int rmean = (red1 + red2) >> 1; - int r = red1 - red2; - int g = c1.getGreen() - c2.getGreen(); - int b = c1.getBlue() - c2.getBlue(); - double dist = Math.sqrt((((512 + rmean) * r * r) >> 8) + 4 * g * g + (((767 - rmean) * b * b) >> 8)); - if (dist < distance) { - closest = one; - distance = dist; - } - } - - if (closest != null) { - CUSTOM_BY_RGB.put(hex, closest); - return closest; - } - CUSTOM_BY_RGB.put(hex, null); - - return null; - } - - public CMIChatColor mixColors(CMIChatColor color, double percent) { - return mixColors(this, color, percent); - } - - public static CMIChatColor mixColors(CMIChatColor color1, CMIChatColor color2, double percent) { - percent = percent / 100D; - double inverse_percent = 1.0 - percent; - int redPart = (int) (color2.getRed() * percent + color1.getRed() * inverse_percent); - int greenPart = (int) (color2.getGreen() * percent + color1.getGreen() * inverse_percent); - int bluePart = (int) (color2.getBlue() * percent + color1.getBlue() * inverse_percent); - String hexCode = String.format("#%02x%02x%02x", redPart, greenPart, bluePart); - return new CMIChatColor(hexCode); - } - -// public static CMIChatColor getClosest(Long rgb) { -// -// Entry low = CUSTOM_BY_RGB.floorEntry(rgb); -// Entry high = CUSTOM_BY_RGB.ceilingEntry(rgb); -// customColors res = null; -// if (low != null && high != null) { -// res = Math.abs(rgb - low.getKey()) < Math.abs(rgb - high.getKey()) ? low.getValue() : high.getValue(); -// } else if (low != null || high != null) { -// res = low != null ? low.getValue() : high == null ? null : high.getValue(); -// } -// if (res == null) { -// return null; -// } -// return new CMIChatColor(res.name(), res.hex); -// } - -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMICustomColors.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMICustomColors.java deleted file mode 100644 index 1bf46324..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMICustomColors.java +++ /dev/null @@ -1,1592 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -public enum CMICustomColors { - Black("000000"), - Navy_Blue("000080"), - Dark_Blue("0000C8"), - Blue("0000FF"), - Stratos("000741"), - Swamp("001B1C"), - Resolution_Blue("002387"), - Deep_Fir("002900"), - Burnham("002E20"), - International_Klein_Blue("002FA7"), - Prussian_Blue("003153"), - Midnight_Blue("003366"), - Smalt("003399"), - Deep_Teal("003532"), - Cyprus("003E40"), - Kaitoke_Green("004620"), - Cobalt("0047AB"), - Crusoe("004816"), - Sherpa_Blue("004950"), - Endeavour("0056A7"), - Camarone("00581A"), - Science_Blue("0066CC"), - Blue_Ribbon("0066FF"), - Tropical_Rain_Forest("00755E"), - Allports("0076A3"), - Deep_Cerulean("007BA7"), - Lochmara("007EC7"), - Azure_Radiance("007FFF"), - Teal("008080"), - Bondi_Blue("0095B6"), - Pacific_Blue("009DC4"), - Persian_Green("00A693"), - Jade("00A86B"), - Caribbean_Green("00CC99"), - Robins_Egg_Blue("00CCCC"), - Green("00FF00"), - Spring_Green("00FF7F"), - Cyan("00FFFF", "Aqua"), - Blue_Charcoal("010D1A"), - Midnight("011635"), - Holly("011D13"), - Daintree("012731"), - Cardin_Green("01361C"), - County_Green("01371A"), - Astronaut_Blue("013E62"), - Regal_Blue("013F6A"), - Aqua_Deep("014B43"), - Orient("015E85"), - Blue_Stone("016162"), - Fun_Green("016D39"), - Pine_Green("01796F"), - Blue_Lagoon("017987"), - Deep_Sea("01826B"), - Green_Haze("01A368"), - English_Holly("022D15"), - Sherwood_Green("02402C"), - Congress_Blue("02478E"), - Evening_Sea("024E46"), - Bahama_Blue("026395"), - Observatory("02866F"), - Cerulean("02A4D3"), - Tangaroa("03163C"), - Green_Vogue("032B52"), - Mosque("036A6E"), - Midnight_Moss("041004"), - Black_Pearl("041322"), - Blue_Whale("042E4C"), - Zuccini("044022"), - Teal_Blue("044259"), - Deep_Cove("051040"), - Gulf_Blue("051657"), - Venice_Blue("055989"), - Watercourse("056F57"), - Catalina_Blue("062A78"), - Tiber("063537"), - Gossamer("069B81"), - Niagara("06A189"), - Tarawera("073A50"), - Jaguar("080110"), - Black_Bean("081910"), - Deep_Sapphire("082567"), - Elf_Green("088370"), - Bright_Turquoise("08E8DE"), - Downriver("092256"), - Palm_Green("09230F"), - Madison("09255D"), - Bottle_Green("093624"), - Deep_Sea_Green("095859"), - Salem("097F4B"), - Black_Russian("0A001C"), - Dark_Fern("0A480D"), - Japanese_Laurel("0A6906"), - Atoll("0A6F75"), - Cod_Gray("0B0B0B"), - Marshland("0B0F08"), - Gordons_Green("0B1107"), - Black_Forest("0B1304"), - San_Felix("0B6207"), - Malachite("0BDA51"), - Ebony("0C0B1D"), - Woodsmoke("0C0D0F"), - Racing_Green("0C1911"), - Surfie_Green("0C7A79"), - Blue_Chill("0C8990"), - Black_Rock("0D0332"), - Bunker("0D1117"), - Aztec("0D1C19"), - Bush("0D2E1C"), - Cinder("0E0E18"), - Firefly("0E2A30"), - Torea_Bay("0F2D9E"), - Vulcan("10121D"), - Green_Waterloo("101405"), - Eden("105852"), - Arapawa("110C6C"), - Ultramarine("120A8F"), - Elephant("123447"), - Jewel("126B40"), - Diesel("130000"), - Asphalt("130A06"), - Blue_Zodiac("13264D"), - Parsley("134F19"), - Nero("140600"), - Tory_Blue("1450AA"), - Bunting("151F4C"), - Denim("1560BD"), - Genoa("15736B"), - Mirage("161928"), - Hunter_Green("161D10"), - Big_Stone("162A40"), - Celtic("163222"), - Timber_Green("16322C"), - Gable_Green("163531"), - Pine_Tree("171F04"), - Chathams_Blue("175579"), - Deep_Forest_Green("182D09"), - Blumine("18587A"), - Palm_Leaf("19330E"), - Nile_Blue("193751"), - Fun_Blue("1959A8"), - Lucky_Point("1A1A68"), - Mountain_Meadow("1AB385"), - Tolopea("1B0245"), - Haiti("1B1035"), - Deep_Koamaru("1B127B"), - Acadia("1B1404"), - Seaweed("1B2F11"), - Biscay("1B3162"), - Matisse("1B659D"), - Crowshead("1C1208"), - Rangoon_Green("1C1E13"), - Persian_Blue("1C39BB"), - Everglade("1C402E"), - Elm("1C7C7D"), - Green_Pea("1D6142"), - Creole("1E0F04"), - Karaka("1E1609"), - El_Paso("1E1708"), - Cello("1E385B"), - Te_Papa_Green("1E433C"), - Dodger_Blue("1E90FF"), - Eastern_Blue("1E9AB0"), - Night_Rider("1F120F"), - Java("1FC2C2"), - Jacksons_Purple("20208D"), - Cloud_Burst("202E54"), - Blue_Dianne("204852"), - Eternity("211A0E"), - Deep_Blue("220878"), - Forest_Green("228B22"), - Mallard("233418"), - Violet("240A40"), - Kilamanjaro("240C02"), - Log_Cabin("242A1D"), - Black_Olive("242E16"), - Green_House("24500F"), - Graphite("251607"), - Cannon_Black("251706"), - Port_Gore("251F4F"), - Shark("25272C"), - Green_Kelp("25311C"), - Curious_Blue("2596D1"), - Paua("260368"), - Paris_M("26056A"), - Wood_Bark("261105"), - Gondola("261414"), - Steel_Gray("262335"), - Ebony_Clay("26283B"), - Bay_of_Many("273A81"), - Plantation("27504B"), - Eucalyptus("278A5B"), - Oil("281E15"), - Astronaut("283A77"), - Mariner("286ACD"), - Violent_Violet("290C5E"), - Bastille("292130"), - Zeus("292319"), - Charade("292937"), - Jelly_Bean("297B9A"), - Jungle_Green("29AB87"), - Cherry_Pie("2A0359"), - Coffee_Bean("2A140E"), - Baltic_Sea("2A2630"), - Turtle_Green("2A380B"), - Cerulean_Blue("2A52BE"), - Sepia_Black("2B0202"), - Valhalla("2B194F"), - Heavy_Metal("2B3228"), - Blue_Gem("2C0E8C"), - Revolver("2C1632"), - Bleached_Cedar("2C2133"), - Lochinvar("2C8C84"), - Mikado("2D2510"), - Outer_Space("2D383A"), - St_Tropaz("2D569B"), - Jacaranda("2E0329"), - Jacko_Bean("2E1905"), - Rangitoto("2E3222"), - Rhino("2E3F62"), - Sea_Green("2E8B57"), - Scooter("2EBFD4"), - Onion("2F270E"), - Governor_Bay("2F3CB3"), - Sapphire("2F519E"), - Spectra("2F5A57"), - Casal("2F6168"), - Melanzane("300529"), - Cocoa_Brown("301F1E"), - Woodrush("302A0F"), - San_Juan("304B6A"), - Turquoise("30D5C8"), - Eclipse("311C17"), - Pickled_Bluewood("314459"), - Azure("315BA1"), - Calypso("31728D"), - Paradiso("317D82"), - Persian_Indigo("32127A"), - Blackcurrant("32293A"), - Mine_Shaft("323232"), - Stromboli("325D52"), - Bilbao("327C14"), - Astral("327DA0"), - Christalle("33036B"), - Thunder("33292F"), - Shamrock("33CC99"), - Tamarind("341515"), - Mardi_Gras("350036"), - Valentino("350E42"), - Jagger("350E57"), - Tuna("353542"), - Chambray("354E8C"), - Martinique("363050"), - Tuatara("363534"), - Waiouru("363C0D"), - Ming("36747D"), - La_Palma("368716"), - Chocolate("370202"), - Clinker("371D09"), - Brown_Tumbleweed("37290E"), - Birch("373021"), - Oracle("377475"), - Blue_Diamond("380474"), - Grape("381A51"), - Dune("383533"), - Oxford_Blue("384555"), - Clover("384910"), - Limed_Spruce("394851"), - Dell("396413"), - Toledo("3A0020"), - Sambuca("3A2010"), - Jacarta("3A2A6A"), - William("3A686C"), - Killarney("3A6A47"), - Keppel("3AB09E"), - Temptress("3B000B"), - Aubergine("3B0910"), - Jon("3B1F1F"), - Treehouse("3B2820"), - Amazon("3B7A57"), - Boston_Blue("3B91B4"), - Windsor("3C0878"), - Rebel("3C1206"), - Meteorite("3C1F76"), - Dark_Ebony("3C2005"), - Camouflage("3C3910"), - Bright_Gray("3C4151"), - Cape_Cod("3C4443"), - Lunar_Green("3C493A"), - Bean_("3D0C02"), - Bistre("3D2B1F"), - Goblin("3D7D52"), - Kingfisher_Daisy("3E0480"), - Cedar("3E1C14"), - English_Walnut("3E2B23"), - Black_Marlin("3E2C1C"), - Ship_Gray("3E3A44"), - Pelorous("3EABBF"), - Bronze("3F2109"), - Cola("3F2500"), - Madras("3F3002"), - Minsk("3F307F"), - Cabbage_Pont("3F4C3A"), - Tom_Thumb("3F583B"), - Mineral_Green("3F5D53"), - Puerto_Rico("3FC1AA"), - Harlequin("3FFF00"), - Brown_Pod("401801"), - Cork("40291D"), - Masala("403B38"), - Thatch_Green("403D19"), - Fiord("405169"), - Viridian("40826D"), - Chateau_Green("40A860"), - Ripe_Plum("410056"), - Paco("411F10"), - Deep_Oak("412010"), - Merlin("413C37"), - Gun_Powder("414257"), - East_Bay("414C7D"), - Royal_Blue("4169E1"), - Ocean_Green("41AA78"), - Burnt_Maroon("420303"), - Lisbon_Brown("423921"), - Faded_Jade("427977"), - Scarlet_Gum("431560"), - Iroko("433120"), - Armadillo("433E37"), - River_Bed("434C59"), - Green_Leaf("436A0D"), - Barossa("44012D"), - Morocco_Brown("441D00"), - Mako("444954"), - Kelp("454936"), - San_Marino("456CAC"), - Picton_Blue("45B1E8"), - Loulou("460B41"), - Crater_Brown("462425"), - Gray_Asparagus("465945"), - Steel_Blue("4682B4"), - Rustic_Red("480404"), - Bulgarian_Rose("480607"), - Clairvoyant("480656"), - Cocoa_Bean("481C1C"), - Woody_Brown("483131"), - Taupe("483C32"), - Van_Cleef("49170C"), - Brown_Derby("492615"), - Metallic_Bronze("49371B"), - Verdun_Green("495400"), - Blue_Bayoux("496679"), - Bismark("497183"), - Bracken("4A2A04"), - Deep_Bronze("4A3004"), - Mondo("4A3C30"), - Tundora("4A4244"), - Gravel("4A444B"), - Trout("4A4E5A"), - Pigment_Indigo("4B0082"), - Nandor("4B5D52"), - Saddle("4C3024"), - Abbey("4C4F56"), - Blackberry("4D0135"), - Cab_Sav("4D0A18"), - Indian_Tan("4D1E01"), - Cowboy("4D282D"), - Livid_Brown("4D282E"), - Rock("4D3833"), - Punga("4D3D14"), - Bronzetone("4D400F"), - Woodland("4D5328"), - Mahogany("4E0606"), - Bossanova("4E2A5A"), - Matterhorn("4E3B41"), - Bronze_Olive("4E420C"), - Mulled_Wine("4E4562"), - Axolotl("4E6649"), - Wedgewood("4E7F9E"), - Shakespeare("4EABD1"), - Honey_Flower("4F1C70"), - Daisy_Bush("4F2398"), - Indigo("4F69C6"), - Fern_Green("4F7942"), - Fruit_Salad("4F9D5D"), - Apple("4FA83D"), - Mortar("504351"), - Kashmir_Blue("507096"), - Cutty_Sark("507672"), - Emerald("50C878"), - Emperor("514649"), - Chalet_Green("516E3D"), - Como("517C66"), - Smalt_Blue("51808F"), - Castro("52001F"), - Maroon_Oak("520C17"), - Gigas("523C94"), - Voodoo("533455"), - Victoria("534491"), - Hippie_Green("53824B"), - Heath("541012"), - Judge_Gray("544333"), - Fuscous_Gray("54534D"), - Vida_Loca("549019"), - Cioccolato("55280C"), - Saratoga("555B10"), - Finlandia("556D56"), - Havelock_Blue("5590D9"), - Fountain_Blue("56B4BE"), - Spring_Leaves("578363"), - Saddle_Brown("583401"), - Scarpa_Flow("585562"), - Cactus("587156"), - Hippie_Blue("589AAF"), - Wine_Berry("591D35"), - Brown_Bramble("592804"), - Congo_Brown("593737"), - Millbrook("594433"), - Waikawa_Gray("5A6E9C"), - Horizon("5A87A0"), - Jambalaya("5B3013"), - Bordeaux("5C0120"), - Mulberry_Wood("5C0536"), - Carnaby_Tan("5C2E01"), - Comet("5C5D75"), - Redwood("5D1E0F"), - Don_Juan("5D4C51"), - Chicago("5D5C58"), - Verdigris("5D5E37"), - Dingley("5D7747"), - Breaker_Bay("5DA19F"), - Kabul("5E483E"), - Hemlock("5E5D3B"), - Irish_Coffee("5F3D26"), - Mid_Gray("5F5F6E"), - Shuttle_Gray("5F6672"), - Aqua_Forest("5FA777"), - Tradewind("5FB3AC"), - Horses_Neck("604913"), - Smoky("605B73"), - Corduroy("606E68"), - Danube("6093D1"), - Espresso("612718"), - Eggplant("614051"), - Costa_Del_Sol("615D30"), - Glade_Green("61845F"), - Buccaneer("622F30"), - Quincy("623F2D"), - Butterfly_Bush("624E9A"), - West_Coast("625119"), - Finch("626649"), - Patina("639A8F"), - Fern("63B76C"), - Blue_Violet("6456B7"), - Dolphin("646077"), - Storm_Dust("646463"), - Siam("646A54"), - Nevada("646E75"), - Cornflower_Blue("6495ED"), - Viking("64CCDB"), - Rosewood("65000B"), - Cherrywood("651A14"), - Purple_Heart("652DC1"), - Fern_Frond("657220"), - Willow_Grove("65745D"), - Hoki("65869F"), - Pompadour("660045"), - Purple("660099"), - Tyrian_Purple("66023C"), - Dark_Tan("661010"), - Silver_Tree("66B58F"), - Bright_Green("66FF00"), - Screamin_Green("66FF66"), - Black_Rose("67032D"), - Scampi("675FA6"), - Ironside_Gray("676662"), - Viridian_Green("678975"), - Christi("67A712"), - Nutmeg_Wood_Finish("683600"), - Zambezi("685558"), - Salt_Box("685E6E"), - Tawny_Port("692545"), - Finn("692D54"), - Scorpion("695F62"), - Lynch("697E9A"), - Spice("6A442E"), - Himalaya("6A5D1B"), - Soya_Bean("6A6051"), - Hairy_Heath("6B2A14"), - Royal_Purple("6B3FA0"), - Shingle_Fawn("6B4E31"), - Dorado("6B5755"), - Bermuda_Gray("6B8BA2"), - Olive_Drab("6B8E23"), - Eminence("6C3082"), - Turquoise_Blue("6CDAE7"), - Lonestar("6D0101"), - Pine_Cone("6D5E54"), - Dove_Gray("6D6C6C"), - Juniper("6D9292"), - Gothic("6D92A1"), - Red_Oxide("6E0902"), - Moccaccino("6E1D14"), - Pickled_Bean("6E4826"), - Dallas("6E4B26"), - Kokoda("6E6D57"), - Pale_Sky("6E7783"), - Cafe_Royale("6F440C"), - Flint("6F6A61"), - Highland("6F8E63"), - Limeade("6F9D02"), - Downy("6FD0C5"), - Persian_Plum("701C1C"), - Sepia("704214"), - Antique_Bronze("704A07"), - Ferra("704F50"), - Coffee("706555"), - Slate_Gray("708090"), - Cedar_Wood_Finish("711A00"), - Metallic_Copper("71291D"), - Affair("714693"), - Studio("714AB2"), - Tobacco_Brown("715D47"), - Yellow_Metal("716338"), - Peat("716B56"), - Olivetone("716E10"), - Storm_Gray("717486"), - Sirocco("718080"), - Aquamarine_Blue("71D9E2"), - Venetian_Red("72010F"), - Old_Copper("724A2F"), - Go_Ben("726D4E"), - Raven("727B89"), - Seance("731E8F"), - Raw_Umber("734A12"), - Kimberly("736C9F"), - Crocodile("736D58"), - Crete("737829"), - Xanadu("738678"), - Spicy_Mustard("74640D"), - Limed_Ash("747D63"), - Rolling_Stone("747D83"), - Blue_Smoke("748881"), - Laurel("749378"), - Mantis("74C365"), - Russett("755A57"), - Deluge("7563A8"), - Cosmic("76395D"), - Blue_Marguerite("7666C6"), - Lima("76BD17"), - Sky_Blue("76D7EA"), - Dark_Burgundy("770F05"), - Crown_of_Thorns("771F1F"), - Walnut("773F1A"), - Pablo("776F61"), - Pacifika("778120"), - Oxley("779E86"), - Pastel_Green("77DD77"), - Japanese_Maple("780109"), - Mocha("782D19"), - Peanut("782F16"), - Camouflage_Green("78866B"), - Wasabi("788A25"), - Ship_Cove("788BBA"), - Sea_Nymph("78A39C"), - Roman_Coffee("795D4C"), - Old_Lavender("796878"), - Rum("796989"), - Fedora("796A78"), - Sandstone("796D62"), - Spray("79DEEC"), - Siren("7A013A"), - Fuchsia_Blue("7A58C1"), - Boulder("7A7A7A"), - Wild_Blue_Yonder("7A89B8"), - De_York("7AC488"), - Red_Beech("7B3801"), - Cinnamon("7B3F00"), - Yukon_Gold("7B6608"), - Tapa("7B7874"), - Waterloo_("7B7C94"), - Flax_Smoke("7B8265"), - Amulet("7B9F80"), - Asparagus("7BA05B"), - Kenyan_Copper("7C1C05"), - Pesto("7C7631"), - Topaz("7C778A"), - Concord("7C7B7A"), - Jumbo("7C7B82"), - Trendy_Green("7C881A"), - Gumbo("7CA1A6"), - Acapulco("7CB0A1"), - Neptune("7CB7BB"), - Pueblo("7D2C14"), - Bay_Leaf("7DA98D"), - Malibu("7DC8F7"), - Bermuda("7DD8C6"), - Copper_Canyon("7E3A15"), - Claret("7F1734"), - Peru_Tan("7F3A02"), - Falcon("7F626D"), - Mobster("7F7589"), - Moody_Blue("7F76D3"), - Chartreuse("7FFF00"), - Aquamarine("7FFFD4"), - Maroon("800000"), - Rose_Bud_Cherry("800B47"), - Falu_Red("801818"), - Red_Robin("80341F"), - Vivid_Violet("803790"), - Russet("80461B"), - Friar_Gray("807E79"), - Olive("808000"), - Gray("808080"), - Gulf_Stream("80B3AE"), - Glacier("80B3C4"), - Seagull("80CCEA"), - Nutmeg("81422C"), - Spicy_Pink("816E71"), - Empress("817377"), - Spanish_Green("819885"), - Sand_Dune("826F65"), - Gunsmoke("828685"), - Battleship_Gray("828F72"), - Merlot("831923"), - Shadow("837050"), - Chelsea_Cucumber("83AA5D"), - Monte_Carlo("83D0C6"), - Plum("843179"), - Granny_Smith("84A0A0"), - Chetwode_Blue("8581D9"), - Bandicoot("858470"), - Bali_Hai("859FAF"), - Half_Baked("85C4CC"), - Red_Devil("860111"), - Lotus("863C3C"), - Ironstone("86483C"), - Bull_Shot("864D1E"), - Rusty_Nail("86560A"), - Bitter("868974"), - Regent_Gray("86949F"), - Disco("871550"), - Americano("87756E"), - Hurricane("877C7B"), - Oslo_Gray("878D91"), - Sushi("87AB39"), - Spicy_Mix("885342"), - Kumera("886221"), - Suva_Gray("888387"), - Avocado("888D65"), - Camelot("893456"), - Solid_Pink("893843"), - Cannon_Pink("894367"), - Makara("897D6D"), - Burnt_Umber("8A3324"), - True_V("8A73D6"), - Clay_Creek("8A8360"), - Monsoon("8A8389"), - Stack("8A8F8A"), - Jordy_Blue("8AB9F1"), - Electric_Violet("8B00FF"), - Monarch("8B0723"), - Corn_Harvest("8B6B0B"), - Olive_Haze("8B8470"), - Schooner("8B847E"), - Natural_Gray("8B8680"), - Mantle("8B9C90"), - Portage("8B9FEE"), - Envy("8BA690"), - Cascade("8BA9A5"), - Riptide("8BE6D8"), - Cardinal_Pink("8C055E"), - Mule_Fawn("8C472F"), - Potters_Clay("8C5738"), - Trendy_Pink("8C6495"), - Paprika("8D0226"), - Sanguine_Brown("8D3D38"), - Tosca("8D3F3F"), - Cement("8D7662"), - Granite_Green("8D8974"), - Manatee("8D90A1"), - Polo_Blue("8DA8CC"), - Red_Berry("8E0000"), - Rope("8E4D1E"), - Opium("8E6F70"), - Domino("8E775E"), - Mamba("8E8190"), - Nepal("8EABC1"), - Pohutukawa("8F021C"), - El_Salva("8F3E33"), - Korma("8F4B0E"), - Squirrel("8F8176"), - Vista_Blue("8FD6B4"), - Burgundy("900020"), - Old_Brick("901E1E"), - Hemp("907874"), - Almond_Frost("907B71"), - Sycamore("908D39"), - Sangria("92000A"), - Cumin("924321"), - Beaver("926F5B"), - Stonewall("928573"), - Venus("928590"), - Medium_Purple("9370DB"), - Cornflower("93CCEA"), - Algae_Green("93DFB8"), - Copper_Rust("944747"), - Arrowtown("948771"), - Scarlett("950015"), - Strikemaster("956387"), - Mountain_Mist("959396"), - Carmine("960018"), - Brown("964B00"), - Leather("967059"), - Purple_Mountains_Majesty("9678B6"), - Lavender_Purple("967BB6"), - Pewter("96A8A1"), - Summer_Green("96BBAB"), - Au_Chico("97605D"), - Wisteria("9771B5"), - Atlantis("97CD2D"), - Vin_Rouge("983D61"), - Lilac_Bush("9874D3"), - Bazaar("98777B"), - Hacienda("98811B"), - Pale_Oyster("988D77"), - Mint_Green("98FF98"), - Fresh_Eggplant("990066"), - Violet_Eggplant("991199"), - Tamarillo("991613"), - Totem_Pole("991B07"), - Copper_Rose("996666"), - Amethyst("9966CC"), - Mountbatten_Pink("997A8D"), - Blue_Bell("9999CC"), - Prairie_Sand("9A3820"), - Toast("9A6E61"), - Gurkha("9A9577"), - Olivine("9AB973"), - Shadow_Green("9AC2B8"), - Oregon("9B4703"), - Lemon_Grass("9B9E8F"), - Stiletto("9C3336"), - Hawaiian_Tan("9D5616"), - Gull_Gray("9DACB7"), - Pistachio("9DC209"), - Granny_Smith_Apple("9DE093"), - Anakiwa("9DE5FF"), - Chelsea_Gem("9E5302"), - Sepia_Skin("9E5B40"), - Sage("9EA587"), - Citron("9EA91F"), - Rock_Blue("9EB1CD"), - Morning_Glory("9EDEE0"), - Cognac("9F381D"), - Reef_Gold("9F821C"), - Star_Dust("9F9F9C"), - Santas_Gray("9FA0B1"), - Sinbad("9FD7D3"), - Feijoa("9FDD8C"), - Tabasco("A02712"), - Buttered_Rum("A1750D"), - Hit_Gray("A1ADB5"), - Citrus("A1C50A"), - Aqua_Island("A1DAD7"), - Water_Leaf("A1E9DE"), - Flirt("A2006D"), - Rouge("A23B6C"), - Cape_Palliser("A26645"), - Gray_Chateau("A2AAB3"), - Edward("A2AEAB"), - Pharlap("A3807B"), - Amethyst_Smoke("A397B4"), - Blizzard_Blue("A3E3ED"), - Delta("A4A49D"), - Wistful("A4A6D3"), - Green_Smoke("A4AF6E"), - Jazzberry_Jam("A50B5E"), - Zorba("A59B91"), - Bahia("A5CB0C"), - Roof_Terracotta("A62F20"), - Paarl("A65529"), - Barley_Corn("A68B5B"), - Donkey_Brown("A69279"), - Dawn("A6A29A"), - Mexican_Red("A72525"), - Luxor_Gold("A7882C"), - Rich_Gold("A85307"), - Reno_Sand("A86515"), - Coral_Tree("A86B6B"), - Dusty_Gray("A8989B"), - Dull_Lavender("A899E6"), - Tallow("A8A589"), - Bud("A8AE9C"), - Locust("A8AF8E"), - Norway("A8BD9F"), - Chinook("A8E3BD"), - Gray_Olive("A9A491"), - Aluminium("A9ACB6"), - Cadet_Blue("A9B2C3"), - Schist("A9B497"), - Tower_Gray("A9BDBF"), - Perano("A9BEF2"), - Opal("A9C6C2"), - Night_Shadz("AA375A"), - Fire("AA4203"), - Muesli("AA8B5B"), - Sandal("AA8D6F"), - Shady_Lady("AAA5A9"), - Logan("AAA9CD"), - Spun_Pearl("AAABB7"), - Regent_St_Blue("AAD6E6"), - Magic_Mint("AAF0D1"), - Lipstick("AB0563"), - Royal_Heath("AB3472"), - Sandrift("AB917A"), - Cold_Purple("ABA0D9"), - Bronco("ABA196"), - Limed_Oak("AC8A56"), - East_Side("AC91CE"), - Lemon_Ginger("AC9E22"), - Napa("ACA494"), - Hillary("ACA586"), - Cloudy("ACA59F"), - Silver_Chalice("ACACAC"), - Swamp_Green("ACB78E"), - Spring_Rain("ACCBB1"), - Conifer("ACDD4D"), - Celadon("ACE1AF"), - Mandalay("AD781B"), - Casper("ADBED1"), - Moss_Green("ADDFAD"), - Padua("ADE6C4"), - Green_Yellow("ADFF2F"), - Hippie_Pink("AE4560"), - Desert("AE6020"), - Bouquet("AE809E"), - Medium_Carmine("AF4035"), - Apple_Blossom("AF4D43"), - Brown_Rust("AF593E"), - Driftwood("AF8751"), - Alpine("AF8F2C"), - Lucky("AF9F1C"), - Martini("AFA09E"), - Bombay("AFB1B8"), - Pigeon_Post("AFBDD9"), - Cadillac("B04C6A"), - Matrix("B05D54"), - Tapestry("B05E81"), - Mai_Tai("B06608"), - Del_Rio("B09A95"), - Powder_Blue("B0E0E6"), - Inch_Worm("B0E313"), - Bright_Red("B10000"), - Vesuvius("B14A0B"), - Pumpkin_Skin("B1610B"), - Santa_Fe("B16D52"), - Teak("B19461"), - Fringy_Flower("B1E2C1"), - Ice_Cold("B1F4E7"), - Shiraz("B20931"), - Biloba_Flower("B2A1EA"), - Tall_Poppy("B32D29"), - Fiery_Orange("B35213"), - Hot_Toddy("B38007"), - Taupe_Gray("B3AF95"), - La_Rioja("B3C110"), - Well_Read("B43332"), - Blush("B44668"), - Jungle_Mist("B4CFD3"), - Turkish_Rose("B57281"), - Lavender("B57EDC"), - Mongoose("B5A27F"), - Olive_Green("B5B35C"), - Jet_Stream("B5D2CE"), - Cruise("B5ECDF"), - Hibiscus("B6316C"), - Thatch("B69D98"), - Heathered_Gray("B6B095"), - Eagle("B6BAA4"), - Spindle("B6D1EA"), - Gum_Leaf("B6D3BF"), - Rust("B7410E"), - Muddy_Waters("B78E5C"), - Sahara("B7A214"), - Husk("B7A458"), - Nobel("B7B1B1"), - Heather("B7C3D0"), - Madang("B7F0BE"), - Milano_Red("B81104"), - Copper("B87333"), - Gimblet("B8B56A"), - Green_Spring("B8C1B1"), - Celery("B8C25D"), - Sail("B8E0F9"), - Chestnut("B94E48"), - Crail("B95140"), - Marigold("B98D28"), - Wild_Willow("B9C46A"), - Rainee("B9C8AC"), - Guardsman_Red("BA0101"), - Rock_Spray("BA450C"), - Bourbon("BA6F1E"), - Pirate_Gold("BA7F03"), - Nomad("BAB1A2"), - Submarine("BAC7C9"), - Charlotte("BAEEF9"), - Medium_Red_Violet("BB3385"), - Brandy_Rose("BB8983"), - Rio_Grande("BBD009"), - Surf("BBD7C1"), - Powder_Ash("BCC9C2"), - Tuscany("BD5E2E"), - Quicksand("BD978E"), - Silk("BDB1A8"), - Malta("BDB2A1"), - Chatelle("BDB3C7"), - Lavender_Gray("BDBBD7"), - French_Gray("BDBDC6"), - Clay_Ash("BDC8B3"), - Loblolly("BDC9CE"), - French_Pass("BDEDFD"), - London_Hue("BEA6C3"), - Pink_Swan("BEB5B7"), - Fuego("BEDE0D"), - Rose_of_Sharon("BF5500"), - Tide("BFB8B0"), - Blue_Haze("BFBED8"), - Silver_Sand("BFC1C2"), - Key_Lime_Pie("BFC921"), - Ziggurat("BFDBE2"), - Lime("BFFF00"), - Thunderbird("C02B18"), - Mojo("C04737"), - Old_Rose("C08081"), - Silver("C0C0C0"), - Pale_Leaf("C0D3B9"), - Pixie_Green("C0D8B6"), - Tia_Maria("C1440E"), - Fuchsia_Pink("C154C1"), - Buddha_Gold("C1A004"), - Bison_Hide("C1B7A4"), - Tea("C1BAB0"), - Gray_Suit("C1BECD"), - Sprout("C1D7B0"), - Sulu("C1F07C"), - Indochine("C26B03"), - Twine("C2955D"), - Cotton_Seed("C2BDB6"), - Pumice("C2CAC4"), - Jagged_Ice("C2E8E5"), - Maroon_Flush("C32148"), - Indian_Khaki("C3B091"), - Pale_Slate("C3BFC1"), - Gray_Nickel("C3C3BD"), - Periwinkle_Gray("C3CDE6"), - Tiara("C3D1D1"), - Tropical_Blue("C3DDF9"), - Cardinal("C41E3A"), - Fuzzy_Wuzzy_Brown("C45655"), - Orange_Roughy("C45719"), - Mist_Gray("C4C4BC"), - Coriander("C4D0B0"), - Mint_Tulip("C4F4EB"), - Mulberry("C54B8C"), - Nugget("C59922"), - Tussock("C5994B"), - Sea_Mist("C5DBCA"), - Yellow_Green("C5E17A"), - Brick_Red("C62D42"), - Contessa("C6726B"), - Oriental_Pink("C69191"), - Roti("C6A84B"), - Ash("C6C3B5"), - Kangaroo("C6C8BD"), - Las_Palmas("C6E610"), - Monza("C7031E"), - Red_Violet("C71585"), - Coral_Reef("C7BCA2"), - Melrose("C7C1FF"), - Cloud("C7C4BF"), - Ghost("C7C9D5"), - Pine_Glade("C7CD90"), - Botticelli("C7DDE5"), - Antique_Brass("C88A65"), - Lilac("C8A2C8"), - Hokey_Pokey("C8A528"), - Lily("C8AABF"), - Laser("C8B568"), - Edgewater("C8E3D7"), - Piper("C96323"), - Pizza("C99415"), - Light_Wisteria("C9A0DC"), - Rodeo_Dust("C9B29B"), - Sundance("C9B35B"), - Earls_Green("C9B93B"), - Silver_Rust("C9C0BB"), - Conch("C9D9D2"), - Reef("C9FFA2"), - Aero_Blue("C9FFE5"), - Flush_Mahogany("CA3435"), - Turmeric("CABB48"), - Paris_White("CADCD4"), - Bitter_Lemon("CAE00D"), - Skeptic("CAE6DA"), - Viola("CB8FA9"), - Foggy_Gray("CBCAB6"), - Green_Mist("CBD3B0"), - Nebula("CBDBD6"), - Persian_Red("CC3333"), - Burnt_Orange("CC5500"), - Ochre("CC7722"), - Puce("CC8899"), - Thistle_Green("CCCAA8"), - Periwinkle("CCCCFF"), - Electric_Lime("CCFF00"), - Tenn("CD5700"), - Chestnut_Rose("CD5C5C"), - Brandy_Punch("CD8429"), - Onahau("CDF4FF"), - Sorrell_Brown("CEB98F"), - Cold_Turkey("CEBABA"), - Yuma("CEC291"), - Chino("CEC7A7"), - Eunry("CFA39D"), - Old_Gold("CFB53B"), - Tasman("CFDCCF"), - Surf_Crest("CFE5D2"), - Humming_Bird("CFF9F3"), - Scandal("CFFAF4"), - Red_Stage("D05F04"), - Hopbush("D06DA1"), - Meteor("D07D12"), - Perfume("D0BEF8"), - Prelude("D0C0E5"), - Tea_Green("D0F0C0"), - Geebung("D18F1B"), - Vanilla("D1BEA8"), - Soft_Amber("D1C6B4"), - Celeste("D1D2CA"), - Mischka("D1D2DD"), - Pear("D1E231"), - Hot_Cinnamon("D2691E"), - Raw_Sienna("D27D46"), - Careys_Pink("D29EAA"), - Tan("D2B48C"), - Deco("D2DA97"), - Blue_Romance("D2F6DE"), - Gossip("D2F8B0"), - Sisal("D3CBBA"), - Swirl("D3CDC5"), - Charm("D47494"), - Clam_Shell("D4B6AF"), - Straw("D4BF8D"), - Akaroa("D4C4A8"), - Bird_Flower("D4CD16"), - Iron("D4D7D9"), - Geyser("D4DFE2"), - Hawkes_Blue("D4E2FC"), - Grenadier("D54600"), - Can_Can("D591A4"), - Whiskey("D59A6F"), - Winter_Hazel("D5D195"), - Granny_Apple("D5F6E3"), - My_Pink("D69188"), - Tacha("D6C562"), - Moon_Raker("D6CEF6"), - Quill_Gray("D6D6D1"), - Snowy_Mint("D6FFDB"), - New_York_Pink("D7837F"), - Pavlova("D7C498"), - Fog("D7D0FF"), - Valencia("D84437"), - Japonica("D87C63"), - Thistle("D8BFD8"), - Maverick("D8C2D5"), - Foam("D8FCFA"), - Cabaret("D94972"), - Burning_Sand("D99376"), - Cameo("D9B99B"), - Timberwolf("D9D6CF"), - Tana("D9DCC1"), - Link_Water("D9E4F5"), - Mabel("D9F7FF"), - Cerise("DA3287"), - Flame_Pea("DA5B38"), - Bamboo("DA6304"), - Red_Damask("DA6A41"), - Orchid("DA70D6"), - Copperfield("DA8A67"), - Golden_Grass("DAA520"), - Zanah("DAECD6"), - Iceberg("DAF4F0"), - Oyster_Bay("DAFAFF"), - Cranberry("DB5079"), - Petite_Orchid("DB9690"), - Di_Serria("DB995E"), - Alto("DBDBDB"), - Frosted_Mint("DBFFF8"), - Crimson("DC143C"), - Punch("DC4333"), - Galliano("DCB20C"), - Blossom("DCB4BC"), - Wattle("DCD747"), - Westar("DCD9D2"), - Moon_Mist("DCDDCC"), - Caper("DCEDB4"), - Swans_Down("DCF0EA"), - Swiss_Coffee("DDD6D5"), - White_Ice("DDF9F1"), - Cerise_Red("DE3163"), - Roman("DE6360"), - Tumbleweed("DEA681"), - Gold_Tips("DEBA13"), - Brandy("DEC196"), - Wafer("DECBC6"), - Sapling("DED4A4"), - Barberry("DED717"), - Beryl_Green("DEE5C0"), - Pattens_Blue("DEF5FF"), - Heliotrope("DF73FF"), - Apache("DFBE6F"), - Chenin("DFCD6F"), - Lola("DFCFDB"), - Willow_Brook("DFECDA"), - Chartreuse_Yellow("DFFF00"), - Mauve("E0B0FF"), - Anzac("E0B646"), - Harvest_Gold("E0B974"), - Calico("E0C095"), - Baby_Blue("E0FFFF"), - Sunglo("E16865"), - Equator("E1BC64"), - Pink_Flare("E1C0C8"), - Periglacial_Blue("E1E6D6"), - Kidnapper("E1EAD4"), - Tara("E1F6E8"), - Mandy("E25465"), - Terracotta("E2725B"), - Golden_Bell("E28913"), - Shocking("E292C0"), - Dixie("E29418"), - Light_Orchid("E29CD2"), - Snuff("E2D8ED"), - Mystic("E2EBED"), - Apple_Green("E2F3EC"), - Razzmatazz("E30B5C"), - Alizarin_Crimson("E32636"), - Cinnabar("E34234"), - Cavern_Pink("E3BEBE"), - Peppermint("E3F5E1"), - Mindaro("E3F988"), - Deep_Blush("E47698"), - Gamboge("E49B0F"), - Melanie("E4C2D5"), - Twilight("E4CFDE"), - Bone("E4D1C0"), - Sunflower("E4D422"), - Grain_Brown("E4D5B7"), - Zombie("E4D69B"), - Frostee("E4F6E7"), - Snow_Flurry("E4FFD1"), - Amaranth("E52B50"), - Zest("E5841B"), - Dust_Storm("E5CCC9"), - Stark_White("E5D7BD"), - Hampton("E5D8AF"), - Bon_Jour("E5E0E1"), - Mercury("E5E5E5"), - Polar("E5F9F6"), - Trinidad("E64E03"), - Gold_Sand("E6BE8A"), - Cashmere("E6BEA5"), - Double_Spanish_White("E6D7B9"), - Satin_Linen("E6E4D4"), - Harp("E6F2EA"), - Off_Green("E6F8F3"), - Hint_of_Green("E6FFE9"), - Tranquil("E6FFFF"), - Mango_Tango("E77200"), - Christine("E7730A"), - Tonys_Pink("E79F8C"), - Kobi("E79FC4"), - Rose_Fog("E7BCB4"), - Corn("E7BF05"), - Putty("E7CD8C"), - Gray_Nurse("E7ECE6"), - Lily_White("E7F8FF"), - Bubbles("E7FEFF"), - Fire_Bush("E89928"), - Shilo("E8B9B3"), - Pearl_Bush("E8E0D5"), - Green_White("E8EBE0"), - Chrome_White("E8F1D4"), - Gin("E8F2EB"), - Aqua_Squeeze("E8F5F2"), - Clementine("E96E00"), - Burnt_Sienna("E97451"), - Tahiti_Gold("E97C07"), - Oyster_Pink("E9CECD"), - Confetti("E9D75A"), - Ebb("E9E3E3"), - Ottoman("E9F8ED"), - Clear_Day("E9FFFD"), - Carissma("EA88A8"), - Porsche("EAAE69"), - Tulip_Tree("EAB33B"), - Rob_Roy("EAC674"), - Raffia("EADAB8"), - White_Rock("EAE8D4"), - Panache("EAF6EE"), - Solitude("EAF6FF"), - Aqua_Spring("EAF9F5"), - Dew("EAFFFE"), - Apricot("EB9373"), - Zinnwaldite("EBC2AF"), - Fuel_Yellow("ECA927"), - Ronchi("ECC54E"), - French_Lilac("ECC7EE"), - Just_Right("ECCDB9"), - Wild_Rice("ECE090"), - Fall_Green("ECEBBD"), - Aths_Special("ECEBCE"), - Starship("ECF245"), - Red_Ribbon("ED0A3F"), - Tango("ED7A1C"), - Carrot_Orange("ED9121"), - Sea_Pink("ED989E"), - Tacao("EDB381"), - Desert_Sand("EDC9AF"), - Pancho("EDCDAB"), - Chamois("EDDCB1"), - Primrose("EDEA99"), - Frost("EDF5DD"), - Aqua_Haze("EDF5F5"), - Zumthor("EDF6FF"), - Narvik("EDF9F1"), - Honeysuckle("EDFC84"), - Lavender_Magenta("EE82EE"), - Beauty_Bush("EEC1BE"), - Chalky("EED794"), - Almond("EED9C4"), - Flax("EEDC82"), - Bizarre("EEDEDA"), - Double_Colonial_White("EEE3AD"), - Cararra("EEEEE8"), - Manz("EEEF78"), - Tahuna_Sands("EEF0C8"), - Athens_Gray("EEF0F3"), - Tusk("EEF3C3"), - Loafer("EEF4DE"), - Catskill_White("EEF6F7"), - Twilight_Blue("EEFDFF"), - Jonquil("EEFF9A"), - Rice_Flower("EEFFE2"), - Jaffa("EF863F"), - Gallery("EFEFEF"), - Porcelain("EFF2F3"), - Mauvelous("F091A9"), - Golden_Dream("F0D52D"), - Golden_Sand("F0DB7D"), - Buff("F0DC82"), - Prim("F0E2EC"), - Khaki("F0E68C"), - Selago("F0EEFD"), - Titan_White("F0EEFF"), - Alice_Blue("F0F8FF"), - Feta("F0FCEA"), - Gold_Drop("F18200"), - Wewak("F19BAB"), - Sahara_Sand("F1E788"), - Parchment("F1E9D2"), - Blue_Chalk("F1E9FF"), - Mint_Julep("F1EEC1"), - Seashell("F1F1F1"), - Saltpan("F1F7F2"), - Tidal("F1FFAD"), - Chiffon("F1FFC8"), - Flamingo("F2552A"), - Tangerine("F28500"), - Mandys_Pink("F2C3B2"), - Concrete("F2F2F2"), - Black_Squeeze("F2FAFA"), - Pomegranate("F34723"), - Buttercup("F3AD16"), - New_Orleans("F3D69D"), - Vanilla_Ice("F3D9DF"), - Sidecar("F3E7BB"), - Dawn_Pink("F3E9E5"), - Wheatfield("F3EDCF"), - Canary("F3FB62"), - Orinoco("F3FBD4"), - Carla("F3FFD8"), - Hollywood_Cerise("F400A1"), - Sandy_brown("F4A460"), - Saffron("F4C430"), - Ripe_Lemon("F4D81C"), - Janna("F4EBD3"), - Pampas("F4F2EE"), - Wild_Sand("F4F4F4"), - Zircon("F4F8FF"), - Froly("F57584"), - Cream_Can("F5C85C"), - Manhattan("F5C999"), - Maize("F5D5A0"), - Wheat("F5DEB3"), - Sandwisp("F5E7A2"), - Pot_Pourri("F5E7E2"), - Albescent_White("F5E9D3"), - Soft_Peach("F5EDEF"), - Ecru_White("F5F3E5"), - Beige("F5F5DC"), - Golden_Fizz("F5FB3D"), - Australian_Mint("F5FFBE"), - French_Rose("F64A8A"), - Brilliant_Rose("F653A6"), - Illusion("F6A4C9"), - Merino("F6F0E6"), - Black_Haze("F6F7F7"), - Spring_Sun("F6FFDC"), - Violet_Red("F7468A"), - Chilean_Fire("F77703"), - Persian_Pink("F77FBE"), - Rajah("F7B668"), - Azalea("F7C8DA"), - We_Peep("F7DBE6"), - Quarter_Spanish_White("F7F2E1"), - Whisper("F7F5FA"), - Snow_Drift("F7FAF7"), - Casablanca("F8B853"), - Chantilly("F8C3DF"), - Cherub("F8D9E9"), - Marzipan("F8DB9D"), - Energy_Yellow("F8DD5C"), - Givry("F8E4BF"), - White_Linen("F8F0E8"), - Magnolia("F8F4FF"), - Spring_Wood("F8F6F1"), - Coconut_Cream("F8F7DC"), - White_Lilac("F8F7FC"), - Desert_Storm("F8F8F7"), - Texas("F8F99C"), - Corn_Field("F8FACD"), - Mimosa("F8FDD3"), - Carnation("F95A61"), - Saffron_Mango("F9BF58"), - Carousel_Pink("F9E0ED"), - Dairy_Cream("F9E4BC"), - Portica("F9E663"), - Amour("F9EAF3"), - Rum_Swizzle("F9F8E4"), - Dolly("F9FF8B"), - Sugar_Cane("F9FFF6"), - Ecstasy("FA7814"), - Tan_Hide("FA9D5A"), - Corvette("FAD3A2"), - Peach_Yellow("FADFAD"), - Turbo("FAE600"), - Astra("FAEAB9"), - Champagne("FAECCC"), - Linen("FAF0E6"), - Fantasy("FAF3F0"), - Citrine_White("FAF7D6"), - Alabaster("FAFAFA"), - Hint_of_Yellow("FAFDE4"), - Milan("FAFFA4"), - Brink_Pink("FB607F"), - Geraldine("FB8989"), - Lavender_Rose("FBA0E3"), - Sea_Buckthorn("FBA129"), - Sun("FBAC13"), - Lavender_Pink("FBAED2"), - Rose_Bud("FBB2A3"), - Cupid("FBBEDA"), - Classic_Rose("FBCCE7"), - Apricot_Peach("FBCEB1"), - Banana_Mania("FBE7B2"), - Marigold_Yellow("FBE870"), - Festival("FBE96C"), - Sweet_Corn("FBEA8C"), - Candy_Corn("FBEC5D"), - Hint_of_Red("FBF9F9"), - Shalimar("FBFFBA"), - Shocking_Pink("FC0FC0"), - Tickle_Me_Pink("FC80A5"), - Tree_Poppy("FC9C1D"), - Lightning_Yellow("FCC01E"), - Goldenrod("FCD667"), - Candlelight("FCD917"), - Cherokee("FCDA98"), - Double_Pearl_Lusta("FCF4D0"), - Pearl_Lusta("FCF4DC"), - Vista_White("FCF8F7"), - Bianca("FCFBF3"), - Moon_Glow("FCFEDA"), - China_Ivory("FCFFE7"), - Ceramic("FCFFF9"), - Torch_Red("FD0E35"), - Wild_Watermelon("FD5B78"), - Crusta("FD7B33"), - Sorbus("FD7C07"), - Sweet_Pink("FD9FA2"), - Light_Apricot("FDD5B1"), - Pig_Pink("FDD7E4"), - Cinderella("FDE1DC"), - Golden_Glow("FDE295"), - Lemon("FDE910"), - Old_Lace("FDF5E6"), - Half_Colonial_White("FDF6D3"), - Drover("FDF7AD"), - Pale_Prim("FDFEB8"), - Cumulus("FDFFD5"), - Persian_Rose("FE28A2"), - Sunset_Orange("FE4C40"), - Bittersweet("FE6F5E"), - California("FE9D04"), - Yellow_Sea("FEA904"), - Melon("FEBAAD"), - Bright_Sun("FED33C"), - Dandelion("FED85D"), - Salomie("FEDB8D"), - Cape_Honey("FEE5AC"), - Remy("FEEBF3"), - Oasis("FEEFCE"), - Bridesmaid("FEF0EC"), - Beeswax("FEF2C7"), - Bleach_White("FEF3D8"), - Pipi("FEF4CC"), - Half_Spanish_White("FEF4DB"), - Wisp_Pink("FEF4F8"), - Provincial_Pink("FEF5F1"), - Half_Dutch_White("FEF7DE"), - Solitaire("FEF8E2"), - White_Pointer("FEF8FF"), - Off_Yellow("FEF9E3"), - Orange_White("FEFCED"), - Red("FF0000"), - Rose("FF007F"), - Purple_Pizzazz("FF00CC"), - Magenta("FF00FF", "Fuchsia"), - Scarlet("FF2400"), - Wild_Strawberry("FF3399"), - Razzle_Dazzle_Rose("FF33CC"), - Radical_Red("FF355E"), - Red_Orange("FF3F34"), - Coral_Red("FF4040"), - Vermilion("FF4D00"), - International_Orange("FF4F00"), - Outrageous_Orange("FF6037"), - Blaze_Orange("FF6600"), - Pink_Flamingo("FF66FF"), - Orange("FF681F"), - Hot_Pink("FF69B4"), - Persimmon("FF6B53"), - Blush_Pink("FF6FFF"), - Burning_Orange("FF7034"), - Pumpkin("FF7518"), - Flamenco("FF7D07"), - Flush_Orange("FF7F00"), - Coral("FF7F50"), - Salmon("FF8C69"), - Pizazz("FF9000"), - West_Side("FF910F"), - Pink_Salmon("FF91A4"), - Neon_Carrot("FF9933"), - Atomic_Tangerine("FF9966"), - Vivid_Tangerine("FF9980"), - Sunshade("FF9E2C"), - Orange_Peel("FFA000"), - Mona_Lisa("FFA194"), - Web_Orange("FFA500"), - Carnation_Pink("FFA6C9"), - Hit_Pink("FFAB81"), - Yellow_Orange("FFAE42"), - Cornflower_Lilac("FFB0AC"), - Sundown("FFB1B3"), - My_Sin("FFB31F"), - Texas_Rose("FFB555"), - Cotton_Candy("FFB7D5"), - Macaroni_and_Cheese("FFB97B"), - Selective_Yellow("FFBA00"), - Koromiko("FFBD5F"), - Amber("FFBF00"), - Wax_Flower("FFC0A8"), - Pink("FFC0CB"), - Your_Pink("FFC3C0"), - Supernova("FFC901"), - Flesh("FFCBA4"), - Sunglow("FFCC33"), - Golden_Tainoi("FFCC5C"), - Peach_Orange("FFCC99"), - Chardonnay("FFCD8C"), - Pastel_Pink("FFD1DC"), - Romantic("FFD2B7"), - Grandis("FFD38C"), - Gold("FFD700"), - School_bus_Yellow("FFD800"), - Cosmos("FFD8D9"), - Mustard("FFDB58"), - Peach_Schnapps("FFDCD6"), - Caramel("FFDDAF"), - Tuft_Bush("FFDDCD"), - Watusi("FFDDCF"), - Pink_Lace("FFDDF4"), - Navajo_White("FFDEAD"), - Frangipani("FFDEB3"), - Pippin("FFE1DF"), - Pale_Rose("FFE1F2"), - Negroni("FFE2C5"), - Cream_Brulee("FFE5A0"), - Peach("FFE5B4"), - Tequila("FFE6C7"), - Kournikova("FFE772"), - Sandy_Beach("FFEAC8"), - Karry("FFEAD4"), - Broom("FFEC13"), - Colonial_White("FFEDBC"), - Derby("FFEED8"), - Vis_Vis("FFEFA1"), - Egg_White("FFEFC1"), - Papaya_Whip("FFEFD5"), - Fair_Pink("FFEFEC"), - Peach_Cream("FFF0DB"), - Lavender_blush("FFF0F5"), - Gorse("FFF14F"), - Buttermilk("FFF1B5"), - Pink_Lady("FFF1D8"), - Forget_Me_Not("FFF1EE"), - Tutu("FFF1F9"), - Picasso("FFF39D"), - Chardon("FFF3F1"), - Paris_Daisy("FFF46E"), - Barley_White("FFF4CE"), - Egg_Sour("FFF4DD"), - Sazerac("FFF4E0"), - Serenade("FFF4E8"), - Chablis("FFF4F3"), - Seashell_Peach("FFF5EE"), - Sauvignon("FFF5F3"), - Milk_Punch("FFF6D4"), - Varden("FFF6DF"), - Rose_White("FFF6F5"), - Baja_White("FFF8D1"), - Gin_Fizz("FFF9E2"), - Early_Dawn("FFF9E6"), - Lemon_Chiffon("FFFACD"), - Bridal_Heath("FFFAF4"), - Scotch_Mist("FFFBDC"), - Soapstone("FFFBF9"), - Witch_Haze("FFFC99"), - Buttery_White("FFFCEA"), - Island_Spice("FFFCEE"), - Cream("FFFDD0"), - Chilean_Heath("FFFDE6"), - Travertine("FFFDE8"), - Orchid_White("FFFDF3"), - Quarter_Pearl_Lusta("FFFDF4"), - Half_and_Half("FFFEE1"), - Apricot_White("FFFEEC"), - Rice_Cake("FFFEF0"), - Black_White("FFFEF6"), - Romance("FFFEFD"), - Yellow("FFFF00"), - Laser_Lemon("FFFF66"), - Pale_Canary("FFFF99"), - Portafino("FFFFB4"), - Ivory("FFFFF0"), - White("FFFFFF"); - - private String hex; - private String[] extra; - private long rgb = 0; - - CMICustomColors(String hex, String... extra) { - this.hex = hex.toLowerCase(); - this.extra = extra; - rgb = Long.parseLong(hex, 16); - } - - public String getHex() { - return hex; - } - - public String[] getExtra() { - return extra; - } - - public long getRgb() { - return rgb; - } -} \ No newline at end of file diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMIEnchantment.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMIEnchantment.java index a708eab7..778f16d5 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMIEnchantment.java +++ b/src/main/java/com/gamingmesh/jobs/CMILib/CMIEnchantment.java @@ -8,7 +8,7 @@ import java.util.Map; import org.bukkit.enchantments.Enchantment; -import com.gamingmesh.jobs.stuff.Util; +import net.Zrips.CMILib.Container.CMIText; public enum CMIEnchantment { @@ -206,7 +206,7 @@ public enum CMIEnchantment { } public String getName() { - return Util.firstToUpperCase(toString()); + return CMIText.firstToUpperCase(toString()); } public static String getName(Enchantment enchant) { diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMIEntityType.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMIEntityType.java deleted file mode 100644 index 968960b4..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMIEntityType.java +++ /dev/null @@ -1,377 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; - -import org.bukkit.block.CreatureSpawner; -import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.BlockStateMeta; - -public enum CMIEntityType { - - DROPPED_ITEM(1, "Item"), - EXPERIENCE_ORB(2, "Experience Orb"), - AREA_EFFECT_CLOUD(3, "Area Effect Cloud"), - ELDER_GUARDIAN(4, "Elder Guardian", Arrays.asList( - "MWM3OTc0ODJhMTRiZmNiODc3MjU3Y2IyY2ZmMWI2ZTZhOGI4NDEzMzM2ZmZiNGMyOWE2MTM5Mjc4YjQzNmIifX19")), - WITHER_SKELETON(5, "Wither Skeleton", Arrays.asList( - "Nzk1M2I2YzY4NDQ4ZTdlNmI2YmY4ZmIyNzNkNzIwM2FjZDhlMWJlMTllODE0ODFlYWQ1MWY0NWRlNTlhOCJ9fX0=", - "NDk2YmM4ZWJkNGUxM2Y0OTZkOGQ3NGM1NjVkZDU2ZTk5YTRhZjJlMmVhN2EyN2E5NmMxYWJkMjg0MTg0YiJ9fX0=", - "ZjVlYzk2NDY0NWE4ZWZhYzc2YmUyZjE2MGQ3Yzk5NTYzNjJmMzJiNjUxNzM5MGM1OWMzMDg1MDM0ZjA1MGNmZiJ9fX0=")), - STRAY(6, "Stray", Arrays.asList( - "NzhkZGY3NmU1NTVkZDVjNGFhOGEwYTVmYzU4NDUyMGNkNjNkNDg5YzI1M2RlOTY5ZjdmMjJmODVhOWEyZDU2In19fQ==")), - EGG(7, "Thrown Egg"), - LEASH_HITCH(8, "Leash Knot"), - PAINTING(9, "Painting"), - ARROW(10, "Arrow"), - SNOWBALL(11, "Snowball"), - FIREBALL(12, "Fireball"), - SMALL_FIREBALL(13, "Small Fireball"), - ENDER_PEARL(14, "Thrown Ender Pearl"), - ENDER_SIGNAL(15, "End Signal"), - SPLASH_POTION(16, "Splash Potion"), - THROWN_EXP_BOTTLE(17, "Thrown Bottle o' Enchanting"), - ITEM_FRAME(18, "Item Frame"), - WITHER_SKULL(19, "Wither Skull"), - PRIMED_TNT(20, "Primed TNT"), - FALLING_BLOCK(21, "Falling Block"), - FIREWORK(22, "Firework Rocket"), - HUSK(23, "Husk", Arrays.asList( - "Nzc3MDY4MWQxYTI1NWZiNGY3NTQ3OTNhYTA1NWIyMjA0NDFjZGFiOWUxMTQxZGZhNTIzN2I0OTkzMWQ5YjkxYyJ9fX0=")), - SPECTRAL_ARROW(24, "Spectral Arrow"), - SHULKER_BULLET(25, "Shulker Bullet"), - DRAGON_FIREBALL(26, "Dragon Fireball"), - ZOMBIE_VILLAGER(27, "Zombie Villager", Arrays.asList( - "NDRmMDhlYmQ0ZTI1Y2RhM2FkZTQ1Yjg2MzM3OGFkMzc3ZjE4YzUxMGRiNGQyOGU4MmJiMjQ0NTE0MzliMzczNCJ9fX0=", - "OTYxZjE5ZmZkOGFlNDI1NzkyYzRiMTgxNzU2YWRmZjhkNDgxNzRhZWVmNThhMGYzMjdhMjhjNzQyYzcyNDQyIn19fQ==", - "NTI4YzJiYWQ1Mzg5Y2IzNTkyYjU2NWIzYzQ3ZWNjMTg5ZTA1NDJhODc4MzUwMjhkNjE0OGJiZTMzNDU2NDUifX19", - "YTE2MTU1ZmNmMzY2Y2Y0ZTA2Y2U1ZGZmYzQ4Y2E1NGU4ZWE0OGRmZTUyNTM1OGI2MTJkYzQ0ZmQ0MzIifX19", - "Y2ZmMDQ4MmZkMzJmYWIyY2U5ZjVmYTJlMmQ5YjRkYzc1NjFkYTQyMjE1MmM5OWZjODA0YjkxMzljYWYyNTZiIn19fQ==", - "MzdlODM4Y2NjMjY3NzZhMjE3YzY3ODM4NmY2YTY1NzkxZmU4Y2RhYjhjZTljYTRhYzZiMjgzOTdhNGQ4MWMyMiJ9fX0=")), - SKELETON_HORSE(28, "Skeleton Horse", Arrays.asList( - "NDdlZmZjZTM1MTMyYzg2ZmY3MmJjYWU3N2RmYmIxZDIyNTg3ZTk0ZGYzY2JjMjU3MGVkMTdjZjg5NzNhIn19fQ==")), - ZOMBIE_HORSE(29, "Zombie Horse", Arrays.asList( - "ZDIyOTUwZjJkM2VmZGRiMThkZTg2ZjhmNTVhYzUxOGRjZTczZjEyYTZlMGY4NjM2ZDU1MWQ4ZWI0ODBjZWVjIn19fQ==")), - ARMOR_STAND(30, "Armor Stand"), - DONKEY(31, "Donkey", Arrays.asList( - "ZGZiNmMzYzA1MmNmNzg3ZDIzNmEyOTE1ZjgwNzJiNzdjNTQ3NDk3NzE1ZDFkMmY4Y2JjOWQyNDFkODhhIn19fQ==")), - MULE(32, "Mule", Arrays.asList( - "YTA0ODZhNzQyZTdkZGEwYmFlNjFjZTJmNTVmYTEzNTI3ZjFjM2IzMzRjNTdjMDM0YmI0Y2YxMzJmYjVmNWYifX19")), - EVOKER_FANGS(33, "Evoker Fangs"), - EVOKER(34, "Evoker", Arrays.asList( - "YTAwZDNmZmYxNmMyZGNhNTliOWM1OGYwOTY1MjVjODY5NzExNjZkYmFlMTMzYjFiMDUwZTVlZTcxNjQ0MyJ9fX0=")), - VEX(35, "Vex", Arrays.asList( - "NWU3MzMwYzdkNWNkOGEwYTU1YWI5ZTk1MzIxNTM1YWM3YWUzMGZlODM3YzM3ZWE5ZTUzYmVhN2JhMmRlODZiIn19fQ==")), - VINDICATOR(36, "Vindicator", Arrays.asList( - "YTAwZDNmZmYxNmMyZGNhNTliOWM1OGYwOTY1MjVjODY5NzExNjZkYmFlMTMzYjFiMDUwZTVlZTcxNjQ0MyJ9fX0=")), - ILLUSIONER(37, "Illusioner", Arrays.asList( - "NTEyNTEyZTdkMDE2YTIzNDNhN2JmZjFhNGNkMTUzNTdhYjg1MTU3OWYxMzg5YmQ0ZTNhMjRjYmViODhiIn19fQ==", - "MmYyODgyZGQwOTcyM2U0N2MwYWI5NjYzZWFiMDgzZDZhNTk2OTI3MzcwNjExMGM4MjkxMGU2MWJmOGE4ZjA3ZSJ9fX0=")), - MINECART_COMMAND(40, "Minecart with Command Block"), - BOAT(41, "Boat"), - MINECART(42, "Minecart"), - MINECART_CHEST(43, "Minecart with Chest"), - MINECART_FURNACE(44, "Minecart with Furnace"), - MINECART_TNT(45, "Minecart with TNT"), - MINECART_HOPPER(46, "Minecart with Hopper"), - MINECART_MOB_SPAWNER(47, "Minecart with Spawner"), - CREEPER(50, "Creeper", Arrays.asList( - "ZjQyNTQ4MzhjMzNlYTIyN2ZmY2EyMjNkZGRhYWJmZTBiMDIxNWY3MGRhNjQ5ZTk0NDQ3N2Y0NDM3MGNhNjk1MiJ9fX0=", - "YTNmMTcyZDI5Y2Y5NGJjODk1NjA4YjdhNWRjMmFmMGRlNDljNzg4ZDViZWNiMTYwNWYxZjUzNDg4YTAxNzBiOCJ9fX0=")), - SKELETON(51, "Skeleton", Arrays.asList( - "MzAxMjY4ZTljNDkyZGExZjBkODgyNzFjYjQ5MmE0YjMwMjM5NWY1MTVhN2JiZjc3ZjRhMjBiOTVmYzAyZWIyIn19fQ==", - "Yjk1MDc4ZDNiM2IxNzAxZDQ1NzI5ZDNhMTQyMjQ2N2IyOWRiYjJlMWE5MTI4MTMzYTJmMTYzZWJlODVkMmRiOSJ9fX0=")), - SPIDER(52, "Spider", Arrays.asList( - "Y2Q1NDE1NDFkYWFmZjUwODk2Y2QyNThiZGJkZDRjZjgwYzNiYTgxNjczNTcyNjA3OGJmZTM5MzkyN2U1N2YxIn19fQ==")), - GIANT(53, "Giant"), - ZOMBIE(54, "Zombie", Arrays.asList( - "NTZmYzg1NGJiODRjZjRiNzY5NzI5Nzk3M2UwMmI3OWJjMTA2OTg0NjBiNTFhNjM5YzYwZTVlNDE3NzM0ZTExIn19fQ==", - "MzExZGQ5MWVlNGQzMWRkZDU5MWQyODMyZWExZWMwODBmMmVkZWQzM2FiODllZTFkYjhiMDRiMjZhNjhhIn19fQ==")), - SLIME(55, "Slime", Arrays.asList( - "MTZhZDIwZmMyZDU3OWJlMjUwZDNkYjY1OWM4MzJkYTJiNDc4YTczYTY5OGI3ZWExMGQxOGM5MTYyZTRkOWI1In19fQ==")), - GHAST(56, "Ghast", Arrays.asList( - "OGI2YTcyMTM4ZDY5ZmJiZDJmZWEzZmEyNTFjYWJkODcxNTJlNGYxYzk3ZTVmOTg2YmY2ODU1NzFkYjNjYzAifX19")), - PIG_ZOMBIE(57, "Zombie Pigman", Arrays.asList( - "NzRlOWM2ZTk4NTgyZmZkOGZmOGZlYjMzMjJjZDE4NDljNDNmYjE2YjE1OGFiYjExY2E3YjQyZWRhNzc0M2ViIn19fQ==")), - ENDERMAN(58, "Enderman", Arrays.asList( - "N2E1OWJiMGE3YTMyOTY1YjNkOTBkOGVhZmE4OTlkMTgzNWY0MjQ1MDllYWRkNGU2YjcwOWFkYTUwYjljZiJ9fX0=")), - CAVE_SPIDER(59, "Cave Spider", Arrays.asList( - "NDE2NDVkZmQ3N2QwOTkyMzEwN2IzNDk2ZTk0ZWViNWMzMDMyOWY5N2VmYzk2ZWQ3NmUyMjZlOTgyMjQifX19")), - SILVERFISH(60, "Silverfish", Arrays.asList( - "ZGE5MWRhYjgzOTFhZjVmZGE1NGFjZDJjMGIxOGZiZDgxOWI4NjVlMWE4ZjFkNjIzODEzZmE3NjFlOTI0NTQwIn19fQ==")), - BLAZE(61, "Blaze", Arrays.asList( - "Yjc4ZWYyZTRjZjJjNDFhMmQxNGJmZGU5Y2FmZjEwMjE5ZjViMWJmNWIzNWE0OWViNTFjNjQ2Nzg4MmNiNWYwIn19fQ==")), - MAGMA_CUBE(62, "Magma Cube", Arrays.asList( - "Mzg5NTdkNTAyM2M5MzdjNGM0MWFhMjQxMmQ0MzQxMGJkYTIzY2Y3OWE5ZjZhYjM2Yjc2ZmVmMmQ3YzQyOSJ9fX0=")), - ENDER_DRAGON(63, "Ender Dragon"), - WITHER(64, "Wither", Arrays.asList( - "ZGRhZmIyM2VmYzU3ZjI1MTg3OGU1MzI4ZDExY2IwZWVmODdiNzljODdiMjU0YTdlYzcyMjk2ZjkzNjNlZjdjIn19fQ==", - "M2U0ZjQ5NTM1YTI3NmFhY2M0ZGM4NDEzM2JmZTgxYmU1ZjJhNDc5OWE0YzA0ZDlhNGRkYjcyZDgxOWVjMmIyYiJ9fX0=", - "OTY0ZTFjM2UzMTVjOGQ4ZmZmYzM3OTg1YjY2ODFjNWJkMTZhNmY5N2ZmZDA3MTk5ZThhMDVlZmJlZjEwMzc5MyJ9fX0=", - "Y2RmNzRlMzIzZWQ0MTQzNjk2NWY1YzU3ZGRmMjgxNWQ1MzMyZmU5OTllNjhmYmI5ZDZjZjVjOGJkNDEzOWYifX19", - "YTQzNTE2NGMwNWNlYTI5OWEzZjAxNmJiYmVkMDU3MDZlYmI3MjBkYWM5MTJjZTQzNTFjMjI5NjYyNmFlY2Q5YSJ9fX0=")), - BAT(65, "Bat", Arrays.asList( - "NGNmMWIzYjNmNTM5ZDJmNjNjMTcyZTk0Y2FjZmFhMzkxZThiMzg1Y2RkNjMzZjNiOTkxYzc0ZTQ0YjI4In19fQ==")), - WITCH(66, "Witch", Arrays.asList( - "ODllOGI1ZjE1YTliMjlhMWUzODljOTUyMThmZDM3OTVmMzI4NzJlNWFlZTk0NjRhNzY0OTVjNTI3ZDIyNDUifX19")), - ENDERMITE(67, "Endermite", Arrays.asList( - "ODRhYWZmYTRjMDllMmVhZmI4NWQzNTIyMTIyZGIwYWE0NTg3NGJlYTRlM2Y1ZTc1NjZiNGQxNjZjN2RmOCJ9fX0=")), - GUARDIAN(68, "Guardian", Arrays.asList( - "ZGZiNjc1Y2I1YTdlM2ZkMjVlMjlkYTgyNThmMjRmYzAyMGIzZmE5NTAzNjJiOGJjOGViMjUyZTU2ZTc0In19fQ==")), - SHULKER(69, "Shulker", Arrays.asList( - "MWU3MzgzMmUyNzJmODg0NGM0NzY4NDZiYzQyNGEzNDMyZmI2OThjNThlNmVmMmE5ODcxYzdkMjlhZWVhNyJ9fX0=")), - PIG(90, "Pig", Arrays.asList( - "NjIxNjY4ZWY3Y2I3OWRkOWMyMmNlM2QxZjNmNGNiNmUyNTU5ODkzYjZkZjRhNDY5NTE0ZTY2N2MxNmFhNCJ9fX0=", - "YzNhYmQ0NGFlNjdkOWM5MjU0ZDE3N2U5NjU4ZGE4NDg0MzM4OWQ1ZTFmZmQyYWYxZmI1MTIxN2M3NWMyOTgifX19")), - SHEEP(91, "Sheep", Arrays.asList( - "MjZhNDExMmRmMWU0YmNlMmE1ZTI4NDE3ZjNhYWZmNzljZDY2ZTg4NWMzNzI0NTU0MTAyY2VmOGViOCJ9fX0=", - "ZjMxZjljY2M2YjNlMzJlY2YxM2I4YTExYWMyOWNkMzNkMThjOTVmYzczZGI4YTY2YzVkNjU3Y2NiOGJlNzAifX19", - "Y2UxYWM2ODM5OTNiZTM1NTEyZTFiZTMxZDFmNGY5OGU1ODNlZGIxNjU4YTllMjExOTJjOWIyM2I1Y2NjZGMzIn19fQ==", - "ODM5YWY0NzdlYjYyNzgxNWY3MjNhNTY2MjU1NmVjOWRmY2JhYjVkNDk0ZDMzOGJkMjE0MjMyZjIzZTQ0NiJ9fX0=", - "YWU1Mjg2N2FmZWYzOGJiMTRhMjZkMTQyNmM4YzBmMTE2YWQzNDc2MWFjZDkyZTdhYWUyYzgxOWEwZDU1Yjg1In19fQ==", - "MmFjNzRhMmI5YjkxNDUyZTU2ZmExZGRhNWRiODEwNzc4NTZlNDlmMjdjNmUyZGUxZTg0MWU1Yzk1YTZmYzVhYiJ9fX0=", - "ZjA5ODM5N2EyNzBiNGMzZDJiMWU1NzRiOGNmZDNjYzRlYTM0MDkwNjZjZWZlMzFlYTk5MzYzM2M5ZDU3NiJ9fX0=", - "MTgzNjU2NWM3ODk3ZDQ5YTcxYmMxODk4NmQxZWE2NTYxMzIxYTBiYmY3MTFkNDFhNTZjZTNiYjJjMjE3ZTdhIn19fQ==", - "OTJhMjQ0OGY1OGE0OTEzMzI0MzRlODVjNDVkNzg2ZDg3NDM5N2U4MzBhM2E3ODk0ZTZkOTI2OTljNDJiMzAifX19", - "MWM4YTk3YTM4ODU2NTE0YTE2NDEzZTJjOTk1MjEyODlmNGM1MzYzZGM4MmZjOWIyODM0Y2ZlZGFjNzhiODkifX19", - "YTAxNzIxNWM3ZjhkYjgyMDQwYWEyYzQ3Mjk4YjY2NTQxYzJlYjVmN2Y5MzA0MGE1ZDIzZDg4ZjA2ODdkNGIzNCJ9fX0=", - "NDI4N2ViNTAxMzkxZjI3NTM4OWYxNjZlYzlmZWJlYTc1ZWM0YWU5NTFiODhiMzhjYWU4N2RmN2UyNGY0YyJ9fX0=", - "NDZmNmM3ZTdmZDUxNGNlMGFjYzY4NTkzMjI5ZTQwZmNjNDM1MmI4NDE2NDZlNGYwZWJjY2NiMGNlMjNkMTYifX19", - "YTU1YWQ2ZTVkYjU2OTJkODdmNTE1MTFmNGUwOWIzOWZmOWNjYjNkZTdiNDgxOWE3Mzc4ZmNlODU1M2I4In19fQ==", - "ZDllYzIyODE4ZDFmYmZjODE2N2ZiZTM2NzI4YjI4MjQwZTM0ZTE2NDY5YTI5MjlkMDNmZGY1MTFiZjJjYTEifX19", - "MzI2NTIwODNmMjhlZDFiNjFmOWI5NjVkZjFhYmYwMTBmMjM0NjgxYzIxNDM1OTUxYzY3ZDg4MzY0NzQ5ODIyIn19fQ==")), - COW(92, "Cow", Arrays.asList( - "NWQ2YzZlZGE5NDJmN2Y1ZjcxYzMxNjFjNzMwNmY0YWVkMzA3ZDgyODk1ZjlkMmIwN2FiNDUyNTcxOGVkYzUifX19", - "YzVhOWNkNThkNGM2N2JjY2M4ZmIxZjVmNzU2YTJkMzgxYzlmZmFjMjkyNGI3ZjRjYjcxYWE5ZmExM2ZiNWMifX19")), - CHICKEN(93, "Chicken", Arrays.asList( - "MTYzODQ2OWE1OTljZWVmNzIwNzUzNzYwMzI0OGE5YWIxMWZmNTkxZmQzNzhiZWE0NzM1YjM0NmE3ZmFlODkzIn19fQ==")), - SQUID(94, "Squid", Arrays.asList( - "MDE0MzNiZTI0MjM2NmFmMTI2ZGE0MzRiODczNWRmMWViNWIzY2IyY2VkZTM5MTQ1OTc0ZTljNDgzNjA3YmFjIn19fQ==")), - WOLF(95, "Wolf", Arrays.asList( - "ZTk1Y2JiNGY3NWVhODc2MTdmMmY3MTNjNmQ0OWRhYzMyMDliYTFiZDRiOTM2OTY1NGIxNDU5ZWExNTMxNyJ9fX0=")), - MUSHROOM_COW(96, "Mushroom Cow", "Mooshroom", Arrays.asList( - "ZDBiYzYxYjk3NTdhN2I4M2UwM2NkMjUwN2EyMTU3OTEzYzJjZjAxNmU3YzA5NmE0ZDZjZjFmZTFiOGRiIn19fQ==")), - SNOWMAN(97, "Snowman", Arrays.asList( - "MWZkZmQxZjc1MzhjMDQwMjU4YmU3YTkxNDQ2ZGE4OWVkODQ1Y2M1ZWY3MjhlYjVlNjkwNTQzMzc4ZmNmNCJ9fX0=")), - OCELOT(98, "Ocelot", "Cat", Arrays.asList( - "YWI4ODFjMzliM2FmZGNjNzlmOTFmZTVkZTNjZGQwMTViYzMzNTM4NDNmNTkxZjRkMjNjZDMwMjdkZTRlNiJ9fX0=", - "YTc1NWU3ZGYwNGQxOGIzMWQ2M2MxN2Y0YTdiNGM3MzkyNGJkNjI2NWRhNjllMTEzZWRkZDk3NTE2ZmM3In19fQ==", - "ZjJhNjYyZjJhZTdkZWJlZTY1MjkyYzJiZjQyZmJiMDliOTdiMmZmYmRiMjcwNTIwYzJkYjk2ZTUxZDg5NDUifX19", - "NTY1N2NkNWMyOTg5ZmY5NzU3MGZlYzRkZGNkYzY5MjZhNjhhMzM5MzI1MGMxYmUxZjBiMTE0YTFkYjEifX19")), - IRON_GOLEM(99, "Iron Golem", Arrays.asList( - "ODkwOTFkNzllYTBmNTllZjdlZjk0ZDdiYmE2ZTVmMTdmMmY3ZDQ1NzJjNDRmOTBmNzZjNDgxOWE3MTQifX19")), - HORSE(100, "Horse", Arrays.asList( - "NjE5MDI4OTgzMDg3MzBjNDc0NzI5OWNiNWE1ZGE5YzI1ODM4YjFkMDU5ZmU0NmZjMzY4OTZmZWU2NjI3MjkifX19")), - RABBIT(101, "Rabbit", Arrays.asList( - "Y2I4Y2ZmNGIxNWI4Y2EzN2UyNTc1MGYzNDU3MThmMjg5Y2IyMmM1YjNhZDIyNjI3YTcxMjIzZmFjY2MifX19", - "NzJjNTgxMTZhMTQ3ZDFhOWEyNjI2OTIyNGE4YmUxODRmZThlNWYzZjNkZjliNjE3NTEzNjlhZDg3MzgyZWM5In19fQ==", - "Yzk3N2EzMjY2YmYzYjllYWYxN2U1YTAyZWE1ZmJiNDY4MDExNTk4NjNkZDI4OGI5M2U2YzEyYzljYiJ9fX0=")), - POLAR_BEAR(102, "Polar Bear", Arrays.asList( - "ZDQ2ZDIzZjA0ODQ2MzY5ZmEyYTM3MDJjMTBmNzU5MTAxYWY3YmZlODQxOTk2NjQyOTUzM2NkODFhMTFkMmIifX19")), - LLAMA(103, "Llama", Arrays.asList( - "ODAyNzdlNmIzZDlmNzgxOWVmYzdkYTRiNDI3NDVmN2FiOWE2M2JhOGYzNmQ2Yjg0YTdhMjUwYzZkMWEzNThlYiJ9fX0=", - "Y2YyNGU1NmZkOWZmZDcxMzNkYTZkMWYzZTJmNDU1OTUyYjFkYTQ2MjY4NmY3NTNjNTk3ZWU4MjI5OWEifX19", - "YzJiMWVjZmY3N2ZmZTNiNTAzYzMwYTU0OGViMjNhMWEwOGZhMjZmZDY3Y2RmZjM4OTg1NWQ3NDkyMTM2OCJ9fX0=", - "NGQ2N2ZkNGJmZjI5MzI2OWNiOTA4OTc0ZGNhODNjMzM0ODVlNDM1ZWQ1YThlMWRiZDY1MjFjNjE2ODcxNDAifX19")), - LLAMA_SPIT(104, "Llama Spit"), - PARROT(105, "Parrot", Arrays.asList( - "YTRiYThkNjZmZWNiMTk5MmU5NGI4Njg3ZDZhYjRhNTMyMGFiNzU5NGFjMTk0YTI2MTVlZDRkZjgxOGVkYmMzIn19fQ==", - "Yjc4ZTFjNWY0OGE3ZTEyYjI2Mjg1MzU3MWVmMWY1OTdhOTJlZjU4ZGE4ZmFhZmUwN2JiN2MwZTY5ZTkzIn19fQ==", - "YWI5YTM2YzU1ODlmM2EyZTU5YzFjYWE5YjNiODhmYWRhNzY3MzJiZGI0YTc5MjYzODhhOGMwODhiYmJjYiJ9fX0=", - "M2Q2ZjRhMjFlMGQ2MmFmODI0Zjg3MDhhYzYzNDEwZjFhMDFiYmI0MWQ3ZjRhNzAyZDk0NjljNjExMzIyMiJ9fX0=", - "MmI5NGYyMzZjNGE2NDJlYjJiY2RjMzU4OWI5YzNjNGEwYjViZDVkZjljZDVkNjhmMzdmOGM4M2Y4ZTNmMSJ9fX0=", - "ZGFjNjcwM2RlZDQ2ZDkzOWE2MjBmZTIyYzQzZTE4Njc0ZTEzZDIzYzk3NDRiZTAzNmIzNDgzYzFkMWNkZCJ9fX0=", - "ZjBiZmE4NTBmNWRlNGIyOTgxY2NlNzhmNTJmYzJjYzdjZDdiNWM2MmNhZWZlZGRlYjljZjMxMWU4M2Q5MDk3In19fQ==", - "ZjhhODJjOGI3NWRkMWMyY2U4MTMzYzBiYTkzOWI4YzUyZTQ3ZDNlYzM3NDk1MGY0N2RkZGJiZTM0NWUyMCJ9fX0=", - "YWNhNTgwYjA1MWM2M2JlMjlkYTU0NWE5YWE3ZmY3ZTEzNmRmNzdhODFjNjdkYzFlZTllNjE3MGMxNGZiMzEwIn19fQ==")), - VILLAGER(120, "Villager", Arrays.asList( - "ODIyZDhlNzUxYzhmMmZkNGM4OTQyYzQ0YmRiMmY1Y2E0ZDhhZThlNTc1ZWQzZWIzNGMxOGE4NmU5M2IifX19")), - ENDER_CRYSTAL(200, "End Crystal"), - TURTLE(901, "Turtle", Arrays.asList( - "MGE0MDUwZTdhYWNjNDUzOTIwMjY1OGZkYzMzOWRkMTgyZDdlMzIyZjlmYmNjNGQ1Zjk5YjU3MThhIn19fQ==")), - PHANTOM(902, "Phantom", Arrays.asList( - "NDExZDI1YmNkYWJhZmFkNWZkNmUwMTBjNWIxY2Y3YTAwYzljY2E0MGM1YTQ2NzQ3ZjcwNmRjOWNiM2EifX19", - "YWQyZmE1NjE4NDQ3NzYyZTI2MTExZTA2MGRjNTkzZWE2MjJkNWRkZmMzODVkN2U0MjUzMmU0NjMyN2Y4MDdjMCJ9fX0=")), - TRIDENT(903, "Trident"), - COD(904, "Cod", Arrays.asList( - "NmY5OWI1ODBkNDVhNzg0ZTdhOTY0ZTdkM2IxZjk3Y2VjZTc0OTExMTczYmQyMWMxZDdjNTZhY2RjMzg1ZWQ1In19fQ==")), - SALMON(905, "Salmon", Arrays.asList( - "YWRmYzU3ZDA5MDU5ZTQ3OTlmYTkyYzE1ZTI4NTEyYmNmYWExMzE1NTc3ZmUzYTI3YWVkMzg5ZTRmNzUyMjg5YSJ9fX0=")), - PUFFERFISH(906, "Pufferfish", Arrays.asList( - "YTk1NTkzODg5OTNmZTc4MmY2N2JkNThkOThjNGRmNTZiY2Q0MzBlZGNiMmY2NmVmNTc3N2E3M2MyN2RlMyJ9fX0=")), - TROPICAL_FISH(907, "Tropical Fish", Arrays.asList( - "MzZkMTQ5ZTRkNDk5OTI5NjcyZTI3Njg5NDllNjQ3Nzk1OWMyMWU2NTI1NDYxM2IzMjdiNTM4ZGYxZTRkZiJ9fX0=")), - DROWNED(908, "Drowned", Arrays.asList( - "YzNmN2NjZjYxZGJjM2Y5ZmU5YTYzMzNjZGUwYzBlMTQzOTllYjJlZWE3MWQzNGNmMjIzYjNhY2UyMjA1MSJ9fX0=", - "MWY4YmFhNDhiOGY1MTE5OTBlNDdkYjk2ODMyNGMxNTJiZDExNjc3MzFkZGYwMzQ1MzAwNDQ3MzVhNmJkMmVkNCJ9fX0=", - "YzFhNzMyNTI0MDFhNmU5NDZmNjFkYmFjMGUwMjdkMTgzZTBhY2U1ODc1MmZhMTVhNjRkMjQ0OWZjZjUwODdiNyJ9fX0=", - "Yzg0ZGY3OWM0OTEwNGIxOThjZGFkNmQ5OWZkMGQwYmNmMTUzMWM5MmQ0YWI2MjY5ZTQwYjdkM2NiYmI4ZTk4YyJ9fX0=", - "ZmIxNTMxYzA0ZTI1ZDdmYTY0NTc2OTgyNjg0OTFjYjg5NmQzMzAyZDI2ODg0ZmNmZGYxYTBiMmY5MmQ3N2M4ZiJ9fX0=", - "NTZkYWY1MGVhZjc2YzNhNmQ1YWQzOWM5NjZmMjk4NzdiOTFkOTUwZGQxZTM3MTIyZTljODE5NTg1Yzg5ZDkyZSJ9fX0=")), - DOLPHIN(909, "Dolphin", Arrays.asList( - "OGU5Njg4Yjk1MGQ4ODBiNTViN2FhMmNmY2Q3NmU1YTBmYTk0YWFjNmQxNmY3OGU4MzNmNzQ0M2VhMjlmZWQzIn19fQ==")), - LINGERING_POTION(910, "Lingering Potion"), - FISHING_HOOK(911, "Fishing Hook"), - LIGHTNING(912, "Lightning Bolt"), - WEATHER(913, "Weather"), - PLAYER(914, "Player"), - COMPLEX_PART(915, "Complex Part"), - TIPPED_ARROW(916, "Tipped Arrow"), - - PANDA(917, "Panda", Arrays.asList( - "ZDE4OGM5ODBhYWNmYTk0Y2YzMzA4ODUxMmIxYjk1MTdiYTgyNmIxNTRkNGNhZmMyNjJhZmY2OTc3YmU4YSJ9fX0=")), - PILLAGER(918, "Pillager", Arrays.asList( - "NGFlZTZiYjM3Y2JmYzkyYjBkODZkYjVhZGE0NzkwYzY0ZmY0NDY4ZDY4Yjg0OTQyZmRlMDQ0MDVlOGVmNTMzMyJ9fX0=")), - RAVAGER(919, "Ravager", Arrays.asList( - "MWNiOWYxMzlmOTQ4OWQ4NmU0MTBhMDZkOGNiYzY3MGM4MDI4MTM3NTA4ZTNlNGJlZjYxMmZlMzJlZGQ2MDE5MyJ9fX0=", - "M2I2MjUwMWNkMWI4N2IzN2Y2MjgwMTgyMTBlYzU0MDBjYjY1YTRkMWFhYjc0ZTZhM2Y3ZjYyYWE4NWRiOTdlZSJ9fX0=")), - TRADER_LLAMA(920, "Trader Llama", Arrays.asList( - "ODQyNDc4MGIzYzVjNTM1MWNmNDlmYjViZjQxZmNiMjg5NDkxZGY2YzQzMDY4M2M4NGQ3ODQ2MTg4ZGI0Zjg0ZCJ9fX0=", - "NzA4N2E1NTZkNGZmYTk1ZWNkMjg0NGYzNTBkYzQzZTI1NGU1ZDUzNWZhNTk2ZjU0MGQ3ZTc3ZmE2N2RmNDY5NiJ9fX0=", - "YmU0ZDhhMGJjMTVmMjM5OTIxZWZkOGJlMzQ4MGJhNzdhOThlZTdkOWNlMDA3MjhjMGQ3MzNmMGEyZDYxNGQxNiJ9fX0=")), - WANDERING_TRADER(921, "Wandering Trader", Arrays.asList( - "NWYxMzc5YTgyMjkwZDdhYmUxZWZhYWJiYzcwNzEwZmYyZWMwMmRkMzRhZGUzODZiYzAwYzkzMGM0NjFjZjkzMiJ9fX0=")), - FOX(922, "Fox", Arrays.asList( - "YjZmZWI3NjFiMmY1OWZhYmU1Y2MzY2M4MmE5MzRiNTM0ZWE5OWVkYjkxMzJjY2RhOWY0ODRiZDU5ODZkNyJ9fX0=", - "MjRhMDM0NzQzNjQzNGViMTNkNTM3YjllYjZiNDViNmVmNGM1YTc4Zjg2ZTkxODYzZWY2MWQyYjhhNTNiODIifX19", - "MTZkYjdkNTA3Mzg5YTE0YmJlYzM5ZGU2OTIyMTY1YjMyZDQzNjU3YmNiNmFhZjRiNTE4MjgyNWIyMmI0In19fQ==")), - CAT(923, "Cat", Arrays.asList( - "N2M5Yjc0MDllN2I1MzgzYzE5YjM2MmIyYTBjYjQzZDUwOTNiMTNlMmIyMzRlOGExODkxNTYzZTU1ZWFlOWQ2OCJ9fX0=", - "NTg4MDNmMDI3MGY4Y2RmNGUwZmU5NzMyZDQ5NjdjY2NjMGEyZjRmY2QxMThjZDE1MDAwOTc5YjE4ODg1MTQ0ZiJ9fX0=")), - BEE(924, "Bee", Arrays.asList( - "OTQ3MzIyZjgzMWUzYzE2OGNmYmQzZTI4ZmU5MjUxNDRiMjYxZTc5ZWIzOWM3NzEzNDlmYWM1NWE4MTI2NDczIn19fQ==", - "OTlkYzNmMDBlY2FiMjI0OWJiNmExNmM4YzUxMTVjZWI5ZjIzMjA1YTBkNTVjYzBlOWJhYmQyNTYyZjc5NTljNCJ9fX0==", - "ZTZiNzRlMDUyYjc0Mjg4Nzk5YmE2ZDlmMzVjNWQwMjIxY2Y4YjA0MzMxNTQ3ZWMyZjY4ZDczNTk3YWUyYzliIn19fQ==", - "YmIxNzc3NDY2MjUxMmQ3ODdlZjc3YjFhNDZhMDRlMmM2ZmQ2Nzc5NGJmN2Y3Nzk1NjZlYjIxYzgxNDNhYWQ5ZSJ9fX0=")), - - ZOMBIFIED_PIGLIN(925, "Zombified Piglin", Arrays.asList("N2VhYmFlY2M1ZmFlNWE4YTQ5Yzg4NjNmZjQ4MzFhYWEyODQxOThmMWEyMzk4ODkwYzc2NWUwYThkZTE4ZGE4YyJ9fX0=")), - HOGLIN(926, "Hoglin", Arrays.asList("OWJiOWJjMGYwMWRiZDc2MmEwOGQ5ZTc3YzA4MDY5ZWQ3Yzk1MzY0YWEzMGNhMTA3MjIwODU2MWI3MzBlOGQ3NSJ9fX0=")), - PIGLIN(927, "Piglin", Arrays.asList("OWYxODEwN2QyNzVmMWNiM2E5Zjk3M2U1OTI4ZDU4NzlmYTQwMzI4ZmYzMjU4MDU0ZGI2ZGQzZTdjMGNhNjMzMCJ9fX0=")), - STRIDER(928, "Strider", Arrays.asList("MThhOWFkZjc4MGVjN2RkNDYyNWM5YzA3NzkwNTJlNmExNWE0NTE4NjY2MjM1MTFlNGM4MmU5NjU1NzE0YjNjMSJ9fX0=")), - ZOGLIN(929, "Zoglin", Arrays.asList("ZTY3ZTE4NjAyZTAzMDM1YWQ2ODk2N2NlMDkwMjM1ZDg5OTY2NjNmYjllYTQ3NTc4ZDNhN2ViYmM0MmE1Y2NmOSJ9fX0=")), - - // 1.16.2 - PIGLIN_BRUTE(930, "Piglin Brute", Arrays.asList("M2UzMDBlOTAyNzM0OWM0OTA3NDk3NDM4YmFjMjllM2E0Yzg3YTg0OGM1MGIzNGMyMTI0MjcyN2I1N2Y0ZTFjZiJ9fX0=")), - - // if possible we can remove this string for each texture to save up some space - // eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUv - UNKNOWN(999, "Unknown"); - - private int id; - private String name; - private String secondaryName; - EntityType type = null; - public static HashMap cache = new HashMap<>(); - static HashMap byName = new HashMap<>(); - - static { - for (CMIEntityType one : CMIEntityType.values()) { - byName.put(one.toString().replace("_", "").toLowerCase(), one); - byName.put(one.getName().replace("_", "").replace(" ", "").toLowerCase(), one); - byName.put(String.valueOf(one.getId()), one); - if (one.secondaryName != null) - byName.put(one.secondaryName.replace("_", "").replace(" ", "").toLowerCase(), one); - } - } - - CMIEntityType(int id, String name, List headTextures) { - this(id, name, null, headTextures); - } - - CMIEntityType(int id, String name) { - this(id, name, null, new ArrayList()); - } - - CMIEntityType(int id, String name, String secondaryName) { - this(id, name, secondaryName, new ArrayList()); - } - - CMIEntityType(int id, String name, String secondaryName, List headTextures) { - this.id = id; - this.name = name; - this.secondaryName = secondaryName; - } - - public int getId() { - return id; - } - - public String getName() { - return name; - } - - public static CMIEntityType getById(int id) { - CMIEntityType ttype = getByName(String.valueOf(id)); - return ttype == null ? CMIEntityType.PIG : ttype; - } - - public static CMIEntityType getByType(EntityType entity) { - return getByName(entity.toString()); - } - - public static CMIEntityType getByItem(ItemStack item) { - if (item == null) - return null; - - if (CMIMaterial.isMonsterEgg(item.getType())) { - String name = item.getType().toString().replace("_SPAWN_EGG", ""); - return getByName(name); - } - - if (CMIMaterial.SPAWNER.equals(item.getType())) { - if (item.getItemMeta() instanceof BlockStateMeta) { - BlockStateMeta bsm = (BlockStateMeta) item.getItemMeta(); - if (bsm.getBlockState() instanceof CreatureSpawner) { - CreatureSpawner bs = (CreatureSpawner) bsm.getBlockState(); - return CMIEntityType.getByType(bs.getSpawnedType()); - } - } - } - return null; - } - - public static CMIEntityType getByName(String name) { - return byName.get(name.toLowerCase().replace("_", "")); - } - - public EntityType getType() { - if (type != null) - return type; - for (EntityType one : EntityType.values()) { - if (one.toString().equalsIgnoreCase(this.name())) { - type = one; - break; - } - } - return type; - } - - public boolean isAlive() { - return getType() != null && getType().isAlive(); - } - - public boolean isSpawnable() { - return getType() != null && getType().isSpawnable(); - } - - public static String getRealNameByType(EntityType type) { - if (type == null) - return null; - CMIEntityType ctype = CMIEntityType.getByType(type); - if (ctype != null) - return ctype.getName(); - String name = type.name(); - - name = name.toLowerCase().replace('_', ' '); - name = name.substring(0, 1).toUpperCase() + name.substring(1); - return name; - } - - public CMIMaterial getSpawnEggMaterial() { - CMIMaterial m = CMIMaterial.get((this.equals(CMIEntityType.MUSHROOM_COW) ? "Mooshroom".toLowerCase() : this.toString().toLowerCase()) + "_spawn_egg"); - return m != null && m.isMonsterEgg() ? m : null; - } -} \ No newline at end of file diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java deleted file mode 100644 index 544d691e..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMIItemStack.java +++ /dev/null @@ -1,547 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; - -import org.bukkit.Material; -import org.bukkit.block.CreatureSpawner; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.PotionMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.material.SpawnEgg; -import org.bukkit.potion.PotionData; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; - -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.stuff.Util; - -public class CMIItemStack { - - @Deprecated - private int id = 0; - @Deprecated - private short data = 0; - private short durability = 0; - private int amount = 0; - - private String bukkitName = null; - private String mojangName = null; - private CMIMaterial cmiMaterial = null; - private Material material = null; - private CMIEntityType entityType = null; - private ItemStack item; - - public CMIItemStack(Material material) { - this.material = material; - this.cmiMaterial = CMIMaterial.get(material); - } - - public CMIItemStack(CMIMaterial cmiMaterial) { - this.cmiMaterial = cmiMaterial; - if (cmiMaterial != null) - this.material = cmiMaterial.getMaterial(); - } - - public CMIItemStack(ItemStack item) { - setItemStack(item); - } - - @Override - public CMIItemStack clone() { - CMIItemStack cm = new CMIItemStack(material); - cm.entityType = this.entityType; - cm.setId(id); - cm.setData(data); - cm.setAmount(amount); - cm.setDurability(durability); - cm.setBukkitName(bukkitName); - cm.setMojangName(mojangName); - cm.setCMIMaterial(cmiMaterial); - cm.setMaterial(material); - cm.setItemStack(item != null ? item.clone() : null); - return cm; - } - - @Deprecated - public int getId() { - return id; - } - - @Deprecated - public void setId(Integer id) { - this.id = id; - } - - @Deprecated - public short getData() { - return data; - } - - public boolean isTool() { - return getMaxDurability() > 0; - } - - public boolean isArmor() { - if (this.getCMIType() != null && this.getCMIType().isArmor()) - return true; - return CMIMaterial.isArmor(this.getType()); - } - - public short getDurability() { - return Util.getDurability(getItemStack()); - } - - public short getMaxDurability() { - return material.getMaxDurability(); - } - - public void setData(short data) { - this.data = data; - if (this.getCMIType() != null) { - ItemMeta meta = null; - if (item != null && item.hasItemMeta()) { - meta = item.getItemMeta(); - } - this.item = null; - if (meta != null && this.getItemStack() != null) { - this.getItemStack().setItemMeta(meta); - } - } - } - - public CMIItemStack setDisplayName(String name) { - ItemMeta meta = getItemStack().getItemMeta(); - if (meta != null) { - if (name == null) { - meta.setDisplayName(null); - } else - meta.setDisplayName(CMIChatColor.translate(name)); - } - getItemStack().setItemMeta(meta); - return this; - } - - public String getDisplayName() { - ItemMeta meta = getItemStack().getItemMeta(); - return meta == null || meta.getDisplayName() == null || meta.getDisplayName().isEmpty() ? getRealName() : meta.getDisplayName(); - } - - public CMIItemStack addLore(String string) { - if (string == null) - return this; - ItemMeta meta = getItemStack().getItemMeta(); - List lore = meta.getLore(); - if (lore == null) - lore = new ArrayList<>(); - lore.add(CMIChatColor.translate(string)); - meta.setLore(lore); - getItemStack().setItemMeta(meta); - return this; - } - - public CMIItemStack clearLore() { - ItemMeta meta = getItemStack().getItemMeta(); - if (meta != null) { - List t = new ArrayList(); - meta.setLore(t); - this.getItemStack().setItemMeta(meta); - } - return this; - } - - public CMIItemStack setLore(List lore) { - if (lore == null || lore.isEmpty()) - return this; - ItemMeta meta = getItemStack().getItemMeta(); - List t = new ArrayList<>(); - for (String one : lore) { - t.add(CMIChatColor.translate(one)); - } - meta.setLore(t); - getItemStack().setItemMeta(meta); - return this; - } - - public CMIItemStack addEnchant(Enchantment enchant, Integer level) { - if (enchant == null) - return this; - - if (getItemStack().getItemMeta() instanceof EnchantmentStorageMeta) { - EnchantmentStorageMeta meta = (EnchantmentStorageMeta) getItemStack().getItemMeta(); - meta.addStoredEnchant(enchant, level, true); - getItemStack().setItemMeta(meta); - } else { - ItemMeta meta = getItemStack().getItemMeta(); - meta.addEnchant(enchant, level, true); - getItemStack().setItemMeta(meta); - } - - return this; - } - - public CMIItemStack addEnchant(HashMap enchants) { - if (enchants == null || enchants.isEmpty()) - return this; - for (Entry oneEnch : enchants.entrySet()) { - addEnchant(oneEnch.getKey(), oneEnch.getValue()); - } - return this; - } - - public CMIItemStack clearEnchants() { - ItemMeta meta = getItemStack().getItemMeta(); - meta.getEnchants().clear(); - getItemStack().setItemMeta(meta); - return this; - } - - public List getLore() { - ItemMeta meta = this.getItemStack().getItemMeta(); - if (meta != null) { - List lore = meta.getLore(); - if (lore == null) { - lore = new ArrayList<>(); - meta.setLore(lore); - } - - return meta.getLore() == null ? new ArrayList<>() : meta.getLore(); - } - return new ArrayList<>(); - } - - public String getRealName() { - return getCMIType() == null || getCMIType() == CMIMaterial.NONE ? getType().name() : getCMIType().getName(); -// if (this.getItemStack() != null) { - // -//// String translated = CMI.getInstance().getItemManager().getTranslatedName(this.getItemStack()); -//// if (translated != null) -//// return translated; -// try { -// return CMI.getInstance().getRef().getItemMinecraftName(this.getItemStack()); -// } catch (Exception e) { -// } -// } -// return CMI.getInstance().getItemManager().getRealName(this, true).getName(); - } - - public String getBukkitName() { - return bukkitName == null || bukkitName.isEmpty() ? null : bukkitName; - } - - public void setBukkitName(String bukkitName) { - this.bukkitName = bukkitName; - } - - public String getMojangName() { -// if (getCMIType().isSkull() && !Version.isCurrentEqualOrHigher(Version.v1_13_R1)) -// mojangName = "skull"; -// try { -// mojangName = CMI.getInstance().getRef().getItemMinecraftName(getItemStack()).replace("minecraft:", ""); -// } catch (Exception e) { - // -// } - return mojangName == null || mojangName.isEmpty() ? getCMIType().getMaterial().name() : mojangName; - } - - public void setMojangName(String mojangName) { - if (mojangName != null) - this.mojangName = mojangName.replace("minecraft:", ""); - } - - public Material getType() { - if (material == null && cmiMaterial != null) - return cmiMaterial.getMaterial(); - return material; - } - - public CMIMaterial getCMIType() { - return cmiMaterial == null ? CMIMaterial.get(material) : cmiMaterial; - } - - /** - * Gets the material - * - * @deprecated Use {@link #getType()} - * @return Material - */ - @Deprecated - public Material getMaterial() { - return getType(); - } - - public void setMaterial(Material material) { - this.cmiMaterial = CMIMaterial.get(material); - this.material = material; - } - - public void setCMIMaterial(CMIMaterial material) { - this.cmiMaterial = material; - this.material = material == null ? null : material.getMaterial(); - } - - @SuppressWarnings("deprecation") - public ItemStack getItemStack() { - if (item == null) { - try { - if (!this.getType().isItem()) { - return null; - } - } catch (Throwable e) { - } - - if (cmiMaterial.isMonsterEgg()) { - if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) { - item = new ItemStack(getType()); - item.setAmount(getAmount()); - } else - item = new ItemStack(getType(), amount == 0 ? 1 : amount, data == 0 ? (short) 90 : data); - } else { - if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) { - item = new ItemStack(getType()); - item.setAmount(getAmount()); - } else - item = new ItemStack(getType(), amount == 0 ? 1 : amount, data); - } - - if (getCMIType().isPotion() || item.getType().name().contains("SPLASH_POTION") || item.getType().name().contains("TIPPED_ARROW")) { - PotionMeta potion = (PotionMeta) item.getItemMeta(); - PotionEffectType effect = PotionEffectType.getById(data); - if (effect != null) { - potion.addCustomEffect(new PotionEffect(effect, 60, 0), true); - } - item.setItemMeta(potion); - item.setDurability((short) 0); - potion = (PotionMeta) item.getItemMeta(); - potion.setDisplayName(getRealName()); - item.setItemMeta(potion); - } - } - return item; - } - - @SuppressWarnings("deprecation") - public CMIItemStack setItemStack(ItemStack item) { - this.item = item; - if (item != null) { - this.amount = item.getAmount(); - this.material = item.getType(); - this.cmiMaterial = CMIMaterial.get(item); - if (Version.isCurrentEqualOrLower(Version.v1_13_R2)) { - this.id = item.getType().getId(); - if ((this.getType().isBlock() || this.getType().isSolid())) { - data = item.getData().getData(); - } - if (item.getType().getMaxDurability() - item.getDurability() < 0) { - data = item.getData().getData(); - } - } else if (cmiMaterial != null) { - this.id = cmiMaterial.getId(); - } - - if (item.getType().getMaxDurability() > 15) - data = (short) 0; - - if (item.getType() == Material.POTION || item.getType().name().contains("SPLASH_POTION") - || item.getType().name().contains("TIPPED_ARROW")) { - PotionMeta potion = (PotionMeta) item.getItemMeta(); - try { - if (potion != null && potion.getBasePotionData().getType().getEffectType() != null) { - data = (short) potion.getBasePotionData().getType().getEffectType().getId(); - } - } catch (NoSuchMethodError e) { - } - } - } - return this; - } - - public int getAmount() { - return amount <= 0 ? 1 : amount; - } - - public void setAmount(int amount) { - this.amount = amount; - if (item != null) - this.item.setAmount(this.amount == 0 ? item.getAmount() : this.amount); - } - - public boolean isSimilar(ItemStack item) { - return isSimilar(ItemManager.getItem(item)); - } - - public boolean isSimilar(CMIItemStack item) { - if (item == null) - return false; - - try { - if ((item.getCMIType().isPotion() || item.getCMIType() == CMIMaterial.TIPPED_ARROW) && - (getCMIType().isPotion() || getCMIType() == CMIMaterial.TIPPED_ARROW) && - getType() == item.getType()) { - PotionMeta potion = (PotionMeta) item.getItemStack().getItemMeta(); - PotionMeta potion2 = (PotionMeta) getItemStack().getItemMeta(); - try { - if (potion != null && potion.getBasePotionData() != null) { - PotionData base1 = potion.getBasePotionData(); - if (base1.getType() != null) { - if (potion2 != null && potion2.getBasePotionData() != null) { - PotionData base2 = potion2.getBasePotionData(); - if (base2.getType() != null) { - if (base1.getType() == base2.getType() && base1.isExtended() == base2.isExtended() && base1.isUpgraded() == base2.isUpgraded()) - return true; - } - } - } - } - return false; - } catch (NoSuchMethodError e) { - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - try { - if (this.getItemStack().getItemMeta() instanceof EnchantmentStorageMeta && item.getItemStack().getItemMeta() instanceof EnchantmentStorageMeta) { - EnchantmentStorageMeta meta1 = (EnchantmentStorageMeta) this.getItemStack().getItemMeta(); - EnchantmentStorageMeta meta2 = (EnchantmentStorageMeta) item.getItemStack().getItemMeta(); - - for (Entry one : meta1.getEnchants().entrySet()) { - if (!meta2.getEnchants().containsKey(one.getKey()) || meta2.getEnchants().get(one.getKey()) != one.getValue()) - return false; - } - - for (Entry one : meta1.getStoredEnchants().entrySet()) { - if (!meta2.getStoredEnchants().containsKey(one.getKey()) || meta2.getStoredEnchants().get(one.getKey()) != one.getValue()) - return false; - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - - if ((item.getCMIType() == CMIMaterial.SPAWNER || item.getCMIType().isMonsterEgg()) && (getCMIType() == CMIMaterial.SPAWNER || getCMIType().isMonsterEgg())) { - if (this.cmiMaterial != item.cmiMaterial) - return false; - if (getEntityType() != item.getEntityType()) - return false; - - return true; - } - - if (item.getCMIType() == CMIMaterial.PLAYER_HEAD && this.getCMIType() == CMIMaterial.PLAYER_HEAD) { - try { - SkullMeta skullMeta = (SkullMeta) item.getItemStack().getItemMeta(); - SkullMeta skullMeta2 = (SkullMeta) getItemStack().getItemMeta(); - - if (skullMeta.getOwner() != null && skullMeta2.getOwner() == null || skullMeta.getOwner() == null && skullMeta2.getOwner() != null) - return false; - if (skullMeta.getOwner() != null && skullMeta2.getOwner() != null && !skullMeta.getOwner().equals(skullMeta2.getOwner())) - return false; - } catch (Throwable e) { - e.printStackTrace(); - } - } - - if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) - return this.cmiMaterial == item.cmiMaterial; - return this.cmiMaterial == item.cmiMaterial && this.getData() == item.getData(); - } - - public EntityType getEntityType() { - if (this.getItemStack() == null) - return null; - - if (this.entityType != null) - return this.entityType.getType(); - - ItemStack is = this.getItemStack().clone(); - - if (Version.isCurrentEqualOrHigher(Version.v1_8_R1) && is.getItemMeta() instanceof org.bukkit.inventory.meta.BlockStateMeta) { - org.bukkit.inventory.meta.BlockStateMeta bsm = (org.bukkit.inventory.meta.BlockStateMeta) is.getItemMeta(); - if (bsm.getBlockState() instanceof CreatureSpawner) { - CreatureSpawner bs = (CreatureSpawner) bsm.getBlockState(); - return bs.getSpawnedType(); - } - } - - if (is.getData() instanceof SpawnEgg) { - return CMIReflections.getEggType(is); - } - - if (CMIMaterial.get(is) != null && CMIMaterial.get(is).isMonsterEgg()) { - return CMIReflections.getEggType(is); - } - - if (Version.isCurrentEqualOrLower(Version.v1_12_R1)) - return EntityType.fromId(is.getData().getData()); - return null; - } - - public void setDurability(short durability) { - this.durability = durability; - } - - public String toOneLiner() { - String liner = getType().toString(); - if (getCMIType().isPotion() || getType().name().contains("TIPPED_ARROW")) { - PotionMeta potion = (PotionMeta) item.getItemMeta(); - try { - if (potion != null && potion.getBasePotionData().getType().getEffectType() != null) { - liner += ":" + potion.getBasePotionData().getType().getEffectType().getName() + "-" + potion.getBasePotionData().isUpgraded() + "-" + potion.getBasePotionData().isExtended(); - } - } catch (NoSuchMethodError e) { - } - } else { - if (Version.isCurrentLower(Version.v1_13_R1)) - liner += ":" + getData(); - } - if (this.getItemStack().getItemMeta() instanceof EnchantmentStorageMeta) { - EnchantmentStorageMeta meta = (EnchantmentStorageMeta) getItemStack().getItemMeta(); - String s = ""; - for (Entry one : meta.getStoredEnchants().entrySet()) { - if (!s.isEmpty()) - s += ";"; - s += CMIEnchantment.get(one.getKey()) + "x" + one.getValue(); - } - - for (Entry one : meta.getEnchants().entrySet()) { - if (!s.isEmpty()) - s += ";"; - s += CMIEnchantment.get(one.getKey()) + "x" + one.getValue(); - } - if (!s.isEmpty()) - liner += ":" + s; - } - - return liner; - } - - public static ItemStack getHead(String texture) { - if (texture == null || texture.isEmpty()) - return null; - if (texture.length() < 120) - texture = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUv" + texture; - ItemStack cached = CMIEntityType.cache.get(texture); - if (cached != null) { - return cached.clone(); - } - ItemStack item = CMIMaterial.PLAYER_HEAD.newItemStack(); - item = CMIReflections.setSkullTexture(item, null, texture); - CMIEntityType.cache.put(texture, item); - return item.clone(); - } - - public void setEntityType(CMIEntityType entityType) { - this.entityType = entityType; - } - - public void setEntityType(EntityType entityType) { - setEntityType(CMIEntityType.getByType(entityType)); - } -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMIMaterial.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMIMaterial.java deleted file mode 100644 index 384dc9ba..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMIMaterial.java +++ /dev/null @@ -1,2771 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.Skull; -import org.bukkit.inventory.ItemStack; - -public enum CMIMaterial { - NONE(null, "None"), - ACACIA_BOAT(447, 0, 27326, "Acacia Boat", "BOAT_ACACIA"), - ACACIA_BUTTON(13993, "Acacia Button"), - ACACIA_DOOR(430, 0, 23797, "Acacia Door", "ACACIA_DOOR_ITEM"), - ACACIA_FENCE(192, 0, 4569, Arrays.asList(CMIMaterialCriteria.seeThrow), "Acacia Fence"), - ACACIA_FENCE_GATE(187, 0, 14145, Arrays.asList(CMIMaterialCriteria.seeThrow), "Acacia Fence Gate"), - ACACIA_LEAVES(161, 0, 16606, "Acacia Leaves", "LEAVES_2"), - ACACIA_LOG(162, 0, 8385, "Acacia Log", "LOG_2"), - ACACIA_PLANKS(5, 4, 31312, "Acacia Wood Plank", "Acacia Planks"), - ACACIA_PRESSURE_PLATE(17586, "Acacia Pressure Plate"), - ACACIA_SAPLING(6, 4, 20806, "Acacia Sapling"), - ACACIA_SLAB(126, 4, 23730, "Acacia Wood Slab", "Acacia Slab"), - ACACIA_STAIRS(163, 0, 17453, "Acacia Stairs"), - ACACIA_TRAPDOOR(18343, "Acacia Trapdoor"), - ACACIA_WOOD(21861, "Acacia Wood"), - ACTIVATOR_RAIL(157, 0, 5834, "Activator Rail"), - AIR(0, 0, 9648, "Air"), - ALLIUM(38, 2, 6871, "Allium", "RED_ROSE"), - ANDESITE(1, 5, 25975, "Andesite"), - ANVIL(145, 0, 18718, "Anvil"), - APPLE(260, 0, 7720, "Apple"), - ARMOR_STAND(416, 0, 12852, "Armor Stand"), - ARROW(262, 0, 31091, "Arrow"), - ATTACHED_MELON_STEM(30882, "Attached Melon Stem"), - ATTACHED_PUMPKIN_STEM(12724, "Attached Pumpkin Stem"), - AZURE_BLUET(38, 3, 17608, "Azure Bluet"), - BAKED_POTATO(393, 0, 14624, "Baked Potato"), - BARRIER(166, 0, 26453, "Barrier"), - BAT_SPAWN_EGG(383, 65, 14607, "Bat Spawn Egg", "Spawn Bat"), - BEACON(138, 0, 6608, "Beacon"), - BEDROCK(7, 0, 23130, "Bedrock"), - BEEF(363, 0, 4803, "Raw Beef"), - BEETROOT(434, 0, 23305, "Beetroot"), - BEETROOTS(207, 0, 22075, "Beetroots", "BEETROOT_BLOCK"), - BEETROOT_SEEDS(435, 0, 21282, "Beetroot Seeds"), - BEETROOT_SOUP(436, 0, 16036, "Beetroot Soup"), - BIRCH_BOAT(445, 0, 28104, "Birch Boat", "BOAT_BIRCH"), - BIRCH_BUTTON(26934, "Birch Button"), - BIRCH_DOOR(428, 0, 14759, "Birch Door", "BIRCH_DOOR_ITEM"), - BIRCH_FENCE(189, 0, 17347, Arrays.asList(CMIMaterialCriteria.seeThrow), "Birch Fence"), - BIRCH_FENCE_GATE(184, 0, 6322, Arrays.asList(CMIMaterialCriteria.seeThrow), "Birch Fence Gate"), - BIRCH_LEAVES(18, 2, 12601, "Birch Leaves", "LEAVES"), - BIRCH_LOG(17, 2, 26727, "Birch Log", "LOG"), - BIRCH_PLANKS(5, 2, 29322, "Birch Wood Plank"), - BIRCH_PRESSURE_PLATE(9664, "Birch Pressure Plate"), - BIRCH_SAPLING(6, 2, 31533, "Birch Sapling"), - BIRCH_SLAB(126, 2, 13807, "Birch Slab"), - BIRCH_STAIRS(135, 0, 7657, "Birch Wood Stairs"), - BIRCH_TRAPDOOR(32585, "Birch Trapdoor"), - BIRCH_WOOD(20913, "Birch Wood"), - BLACK_BANNER(425, 0, 9365, "Black Banner"), - BLACK_BED(355, 15, 20490, "Black Bed"), - BLACK_CARPET(171, 15, 6056, "Black Carpet", "CARPET"), - BLACK_CONCRETE(251, 15, 13338, "Black Concrete", "CONCRETE"), - BLACK_CONCRETE_POWDER(252, 15, 16150, "Black Concrete Powder", "CONCRETE_POWDER"), - BLACK_GLAZED_TERRACOTTA(250, 0, 29678, "Black Glazed Terracotta"), - BLACK_SHULKER_BOX(234, 0, 24076, "Black Shulker Box"), - BLACK_STAINED_GLASS(95, 15, 13941, Arrays.asList(CMIMaterialCriteria.seeThrow), "Black Stained Glass", "STAINED_GLASS"), - BLACK_STAINED_GLASS_PANE(160, 15, 13201, Arrays.asList(CMIMaterialCriteria.seeThrow), "Black Stained Glass Pane", "STAINED_GLASS_PANE"), - BLACK_TERRACOTTA(159, 15, 26691, "Black Terracotta", "STAINED_CLAY"), - BLACK_WALL_BANNER(177, 0, 4919, "Black Banner"), - BLACK_WOOL(35, 15, 16693, "Black Wool"), - BLAZE_POWDER(377, 0, 18941, "Blaze Powder"), - BLAZE_ROD(369, 0, 8289, "Blaze Rod"), - BLAZE_SPAWN_EGG(383, 61, 4759, "Blaze Spawn Egg", "Spawn Blaze"), - BLUE_BANNER(245, 4, 18481, "Blue Banner"), - BLUE_BED(355, 11, 12714, "Blue Bed"), - BLUE_CARPET(171, 11, 13292, "Blue Carpet"), - BLUE_CONCRETE(251, 11, 18756, "Blue Concrete"), - BLUE_CONCRETE_POWDER(252, 11, 17773, "Blue Concrete Powder"), - BLUE_GLAZED_TERRACOTTA(246, 0, 23823, "Blue Glazed Terracotta"), - BLUE_ICE(22449, "Blue Ice"), - BLUE_ORCHID(38, 1, 13432, "Blue Orchid"), - BLUE_SHULKER_BOX(230, 0, 11476, "Blue Shulker Box"), - BLUE_STAINED_GLASS(95, 11, 7107, Arrays.asList(CMIMaterialCriteria.seeThrow), "Blue Stained Glass"), - BLUE_STAINED_GLASS_PANE(160, 11, 28484, Arrays.asList(CMIMaterialCriteria.seeThrow), "Blue Stained Glass Pane"), - BLUE_TERRACOTTA(159, 11, 5236, "Blue Terracotta"), - BLUE_WALL_BANNER(177, 4, 17757, "Blue Banner"), - BLUE_WOOL(35, 11, 15738, "Blue Wool"), - BONE(352, 0, 5686, "Bone"), - BONE_BLOCK(216, 0, 17312, "Bone Block"), - BONE_MEAL(351, 15, 32458, "Bone Meal"), - BOOK(340, 0, 23097, "Book"), - BOOKSHELF(47, 0, 10069, "Bookshelf"), - BOW(261, 0, 8745, "Bow"), - BOWL(281, 0, 32661, "Bowl"), - BRAIN_CORAL(31316, "Brain Coral"), - BRAIN_CORAL_BLOCK(30618, "Brain Coral Block"), - BRAIN_CORAL_FAN(13849, "Brain Coral Fan"), - BRAIN_CORAL_WALL_FAN(22685, "Brain Coral Wall Fan"), - BREAD(297, 0, 32049, "Bread"), - BREWING_STAND(379, 0, 14539, "Brewing Stand", "BREWING_STAND_ITEM"), - BRICK(336, 0, 6820, "Brick", "claybrick"), - BRICKS(45, 0, 14165, "Bricks"), - BRICK_SLAB(44, 4, 26333, "Brick Slab", "STEP"), - BRICK_STAIRS(108, 0, 21534, "Brick Stairs"), - BROWN_BANNER(425, 3, 11481, "Brown Banner"), - BROWN_BED(355, 12, 25624, "Brown Bed"), - BROWN_CARPET(171, 12, 23352, "Brown Carpet"), - BROWN_CONCRETE(251, 12, 19006, "Brown Concrete"), - BROWN_CONCRETE_POWDER(252, 12, 21485, "Brown Concrete Powder"), - BROWN_GLAZED_TERRACOTTA(247, 0, 5655, "Brown Glazed Terracotta"), - BROWN_MUSHROOM(39, 0, 9665, "Brown Mushroom"), - BROWN_MUSHROOM_BLOCK(99, 0, 6291, "Brown Mushroom Block", "HUGE_MUSHROOM_1"), - BROWN_SHULKER_BOX(231, 0, 24230, "Brown Shulker Box"), - BROWN_STAINED_GLASS(95, 12, 20945, Arrays.asList(CMIMaterialCriteria.seeThrow), "Brown Stained Glass"), - BROWN_STAINED_GLASS_PANE(160, 12, 17557, Arrays.asList(CMIMaterialCriteria.seeThrow), "Brown Stained Glass Pane"), - BROWN_TERRACOTTA(159, 12, 23664, "Brown Terracotta"), - BROWN_WALL_BANNER(177, 3, 14731, "Brown Banner"), - BROWN_WOOL(35, 12, 32638, "Brown Wool"), - BUBBLE_COLUMN(13758, "Bubble Column"), - BUBBLE_CORAL(12464, "Bubble Coral"), - BUBBLE_CORAL_BLOCK(15437, "Bubble Coral Block"), - BUBBLE_CORAL_FAN(10795, "Bubble Coral Fan"), - BUBBLE_CORAL_WALL_FAN(20382, "Bubble Coral Wall Fan"), - BUCKET(325, 0, 15215, "Bucket"), - CACTUS(81, 0, 12191, "Cactus"), - CACTUS_GREEN(351, 2, 17296, "Cactus Green"), - CAKE(354, 0, 27048, "Cake"), - CARROT(141, 0, 22824, "Carrot", "Carrotitem"), - CARROTS(391, 0, 17258, "Carrots"), - CARROT_ON_A_STICK(398, 0, 27809, "Carrot on a Stick", "carrotstick"), - CARVED_PUMPKIN(25833, "Carved Pumpkin"), - CAULDRON(380, 0, 26531, "Cauldron", "CAULDRON_ITEM"), - CAVE_AIR(17422, "Cave Air"), - CAVE_SPIDER_SPAWN_EGG(383, 59, 23341, "Cave Spider Spawn Egg", "Spawn Cave Spider"), - CHAINMAIL_BOOTS(305, 0, 17953, "Chainmail Boots"), - CHAINMAIL_CHESTPLATE(303, 0, 23602, "Chainmail Chestplate"), - CHAINMAIL_HELMET(302, 0, 26114, "Chainmail Helmet"), - CHAINMAIL_LEGGINGS(304, 0, 19087, "Chainmail Leggings"), - CHAIN_COMMAND_BLOCK(26798, "Chain Command Block"), - CHARCOAL(263, 1, 5390, "Charcoal"), - CHEST(54, 0, 22969, "Chest"), - CHEST_MINECART(342, 0, 4497, "Minecart with Chest", "Storageminecart"), - CHICKEN(365, 0, 17281, "Raw Chicken"), - CHICKEN_SPAWN_EGG(383, 93, 5462, "Chicken Spawn Egg", "Spawn Chicken"), - CHIPPED_ANVIL(145, 1, 10623, "Chipped Anvil"), - CHISELED_QUARTZ_BLOCK(155, 1, 30964, "Chiseled Quartz Block"), - CHISELED_RED_SANDSTONE(179, 1, 15529, "Chiseled Red Sandstone"), - CHISELED_SANDSTONE(24, 1, 31763, "Chiseled Sandstone"), - CHISELED_STONE_BRICKS(98, 3, 9087, "Chiseled Stone Bricks", "SMOOTH_BRICK"), - CHORUS_FLOWER(200, 0, 28542, "Chorus Flower"), - CHORUS_FRUIT(432, 0, 7652, "Chorus Fruit"), - CHORUS_PLANT(199, 0, 28243, "Chorus Plant"), - CLAY(82, 0, 27880, "Clay", "Clay Block"), - CLAY_BALL(337, 0, 24603, "Clay Ball"), - CLOCK(347, 0, 14980, "Clock", "watch"), - COAL(263, 0, 29067, "Coal"), - COAL_BLOCK(173, 0, 27968, "Block of Coal"), - COAL_ORE(16, 0, 30965, "Coal Ore"), - COARSE_DIRT(3, 1, 15411, "Coarse Dirt"), - COBBLESTONE(4, 0, 32147, "Cobblestone"), - COBBLESTONE_SLAB(44, 3, 6340, "Cobblestone Slab"), - COBBLESTONE_STAIRS(67, 0, 24715, "Cobblestone Stairs"), - COBBLESTONE_WALL(139, 0, 12616, "Cobblestone Wall", "COBBLE_WALL"), - COBWEB(30, 0, 9469, Arrays.asList(CMIMaterialCriteria.seeThrow), "Cobweb", "WEB"), - COCOA(127, 0, 29709, "Cocoa"), - COCOA_BEANS(351, 3, 27381, "Coco Beans"), - COD(24691, "Raw Cod"), - COD_BUCKET(28601, "Bucket of Cod"), - COD_SPAWN_EGG(27248, "Cod Spawn Egg"), - COMMAND_BLOCK(137, 0, 4355, "Command Block", "COMMAND"), - COMMAND_BLOCK_MINECART(422, 0, 7992, "Minecart with Command Block"), - COMPARATOR(404, 0, 18911, "Redstone Comparator"), - COMPASS(345, 0, 24139, "Compass"), - CONDUIT(5148, "Conduit"), - COOKED_BEEF(364, 0, 21595, "Steak"), - COOKED_CHICKEN(366, 0, 20780, "Cooked Chicken"), - COOKED_COD(350, 0, 9681, "Cooked Fish"), - COOKED_MUTTON(424, 0, 31447, "Cooked Mutton"), - COOKED_PORKCHOP(320, 0, 27231, "Cooked Porkchop", "grilledpork"), - COOKED_RABBIT(412, 0, 4454, "Cooked Rabbit"), - COOKED_SALMON(350, 1, 5615, "Cooked Salmon"), - COOKIE(357, 0, 27431, "Cookie"), - COW_SPAWN_EGG(383, 92, 14761, "Cow Spawn Egg", "Spawn Cow"), - CRACKED_STONE_BRICKS(98, 2, 27869, "Cracked Stone Bricks"), - CRAFTING_TABLE(58, 0, 20706, "Crafting Table", "WORKBENCH", "Table"), - CREEPER_HEAD(397, 4, 29146, "Mob Head (Creeper)"), - CREEPER_SPAWN_EGG(383, 50, 9653, "Creeper Spawn Egg", "Spawn Creeper"), - CREEPER_WALL_HEAD(144, 4, 30123, "Creeper Wall Head"), - CUT_RED_SANDSTONE(26842, "Cut Red Sandstone"), - CUT_SANDSTONE(6118, "Cut Sandstone"), - CYAN_BANNER(425, 6, 9839, "Cyan Banner"), - CYAN_BED(355, 9, 16746, "Cyan Bed"), - CYAN_CARPET(171, 9, 31495, "Cyan Carpet"), - CYAN_CONCRETE(251, 9, 26522, "Cyan Concrete"), - CYAN_CONCRETE_POWDER(252, 9, 15734, "Cyan Concrete Powder"), - CYAN_DYE(351, 6, 8043, "Cyan Dye"), - CYAN_GLAZED_TERRACOTTA(244, 0, 9550, "Cyan Glazed Terracotta"), - CYAN_SHULKER_BOX(228, 0, 28123, "Cyan Shulker Box"), - CYAN_STAINED_GLASS(95, 9, 30604, Arrays.asList(CMIMaterialCriteria.seeThrow), "Cyan Stained Glass"), - CYAN_STAINED_GLASS_PANE(160, 9, 11784, Arrays.asList(CMIMaterialCriteria.seeThrow), "Cyan Stained Glass Pane"), - CYAN_TERRACOTTA(159, 9, 25940, "Cyan Terracotta"), - CYAN_WALL_BANNER(177, 6, 10889, "Cyan Banner"), - CYAN_WOOL(35, 9, 12221, "Cyan Wool"), - DAMAGED_ANVIL(145, 2, 10274, "Damaged Anvil"), - DANDELION(37, 0, 30558, "Dandelion", "YELLOW_FLOWER"), - DANDELION_YELLOW(351, 11, 21789, "Dandelion Yellow"), - DARK_OAK_BOAT(448, 0, 28618, "Dark Oak Boat", "BOAT_DARK_OAK"), - DARK_OAK_BUTTON(6214, "Dark Oak Button"), - DARK_OAK_DOOR(431, 0, 10669, "Dark Oak Door", "DARK_OAK_DOOR_ITEM"), - DARK_OAK_FENCE(191, 0, 21767, Arrays.asList(CMIMaterialCriteria.seeThrow), "Dark Oak Fence"), - DARK_OAK_FENCE_GATE(186, 0, 10679, Arrays.asList(CMIMaterialCriteria.seeThrow), "Dark Oak Fence Gate"), - DARK_OAK_LEAVES(161, 1, 22254, "Dark Oak Leaves"), - DARK_OAK_LOG(162, 1, 14831, "Dark Oak Log"), - DARK_OAK_PLANKS(5, 5, 20869, "Dark Oak Wood Plank"), - DARK_OAK_PRESSURE_PLATE(31375, "Dark Oak Pressure Plate"), - DARK_OAK_SAPLING(6, 5, 14933, "Dark Oak Sapling"), - DARK_OAK_SLAB(126, 5, 28852, "Dark Oak Wood Slab"), - DARK_OAK_STAIRS(164, 0, 22921, "Dark Oak Stairs"), - DARK_OAK_TRAPDOOR(10355, "Dark Oak Trapdoor"), - DARK_OAK_WOOD(16995, "Dark Oak Wood"), - DARK_PRISMARINE(168, 2, 19940, "Dark Prismarine"), - DARK_PRISMARINE_SLAB(7577, "Dark Prismarine Slab"), - DARK_PRISMARINE_STAIRS(26511, "Dark Prismarine Stairs"), - DAYLIGHT_DETECTOR(151, 0, 8864, "Daylight Detector"), - DEAD_BRAIN_CORAL(9116, "Dead Brain Coral"), - DEAD_BRAIN_CORAL_BLOCK(12979, "Dead Brain Coral Block"), - DEAD_BRAIN_CORAL_FAN(26150, "Dead Brain Coral Fan"), - DEAD_BRAIN_CORAL_WALL_FAN(23718, "Dead Brain Coral Wall Fan"), - DEAD_BUBBLE_CORAL(30583, "Dead Bubble Coral"), - DEAD_BUBBLE_CORAL_BLOCK(28220, "Dead Bubble Coral Block"), - DEAD_BUBBLE_CORAL_FAN(17322, "Dead Bubble Coral Fan"), - DEAD_BUBBLE_CORAL_WALL_FAN(18453, "Dead Bubble Coral Wall Fan"), - DEAD_BUSH(32, 0, 22888, "Dead Bush"), - DEAD_FIRE_CORAL(8365, "Dead Fire Coral"), - DEAD_FIRE_CORAL_BLOCK(5307, "Dead Fire Coral Block"), - DEAD_FIRE_CORAL_FAN(27073, "Dead Fire Coral Fan"), - DEAD_FIRE_CORAL_WALL_FAN(23375, "Dead Fire Coral Wall Fan"), - DEAD_HORN_CORAL(5755, "Dead Horn Coral"), - DEAD_HORN_CORAL_BLOCK(15103, "Dead Horn Coral Block"), - DEAD_HORN_CORAL_FAN(11387, "Dead Horn Coral Fan"), - DEAD_HORN_CORAL_WALL_FAN(27550, "Dead Horn Coral Wall Fan"), - DEAD_TUBE_CORAL(18028, "Dead Tube Coral"), - DEAD_TUBE_CORAL_BLOCK(28350, "Dead Tube Coral Block"), - DEAD_TUBE_CORAL_FAN(17628, "Dead Tube Coral Fan"), - DEAD_TUBE_CORAL_WALL_FAN(5128, "Dead Tube Coral Wall Fan"), - DEBUG_STICK(24562, "Debug Stick"), - DETECTOR_RAIL(28, 0, 13475, "Detector Rail"), - DIAMOND(264, 0, 20865, "Diamond"), - DIAMOND_AXE(279, 0, 27277, "Diamond Axe"), - DIAMOND_BLOCK(57, 0, 5944, "Block of Diamond"), - DIAMOND_BOOTS(313, 0, 16522, "Diamond Boots"), - DIAMOND_CHESTPLATE(311, 0, 32099, "Diamond Chestplate"), - DIAMOND_HELMET(310, 0, 10755, "Diamond Helmet"), - DIAMOND_HOE(293, 0, 24050, "Diamond Hoe"), - DIAMOND_HORSE_ARMOR(419, 0, 10321, "Diamond Horse Armor", "Diamond_barding"), - DIAMOND_LEGGINGS(312, 0, 11202, "Diamond Leggings"), - DIAMOND_ORE(56, 0, 9292, "Diamond Ore"), - DIAMOND_PICKAXE(278, 0, 24291, "Diamond Pickaxe"), - DIAMOND_SHOVEL(277, 0, 25415, "Diamond Shovel", "DIAMOND_SPADE"), - DIAMOND_SWORD(276, 0, 27707, "Diamond Sword"), - DIORITE(1, 3, 24688, "Diorite"), - DIRT(3, 0, 10580, "Dirt"), - DISPENSER(23, 0, 20871, "Dispenser"), - DOLPHIN_SPAWN_EGG(20787, "Dolphin Spawn Egg"), - DONKEY_SPAWN_EGG(383, 31, 14513, "Donkey Spawn Egg", "Spawn Donkey"), - DRAGON_BREATH(437, 0, 20154, "Dragon's Breath"), - DRAGON_EGG(122, 0, 29946, "Dragon Egg"), - DRAGON_HEAD(397, 5, 20084, "Dragon Head"), - DRAGON_WALL_HEAD(144, 5, 19818, "Dragon Wall Head"), - DRIED_KELP(21042, "Dried Kelp"), - DRIED_KELP_BLOCK(12966, "Dried Kelp Block"), - DROPPER(158, 0, 31273, "Dropper"), - DROWNED_SPAWN_EGG(19368, "Drowned Spawn Egg"), - EGG(344, 0, 21603, "Egg"), - ELDER_GUARDIAN_SPAWN_EGG(383, 4, 11418, "Elder Guardian Spawn Egg", "Spawn Elder Guardian"), - ELYTRA(443, 0, 23829, "Elytra"), - EMERALD(388, 0, 5654, "Emerald"), - EMERALD_BLOCK(133, 0, 9914, "Emerald Block", "Block of Emerald"), - EMERALD_ORE(129, 0, 16630, "Emerald Ore"), - ENCHANTED_BOOK(403, 0, 11741, "Enchanted Book"), - ENCHANTED_GOLDEN_APPLE(322, 1, 8280, "Enchanted Golden Apple"), - ENCHANTING_TABLE(116, 0, 16255, "Enchanting Table", "ENCHANTMENT_TABLE"), - ENDERMAN_SPAWN_EGG(383, 58, 29488, "Enderman Spawn Egg", "Spawn Enderman"), - ENDERMITE_SPAWN_EGG(383, 67, 16617, "Endermite Spawn Egg", "Spawn Endermite"), - ENDER_CHEST(130, 0, 32349, "Ender Chest"), - ENDER_EYE(381, 0, 24860, "Eye of Ender"), - ENDER_PEARL(368, 0, 5259, "Ender Pearl"), - END_CRYSTAL(426, 0, 19090, "End Crystal"), - END_GATEWAY(209, 0, 26605, "End Gateway"), - END_PORTAL(119, 0, 16782, "End Portal"), - END_PORTAL_FRAME(120, 0, 15480, "End Portal Frame", "ENDER_PORTAL_FRAME"), - END_ROD(198, 0, 24832, "End Rod"), - END_STONE(121, 0, 29686, "End Stone", "ENDER_STONE"), - END_STONE_BRICKS(206, 0, 20314, "End Stone Bricks", "END_BRICKS"), - EVOKER_SPAWN_EGG(383, 34, 21271, "Evoker Spawn Egg", "Spawn Evoker"), - EXPERIENCE_BOTTLE(384, 0, 12858, "Bottle o' Enchanting", "expbottle"), - FARMLAND(60, 0, 31166, "Farmland", "SOIL"), - FEATHER(288, 0, 30548, "Feather"), - FERMENTED_SPIDER_EYE(376, 0, 19386, "Fermented Spider Eye"), - FERN(31, 2, 15794, "Fern", "LONG_GRASS"), - FILLED_MAP(358, 0, 23504, "Map"), - FIRE(51, 0, 16396, "Fire"), - FIREWORK_ROCKET(401, 0, 23841, "Firework Rocket"), - FIREWORK_STAR(402, 0, 12190, "Firework Star", "FIREWORK_CHARGE"), - FIRE_CHARGE(385, 0, 4842, "Fire Charge", "Fireball"), - FIRE_CORAL(29151, "Fire Coral"), - FIRE_CORAL_BLOCK(12119, "Fire Coral Block"), - FIRE_CORAL_FAN(11112, "Fire Coral Fan"), - FIRE_CORAL_WALL_FAN(20100, "Fire Coral Wall Fan"), - FISHING_ROD(346, 0, 4167, "Fishing Rod"), - FLINT(318, 0, 23596, "Flint"), - FLINT_AND_STEEL(259, 0, 28620, "Flint and Steel"), - FLOWER_POT(390, 0, 30567, "Flower Pot", "FLOWER_POT_ITEM"), - FROSTED_ICE(212, 0, 21814, "Frosted Ice"), - FURNACE(61, 0, 8133, "Furnace"), - FURNACE_MINECART(343, 0, 14196, "Minecart with Furnace", "POWERED_MINECART"), - GHAST_SPAWN_EGG(383, 56, 9970, "Ghast Spawn Egg", "Spawn Ghast"), - GHAST_TEAR(370, 0, 18222, "Ghast Tear"), - GLASS(20, 0, 6195, Arrays.asList(CMIMaterialCriteria.seeThrow), "Glass"), - GLASS_BOTTLE(374, 0, 6116, "Glass Bottle"), - GLASS_PANE(102, 0, 5709, Arrays.asList(CMIMaterialCriteria.seeThrow), "Glass Pane", "THIN_GLASS"), - GLISTERING_MELON_SLICE(382, 0, 20158, "Glistering Melon", "speckledmelon"), - GLOWSTONE(89, 0, 32713, "Glowstone"), - GLOWSTONE_DUST(348, 0, 6665, "Glowstone Dust"), - GOLDEN_APPLE(322, 0, 27732, "Golden Apple", "Gold apple"), - GOLDEN_AXE(286, 0, 4878, "Golden Axe", "Gold Axe"), - GOLDEN_BOOTS(317, 0, 7859, "Golden Boots", "Gold Boots"), - GOLDEN_CARROT(396, 0, 5300, "Golden Carrot", "Gold Carrot"), - GOLDEN_CHESTPLATE(315, 0, 4507, "Golden Chestplate", "Gold Chestplate"), - GOLDEN_HELMET(314, 0, 7945, "Golden Helmet", "Gold Helmet"), - GOLDEN_HOE(294, 0, 19337, "Golden Hoe", "Gold Hoe"), - GOLDEN_HORSE_ARMOR(418, 0, 7996, "Golden Horse Armor", "Gold Barding"), - GOLDEN_LEGGINGS(316, 0, 21002, "Golden Leggings", "Gold Leggings"), - GOLDEN_PICKAXE(285, 0, 10901, "Golden Pickaxe", "GOLD_PICKAXE"), - GOLDEN_SHOVEL(284, 0, 15597, "Golden Shovel", "GOLD_SPADE"), - GOLDEN_SWORD(283, 0, 10505, "Golden Sword", "GOLD_SWORD"), - GOLD_BLOCK(41, 0, 27392, "Block of Gold", "GOLD_BLOCK"), - GOLD_INGOT(266, 0, 28927, "Gold Ingot"), - GOLD_NUGGET(371, 0, 28814, "Gold Nugget"), - GOLD_ORE(14, 0, 32625, "Gold Ore"), - GRANITE(1, 1, 21091, "Granite"), - GRASS(31, 1, 6155, "Grass"), - GRASS_BLOCK(2, 0, 28346, "Grass Block"), - GRASS_PATH(208, 0, 8604, "Grass Path"), - GRAVEL(13, 0, 7804, "Gravel"), - GRAY_BANNER(425, 8, 12053, "Gray Banner"), - GRAY_BED(355, 7, 15745, "Gray Bed"), - GRAY_CARPET(171, 7, 26991, "Gray Carpet"), - GRAY_CONCRETE(251, 7, 13959, "Gray Concrete"), - GRAY_CONCRETE_POWDER(252, 7, 13031, "Gray Concrete Powder"), - GRAY_DYE(351, 8, 9184, "Gray Dye"), - GRAY_GLAZED_TERRACOTTA(242, 0, 6256, "Gray Glazed Terracotta"), - GRAY_SHULKER_BOX(226, 0, 12754, "Gray Shulker Box"), - GRAY_STAINED_GLASS(95, 7, 29979, Arrays.asList(CMIMaterialCriteria.seeThrow), "Gray Stained Glass"), - GRAY_STAINED_GLASS_PANE(160, 7, 25272, Arrays.asList(CMIMaterialCriteria.seeThrow), "Gray Stained Glass Pane"), - GRAY_TERRACOTTA(159, 7, 18004, "Gray Terracotta"), - GRAY_WALL_BANNER(177, 8, 24275, "Gray Banner"), - GRAY_WOOL(35, 7, 27209, "Gray Wool"), - GREEN_BANNER(425, 2, 10698, "Green Banner"), - GREEN_BED(355, 13, 13797, "Green Bed"), - GREEN_CARPET(171, 13, 7780, "Green Carpet"), - GREEN_CONCRETE(251, 13, 17949, "Green Concrete"), - GREEN_CONCRETE_POWDER(252, 13, 6904, "Green Concrete Powder"), - GREEN_GLAZED_TERRACOTTA(248, 0, 6958, "Green Glazed Terracotta"), - GREEN_SHULKER_BOX(232, 0, 9377, "Green Shulker Box"), - GREEN_STAINED_GLASS(95, 13, 22503, Arrays.asList(CMIMaterialCriteria.seeThrow), "Green Stained Glass"), - GREEN_STAINED_GLASS_PANE(160, 13, 4767, Arrays.asList(CMIMaterialCriteria.seeThrow), "Green Stained Glass Pane"), - GREEN_TERRACOTTA(159, 13, 4105, "Green Terracotta"), - GREEN_WALL_BANNER(177, 2, 15046, "Green Banner"), - GREEN_WOOL(35, 13, 25085, "Green Wool"), - GUARDIAN_SPAWN_EGG(383, 68, 20113, "Guardian Spawn Egg", "Spawn Guardian"), - GUNPOWDER(289, 0, 29974, "Gunpowder", "SULPHUR"), - HAY_BLOCK(170, 0, 17461, "Hay Bale", "HAY_BLOCK"), - HEART_OF_THE_SEA(11807, "Heart of the Sea"), - HEAVY_WEIGHTED_PRESSURE_PLATE(148, 0, 16970, "Heavy Weighted Pressure Plate", "IRON_PLATE"), - HOPPER(154, 0, 31974, "Hopper"), - HOPPER_MINECART(408, 0, 19024, "Minecart with Hopper"), - HORN_CORAL(19511, "Horn Coral"), - HORN_CORAL_BLOCK(19958, "Horn Coral Block"), - HORN_CORAL_FAN(13610, "Horn Coral Fan"), - HORN_CORAL_WALL_FAN(28883, "Horn Coral Wall Fan"), - HORSE_SPAWN_EGG(383, 100, 25981, "Horse Spawn Egg", "Spawn Horse"), - HUSK_SPAWN_EGG(383, 23, 20178, "Husk Spawn Egg", "Spawn Husk"), - ICE(79, 0, 30428, "Ice"), - INFESTED_CHISELED_STONE_BRICKS(97, 5, 4728, "Infested Chiseled Stone Bricks", "MONSTER_EGGS"), - INFESTED_COBBLESTONE(97, 1, 28798, "Infested Cobblestone"), - INFESTED_CRACKED_STONE_BRICKS(97, 4, 7476, "Infested Cracked Stone Bricks"), - INFESTED_MOSSY_STONE_BRICKS(97, 3, 9850, "Infested Mossy Stone Bricks"), - INFESTED_STONE(97, 0, 18440, "Infested Stone"), - INFESTED_STONE_BRICKS(97, 2, 19749, "Infested Stone Bricks"), - INK_SAC(351, 0, 7184, "Ink Sac", "Ink Sack"), - IRON_AXE(258, 0, 15894, "Iron Axe"), - IRON_BARS(101, 0, 9378, Arrays.asList(CMIMaterialCriteria.seeThrow), "Iron Bars", "IRON_FENCE"), - IRON_BLOCK(42, 0, 24754, "Block of Iron", "IRON_BLOCK"), - IRON_BOOTS(309, 0, 8531, "Iron Boots"), - IRON_CHESTPLATE(307, 0, 28112, "Iron Chestplate"), - IRON_DOOR(330, 0, 4788, "Iron Door"), - IRON_HELMET(306, 0, 12025, "Iron Helmet"), - IRON_HOE(292, 0, 11339, "Iron Hoe"), - IRON_HORSE_ARMOR(417, 0, 30108, "Iron Horse Armor", "Iron_barding"), - IRON_INGOT(265, 0, 24895, "Iron Ingot"), - IRON_LEGGINGS(308, 0, 18951, "Iron Leggings"), - IRON_NUGGET(452, 0, 13715, "Iron Nugget"), - IRON_ORE(15, 0, 19834, "Iron Ore"), - IRON_PICKAXE(257, 0, 8842, "Iron Pickaxe"), - IRON_SHOVEL(256, 0, 30045, "Iron Shovel", "IRON_SPADE"), - IRON_SWORD(267, 0, 10904, "Iron Sword"), - IRON_TRAPDOOR(167, 0, 17095, "Iron Trapdoor"), - ITEM_FRAME(389, 0, 27318, "Item Frame"), - JACK_O_LANTERN(91, 0, 31612, "Jack o'Lantern", "JACK_O_LANTERN"), - JUKEBOX(84, 0, 19264, "Jukebox"), - JUNGLE_BOAT(446, 0, 4495, "Jungle Boat", "BOAT_JUNGLE"), - JUNGLE_BUTTON(25317, "Jungle Button"), - JUNGLE_DOOR(429, 0, 28163, "Jungle Door", "JUNGLE_DOOR_ITEM"), - JUNGLE_FENCE(190, 0, 14358, Arrays.asList(CMIMaterialCriteria.seeThrow), "Jungle Fence"), - JUNGLE_FENCE_GATE(185, 0, 21360, Arrays.asList(CMIMaterialCriteria.seeThrow), "Jungle Fence Gate", "JUNGLE_FENCE_GATE"), - JUNGLE_LEAVES(18, 3, 5133, "Jungle Leaves"), - JUNGLE_LOG(17, 3, 20721, "Jungle Log"), - JUNGLE_PLANKS(5, 3, 26445, "Jungle Wood Plank", "Jungle Planks"), - JUNGLE_PRESSURE_PLATE(11376, "Jungle Pressure Plate"), - JUNGLE_SAPLING(6, 3, 17951, "Jungle Sapling"), - JUNGLE_SLAB(43, 0, 19117, "Double Stone Slab"), - JUNGLE_STAIRS(136, 0, 20636, "Jungle Wood Stairs", "Jungle Stairs"), - JUNGLE_TRAPDOOR(8626, "Jungle Trapdoor"), - JUNGLE_WOOD(10341, "Jungle Wood"), - KELP(21916, "Kelp"), - KELP_PLANT(29697, "Kelp Plant"), - KNOWLEDGE_BOOK(453, 0, 12646, "Knowledge Book"), - LADDER(65, 0, 23599, "Ladder"), - LAPIS_BLOCK(22, 0, 14485, "Lapis Lazuli Block", "LAPIS_BLOCK"), - LAPIS_LAZULI(351, 4, 11075, "Lapis Lazuli"), - LAPIS_ORE(21, 0, 22934, "Lapis Lazuli Ore", "LAPIS_ORE"), - LARGE_FERN(175, 3, 30177, "Large Fern", "DOUBLE_PLANT"), - LAVA(10, 0, 8415, "Flowing Lava"), - LAVA_BUCKET(327, 0, 9228, "Lava Bucket"), - LEAD(420, 0, 29539, "Lead", "Leash"), - LEATHER(334, 0, 16414, "Leather"), - LEATHER_BOOTS(301, 0, 15282, "Leather Boots"), - LEATHER_CHESTPLATE(299, 0, 29275, "Leather Tunic", "LEATHER_CHESTPLATE"), - LEATHER_HELMET(298, 0, 11624, "Leather Cap", "LEATHER_HELMET"), - LEATHER_LEGGINGS(300, 0, 28210, "Leather Pants", "LEATHER_LEGGINGS"), - LEVER(69, 0, 15319, "Lever"), - LIGHT_BLUE_BANNER(425, 12, 18060, "Light Blue Banner"), - LIGHT_BLUE_BED(355, 3, 20957, "Light Blue Bed"), - LIGHT_BLUE_CARPET(171, 3, 21194, "Light Blue Carpet"), - LIGHT_BLUE_CONCRETE(251, 3, 29481, "Light Blue Concrete"), - LIGHT_BLUE_CONCRETE_POWDER(252, 3, 31206, "Light Blue Concrete Powder"), - LIGHT_BLUE_DYE(351, 12, 28738, "Light Blue Dye"), - LIGHT_BLUE_GLAZED_TERRACOTTA(238, 0, 4336, "Light Blue Glazed Terracotta"), - LIGHT_BLUE_SHULKER_BOX(222, 0, 18226, "Light Blue Shulker Box"), - LIGHT_BLUE_STAINED_GLASS(95, 3, 17162, Arrays.asList(CMIMaterialCriteria.seeThrow), "Light Blue Stained Glass"), - LIGHT_BLUE_STAINED_GLASS_PANE(160, 3, 18721, Arrays.asList(CMIMaterialCriteria.seeThrow), "Light Blue Stained Glass Pane"), - LIGHT_BLUE_TERRACOTTA(159, 3, 31779, "Light Blue Terracotta"), - LIGHT_BLUE_WALL_BANNER(177, 12, 12011, "Light Blue Banner"), - LIGHT_BLUE_WOOL(35, 3, 21073, "Light Blue Wool"), - LIGHT_GRAY_BANNER(425, 7, 11417, "Light Gray Banner"), - LIGHT_GRAY_BED(355, 8, 5090, "Light Gray Bed"), - LIGHT_GRAY_CARPET(171, 8, 11317, "Light Gray Carpet"), - LIGHT_GRAY_CONCRETE(251, 8, 14453, "Light Gray Concrete"), - LIGHT_GRAY_CONCRETE_POWDER(252, 8, 21589, "Light Gray Concrete Powder"), - LIGHT_GRAY_DYE(351, 7, 27643, "Light Gray Dye"), - LIGHT_GRAY_GLAZED_TERRACOTTA(243, 0, 10707, "Light Gray Glazed Terracotta", "SILVER_GLAZED_TERRACOTTA"), - LIGHT_GRAY_SHULKER_BOX(227, 0, 21345, "Light Gray Shulker Box", "SILVER_SHULKER_BOX"), - LIGHT_GRAY_STAINED_GLASS(95, 8, 5843, Arrays.asList(CMIMaterialCriteria.seeThrow), "Light Gray Stained Glass"), - LIGHT_GRAY_STAINED_GLASS_PANE(160, 8, 19008, Arrays.asList(CMIMaterialCriteria.seeThrow), "Light Gray Stained Glass Pane"), - LIGHT_GRAY_TERRACOTTA(159, 8, 26388, "Light Gray Terracotta"), - LIGHT_GRAY_WALL_BANNER(177, 7, 31088, "Light Gray Banner"), - LIGHT_GRAY_WOOL(35, 8, 22936, "Light Gray Wool"), - LIGHT_WEIGHTED_PRESSURE_PLATE(147, 0, 14875, "Light Weighted Pressure Plate", "GOLD_PLATE"), - LILAC(175, 1, 22837, "Lilac"), - LILY_PAD(111, 0, 19271, "Lily Pad", "WATER_LILY"), - LIME_BANNER(425, 10, 18887, "Lime Banner"), - LIME_BED(355, 5, 27860, "Lime Bed"), - LIME_CARPET(171, 5, 15443, "Lime Carpet"), - LIME_CONCRETE(251, 5, 5863, "Lime Concrete"), - LIME_CONCRETE_POWDER(252, 5, 28859, "Lime Concrete Powder"), - LIME_DYE(351, 10, 6147, "Lime Dye"), - LIME_GLAZED_TERRACOTTA(240, 0, 13861, "Lime Glazed Terracotta"), - LIME_SHULKER_BOX(224, 0, 28360, "Lime Shulker Box"), - LIME_STAINED_GLASS(95, 5, 24266, Arrays.asList(CMIMaterialCriteria.seeThrow), "Lime Stained Glass"), - LIME_STAINED_GLASS_PANE(160, 5, 10610, Arrays.asList(CMIMaterialCriteria.seeThrow), "Lime Stained Glass Pane"), - LIME_TERRACOTTA(159, 5, 24013, "Lime Terracotta"), - LIME_WALL_BANNER(177, 10, 21422, "Lime Banner"), - LIME_WOOL(35, 5, 10443, "Lime Wool"), - LINGERING_POTION(441, 0, 25857, "Lingering Potion"), - LLAMA_SPAWN_EGG(383, 103, 23640, "Llama Spawn Egg", "Spawn Llama"), - MAGENTA_BANNER(425, 13, 15591, "Magenta Banner"), - MAGENTA_BED(355, 2, 20061, "Magenta Bed"), - MAGENTA_CARPET(171, 2, 6180, "Magenta Carpet"), - MAGENTA_CONCRETE(251, 2, 20591, "Magenta Concrete"), - MAGENTA_CONCRETE_POWDER(252, 2, 8272, "Magenta Concrete Powder"), - MAGENTA_DYE(351, 13, 11788, "Magenta Dye"), - MAGENTA_GLAZED_TERRACOTTA(237, 0, 8067, "Magenta Glazed Terracotta"), - MAGENTA_SHULKER_BOX(221, 0, 21566, "Magenta Shulker Box"), - MAGENTA_STAINED_GLASS(95, 2, 26814, Arrays.asList(CMIMaterialCriteria.seeThrow), "Magenta Stained Glass"), - MAGENTA_STAINED_GLASS_PANE(160, 2, 14082, Arrays.asList(CMIMaterialCriteria.seeThrow), "Magenta Stained Glass Pane"), - MAGENTA_TERRACOTTA(159, 2, 25900, "Magenta Terracotta"), - MAGENTA_WALL_BANNER(177, 13, 23291, "Magenta Banner"), - MAGENTA_WOOL(35, 2, 11853, "Magenta Wool"), - MAGMA_BLOCK(213, 0, 25927, "Magma Block", "MAGMA"), - MAGMA_CREAM(378, 0, 25097, "Magma Cream"), - MAGMA_CUBE_SPAWN_EGG(383, 62, 26638, "Magma Cube Spawn Egg", "Spawn Magma Cube"), - MAP(395, 0, 21655, "Empty Map"), - MELON(103, 0, 25172, "Melon Block"), - MELON_SEEDS(362, 0, 18340, "Melon Seeds"), - MELON_SLICE(360, 0, 5347, "Melon Slice"), - MELON_STEM(105, 0, 8247, "Melon Stem"), - MILK_BUCKET(335, 0, 9680, "Milk Bucket"), - MINECART(328, 0, 14352, "Minecart"), - MOOSHROOM_SPAWN_EGG(383, 96, 22125, "Mooshroom Spawn Egg", "Spawn Mushroom Cow"), - MOSSY_COBBLESTONE(48, 0, 21900, "Mossy Cobblestone", "MOSSY_COBBLESTONE"), - MOSSY_COBBLESTONE_WALL(139, 1, 11536, "Mossy Cobblestone Wall"), - MOSSY_STONE_BRICKS(98, 1, 16415, "Mossy Stone Bricks"), - MOVING_PISTON(36, 0, 13831, "Piston Moving Piece"), - MULE_SPAWN_EGG(383, 32, 11229, "Mule Spawn Egg", "Spawn Mule"), - MUSHROOM_STEM(16543, "Mushroom Stem"), - MUSHROOM_STEW(282, 0, 16336, "Mushroom Stew", "MUSHROOM_SOUP"), - MUSIC_DISC_11(2266, 0, 27426, "11 Disc", "RECORD_11"), - MUSIC_DISC_13(2256, 0, 16359, "13 Disc", "GOLD_RECORD"), - MUSIC_DISC_BLOCKS(2258, 0, 26667, "Blocks Disc", "RECORD_3"), - MUSIC_DISC_CAT(2257, 0, 16246, "Cat Disc", "GREEN_RECORD"), - MUSIC_DISC_CHIRP(2259, 0, 19436, "Chirp Disc", "RECORD_4"), - MUSIC_DISC_FAR(2260, 0, 13823, "Far Disc", "RECORD_5"), - MUSIC_DISC_MALL(2261, 0, 11517, "Mall Disc", "RECORD_6"), - MUSIC_DISC_MELLOHI(2262, 0, 26117, "Mellohi Disc", "RECORD_7"), - MUSIC_DISC_STAL(2263, 0, 14989, "Stal Disc", "RECORD_8"), - MUSIC_DISC_STRAD(2264, 0, 16785, "Strad Disc", "RECORD_9"), - MUSIC_DISC_WAIT(2267, 0, 26499, "Wait Disc", "RECORD_12"), - MUSIC_DISC_WARD(2265, 0, 24026, "Ward Disc", "RECORD_10"), - MUTTON(423, 0, 4792, "Raw Mutton"), - MYCELIUM(110, 0, 9913, "Mycelium", "MYCEL"), - NAME_TAG(421, 0, 30731, "Name Tag"), - NAUTILUS_SHELL(19989, "Nautilus Shell"), - NETHERRACK(87, 0, 23425, "Netherrack"), - NETHER_BRICK(405, 0, 19996, "Nether Brick", "Nether Brick Item"), - NETHER_BRICKS(112, 0, 27802, "Nether Bricks"), - NETHER_BRICK_FENCE(113, 0, 5286, Arrays.asList(CMIMaterialCriteria.seeThrow), "Nether Brick Fence", "NETHER_FENCE"), - NETHER_BRICK_SLAB(44, 6, 26586, "Nether Brick Slab"), - NETHER_BRICK_STAIRS(114, 0, 12085, "Nether Brick Stairs", "NETHER_BRICK_STAIRS"), - NETHER_PORTAL(90, 0, 19469, "Nether Portal", "PORTAL"), - NETHER_QUARTZ_ORE(153, 0, 4807, "Nether Quartz Ore", "QUARTZ_ORE"), - NETHER_STAR(399, 0, 12469, "Nether Star"), - NETHER_WART(372, 0, 29227, "Nether Wart", "NETHER_STALK"), - NETHER_WART_BLOCK(214, 0, 15486, "Nether Wart Block", "NETHER_WART_BLOCK"), - NOTE_BLOCK(25, 0, 20979, "Note Block", "NOTE_BLOCK"), - OAK_BOAT(333, 0, 17570, "Boat", "Oak Boat"), - OAK_BUTTON(143, 0, 13510, "Oak Button", "Wooden_button"), - OAK_DOOR(324, 0, 20341, "Wooden Door", "Wood Door", "Door"), - OAK_FENCE(85, 0, 6442, Arrays.asList(CMIMaterialCriteria.seeThrow), "Oak Fence", "FENCE"), - OAK_FENCE_GATE(107, 0, 16689, Arrays.asList(CMIMaterialCriteria.seeThrow), "Oak Fence Gate", "FENCE_GATE"), - OAK_LEAVES(18, 0, 4385, "Oak Leaves"), - OAK_LOG(17, 0, 26723, "Oak Log"), - OAK_PLANKS(5, 0, 14905, "Oak Wood Plank", "Oak Planks"), - OAK_PRESSURE_PLATE(72, 0, 20108, "Oak Pressure Plate", "Wooden_Presure_Plate"), - OAK_SAPLING(6, 0, 9636, "Oak Sapling"), - OAK_SLAB(126, 0, 12002, "Oak Slab", "Wood step"), - OAK_STAIRS(53, 0, 5449, "Oak Stairs", "WOOD_STAIRS"), - OAK_TRAPDOOR(96, 0, 16927, "Oak Trapdoor", "Trapdoor"), - OAK_WOOD(7378, "Oak Wood"), - OBSERVER(218, 0, 10726, "Observer"), - OBSIDIAN(49, 0, 32723, "Obsidian"), - OCELOT_SPAWN_EGG(383, 98, 30080, "Ocelot Spawn Egg", "Spawn Ocelot"), - ORANGE_BANNER(425, 14, 4839, "Orange Banner"), - ORANGE_BED(355, 1, 11194, "Orange Bed"), - ORANGE_CARPET(171, 1, 24752, "Orange Carpet"), - ORANGE_CONCRETE(251, 1, 19914, "Orange Concrete"), - ORANGE_CONCRETE_POWDER(252, 1, 30159, "Orange Concrete Powder"), - ORANGE_DYE(351, 14, 13866, "Orange Dye"), - ORANGE_GLAZED_TERRACOTTA(236, 0, 27451, "Orange Glazed Terracotta"), - ORANGE_SHULKER_BOX(220, 0, 21673, "Orange Shulker Box"), - ORANGE_STAINED_GLASS(95, 1, 25142, Arrays.asList(CMIMaterialCriteria.seeThrow), "Orange Stained Glass"), - ORANGE_STAINED_GLASS_PANE(160, 1, 21089, Arrays.asList(CMIMaterialCriteria.seeThrow), "Orange Stained Glass Pane"), - ORANGE_TERRACOTTA(159, 1, 18684, "Orange Terracotta"), - ORANGE_TULIP(38, 5, 26038, "Orange Tulip"), - ORANGE_WALL_BANNER(177, 114, 9936, "Orange Banner"), - ORANGE_WOOL(35, 1, 23957, "Orange Wool"), - OXEYE_DAISY(38, 8, 11709, "Oxeye Daisy"), - PACKED_ICE(174, 0, 28993, "Packed Ice"), - PAINTING(321, 0, 23945, "Painting"), - PAPER(339, 0, 9923, "Paper"), - PARROT_SPAWN_EGG(383, 105, 23614, "Parrot Spawn Egg", "Spawn Parrot"), - PEONY(175, 5, 21155, "Peony"), - PETRIFIED_OAK_SLAB(18658, "Petrified Oak Slab"), - PHANTOM_MEMBRANE(18398, "Phantom Membrane"), - PHANTOM_SPAWN_EGG(24648, "Phantom Spawn Egg"), - PIG_SPAWN_EGG(383, 90, 22584, "Spawn Pig", "Pig Spawn Egg"), - PINK_BANNER(425, 9, 19439, "Pink Banner"), - PINK_BED(355, 6, 13795, "Pink Bed"), - PINK_CARPET(171, 6, 30186, "Pink Carpet"), - PINK_CONCRETE(251, 6, 5227, "Pink Concrete"), - PINK_CONCRETE_POWDER(252, 6, 6421, "Pink Concrete Powder"), - PINK_DYE(351, 9, 31151, "Pink Dye"), - PINK_GLAZED_TERRACOTTA(241, 0, 10260, "Pink Glazed Terracotta"), - PINK_SHULKER_BOX(225, 0, 24968, "Pink Shulker Box"), - PINK_STAINED_GLASS(95, 6, 16164, Arrays.asList(CMIMaterialCriteria.seeThrow), "Pink Stained Glass"), - PINK_STAINED_GLASS_PANE(160, 6, 24637, Arrays.asList(CMIMaterialCriteria.seeThrow), "Pink Stained Glass Pane"), - PINK_TERRACOTTA(159, 6, 23727, "Pink Terracotta"), - PINK_TULIP(38, 7, 27319, "Pink Tulip"), - PINK_WALL_BANNER(177, 9, 9421, "Pink Banner"), - PINK_WOOL(35, 6, 7611, "Pink Wool"), - PISTON(33, 0, 21130, "Piston", "PISTON_BASE"), - PISTON_HEAD(34, 0, 30226, "Piston Head", "PISTON_EXTENSION"), - PLAYER_HEAD(397, 3, 21174, "Mob Head (Human)", "Player Head"), - PLAYER_WALL_HEAD(144, 3, 13164, "Player Wall Head"), - PODZOL(3, 2, 24068, "Podzol"), - POISONOUS_POTATO(394, 0, 32640, "Poisonous Potato"), - POLAR_BEAR_SPAWN_EGG(383, 102, 17015, "Polar Bear Spawn Egg", "Spawn Polar Bear"), - POLISHED_ANDESITE(1, 6, 8335, "Polished Andesite"), - POLISHED_DIORITE(1, 4, 31615, "Polished Diorite"), - POLISHED_GRANITE(1, 2, 5477, "Polished Granite"), - POPPED_CHORUS_FRUIT(433, 0, 27844, "Popped Chorus Fruit"), - POPPY(38, 0, 12851, "Poppy"), - PORKCHOP(319, 0, 30896, "Raw Porkchop"), - POTATO(392, 0, 21088, "Potato", "Potatoitem"), - POTATOES(142, 0, 10879, "Potatoes"), - POTION(373, 0, 24020, "Potion"), - POTTED_ACACIA_SAPLING(14096, " Acacia Sapling"), - POTTED_ALLIUM(13184, "Potted Allium"), - POTTED_AZURE_BLUET(8754, "Potted Azure Bluet"), - POTTED_BIRCH_SAPLING(32484, "Potted Birch Sapling"), - POTTED_BLUE_ORCHID(6599, "Potted Blue Orchid"), - POTTED_BROWN_MUSHROOM(14481, "Potted Brown Mushroom"), - POTTED_CACTUS(8777, "Potted Cactus"), - POTTED_DANDELION(9727, "Potted Dandelion"), - POTTED_DARK_OAK_SAPLING(6486, "Potted Dark Oak Sapling"), - POTTED_DEAD_BUSH(13020, "Potted Dead Bush"), - POTTED_FERN(23315, "Potted Fern"), - POTTED_JUNGLE_SAPLING(7525, "Potted Jungle Sapling"), - POTTED_OAK_SAPLING(11905, "Potted Oak Sapling"), - POTTED_ORANGE_TULIP(28807, "Potted Orange Tulip"), - POTTED_OXEYE_DAISY(19707, "Potted Oxeye Daisy"), - POTTED_PINK_TULIP(10089, "Potted Pink Tulip"), - POTTED_POPPY(7457, "Potted Poppy"), - POTTED_RED_MUSHROOM(22881, "Potted Red Mushroom"), - POTTED_RED_TULIP(28594, "Potted Red Tulip"), - POTTED_SPRUCE_SAPLING(29498, "Potted Spruce Sapling"), - POTTED_WHITE_TULIP(24330, "Potted White Tulip"), - POWERED_RAIL(27, 0, 11064, "Powered Rail"), - PRISMARINE(168, 0, 7539, "Prismarine"), - PRISMARINE_BRICKS(168, 1, 29118, "Prismarine Bricks"), - PRISMARINE_BRICK_SLAB(26672, "Prismarine Brick Slab"), - PRISMARINE_BRICK_STAIRS(15445, "Prismarine Brick Stairs"), - PRISMARINE_CRYSTALS(410, 0, 31546, "Prismarine Crystals"), - PRISMARINE_SHARD(409, 0, 10993, "Prismarine Shard"), - PRISMARINE_SLAB(31323, "Prismarine Slab"), - PRISMARINE_STAIRS(19217, "Prismarine Stairs"), - PUFFERFISH(349, 3, 8115, "Pufferfish"), - PUFFERFISH_BUCKET(8861, "Bucket of Pufferfish"), - PUFFERFISH_SPAWN_EGG(24573, "Pufferfish Spawn Egg"), - PUMPKIN(86, 0, 19170, "Pumpkin"), - PUMPKIN_PIE(400, 0, 28725, "Pumpkin Pie"), - PUMPKIN_SEEDS(361, 0, 28985, "Pumpkin Seeds"), - PUMPKIN_STEM(104, 0, 19021, "Pumpkin Stem"), - PURPLE_BANNER(425, 5, 29027, "Purple Banner"), - PURPLE_BED(355, 10, 29755, "Purple Bed", "Purple Bed"), - PURPLE_CARPET(171, 10, 5574, "Purple Carpet"), - PURPLE_CONCRETE(251, 10, 20623, "Purple Concrete"), - PURPLE_CONCRETE_POWDER(252, 10, 26808, "Purple Concrete Powder"), - PURPLE_DYE(351, 5, 6347, "Purple Dye"), - PURPLE_GLAZED_TERRACOTTA(245, 0, 4818, "Purple Glazed Terracotta"), - PURPLE_SHULKER_BOX(229, 0, 10373, "Purple Shulker Box"), - PURPLE_STAINED_GLASS(95, 10, 21845, Arrays.asList(CMIMaterialCriteria.seeThrow), "Purple Stained Glass"), - PURPLE_STAINED_GLASS_PANE(160, 10, 10948, Arrays.asList(CMIMaterialCriteria.seeThrow), "Purple Stained Glass Pane"), - PURPLE_TERRACOTTA(159, 10, 10387, "Purple Terracotta"), - PURPLE_WALL_BANNER(177, 5, 14298, "Purple Banner"), - PURPLE_WOOL(35, 10, 11922, "Purple Wool"), - PURPUR_BLOCK(201, 0, 7538, "Purpur Block"), - PURPUR_PILLAR(202, 0, 26718, "Purpur Pillar"), - PURPUR_SLAB(205, 0, 11487, "Purpur Slab"), - PURPUR_STAIRS(203, 0, 8921, "Purpur Stairs"), - QUARTZ(406, 0, 23608, "Nether Quartz"), - QUARTZ_BLOCK(155, 0, 11987, "Block of Quartz"), - QUARTZ_PILLAR(155, 2, 16452, "Quartz Pillar"), - QUARTZ_SLAB(44, 7, 4423, "Quartz Slab"), - QUARTZ_STAIRS(156, 0, 24079, "Quartz Stairs"), - RABBIT(411, 0, 23068, "Raw Rabbit"), - RABBIT_FOOT(414, 0, 13864, "Rabbit's Foot"), - RABBIT_HIDE(415, 0, 12467, "Rabbit Hide"), - RABBIT_SPAWN_EGG(383, 101, 26496, "Rabbit Spawn Egg", "Spawn Rabbit"), - RABBIT_STEW(413, 0, 10611, "Rabbit Stew"), - RAIL(66, 0, 13285, "Rail", "RAILS"), - REDSTONE(331, 0, 11233, "Redstone", "Redstone Dust"), - REDSTONE_BLOCK(152, 0, 19496, "Block of Redstone", "REDSTONE_BLOCK"), - REDSTONE_LAMP(123, 0, 8217, "Redstone Lamp", "REDSTONE_LAMP_OFF"), - REDSTONE_ORE(73, 0, 10887, "Redstone Ore"), - REDSTONE_TORCH(76, 0, 22547, "Redstone Torch(on)", "REDSTONE_TORCH_ON"), - REDSTONE_WALL_TORCH(76, 0, 7595, "Redstone Wall Torch"), - REDSTONE_WIRE(55, 0, 25984, "Redstone Dust", "REDSTONE_WIRE"), - RED_BANNER(425, 1, 26961, "Red Banner"), - RED_BED(355, 14, 30910, "Red Bed", "Red Bed"), - RED_CARPET(171, 14, 5424, "Red Carpet"), - RED_CONCRETE(251, 14, 8032, "Red Concrete"), - RED_CONCRETE_POWDER(252, 14, 13286, "Red Concrete Powder"), - RED_GLAZED_TERRACOTTA(249, 0, 24989, "Red Glazed Terracotta"), - RED_MUSHROOM(40, 0, 19728, "Red Mushroom", "RED_MUSHROOM"), - RED_MUSHROOM_BLOCK(100, 0, 20766, "Red Mushroom Block", "HUGE_MUSHROOM_2"), - RED_NETHER_BRICKS(215, 0, 18056, "Red Nether Bricks", "RED_NETHER_BRICK"), - RED_SAND(12, 1, 16279, "Red Sand"), - RED_SANDSTONE(179, 0, 9092, "Red Sandstone"), - RED_SANDSTONE_SLAB(182, 0, 17550, "Red Sandstone Slab", "STONE_SLAB2"), - RED_SANDSTONE_STAIRS(180, 0, 25466, "Red Sandstone Stairs"), - RED_SHULKER_BOX(233, 0, 32448, "Red Shulker Box"), - RED_STAINED_GLASS(95, 14, 9717, Arrays.asList(CMIMaterialCriteria.seeThrow), "Red Stained Glass"), - RED_STAINED_GLASS_PANE(160, 14, 8630, Arrays.asList(CMIMaterialCriteria.seeThrow), "Red Stained Glass Pane"), - RED_TERRACOTTA(159, 14, 5086, "Red Terracotta"), - RED_TULIP(38, 4, 16781, "Red Tulip"), - RED_WALL_BANNER(177, 1, 4378, "Red Banner"), - RED_WOOL(35, 14, 11621, "Red Wool"), - REPEATER(356, 0, 28823, "Redstone Repeater", "Diode"), - REPEATING_COMMAND_BLOCK(12405, "Repeating Command Block"), - ROSE_BUSH(175, 4, 6080, "Rose Bush"), - ROSE_RED(351, 1, 15694, "Rose Red"), - ROTTEN_FLESH(367, 0, 21591, "Rotten Flesh"), - SADDLE(329, 0, 30206, "Saddle"), - SALMON(349, 1, 18516, "Raw Salmon"), - SALMON_BUCKET(31427, "Bucket of Salmon"), - SALMON_SPAWN_EGG(18739, "Salmon Spawn Egg"), - SAND(12, 0, 11542, "Sand"), - SANDSTONE(24, 0, 13141, "Sandstone"), - SANDSTONE_SLAB(44, 1, 29830, "Sandstone Slab"), - SANDSTONE_STAIRS(128, 0, 18474, "Sandstone Stairs"), - SCUTE(11914, "Scute"), - SEAGRASS(23942, "Seagrass"), - SEA_LANTERN(169, 0, 16984, "Sea Lantern"), - SEA_PICKLE(19562, "Sea Pickle"), - SHEARS(359, 0, 27971, "Shears"), - SHEEP_SPAWN_EGG(383, 91, 24488, "Sheep Spawn Egg", "Spawn Sheep"), - SHIELD(442, 0, 29943, "Shield"), - SHULKER_BOX(229, 0, 7776, "Shulker Box"), - SHULKER_SHELL(450, 0, 27848, "Shulker Shell"), - SHULKER_SPAWN_EGG(383, 69, 31848, "Shulker Spawn Egg", "Spawn Shulker"), - SIGN(323, 0, 16918, "Sign"), - SILVERFISH_SPAWN_EGG(383, 60, 14537, "Silverfish Spawn Egg", "Spawn Silverfish"), - SKELETON_HORSE_SPAWN_EGG(383, 28, 21356, "Skeleton Horse Spawn Egg", "Spawn Skeleton Horse"), - SKELETON_SKULL(397, 0, 13270, "Mob Head (Skeleton)", "Skeleton Skull"), - SKELETON_SPAWN_EGG(383, 51, 15261, "Skeleton Spawn Egg", "Spawn Skeleton"), - SKELETON_WALL_SKULL(144, 0, 31650, "Skeleton Wall Skull"), - SLIME_BALL(341, 0, 5242, "Slimeball"), - SLIME_BLOCK(165, 0, 31892, "Slime Block"), - SLIME_SPAWN_EGG(383, 55, 6550, "Slime Spawn Egg", "Spawn Slime"), - SMOOTH_QUARTZ(14415, "Smooth Quartz"), - SMOOTH_RED_SANDSTONE(179, 2, 25180, "Smooth Red Sandstone"), - SMOOTH_SANDSTONE(24, 2, 30039, "Smooth Sandstone"), - SMOOTH_STONE(21910, "Smooth Stone"), - SNOW(78, 0, 14146, "Snow"), - SNOWBALL(332, 0, 19487, "Snowball"), - SNOW_BLOCK(80, 0, 19913, "Snow Block"), - SOUL_SAND(88, 0, 16841, "Soul Sand"), - SPAWNER(52, 90, 7018, "Spawner", "MOB_SPAWNER"), - SPECTRAL_ARROW(439, 0, 4568, "Spectral Arrow"), - SPIDER_EYE(375, 0, 9318, "Spider Eye"), - SPIDER_SPAWN_EGG(383, 52, 14984, "Spider Spawn Egg", "Spawn Spider"), - SPLASH_POTION(438, 0, 30248, "Splash Potion", "SPLASH_POTION"), - SPONGE(19, 0, 15860, "Sponge", "SPONGE"), - SPRUCE_BOAT(444, 0, 9606, "Spruce Boat", "BOAT_SPRUCE"), - SPRUCE_BUTTON(23281, "Spruce Button"), - SPRUCE_DOOR(427, 0, 10642, "Spruce Door", "SPRUCE_DOOR_ITEM"), - SPRUCE_FENCE(188, 0, 25416, Arrays.asList(CMIMaterialCriteria.seeThrow), "Spruce Fence"), - SPRUCE_FENCE_GATE(183, 0, 26423, Arrays.asList(CMIMaterialCriteria.seeThrow), "Spruce Fence Gate"), - SPRUCE_LEAVES(18, 1, 20039, "Spruce Leaves"), - SPRUCE_LOG(17, 1, 9726, "Spruce Log"), - SPRUCE_PLANKS(5, 1, 14593, "Spruce Wood Plank", "Spruce Planks"), - SPRUCE_PRESSURE_PLATE(15932, "Spruce Pressure Plate"), - SPRUCE_SAPLING(6, 1, 19874, "Spruce Sapling"), - SPRUCE_SLAB(126, 1, 4348, "Spruce Slab"), - SPRUCE_STAIRS(134, 0, 11192, "Spruce Wood Stairs", "Spruce Stairs"), - SPRUCE_TRAPDOOR(10289, "Spruce Trapdoor"), - SPRUCE_WOOD(32328, "Spruce Wood"), - SQUID_SPAWN_EGG(383, 94, 10682, "Squid Spawn Egg", "Spawn Squid"), - STICK(280, 0, 9773, "Stick"), - STICKY_PISTON(29, 0, 18127, "Sticky Piston", "PISTON_STICKY_BASE"), - STONE(1, 0, 22948, "Stone"), - STONE_AXE(275, 0, 6338, "Stone Axe"), - STONE_BRICKS(98, 0, 6962, "Stone Bricks"), - STONE_BRICK_SLAB(44, 5, 19676, "Stone Brick Slab"), - STONE_BRICK_STAIRS(109, 0, 27032, "Stone Brick Stairs", "SMOOTH_STAIRS"), - STONE_BUTTON(77, 0, 12279, "Stone Button"), - STONE_HOE(291, 0, 22855, "Stone Hoe"), - STONE_PICKAXE(274, 0, 14611, "Stone Pickaxe"), - STONE_PRESSURE_PLATE(70, 0, 22591, "Stone Pressure Plate", "STONE_PLATE"), - STONE_SHOVEL(273, 0, 9520, "Stone Shovel", "STONE_SPADE"), - STONE_SLAB(44, 0, 19838, "Stone Slab"), - STONE_SWORD(272, 0, 25084, "Stone Sword"), - STRAY_SPAWN_EGG(383, 6, 30153, "Stray Spawn Egg", "Spawn Stray"), - STRING(287, 0, 12806, "String"), - STRIPPED_ACACIA_LOG(18167, "Stripped Acacia Log"), - STRIPPED_ACACIA_WOOD(27193, "Stripped Acacia Wood"), - STRIPPED_BIRCH_LOG(8838, "Stripped Birch Log"), - STRIPPED_BIRCH_WOOD(22350, "Stripped Birch Wood"), - STRIPPED_DARK_OAK_LOG(6492, "Stripped Dark Oak Log"), - STRIPPED_DARK_OAK_WOOD(16000, "Stripped Dark Oak Wood"), - STRIPPED_JUNGLE_LOG(15476, "Stripped Jungle Log"), - STRIPPED_JUNGLE_WOOD(30315, "Stripped Jungle Wood"), - STRIPPED_OAK_LOG(20523, "Stripped Oak Log"), - STRIPPED_OAK_WOOD(31455, "Stripped Oak Wood"), - STRIPPED_SPRUCE_LOG(6140, "Stripped Spruce Log"), - STRIPPED_SPRUCE_WOOD(6467, "Stripped Spruce Wood"), - STRUCTURE_BLOCK(255, 0, 26831, "Structure Block"), - STRUCTURE_VOID(217, 0, 30806, "Structure Void"), - SUGAR(353, 0, 30638, "Sugar"), - SUGAR_CANE(338, 0, 7726, "Sugar Canes", "Sugar Cane"), - SUNFLOWER(175, 0, 7408, "Sunflower"), - TALL_GRASS(31, 0, 21559, "Tall Grass"), - TALL_SEAGRASS(27189, "Tall Seagrass"), - TERRACOTTA(172, 0, 16544, "Terracotta", "HARD_CLAY"), - TIPPED_ARROW(440, 0, 25164, "Tipped Arrow"), - TNT(46, 0, 7896, "TNT", "TNT"), - TNT_MINECART(407, 0, 4277, "Minecart with TNT", "explosiveminecart"), - TORCH(50, 0, 6063, "Torch"), - TOTEM_OF_UNDYING(449, 0, 10139, "Totem Of Undying", "Totem"), - TRAPPED_CHEST(146, 0, 18970, "Trapped Chest"), - TRIDENT(7534, "Trident"), - TRIPWIRE(132, 0, 8810, "Tripwire"), - TRIPWIRE_HOOK(131, 0, 8130, "Tripwire Hook"), - TROPICAL_FISH(349, 2, 24879, "Tropical Fish"), - TROPICAL_FISH_BUCKET(29995, "Bucket of Tropical Fish"), - TROPICAL_FISH_SPAWN_EGG(19713, "Tropical Fish Spawn Egg"), - TUBE_CORAL(23048, "Tube Coral"), - TUBE_CORAL_BLOCK(23723, "Tube Coral Block"), - TUBE_CORAL_FAN(19929, "Tube Coral Fan"), - TUBE_CORAL_WALL_FAN(25282, "Tube Coral Wall Fan"), - TURTLE_EGG(32101, "Turtle Egg"), - TURTLE_HELMET(30120, "Turtle Shell"), - TURTLE_SPAWN_EGG(17324, "Turtle Spawn Egg"), - VEX_SPAWN_EGG(383, 35, 27751, "Vex Spawn Egg", "Spawn Vex"), - VILLAGER_SPAWN_EGG(383, 120, 30348, "Villager Spawn Egg", "Spawn Villager"), - VINDICATOR_SPAWN_EGG(383, 36, 25324, "Vindicator Spawn Egg", "Spawn Vindicator"), - VINE(106, 0, 14564, Arrays.asList(CMIMaterialCriteria.seeThrow), "Vines", "VINE"), - VOID_AIR(13668, "Void Air"), - WALL_SIGN(68, 0, 10644, "Wall Sign"), - WALL_TORCH(50, 0, 25890, "Wall Torch"), - WATER(8, 0, 24998, "Flowing Water"), - WATER_BUCKET(326, 0, 8802, "Water Bucket"), - WET_SPONGE(19, 1, 9043, "Wet Sponge"), - WHEAT(296, 0, 27709, "Wheat"), - WHEAT_SEEDS(295, 0, 28742, "Wheat Seeds", "SEEDS"), - WHITE_BANNER(425, 15, 17562, "White Banner"), - WHITE_BED(355, 0, 8185, "White Bed", "Bed"), - WHITE_CARPET(171, 0, 15117, "White Carpet"), - WHITE_CONCRETE(251, 0, 6281, "White Concrete"), - WHITE_CONCRETE_POWDER(252, 0, 10363, "White Concrete Powder"), - WHITE_GLAZED_TERRACOTTA(235, 0, 11326, "White Glazed Terracotta"), - WHITE_SHULKER_BOX(219, 0, 31750, "White Shulker Box"), - WHITE_STAINED_GLASS(95, 0, 31190, Arrays.asList(CMIMaterialCriteria.seeThrow), "White Stained Glass"), - WHITE_STAINED_GLASS_PANE(160, 0, 10557, Arrays.asList(CMIMaterialCriteria.seeThrow), "White Stained Glass Pane"), - WHITE_TERRACOTTA(159, 0, 20975, "White Terracotta"), - WHITE_TULIP(38, 6, 9742, "White Tulip"), - WHITE_WALL_BANNER(425, 15, 15967, "White Banner"), - WHITE_WOOL(35, 0, 8624, "White Wool", "Wool"), - WITCH_SPAWN_EGG(383, 66, 11837, "Witch Spawn Egg", "Spawn Witch"), - WITHER_SKELETON_SKULL(397, 1, 31487, "Mob Head (Wither Skeleton)", "Wither Skeleton Skull"), - WITHER_SKELETON_SPAWN_EGG(383, 5, 10073, "Wither Skeleton Spawn Egg", "Spawn Wither Skeleton"), - WITHER_SKELETON_WALL_SKULL(144, 1, 9326, "Wither Skeleton Wall Skull"), - WOLF_SPAWN_EGG(383, 95, 21692, "Wolf Spawn Egg", "Spawn Wolf"), - WOODEN_AXE(271, 0, 6292, "Wooden Axe", "Wood Axe"), - WOODEN_HOE(290, 0, 16043, "Wooden Hoe", "Wood Hoe"), - WOODEN_PICKAXE(270, 0, 12792, "Wooden Pickaxe", "WOOD_PICKAXE"), - WOODEN_SHOVEL(269, 0, 28432, "Wooden Shovel", "WOOD_SPADE"), - WOODEN_SWORD(268, 0, 7175, "Wooden Sword", "WOOD_SWORD"), - WRITABLE_BOOK(386, 0, 13393, "Book and Quill"), - WRITTEN_BOOK(387, 0, 24164, "Written Book"), - YELLOW_BANNER(425, 11, 30382, "Yellow Banner"), - YELLOW_BED(355, 4, 30410, "Yellow Bed"), - YELLOW_CARPET(171, 4, 18149, "Yellow Carpet"), - YELLOW_CONCRETE(251, 4, 15722, "Yellow Concrete"), - YELLOW_CONCRETE_POWDER(252, 4, 10655, "Yellow Concrete Powder"), - YELLOW_GLAZED_TERRACOTTA(239, 0, 10914, "Yellow Glazed Terracotta"), - YELLOW_SHULKER_BOX(223, 0, 28700, "Yellow Shulker Box"), - YELLOW_STAINED_GLASS(95, 4, 12182, Arrays.asList(CMIMaterialCriteria.seeThrow), "Yellow Stained Glass"), - YELLOW_STAINED_GLASS_PANE(160, 4, 20298, Arrays.asList(CMIMaterialCriteria.seeThrow), "Yellow Stained Glass Pane"), - YELLOW_TERRACOTTA(159, 4, 32129, "Yellow Terracotta"), - YELLOW_WALL_BANNER(425, 11, 32004, "Yellow Banner"), - YELLOW_WOOL(35, 4, 29507, "Yellow Wool"), - ZOMBIE_HEAD(397, 2, 9304, "Mob Head (Zombie)", "Zombie Head"), - ZOMBIE_HORSE_SPAWN_EGG(383, 29, 4275, "Zombie Horse Spawn Egg", "Spawn Zombie Horse"), - ZOMBIE_PIGMAN_SPAWN_EGG(383, 57, 11531, "Zombie Pigman Spawn Egg", "Spawn Zombie Pigman"), - ZOMBIE_SPAWN_EGG(383, 54, 5814, "Zombie Spawn Egg", "Spawn Zombie"), - ZOMBIE_VILLAGER_SPAWN_EGG(383, 27, 10311, "Zombie Villager Spawn Egg", "Spawn Zombie Villager"), - ZOMBIE_WALL_HEAD(144, 2, 16296, "Zombie Wall Head"), - - //1.14 - ACACIA_SIGN(29808, "Acacia Sign"), - ACACIA_WALL_SIGN(20316, "Acacia Wall Sign"), - ANDESITE_SLAB(32124, "Andesite Slab"), - ANDESITE_STAIRS(17747, "Andesite Stairs"), - ANDESITE_WALL(14938, "Andesite Wall"), - BAMBOO(18728, "Bamboo"), - BAMBOO_SAPLING(8478, "Bamboo Sapling"), - BARREL(22396, "Barrel"), - BELL(20000, "Bell"), - BIRCH_SIGN(11351, "Birch Sign"), - BIRCH_WALL_SIGN(9887, "Birch Wall Sign"), - BLACK_DYE(6202, "Black Dye"), - BLAST_FURNACE(31157, "Blast Furnace"), - BLUE_DYE(11588, "Blue Dye"), - BRICK_WALL(18995, "Brick Wall"), - BROWN_DYE(7648, "Brown Dye"), - CAMPFIRE(8488, "Campfire"), - CARTOGRAPHY_TABLE(28529, "Cartography Table"), - CAT_SPAWN_EGG(29583, "Cat Spawn Egg"), - CORNFLOWER(15405, "Cornflower"), - CREEPER_BANNER_PATTERN(15774, "Banner Pattern"), - CROSSBOW(4340, "Crossbow"), - CUT_RED_SANDSTONE_SLAB(-11, "Cut Red Sandstone Slab"), - CUT_SANDSTONE_SLAB(-10, "Cut Sandstone Slab"), - DARK_OAK_SIGN(15127, "Dark Oak Sign"), - DARK_OAK_WALL_SIGN(9508, "Dark Oak Wall Sign"), - DIORITE_SLAB(10715, "Diorite Slab"), - DIORITE_STAIRS(13134, "Diorite Stairs"), - DIORITE_WALL(17412, "Diorite Wall"), - END_STONE_BRICK_SLAB(23239, "End Stone Brick Slab"), - END_STONE_BRICK_STAIRS(28831, "End Stone Brick Stairs"), - END_STONE_BRICK_WALL(27225, "End Stone Brick Wall"), - FLETCHING_TABLE(30838, "Fletching Table"), - FLOWER_BANNER_PATTERN(5762, "Banner Pattern"), - FOX_SPAWN_EGG(-1, "Fox Spawn Egg"), - GLOBE_BANNER_PATTERN(-99, "Banner Pattern"), - GRANITE_SLAB(25898, "Granite Slab"), - GRANITE_STAIRS(21840, "Granite Stairs"), - GRANITE_WALL(23279, "Granite Wall"), - GREEN_DYE(23215, "Green Dye"), - GRINDSTONE(26260, "Grindstone"), - JIGSAW(17398, "Jigsaw Block"), - JUNGLE_SIGN(24717, "Jungle Sign"), - JUNGLE_WALL_SIGN(29629, "Jungle Wall Sign"), - LANTERN(5992, "Lantern"), - LEATHER_HORSE_ARMOR(-2, "Leather Horse Armor"), - LECTERN(23490, "Lectern"), - LILY_OF_THE_VALLEY(7185, "Lily of the Valley"), - LOOM(14276, "Loom"), - MOJANG_BANNER_PATTERN(11903, "Banner Pattern"), - MOSSY_COBBLESTONE_SLAB(12139, "Mossy Cobblestone Slab"), - MOSSY_COBBLESTONE_STAIRS(29210, "Mossy Cobblestone Stairs"), - MOSSY_STONE_BRICK_SLAB(14002, "Mossy Stone Brick Slab"), - MOSSY_STONE_BRICK_STAIRS(27578, "Mossy Stone Brick Stairs"), - MOSSY_STONE_BRICK_WALL(18259, "Mossy Stone Brick Wall"), - NETHER_BRICK_WALL(10398, "Nether Brick Wall"), - OAK_SIGN(8192, "Oak Sign"), - OAK_WALL_SIGN(12984, "Oak Wall Sign"), - PANDA_SPAWN_EGG(23759, "Panda Spawn Egg"), - PILLAGER_SPAWN_EGG(28659, "Pillager Spawn Egg"), - POLISHED_ANDESITE_STAIRS(7573, "Polished Andesite Stairs"), - POLISHED_ANDESITE_SLAB(0, "Polished Andesite Slab"), - POLISHED_DIORITE_SLAB(18303, "Polished Diorite Slab"), - POLISHED_DIORITE_STAIRS(4625, "Polished Diorite Stairs"), - POLISHED_GRANITE_SLAB(4521, "Polished Granite Slab"), - POLISHED_GRANITE_STAIRS(29588, "Polished Granite Stairs"), - POTTED_BAMBOO(22542, "Potted Bamboo"), - POTTED_CORNFLOWER(28917, "Potted CornFlower"), - POTTED_LILY_OF_THE_VALLEY(9364, "Potted Lily Of The Valley"), - POTTED_WITHER_ROSE(26876, "Potted Wither Rose"), - PRISMARINE_WALL(18184, "Prismarine Wall"), - RAVAGER_SPAWN_EGG(31284, "Ravager Spawn Egg"), - RED_DYE(5728, "Red Dye"), - RED_NETHER_BRICK_SLAB(12462, "Red Nether Brick Slab"), - RED_NETHER_BRICK_STAIRS(26374, "Red Nether Brick Stairs"), - RED_NETHER_BRICK_WALL(4580, "Red Nether Brick Wall"), - RED_SANDSTONE_WALL(4753, "Red Sandstone Wall"), - SANDSTONE_WALL(18470, "Sandstone Wall"), - SCAFFOLDING(15757, "Scaffolding"), - SKULL_BANNER_PATTERN(7680, "Banner Pattern"), - SMITHING_TABLE(9082, "Smithing Table"), - SMOKER(24781, "Smoker"), - SMOOTH_QUARTZ_SLAB(26543, "Smooth Quartz Slab"), - SMOOTH_QUARTZ_STAIRS(19560, "Smooth Quartz Stairs"), - SMOOTH_RED_SANDSTONE_SLAB(16304, "Smooth Red Sandstone Slab"), - SMOOTH_RED_SANDSTONE_STAIRS(17561, "Smooth Red Sandstone Stairs"), - SMOOTH_SANDSTONE_SLAB(9030, "Smooth Sandstone Slab"), - SMOOTH_SANDSTONE_STAIRS(21183, "Smooth Sandstone Stairs"), - SMOOTH_STONE_SLAB(24129, "Smooth Stone Slab"), - SPRUCE_SIGN(21502, "Spruce Sign"), - SPRUCE_WALL_SIGN(7352, "Spruce Wall Sign"), - STONECUTTER(25170, "Stonecutter"), - STONE_BRICK_WALL(29073, "Stone Brick Wall"), - STONE_STAIRS(23784, "Stone Stairs"), - SUSPICIOUS_STEW(8173, "Suspicious Stew"), - SWEET_BERRIES(19747, "Sweet Berries"), - SWEET_BERRY_BUSH(11958, "Sweet Berry Bush"), - TRADER_LLAMA_SPAWN_EGG(13512, "Trader Llama Spawn Egg"), - WANDERING_TRADER_SPAWN_EGG(12312, "Wandering Trader Spawn Egg"), - WHITE_DYE(10758, "White Dye"), - WITHER_ROSE(8619, "Wither Rose"), - YELLOW_DYE(5952, "Yellow Dye"), - COMPOSTER(-4, "Composter"), - - //1.15 - BEEHIVE("Beehive"), - BEE_NEST("Bee Nest"), - BEE_SPAWN_EGG("Bee Spawn Egg"), - HONEYCOMB("Honeycomb"), - HONEYCOMB_BLOCK("Honeycomb Block"), - HONEY_BLOCK("Honey Block"), - HONEY_BOTTLE("Honey Bottle"), - - //1.16.1 - ANCIENT_DEBRIS("Ancient Debris"), - BASALT("Basalt"), - BLACKSTONE("Blackstone"), - BLACKSTONE_SLAB("Blackstone Slab"), - BLACKSTONE_STAIRS("Blackstone Stairs"), - BLACKSTONE_WALL("Blackstone Wall"), - CHAIN("Chain"), - CHISELED_NETHER_BRICKS("Chiseled Nether Bricks"), - CHISELED_POLISHED_BLACKSTONE("Chiseled Polished Blackstone"), - CRACKED_NETHER_BRICKS("Cracked Nether Bricks"), - CRACKED_POLISHED_BLACKSTONE_BRICKS("Cracked Polished Blackstone Bricks"), - CRIMSON_BUTTON("Crimson Button"), - CRIMSON_DOOR("Crimson Door"), - CRIMSON_FENCE("Crimson Fence"), - CRIMSON_FENCE_GATE("Crimson Fence Gate"), - CRIMSON_FUNGUS("Crimson Fungus"), - CRIMSON_HYPHAE("Crimson Hyphae"), - CRIMSON_NYLIUM("Crimson Nylium"), - CRIMSON_PLANKS("Crimson Planks"), - CRIMSON_PRESSURE_PLATE("Crimson Pressure Plate"), - CRIMSON_ROOTS("Crimson Roots"), - CRIMSON_SIGN("Crimson Sign"), - CRIMSON_SLAB("Crimson Slab"), - CRIMSON_STAIRS("Crimson Stairs"), - CRIMSON_STEM("Crimson Stem"), - CRIMSON_TRAPDOOR("Crimson Trapdoor"), - CRIMSON_WALL_SIGN("Crimson Wall Sign"), - CRYING_OBSIDIAN("Crying Obsidian"), - GILDED_BLACKSTONE("Gilded Blackstone"), - HOGLIN_SPAWN_EGG("Hoglin Spawn Egg"), - LODESTONE("Lodestone"), - MUSIC_DISC_PIGSTEP("Music Disc Pigstep"), - NETHERITE_AXE("Netherite Axe"), - NETHERITE_BLOCK("Netherite Block", "netherite"), - NETHERITE_BOOTS("Netherite Boots"), - NETHERITE_CHESTPLATE("Netherite Chestplate"), - NETHERITE_HELMET("Netherite Helmet"), - NETHERITE_HOE("Netherite Hoe"), - NETHERITE_INGOT("Netherite Ingot"), - NETHERITE_LEGGINGS("Netherite Leggings"), - NETHERITE_PICKAXE("Netherite Pickaxe"), - NETHERITE_SCRAP("Netherite Scrap"), - NETHERITE_SHOVEL("Netherite Shovel"), - NETHERITE_SWORD("Netherite Sword"), - NETHER_GOLD_ORE("Nether Gold Ore"), - NETHER_SPROUTS("Nether Sprouts"), - PIGLIN_BANNER_PATTERN("Piglin Banner Pattern"), - PIGLIN_SPAWN_EGG("Piglin Spawn Egg"), - POLISHED_BASALT("Polished Basalt"), - POLISHED_BLACKSTONE("Polished Blackstone"), - POLISHED_BLACKSTONE_BRICKS("Polished Blackstone Bricks"), - POLISHED_BLACKSTONE_BRICK_SLAB("Polished Blackstone Brick Slab"), - POLISHED_BLACKSTONE_BRICK_STAIRS("Polished Blackstone Brick Stairs"), - POLISHED_BLACKSTONE_BRICK_WALL("Polished Blackstone Brick Wall"), - POLISHED_BLACKSTONE_BUTTON("Polished Blackstone Button"), - POLISHED_BLACKSTONE_PRESSURE_PLATE("Polished Blackstone Pressure Plate"), - POLISHED_BLACKSTONE_SLAB("Polished Blackstone Slab"), - POLISHED_BLACKSTONE_STAIRS("Polished Blackstone Stairs"), - POLISHED_BLACKSTONE_WALL("Polished Blackstone Wall"), - POTTED_CRIMSON_FUNGUS("Potted Crimson Fungus"), - POTTED_CRIMSON_ROOTS("Potted Crimson Roots"), - POTTED_WARPED_FUNGUS("Potted Warped Fungus"), - POTTED_WARPED_ROOTS("Potted Warped Roots"), - QUARTZ_BRICKS("Quartz Bricks"), - RESPAWN_ANCHOR("Respawn Anchor"), - SHROOMLIGHT("Shroomlight"), - SOUL_CAMPFIRE("Soul Campfire"), - SOUL_FIRE("Soul Fire"), - SOUL_LANTERN("Soul Lantern"), - SOUL_SOIL("Soul Soil"), - SOUL_TORCH("Soul Torch"), - SOUL_WALL_TORCH("Soul Wall Torch"), - STRIDER_SPAWN_EGG("Strider Spawn Egg"), - STRIPPED_CRIMSON_HYPHAE("Stripped Crimson Hyphae"), - STRIPPED_CRIMSON_STEM("Stripped Crimson Stem"), - STRIPPED_WARPED_HYPHAE("Stripped Warped Hyphae"), - STRIPPED_WARPED_STEM("Stripped Warped Stem"), - TARGET("Target"), - TWISTING_VINES("Twisting Vines"), - TWISTING_VINES_PLANT("Twisting Vines Plant"), - WARPED_BUTTON("Warped Button"), - WARPED_DOOR("Warped Door"), - WARPED_FENCE("Warped Fence"), - WARPED_FENCE_GATE("Warped Fence Gate"), - WARPED_FUNGUS("Warped Fungus"), - WARPED_FUNGUS_ON_A_STICK("Warped Fungus On A Stick"), - WARPED_HYPHAE("Warped Hyphae"), - WARPED_NYLIUM("Warped Nylium"), - WARPED_PLANKS("Warped Planks"), - WARPED_PRESSURE_PLATE("Warped Pressure Plate"), - WARPED_ROOTS("Warped Roots"), - WARPED_SIGN("Warped Sign"), - WARPED_SLAB("Warped Slab"), - WARPED_STAIRS("Warped Stairs"), - WARPED_STEM("Warped Stem"), - WARPED_TRAPDOOR("Warped Trapdoor"), - WARPED_WALL_SIGN("Warped Wall Sign", "Warped Wall"), - WARPED_WART_BLOCK("Warped Wart Block", "Warped Wart"), - WEEPING_VINES("Weeping Vines"), - WEEPING_VINES_PLANT("Weeping Vines Plant"), - ZOGLIN_SPAWN_EGG("Zoglin Spawn Egg"), - ZOMBIFIED_PIGLIN_SPAWN_EGG("Zombified Piglin Spawn Egg"), - - // 1.16.2 - PIGLIN_BRUTE_SPAWN_EGG("Piglin Brute Spawn Egg"), - - // Legacy - LEGACY_STATIONARY_WATER(9, 0, null, "Stationary Water"), - LEGACY_STATIONARY_LAVA(11, 0, null, "Stationary Lava"), - LEGACY_BURNING_FURNACE(62, 0, null, "Burning Furnace"), - LEGACY_NETHER_WARTS(115, 0, null, "Nether Warts"), - LEGACY_IRON_DOOR_BLOCK(71, 0, null, "Iron Door Block"), - LEGACY_GLOWING_REDSTON_ORE(74, 0, null, "Glowing Redstone Ore"), - LEGACY_SUGAR_CANE_BLOCK(83, 0, null, "Sugar Cane Block"), - LEGACY_RAW_FISH(349, 0, null, "Raw Fish"), - LEGACY_SKULL(144, 0, null, "Skull"), - LEGACY_SIGN_POST(63, 0, null, "Sign Post"), - LEGACY_BED_BLOCK(26, 0, null, "Bed Block"), - LEGACY_REDSTONE_TORCH_OFF(75, 0, null, "Redstone Torch Off"), - LEGACY_REDSTONE_TORCH_ON(76, 0, null, "Redstone Torch On"), - LEGACY_CAKE_BLOCK(92, 0, null, "Cake Block"), - LEGACY_DIODE_BLOCK_OFF(93, 0, null, "Diode Block Off"), - LEGACY_DIODE_BLOCK_ON(94, 0, null, "Diode Block On"), - LEGACY_MELON_BLOCK(103, 0, null, "Melon Block"), - -// LEGACY_BREWING_STAND(117, null, null, "LEGACY_BREWING_STAND", ""), -// LEGACY_CAULDRON(118, 0, null, "LEGACY_CAULDRON", ""), -// LEGACY_REDSTONE_LAMP_ON(124, null, null, "LEGACY_REDSTONE_LAMP_ON", ""), -// LEGACY_WOOD_DOUBLE_STEP(125, null, null, "LEGACY_WOOD_DOUBLE_STEP", ""), -// LEGACY_FLOWER_POT(140, null, null, "LEGACY_FLOWER_POT", ""), - LEGACY_REDSTONE_COMPARATOR_OFF(149, 0, null, "Redstone Comparator Off", ""), - LEGACY_REDSTONE_COMPARATOR_ON(150, 0, null, "Redstone Comparator On", ""), -// LEGACY_STANDING_BANNER(176, null, null, "LEGACY_STANDING_BANNER", ""), -// LEGACY_WALL_BANNER(177, null, null, "LEGACY_WALL_BANNER", ""), -// LEGACY_DAYLIGHT_DETECTOR_INVERTED(178, null, null, "LEGACY_DAYLIGHT_DETECTOR_INVERTED", ""), -// LEGACY_DOUBLE_STONE_SLAB2(181, null, null, "LEGACY_DOUBLE_STONE_SLAB2", ""), - LEGACY_WOODEN_DOOR_BLOCK(64, 0, null, "Wooden Door Block"), - LEGACY_SPRUCE_DOOR(193, 0, null, "Spruce Door Block"), - LEGACY_BIRCH_DOOR(194, 0, null, "Birch Door Block"), - LEGACY_JUNGLE_DOOR(195, 0, null, "Jungle Door Block"), - LEGACY_ACACIA_DOOR(196, 0, null, "Acacia Door Block"), - LEGACY_DARK_OAK_DOOR(197, 0, null, "Dark Oak Door Block"), - LEGACY_GLOWING_REDSTONE_ORE(74, 0, null, "Glowing Redstone Ore"), - LEGACY_BREWING_STAND(117, null, null, "LEGACY_BREWING_STAND"), -// LEGACY_PURPUR_DOUBLE_SLAB(204, null, null, "LEGACY_PURPUR_DOUBLE_SLAB", ""), -// LEGACY_COMMAND_REPEATING(210, null, null, "LEGACY_COMMAND_REPEATING", ""), -// LEGACY_COMMAND_CHAIN(211, null, null, "LEGACY_COMMAND_CHAIN", ""), - LEGACY_WHEAT(59, 0, null, "Wheat block"); - - private Integer legacyId; - private Integer legacyData; - private boolean legacy = false; - private Integer id; - private String name; - private List legacyName; - private String bukkitName; - private String mojangName; - private Set criteria; - - Material mat; - - CMIMaterial(Integer id, String name, String... legacyName) { - this(null, null, id, name, legacyName); - } - - CMIMaterial(Integer id, String name) { - this(null, null, id, name, ""); - } - - CMIMaterial(Integer legacyId, Integer legacyData, Integer id, String name) { - this(legacyId, legacyData, id, name, ""); - } - - CMIMaterial(String name, String... legacyName) { - this(null, null, null, name, legacyName); - } - - CMIMaterial(Integer legacyId, Integer legacyData, Integer id, String name, String... legacyName) { - this(legacyId, legacyData, id, null, name, legacyName); - } - - CMIMaterial(Integer legacyId, Integer legacyData, Integer id, List criteria, String name, String... legacyName) { - this.legacyId = legacyId; - this.legacyData = legacyData; - this.id = id; - this.name = name; - if (legacyName != null && legacyName.length > 0 && !legacyName[0].isEmpty()) - this.legacyName = Arrays.asList(legacyName); - - if (criteria != null) - this.criteria = new HashSet<>(criteria); - - if (this.toString().startsWith("LEGACY_")) { - legacy = true; - } - } - - public String getName() { - return name; - } - - @Deprecated - public Integer getLegacyId() { - return legacyId == null ? 0 : legacyId; - } - - @Deprecated - public Integer getId() { - if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) { - return this.id == null ? 0 : this.id; - } - return getLegacyId(); - } - - public Material getMaterial() { - return mat; - } - - public void updateMaterial() { - mat = null; - if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) { - if (mat == null) { - for (Material one : Material.values()) { - if (!one.name().replace("_", "").equalsIgnoreCase(this.name().replace("_", ""))) - continue; - mat = one; - break; - } - } - } else { - if (Version.isCurrentEqualOrLower(Version.v1_12_R1) && this.equals(CMIMaterial.PODZOL)) { - mat = null; - return; - } - if (Version.isCurrentEqualOrLower(Version.v1_13_R2)) { - if (mat == null && this.getId() != null) { - for (Material one : Material.class.getEnumConstants()) { - if (one.getId() != this.getId()) - continue; - mat = one; - break; - } - } - } - if (mat == null) { - for (Material one : Material.class.getEnumConstants()) { - if (!one.name().replace("LEGACY_", "").replace("_", "").equalsIgnoreCase(this.name().replace("_", ""))) - continue; - mat = one; - break; - } - } - if (mat == null) { - for (Material one : Material.class.getEnumConstants()) { - if (!one.name().replace("LEGACY_", "").replace("_", "").equalsIgnoreCase(this.getName().replace(" ", ""))) - continue; - mat = one; - break; - } - } - if (mat == null && !this.getLegacyNames().isEmpty()) { - main: for (Material one : Material.class.getEnumConstants()) { - for (String oneL : this.getLegacyNames()) { - if (!one.name().replace("LEGACY_", "").replace("_", "").equalsIgnoreCase(oneL.replace(" ", "").replace("_", ""))) - continue main; - } - mat = one; - break; - } - } - } - } - - public ItemStack newItemStack() { - return newItemStack(1); - } - - public ItemStack newItemStack(int amount) { - if (mat == null) { - updateMaterial(); - } - if (mat == null) { - return new ItemStack(Material.STONE); - } - - try { - if (!mat.isItem()) - return new ItemStack(Material.STONE); - } catch (Throwable e) { - } - - if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) { - ItemStack stack = new ItemStack(mat); - stack.setAmount(amount); - return stack; - } - - ItemStack stack = new ItemStack(mat, 1, (short) this.getLegacyData()); - stack.setAmount(amount); - return stack; - } - - public CMIItemStack newCMIItemStack() { - return newCMIItemStack(1); - } - - public CMIItemStack newCMIItemStack(int amount) { - if (mat == null) { - updateMaterial(); - } - if (mat == null) { - return new CMIItemStack(CMIMaterial.STONE); - } - if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) { - CMIItemStack stack = new CMIItemStack(mat); - stack.setAmount(amount); - return stack; - } - - ItemStack stack = new ItemStack(mat, 1, (short) this.getLegacyData()); - stack.setAmount(amount); - return new CMIItemStack(stack); - } - - @Deprecated - public short getData() { - if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) { - return 0; - } - return getLegacyData(); - } - - @Deprecated - public short getLegacyData() { - return legacyData == null ? 0 : legacyData.shortValue(); - } - - public static CMIMaterial getRandom(CMIMaterial mat) { - List ls = new ArrayList<>(); - - for (CMIMaterial one : CMIMaterial.values()) { - if (one.getLegacyId() == null) - continue; - if (one.getLegacyId() != mat.getLegacyId()) - continue; - ls.add(one); - } - - if (ls.isEmpty() || ls.size() == 1) { - String part = mat.name; - if (part.contains("_")) - part = part.split("_")[part.split("[_]").length - 1]; - for (CMIMaterial one : CMIMaterial.values()) { - if (!one.name().endsWith(part)) - continue; - ls.add(one); - } - } - - Collections.shuffle(ls); - - return ls.isEmpty() ? CMIMaterial.NONE : ls.get(0); - } - - public CMIMaterial getByColorId(int id) { - return getByColorId(this, id); - } - - public static CMIMaterial getByColorId(CMIMaterial mat, int id) { - if (mat == null) - return CMIMaterial.NONE; - for (CMIMaterial one : CMIMaterial.values()) { - if (one.getLegacyId() == null) - continue; - if (one.getLegacyId() != mat.getLegacyId()) - continue; - if (one.getLegacyData() == id) - return one; - } - - return mat; - } - - public static CMIMaterial get(String id) { - if (id == null) - return CMIMaterial.NONE; - - id = id.replaceAll("_| |minecraft:", "").toLowerCase(); - - String[] split = id.split(":", 2); - if (split.length > 1) { - try { - int ids = Integer.parseInt(split[0]); - if (ids <= 0) - return CMIMaterial.NONE; - - return get(ids, Integer.parseInt(split[1])); - } catch (NumberFormatException ex) { - } - - try { - int data = Integer.parseInt(split[1]); - id = split[0]; - - CMIMaterial mat = ItemManager.byName.get(id + ":" + data); - - if (mat == null) - mat = ItemManager.byName.get(id); - - if (mat != null) { - if (mat.getLegacyId() > 0) { - CMIMaterial m = get(mat.getLegacyId(), data); - - if (m != null) - mat = m; - } - - return mat; - } - } catch (NumberFormatException ex) { - } - } - - CMIMaterial mat = ItemManager.byName.get(id); - if (mat != null) { - return mat; - } - - try { - if ((mat = ItemManager.byId.get(Integer.parseInt(id))) != null) { - return mat; - } - } catch (NumberFormatException ex) { - } - - return CMIMaterial.NONE; - } - - public static CMIMaterial get(Material mat) { - if (mat == null) - return CMIMaterial.NONE; - CMIMaterial m = ItemManager.byRealMaterial.get(mat); - return m != null ? m : get(mat.toString()); - } - - public static CMIMaterial get(int id) { - for (CMIMaterial one : CMIMaterial.values()) { - if (one.getMaterial() != null && one.getId() == id) { - return one; - } - } - for (CMIMaterial one : CMIMaterial.values()) { - if (one.getLegacyId() == id) { - return one; - } - } - return CMIMaterial.NONE; - } - - public static CMIMaterial get(ItemStack item) { - if (item == null) - return CMIMaterial.NONE; - CMIMaterial mat = null; - if (Version.isCurrentEqualOrLower(Version.v1_13_R2)) { - mat = Version.isCurrentEqualOrHigher(Version.v1_13_R1) ? get(item.getType()) : get(item.getType().getId(), item.getData().getData()); - if (mat == null) { - mat = ItemManager.byName.get(item.getType().toString().toLowerCase().replace("_", "")); - } - } else { - mat = ItemManager.byRealMaterial.get(item.getType()); - } - - return mat == null ? CMIMaterial.NONE : mat; - } - - public static CMIMaterial get(Block block) { - if (block == null) - return CMIMaterial.NONE; - - try { - if (Bukkit.getWorld(block.getWorld().getUID()) == null) - return CMIMaterial.NONE; - } catch (Throwable e) { - e.printStackTrace(); - } - - if (Version.isCurrentEqualOrHigher(Version.v1_14_R1)) { - CMIMaterial res = ItemManager.byRealMaterial.get(block.getType()); - return res == null ? CMIMaterial.NONE : res; - } - - byte data = Version.isCurrentEqualOrLower(Version.v1_13_R1) ? block.getData() : 0; - if (block.getState() instanceof Skull) { - Skull skull = (Skull) block.getState(); - data = (byte) skull.getSkullType().ordinal(); - } - - CMIMaterial mat = null; - - if (Version.isCurrentEqualOrHigher(Version.v1_14_R1)) { - mat = ItemManager.byRealMaterial.get(block.getType()); - } - - if (mat == null) { - mat = ItemManager.byName.get(block.getType().toString().replace("_", "").toLowerCase()); - } - - if (mat == null && Version.isCurrentEqualOrLower(Version.v1_13_R2)) { - mat = get(block.getType().getId(), Version.isCurrentEqualOrHigher(Version.v1_13_R1) ? 0 : data); - } - return mat == null ? CMIMaterial.NONE : mat; - } - - @Deprecated - public static CMIMaterial get(int id, int data) { - CMIMaterial mat = ItemManager.byName.get(id + ":" + data); - if (mat != null) { - return mat; - } - mat = ItemManager.byId.get(id); - return mat == null ? CMIMaterial.NONE : mat; - } - - public static CMIMaterial getLegacy(int id) { - CMIMaterial mat = ItemManager.byId.get(id); - return mat != null ? mat : CMIMaterial.NONE; - } - - public short getMaxDurability() { - return getMaterial() == null ? 0 : getMaterial().getMaxDurability(); - } - - public boolean isBlock() { - return getMaterial() != null && getMaterial().isBlock(); - } - - public boolean isEquipment() { - return getMaxDurability() > 16; - } - - public boolean isSolid() { - return getMaterial() != null && getMaterial().isSolid(); - } - - public static boolean isMonsterEgg(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isMonsterEgg(); - } - - public boolean isMonsterEgg() { - switch (this) { - case ELDER_GUARDIAN_SPAWN_EGG: - case WITHER_SKELETON_SPAWN_EGG: - case STRAY_SPAWN_EGG: - case HUSK_SPAWN_EGG: - case ZOMBIE_VILLAGER_SPAWN_EGG: - case SKELETON_HORSE_SPAWN_EGG: - case ZOMBIE_HORSE_SPAWN_EGG: - case DONKEY_SPAWN_EGG: - case MULE_SPAWN_EGG: - case EVOKER_SPAWN_EGG: - case VEX_SPAWN_EGG: - case VINDICATOR_SPAWN_EGG: - case CREEPER_SPAWN_EGG: - case SKELETON_SPAWN_EGG: - case SPIDER_SPAWN_EGG: - case ZOMBIE_SPAWN_EGG: - case SLIME_SPAWN_EGG: - case GHAST_SPAWN_EGG: - case ZOMBIE_PIGMAN_SPAWN_EGG: - case ENDERMAN_SPAWN_EGG: - case CAVE_SPIDER_SPAWN_EGG: - case SILVERFISH_SPAWN_EGG: - case BLAZE_SPAWN_EGG: - case MAGMA_CUBE_SPAWN_EGG: - case BAT_SPAWN_EGG: - case WITCH_SPAWN_EGG: - case ENDERMITE_SPAWN_EGG: - case GUARDIAN_SPAWN_EGG: - case SHULKER_SPAWN_EGG: - case PIG_SPAWN_EGG: - case SHEEP_SPAWN_EGG: - case COW_SPAWN_EGG: - case CHICKEN_SPAWN_EGG: - case SQUID_SPAWN_EGG: - case WOLF_SPAWN_EGG: - case MOOSHROOM_SPAWN_EGG: - case OCELOT_SPAWN_EGG: - case HORSE_SPAWN_EGG: - case RABBIT_SPAWN_EGG: - case POLAR_BEAR_SPAWN_EGG: - case LLAMA_SPAWN_EGG: - case PARROT_SPAWN_EGG: - case VILLAGER_SPAWN_EGG: - case COD_SPAWN_EGG: - case DOLPHIN_SPAWN_EGG: - case DRAGON_EGG: - case DROWNED_SPAWN_EGG: - case PHANTOM_SPAWN_EGG: - case PUFFERFISH_SPAWN_EGG: - case SALMON_SPAWN_EGG: - case TROPICAL_FISH_SPAWN_EGG: - case TURTLE_SPAWN_EGG: - - // 1.14 - case CAT_SPAWN_EGG: - case FOX_SPAWN_EGG: - case PANDA_SPAWN_EGG: - case PILLAGER_SPAWN_EGG: - case RAVAGER_SPAWN_EGG: - case TRADER_LLAMA_SPAWN_EGG: - case WANDERING_TRADER_SPAWN_EGG: - - // 1.15 - case BEE_SPAWN_EGG: - - case HOGLIN_SPAWN_EGG: - case PIGLIN_SPAWN_EGG: - case STRIDER_SPAWN_EGG: - case ZOGLIN_SPAWN_EGG: - case ZOMBIFIED_PIGLIN_SPAWN_EGG: - return true; - default: - break; - } - return false; - } - - public static boolean isBed(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isBed(); - } - - public boolean isBed() { - switch (this) { - case WHITE_BED: - case ORANGE_BED: - case MAGENTA_BED: - case LIGHT_BLUE_BED: - case YELLOW_BED: - case LIME_BED: - case PINK_BED: - case GRAY_BED: - case LIGHT_GRAY_BED: - case CYAN_BED: - case PURPLE_BED: - case BLUE_BED: - case BROWN_BED: - case GREEN_BED: - case RED_BED: - case BLACK_BED: - case LEGACY_BED_BLOCK: - return true; - default: - break; - } - return false; - } - - public static boolean isStairs(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isStairs(); - } - - public boolean isStairs() { - switch (this) { - case ACACIA_STAIRS: - case BIRCH_STAIRS: - case BRICK_STAIRS: - case COBBLESTONE_STAIRS: - case DARK_OAK_STAIRS: - case DARK_PRISMARINE_STAIRS: - case JUNGLE_STAIRS: - case NETHER_BRICK_STAIRS: - case OAK_STAIRS: - case PRISMARINE_BRICK_STAIRS: - case PRISMARINE_STAIRS: - case PURPUR_STAIRS: - case QUARTZ_STAIRS: - case RED_SANDSTONE_STAIRS: - case SANDSTONE_STAIRS: - case SPRUCE_STAIRS: - case STONE_BRICK_STAIRS: - - case ANDESITE_STAIRS: - case DIORITE_STAIRS: - case END_STONE_BRICK_STAIRS: - case GRANITE_STAIRS: - case MOSSY_COBBLESTONE_STAIRS: - case MOSSY_STONE_BRICK_STAIRS: - case POLISHED_ANDESITE_STAIRS: - case POLISHED_DIORITE_STAIRS: - case POLISHED_GRANITE_STAIRS: - case RED_NETHER_BRICK_STAIRS: - case SMOOTH_QUARTZ_STAIRS: - case SMOOTH_RED_SANDSTONE_STAIRS: - case SMOOTH_SANDSTONE_STAIRS: - case STONE_STAIRS: - - case BLACKSTONE_STAIRS: - case CRIMSON_STAIRS: - case POLISHED_BLACKSTONE_BRICK_STAIRS: - case POLISHED_BLACKSTONE_STAIRS: - case WARPED_STAIRS: - return true; - default: - break; - } - return false; - } - - public static boolean isPotion(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isPotion(); - } - - public boolean isPotion() { - switch (this) { - case POTION: - case LINGERING_POTION: - case SPLASH_POTION: - return true; - default: - break; - } - return false; - } - - public static boolean isBoat(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isBoat(); - } - - public boolean isBoat() { - switch (this) { - case OAK_BOAT: - case ACACIA_BOAT: - case BIRCH_BOAT: - case DARK_OAK_BOAT: - case JUNGLE_BOAT: - case SPRUCE_BOAT: - return true; - default: - break; - } - return false; - } - - public static boolean isSapling(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isSapling(); - } - - public boolean isSapling() { - switch (this) { - case OAK_SAPLING: - case SPRUCE_SAPLING: - case BIRCH_SAPLING: - case JUNGLE_SAPLING: - case ACACIA_SAPLING: - case DARK_OAK_SAPLING: - return true; - default: - break; - } - return false; - } - - public static boolean isButton(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isButton(); - } - - public boolean isButton() { - switch (this) { - case ACACIA_BUTTON: - case BIRCH_BUTTON: - case DARK_OAK_BUTTON: - case JUNGLE_BUTTON: - case OAK_BUTTON: - case SPRUCE_BUTTON: - case STONE_BUTTON: - case POLISHED_BLACKSTONE_BUTTON: - case WARPED_BUTTON: - return true; - default: - break; - } - return false; - } - - public static boolean isWater(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isWater(); - } - - public boolean isWater() { - switch (this) { - case WATER: - case LEGACY_STATIONARY_WATER: - return true; - default: - break; - } - return false; - } - - public static boolean isLava(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isLava(); - } - - public boolean isLava() { - switch (this) { - case LAVA: - case LEGACY_STATIONARY_LAVA: - return true; - default: - break; - } - return false; - } - - public static boolean isPlate(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isPlate(); - } - - public boolean isPlate() { - switch (this) { - case ACACIA_PRESSURE_PLATE: - case BIRCH_PRESSURE_PLATE: - case DARK_OAK_PRESSURE_PLATE: - case HEAVY_WEIGHTED_PRESSURE_PLATE: - case JUNGLE_PRESSURE_PLATE: - case LIGHT_WEIGHTED_PRESSURE_PLATE: - case OAK_PRESSURE_PLATE: - case SPRUCE_PRESSURE_PLATE: - case STONE_PRESSURE_PLATE: - case CRIMSON_PRESSURE_PLATE: - case POLISHED_BLACKSTONE_PRESSURE_PLATE: - case WARPED_PRESSURE_PLATE: - return true; - default: - break; - } - return false; - } - - public static boolean isWool(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isWool(); - } - - public boolean isWool() { - switch (this) { - case BLACK_WOOL: - case BLUE_WOOL: - case BROWN_WOOL: - case CYAN_WOOL: - case GRAY_WOOL: - case GREEN_WOOL: - case LIGHT_BLUE_WOOL: - case LIGHT_GRAY_WOOL: - case LIME_WOOL: - case MAGENTA_WOOL: - case ORANGE_WOOL: - case PINK_WOOL: - case PURPLE_WOOL: - case RED_WOOL: - case WHITE_WOOL: - case YELLOW_WOOL: - return true; - default: - break; - } - return false; - } - - public static boolean isCarpet(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isCarpet(); - } - - public boolean isCarpet() { - switch (this) { - case BLACK_CARPET: - case BLUE_CARPET: - case BROWN_CARPET: - case CYAN_CARPET: - case GRAY_CARPET: - case GREEN_CARPET: - case LIGHT_BLUE_CARPET: - case LIGHT_GRAY_CARPET: - case LIME_CARPET: - case MAGENTA_CARPET: - case ORANGE_CARPET: - case PINK_CARPET: - case PURPLE_CARPET: - case RED_CARPET: - case WHITE_CARPET: - case YELLOW_CARPET: - return true; - default: - break; - } - return false; - } - - public static boolean isShulkerBox(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isShulkerBox(); - } - - public boolean isShulkerBox() { - switch (this) { - case BLACK_SHULKER_BOX: - case BLUE_SHULKER_BOX: - case BROWN_SHULKER_BOX: - case CYAN_SHULKER_BOX: - case GRAY_SHULKER_BOX: - case GREEN_SHULKER_BOX: - case LIGHT_BLUE_SHULKER_BOX: - case LIGHT_GRAY_SHULKER_BOX: - case LIME_SHULKER_BOX: - case MAGENTA_SHULKER_BOX: - case ORANGE_SHULKER_BOX: - case PINK_SHULKER_BOX: - case PURPLE_SHULKER_BOX: - case RED_SHULKER_BOX: - case WHITE_SHULKER_BOX: - case YELLOW_SHULKER_BOX: - case SHULKER_BOX: - return true; - default: - break; - } - return false; - } - - public static boolean isLeatherArmor(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isLeatherArmor(); - } - - public boolean isLeatherArmor() { - switch (this) { - case LEATHER_BOOTS: - case LEATHER_CHESTPLATE: - case LEATHER_HELMET: - case LEATHER_LEGGINGS: - return true; - default: - break; - } - return false; - } - - public static boolean isArmor(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isArmor(); - } - - public boolean isArmor() { - switch (this) { - case NETHERITE_HELMET: - case CHAINMAIL_HELMET: - case DIAMOND_HELMET: - case GOLDEN_HELMET: - case IRON_HELMET: - case LEATHER_HELMET: - - case NETHERITE_CHESTPLATE: - case CHAINMAIL_CHESTPLATE: - case DIAMOND_CHESTPLATE: - case GOLDEN_CHESTPLATE: - case IRON_CHESTPLATE: - case LEATHER_CHESTPLATE: - - case NETHERITE_LEGGINGS: - case CHAINMAIL_LEGGINGS: - case DIAMOND_LEGGINGS: - case GOLDEN_LEGGINGS: - case IRON_LEGGINGS: - case LEATHER_LEGGINGS: - - case NETHERITE_BOOTS: - case CHAINMAIL_BOOTS: - case DIAMOND_BOOTS: - case GOLDEN_BOOTS: - case IRON_BOOTS: - case LEATHER_BOOTS: - - case SHIELD: - case TURTLE_HELMET: - return true; - default: - break; - } - return false; - } - - public static boolean isWeapon(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isWeapon(); - } - - public boolean isWeapon() { - switch (this) { - case DIAMOND_SWORD: - case IRON_SWORD: - case GOLDEN_SWORD: - case STONE_SWORD: - case WOODEN_SWORD: - case BOW: - case CROSSBOW: - case TRIDENT: - case NETHERITE_SWORD: - return true; - default: - break; - } - return false; - } - - public static boolean isTool(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isTool(); - } - - public boolean isTool() { - switch (this) { - case NETHERITE_PICKAXE: - case DIAMOND_PICKAXE: - case GOLDEN_PICKAXE: - case IRON_PICKAXE: - case STONE_PICKAXE: - case WOODEN_PICKAXE: - - case NETHERITE_SHOVEL: - case DIAMOND_SHOVEL: - case GOLDEN_SHOVEL: - case IRON_SHOVEL: - case STONE_SHOVEL: - case WOODEN_SHOVEL: - - case NETHERITE_AXE: - case DIAMOND_AXE: - case GOLDEN_AXE: - case IRON_AXE: - case STONE_AXE: - case WOODEN_AXE: - - case NETHERITE_HOE: - case DIAMOND_HOE: - case GOLDEN_HOE: - case IRON_HOE: - case STONE_HOE: - case WOODEN_HOE: - - case SHEARS: - case FISHING_ROD: - return true; - default: - break; - } - return false; - } - - public static boolean isPickaxe(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isPickaxe(); - } - - public boolean isPickaxe() { - switch (this) { - case NETHERITE_PICKAXE: - case DIAMOND_PICKAXE: - case GOLDEN_PICKAXE: - case IRON_PICKAXE: - case STONE_PICKAXE: - case WOODEN_PICKAXE: - return true; - default: - break; - } - return false; - } - - public static boolean isValidItem(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isValidItem(); - } - - public boolean isValidItem() { - return this != CMIMaterial.NONE && !isAir() && getMaterial() != null; - } - - public static boolean isValidAsItemStack(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - if (m == null) - return false; - return m.isValidItem(); - } - - public boolean isValidAsItemStack() { - - ItemStack item = newItemStack(); - if (item == null || getMaterial() == null) - return false; - - try { - if (!getMaterial().isItem()) - return false; - } catch (Throwable e) { - } - - return isValidItem(); - } - - public boolean isNone() { - return this == CMIMaterial.NONE; - } - - public static boolean isAir(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isAir(); - } - - public boolean isAir() { - switch (this) { - case AIR: - case CAVE_AIR: - case VOID_AIR: - return true; - default: - break; - } - return false; - } - - public static boolean isPotted(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isPotted(); - } - - public boolean isPotted() { - switch (this) { - case POTTED_ACACIA_SAPLING: - case POTTED_ALLIUM: - case POTTED_AZURE_BLUET: - case POTTED_BIRCH_SAPLING: - case POTTED_BLUE_ORCHID: - case POTTED_BROWN_MUSHROOM: - case POTTED_CACTUS: - case POTTED_DANDELION: - case POTTED_DARK_OAK_SAPLING: - case POTTED_DEAD_BUSH: - case POTTED_FERN: - case POTTED_JUNGLE_SAPLING: - case POTTED_OAK_SAPLING: - case POTTED_ORANGE_TULIP: - case POTTED_OXEYE_DAISY: - case POTTED_PINK_TULIP: - case POTTED_POPPY: - case POTTED_RED_MUSHROOM: - case POTTED_RED_TULIP: - case POTTED_SPRUCE_SAPLING: - case POTTED_WHITE_TULIP: - case POTTED_BAMBOO: - case POTTED_CORNFLOWER: - case POTTED_LILY_OF_THE_VALLEY: - case POTTED_WITHER_ROSE: - return true; - default: - break; - } - return false; - } - - public static boolean isAnvil(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isAnvil(); - } - - public boolean isAnvil() { - switch (this) { - case ANVIL: - case CHIPPED_ANVIL: - case DAMAGED_ANVIL: - return true; - default: - break; - } - return false; - } - - public static boolean isDoor(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isDoor(); - } - - public boolean isDoor() { - switch (this) { - case OAK_DOOR: - case IRON_DOOR: - - case LEGACY_SPRUCE_DOOR: - case LEGACY_BIRCH_DOOR: - case LEGACY_JUNGLE_DOOR: - case LEGACY_ACACIA_DOOR: - case LEGACY_DARK_OAK_DOOR: - case LEGACY_WOODEN_DOOR_BLOCK: - -// case SPRUCE_DOOR_ITEM: -// case BIRCH_DOOR_ITEM: -// case JUNGLE_DOOR_ITEM: -// case ACACIA_DOOR_ITEM: -// case DARK_OAK_DOOR_ITEM: -// case WOODEN_DOOR: - case ACACIA_DOOR: - case BIRCH_DOOR: - case DARK_OAK_DOOR: -// case IRON_DOOR_BLOCK: - case JUNGLE_DOOR: - case SPRUCE_DOOR: - case CRIMSON_DOOR: - case WARPED_DOOR: - - return true; - default: - break; - } - return false; - } - - public static boolean isGate(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isGate(); - } - - public boolean isGate() { - switch (this) { - case ACACIA_FENCE_GATE: - case BIRCH_FENCE_GATE: - case DARK_OAK_FENCE_GATE: - case END_GATEWAY: - case JUNGLE_FENCE_GATE: - case OAK_FENCE_GATE: - case SPRUCE_FENCE_GATE: - case CRIMSON_FENCE_GATE: - case WARPED_FENCE_GATE: - return true; - default: - break; - } - return false; - } - - public static boolean isFence(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isFence(); - } - - public boolean isFence() { - switch (this) { - case ACACIA_FENCE: - case BIRCH_FENCE: - case DARK_OAK_FENCE: - case JUNGLE_FENCE: - case NETHER_BRICK_FENCE: - case OAK_FENCE: - case SPRUCE_FENCE: - - case CRIMSON_FENCE: - case WARPED_FENCE: - return true; - default: - break; - } - return false; - } - - public static boolean isRail(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isRail(); - } - - public boolean isRail() { - switch (this) { - case POWERED_RAIL: - case RAIL: - case ACTIVATOR_RAIL: - case DETECTOR_RAIL: - return true; - default: - break; - } - return false; - } - - public static boolean isGlassPane(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isGlassPane(); - } - - public boolean isGlassPane() { - switch (this) { - case BLACK_STAINED_GLASS_PANE: - case BLUE_STAINED_GLASS_PANE: - case BROWN_STAINED_GLASS_PANE: - case CYAN_STAINED_GLASS_PANE: - case GRAY_STAINED_GLASS_PANE: - case GREEN_STAINED_GLASS_PANE: - case LIGHT_BLUE_STAINED_GLASS_PANE: - case LIGHT_GRAY_STAINED_GLASS_PANE: - case LIME_STAINED_GLASS_PANE: - case MAGENTA_STAINED_GLASS_PANE: - case ORANGE_STAINED_GLASS_PANE: - case PINK_STAINED_GLASS_PANE: - case PURPLE_STAINED_GLASS_PANE: - case RED_STAINED_GLASS_PANE: - case WHITE_STAINED_GLASS_PANE: - case YELLOW_STAINED_GLASS_PANE: - case GLASS_PANE: - return true; - default: - break; - } - return false; - } - - public static boolean isWallSign(Material mat) { - CMIMaterial m = get(mat); - return m != null && m.isWallSign(); - } - - public boolean isWallSign() { - switch (this) { - case WALL_SIGN: - case ACACIA_WALL_SIGN: - case BIRCH_WALL_SIGN: - case DARK_OAK_WALL_SIGN: - case JUNGLE_WALL_SIGN: - case OAK_WALL_SIGN: - case SPRUCE_WALL_SIGN: - case CRIMSON_WALL_SIGN: - case WARPED_WALL_SIGN: - return true; - default: - break; - } - return false; - } - - public static boolean isSign(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isSign(); - } - - public boolean isSign() { - switch (this) { - case SIGN: - case WALL_SIGN: - case LEGACY_SIGN_POST: - - case ACACIA_SIGN: - case ACACIA_WALL_SIGN: - - case BIRCH_SIGN: - case BIRCH_WALL_SIGN: - - case DARK_OAK_SIGN: - case DARK_OAK_WALL_SIGN: - - case JUNGLE_SIGN: - case JUNGLE_WALL_SIGN: - - case OAK_SIGN: - case OAK_WALL_SIGN: - - case SPRUCE_SIGN: - case SPRUCE_WALL_SIGN: - - case CRIMSON_SIGN: - case CRIMSON_WALL_SIGN: - - case WARPED_SIGN: - case WARPED_WALL_SIGN: - - return true; - default: - break; - } - return false; - } - - public static boolean isWall(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isWall(); - } - - public boolean isWall() { - switch (this) { - case COBBLESTONE_WALL: - case MOSSY_COBBLESTONE_WALL: - - case ANDESITE_WALL: - case BRICK_WALL: - case DIORITE_WALL: - case END_STONE_BRICK_WALL: - case GRANITE_WALL: - case MOSSY_STONE_BRICK_WALL: - case NETHER_BRICK_WALL: - case PRISMARINE_WALL: - case RED_NETHER_BRICK_WALL: - case RED_SANDSTONE_WALL: - case SANDSTONE_WALL: - case STONE_BRICK_WALL: - return true; - default: - break; - } - return false; - } - - public static boolean isTrapDoor(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isTrapDoor(); - } - - public boolean isTrapDoor() { - switch (this) { - case ACACIA_TRAPDOOR: - case BIRCH_TRAPDOOR: - case DARK_OAK_TRAPDOOR: - case IRON_TRAPDOOR: - case JUNGLE_TRAPDOOR: - case OAK_TRAPDOOR: - case SPRUCE_TRAPDOOR: - case CRIMSON_TRAPDOOR: - case WARPED_TRAPDOOR: - return true; - default: - break; - } - return false; - } - - public static boolean isSkull(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isSkull(); - } - - public boolean isSkull() { - switch (this) { - case SKELETON_SKULL: - case WITHER_SKELETON_SKULL: - case SKELETON_WALL_SKULL: - case WITHER_SKELETON_WALL_SKULL: - case PLAYER_HEAD: - case CREEPER_HEAD: - case DRAGON_HEAD: - case ZOMBIE_HEAD: - case LEGACY_SKULL: - return true; - default: - break; - } - return false; - } - - public static boolean isPlayerHead(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isPlayerHead(); - } - - public boolean isPlayerHead() { - switch (this) { - case PLAYER_HEAD: - case LEGACY_SKULL: - case PLAYER_WALL_HEAD: - return true; - default: - break; - } - return false; - } - - public static boolean isDye(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isDye(); - } - - public boolean isDye() { - switch (this) { - case INK_SAC: - case ROSE_RED: - case CACTUS_GREEN: - case COCOA_BEANS: - case LAPIS_LAZULI: - case PURPLE_DYE: - case CYAN_DYE: - case LIGHT_GRAY_DYE: - case GRAY_DYE: - case PINK_DYE: - case LIME_DYE: - case DANDELION_YELLOW: - case LIGHT_BLUE_DYE: - case MAGENTA_DYE: - case ORANGE_DYE: - case BONE_MEAL: - - case BLACK_DYE: - case BLUE_DYE: - case BROWN_DYE: - case GREEN_DYE: - case RED_DYE: - case WHITE_DYE: - case YELLOW_DYE: - return true; - default: - break; - } - return false; - } - - public static boolean isSlab(Material mat) { - CMIMaterial m = CMIMaterial.get(mat); - return m != null && m.isSlab(); - } - - public boolean isSlab() { - switch (this) { - case ACACIA_SLAB: - case DARK_OAK_SLAB: -// case DOUBLE_STONE_SLAB2: -// case PURPUR_DOUBLE_SLAB: - case BIRCH_SLAB: - case BRICK_SLAB: - case COBBLESTONE_SLAB: - case DARK_PRISMARINE_SLAB: -// case DOUBLE_STONE_SLAB: -// case DOUBLE_SANDSTONE_SLAB: -// case DOUBLE_WOODEN_SLAB: -// case DOUBLE_COBBLESTONE_SLAB: -// case DOUBLE_BRICK_SLAB: -// case DOUBLE_STONE_BRICK_SLAB: -// case DOUBLE_NETHER_BRICK_SLAB: -// case DOUBLE_QUARTZ_SLAB: - case JUNGLE_SLAB: - case NETHER_BRICK_SLAB: - case OAK_SLAB: - case PETRIFIED_OAK_SLAB: - case PRISMARINE_BRICK_SLAB: - case PRISMARINE_SLAB: - case PURPUR_SLAB: - case QUARTZ_SLAB: - case RED_SANDSTONE_SLAB: - case SANDSTONE_SLAB: - case SPRUCE_SLAB: - case STONE_BRICK_SLAB: - case STONE_SLAB: - - case ANDESITE_SLAB: - case CUT_RED_SANDSTONE_SLAB: - case CUT_SANDSTONE_SLAB: - case DIORITE_SLAB: - case END_STONE_BRICK_SLAB: - case GRANITE_SLAB: - case MOSSY_COBBLESTONE_SLAB: - case MOSSY_STONE_BRICK_SLAB: - case POLISHED_ANDESITE_SLAB: - case POLISHED_DIORITE_SLAB: - case POLISHED_GRANITE_SLAB: - case RED_NETHER_BRICK_SLAB: - case SMOOTH_QUARTZ_SLAB: - case SMOOTH_RED_SANDSTONE_SLAB: - case SMOOTH_SANDSTONE_SLAB: - case SMOOTH_STONE_SLAB: - - case BLACKSTONE_SLAB: - case CRIMSON_SLAB: - case POLISHED_BLACKSTONE_BRICK_SLAB: - case POLISHED_BLACKSTONE_SLAB: - case WARPED_SLAB: - return true; - default: - break; - } - return false; - } - - @SuppressWarnings("deprecation") - public static CMISlabType getSlabType(Block block) { - if (!isSlab(block.getType())) - return CMISlabType.NOTSLAB; - - if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) { - if (block.getBlockData() instanceof org.bukkit.block.data.type.Slab) { - org.bukkit.block.data.type.Slab slab = (org.bukkit.block.data.type.Slab) block.getBlockData(); - switch (slab.getType().toString()) { - case "TOP": - return CMISlabType.TOP; - case "BOTTOM": - return CMISlabType.BOTTOM; - case "DOUBLE": - return CMISlabType.DOUBLE; - default: - break; - } - - } - return CMISlabType.NOTSLAB; - } - if (block.getType().name().contains("STEP")) { - switch (CMIMaterial.get(block).getLegacyId()) { - case 44: - switch (block.getData()) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - return CMISlabType.BOTTOM; - default: - return CMISlabType.DOUBLE; - } - case 126: - switch (block.getData()) { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - return CMISlabType.BOTTOM; - default: - return CMISlabType.DOUBLE; - } - case 182: - case 205: - switch (block.getData()) { - case 0: - return CMISlabType.BOTTOM; - default: - return CMISlabType.DOUBLE; - } - default: - break; - } - } - - return CMISlabType.NOTSLAB; - } - - public boolean isCanHavePotionType() { - return isPotion() || this == CMIMaterial.TIPPED_ARROW; - } - - public static String getGeneralMaterialName(String fullName) { - String newName = fullName.toUpperCase(); - if (newName.startsWith("STRIPPED")) { - return newName.replaceFirst("_[^_]+", ""); - } - - if (newName.matches("^(DARK|LIGHT).+")) { - return newName.replaceFirst(".+?_.+?_", ""); - } - - if (newName.matches("^(WHITE|ORANGE|MAGENTA|YELLOW|LIME|PINK|GRAY|CYAN|PURPLE|BLUE|BROWN|GREEN|RED|BLACK|" + - "OAK|SPRUCE|BIRCH|JUNGLE|ACACIA).+")) { - return newName.replaceFirst(".+?_", ""); - } - - if (newName.matches("(?i)^(WHITE|ORANGE|MAGENTA|YELLOW|LIME|PINK|GRAY|CYAN|PURPLE|BLUE|BROWN|GREEN|RED|BLACK|" + - "LIGHT_GRAY|LIGHT_BLUE)$")) { - return "color"; - } - - return fullName; - } - - public static byte getBlockData(Block block) { - @SuppressWarnings("deprecation") - byte data = block.getData(); - if (block.getType() == CMIMaterial.COCOA.getMaterial()) - switch (data) { - case 0: - case 1: - case 2: - case 3: - data = 0; - break; - case 4: - case 5: - case 6: - case 7: - data = 1; - break; - case 8: - case 9: - case 10: - case 11: - data = 2; - break; - default: - break; - } - return data; - } - - public boolean equals(Material mat) { - if (getMaterial() == null) { - return false; - } - return this.getMaterial().equals(mat); - } - - public List getLegacyNames() { - return legacyName == null ? new ArrayList<>() : legacyName; - } - - public void addLegacyName(String legacyName) { - if (legacyName == null || legacyName.isEmpty()) - return; - - if (this.legacyName == null) - this.legacyName = new ArrayList<>(); - - this.legacyName.add(legacyName); - } - - public String getBukkitName() { - if (bukkitName == null) - bukkitName = getMaterial() == null ? "N/A" : getMaterial().name(); - return bukkitName; - } - - public void setBukkitName(String bukkitName) { - this.bukkitName = bukkitName; - } - - public String getMojangName() { - if (mojangName == null) - mojangName = CMIReflections.getItemMinecraftName(this.newItemStack()); - return mojangName; - } - - public void setMojangName(String mojangName) { - this.mojangName = mojangName; - } - - public Set getCriteria() { - return criteria; - } - - public boolean containsCriteria(CMIMaterialCriteria criteria) { - return this.criteria != null && criteria != null && this.criteria.contains(criteria); - } - - public boolean isLegacy() { - return legacy; - } -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMIMaterialCriteria.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMIMaterialCriteria.java deleted file mode 100644 index e024e967..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMIMaterialCriteria.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -public enum CMIMaterialCriteria { - - seeThrow, stars, slab, door, carpet, wool, monsteregg - -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMINBT.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMINBT.java deleted file mode 100644 index 9bfbcf4a..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMINBT.java +++ /dev/null @@ -1,344 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.bukkit.inventory.ItemStack; - -public class CMINBT { - - Object tag; - Object object; - - nmbtType type; - - public enum nmbtType { - item, block, entity; - } - - static { - - } - - public CMINBT(ItemStack item) { - tag = CMIReflections.getNbt(item); - object = item; - type = nmbtType.item; - } - - public Integer getInt(String path) { - if (tag == null) - return null; - if (!this.hasNBT(path)) - return null; - try { - return (Integer) tag.getClass().getMethod("getInt", String.class).invoke(tag, path); - } catch (Exception e) { - return null; - } - } - - public Byte getByte(String path) { - if (tag == null) - return null; - if (!this.hasNBT(path)) - return null; - try { - return (Byte) tag.getClass().getMethod("getByte", String.class).invoke(tag, path); - } catch (Exception e) { - return null; - } - } - - public Long getLong(String path) { - if (tag == null) - return null; - if (!this.hasNBT(path)) - return null; - try { - return (Long) tag.getClass().getMethod("getLong", String.class).invoke(tag, path); - } catch (Exception e) { - return null; - } - } - - public Boolean getBoolean(String path) { - if (tag == null) - return null; - if (!this.hasNBT(path)) - return null; - try { - return (Boolean) tag.getClass().getMethod("getBoolean", String.class).invoke(tag, path); - } catch (Exception e) { - return null; - } - } - - public String getString(String path) { - if (tag == null) - return null; - if (!this.hasNBT(path)) - return null; - try { - - if (tag != null && path.contains(".")) { - List keys = new ArrayList(); - keys.addAll(Arrays.asList(path.split("\\."))); - try { - Object nbtbase = tag.getClass().getMethod("get", String.class).invoke(tag, keys.get(0)); - for (int i = 1; i < keys.size(); i++) { - if (i + 1 < keys.size()) { - nbtbase = nbtbase.getClass().getMethod("get", String.class).invoke(nbtbase, keys.get(i)); - } else { - return nbtbase != null ? (String) nbtbase.getClass().getMethod("getString", String.class).invoke(nbtbase, keys.get(i)) : null; - } - } - } catch (Throwable e) { - } - } - - return (String) tag.getClass().getMethod("getString", String.class).invoke(tag, path); - } catch (Exception e) { - return null; - } - } - - public List getList(String path) { - if (tag == null) - return null; - if (!this.hasNBT(path)) - return null; - List list = new ArrayList(); - try { - Object ls = tag.getClass().getMethod("getList", String.class, int.class).invoke(tag, path, 8); - int size = (int) ls.getClass().getMethod("size").invoke(ls); - Method method = ls.getClass().getMethod("get", int.class); - - if (Version.isCurrentEqualOrLower(Version.v1_12_R1)) { - method = ls.getClass().getMethod("getString", int.class); - for (int i = 0; i < size; i++) { - Object ress = method.invoke(ls, i); - String line = (String) ress; - list.add(line); - } - } else { - Object nbtbase = tag.getClass().getMethod("get", String.class).invoke(tag, path); - Method baseMethod = nbtbase.getClass().getMethod(Version.isCurrentEqualOrLower(Version.v1_12_R1) ? "toString" : "asString"); - for (int i = 0; i < size; i++) { - list.add((String) baseMethod.invoke(method.invoke(ls, i))); - } - } - return list; - } catch (Exception e) { - return null; - } - } - - public Short getShort(String path) { - if (tag == null) - return null; - try { - return (Short) tag.getClass().getMethod("getShort", String.class).invoke(tag, path); - } catch (Exception e) { - return null; - } - } - - public Object setBoolean(String path, Boolean value) { - switch (type) { - case block: - break; - case entity: - break; - case item: - try { - if (value == null) { - Method meth = tag.getClass().getMethod("remove", String.class); - meth.invoke(tag, path); - } else { - Method meth = tag.getClass().getMethod("setBoolean", String.class, boolean.class); - meth.invoke(tag, path, value); - } - return CMIReflections.setTag((ItemStack) object, tag); - } catch (Throwable e) { - if (Version.isCurrentEqualOrHigher(Version.v1_7_R4)) - e.printStackTrace(); - return object; - } - default: - break; - } - return object; - } - - public Object setByte(String path, Byte value) { - switch (type) { - case block: - break; - case entity: - break; - case item: - try { - if (value == null) { - Method meth = tag.getClass().getMethod("remove", String.class); - meth.invoke(tag, path); - } else { - Method meth = tag.getClass().getMethod("setByte", String.class, byte.class); - meth.invoke(tag, path, value); - } - return CMIReflections.setTag((ItemStack) object, tag); - } catch (Throwable e) { - if (Version.isCurrentEqualOrHigher(Version.v1_7_R4)) - e.printStackTrace(); - return object; - } - default: - break; - } - return object; - } - - public Object setShort(String path, Short value) { - switch (type) { - case block: - break; - case entity: - break; - case item: - try { - if (value == null) { - Method meth = tag.getClass().getMethod("remove", String.class); - meth.invoke(tag, path); - } else { - Method meth = tag.getClass().getMethod("setShort", String.class, short.class); - meth.invoke(tag, path, value); - } - return CMIReflections.setTag((ItemStack) object, tag); - } catch (Throwable e) { - if (Version.isCurrentEqualOrHigher(Version.v1_7_R4)) - e.printStackTrace(); - return object; - } - default: - break; - } - return object; - } - - public Object setString(String path, String value) { - switch (type) { - case block: - break; - case entity: - break; - case item: - try { - if (value == null) { - Method meth = tag.getClass().getMethod("remove", String.class); - meth.invoke(tag, path); - } else { - Method meth = tag.getClass().getMethod("setString", String.class, String.class); - meth.invoke(tag, path, value); - } - return CMIReflections.setTag((ItemStack) object, tag); - } catch (Throwable e) { - if (Version.isCurrentEqualOrHigher(Version.v1_7_R4)) - e.printStackTrace(); - return object; - } - default: - break; - } - return object; - } - - public Object setInt(String path, Integer value) { - switch (type) { - case block: - break; - case entity: - break; - case item: - try { - - if (value == null) { - Method meth = tag.getClass().getMethod("remove", String.class); - meth.invoke(tag, path); - } else { - Method meth = tag.getClass().getMethod("setInt", String.class, int.class); - meth.invoke(tag, path, value); - } - return CMIReflections.setTag((ItemStack) object, tag); - } catch (Throwable e) { - if (Version.isCurrentEqualOrHigher(Version.v1_7_R4)) - e.printStackTrace(); - return object; - } - default: - break; - } - return object; - } - - public Object setLong(String path, Long value) { - switch (type) { - case block: - break; - case entity: - break; - case item: - try { - if (value == null) { - Method meth = tag.getClass().getMethod("remove", String.class); - meth.invoke(tag, path, value); - } else { - Method meth = tag.getClass().getMethod("setLong", String.class, long.class); - meth.invoke(tag, path, value); - } - return CMIReflections.setTag((ItemStack) object, tag); - } catch (Throwable e) { - if (Version.isCurrentEqualOrHigher(Version.v1_7_R4)) - e.printStackTrace(); - return object; - } - default: - break; - } - return object; - } - - public boolean hasNBT() { - return tag != null; - } - - public boolean hasNBT(String key) { - if (tag != null && key.contains(".")) { - List keys = new ArrayList(); - keys.addAll(Arrays.asList(key.split("\\."))); - try { - Object nbtbase = tag.getClass().getMethod("get", String.class).invoke(tag, keys.get(0)); - for (int i = 1; i < keys.size(); i++) { - if (i + 1 < keys.size()) { - nbtbase = nbtbase.getClass().getMethod("get", String.class).invoke(nbtbase, keys.get(i)); - } else { - return nbtbase != null && (Boolean) nbtbase.getClass().getMethod("hasKey", String.class).invoke(nbtbase, keys.get(i)); - } - } - } catch (Throwable e) { - } - return false; - } - try { - return tag != null && (Boolean) tag.getClass().getMethod("hasKey", String.class).invoke(tag, key); - } catch (Throwable e) { - e.printStackTrace(); - } - return false; - } - - public Object getNbt() { - return tag; - } -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMIReflections.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMIReflections.java deleted file mode 100644 index 7d032346..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMIReflections.java +++ /dev/null @@ -1,406 +0,0 @@ -/** - * Copyright (C) 2017 Zrips - */ - -package com.gamingmesh.jobs.CMILib; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.UUID; - -import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; - -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; - -public class CMIReflections { - - //private Class CraftServerClass; - //private Object CraftServer; - - private static Class NBTTagCompound; - private static Class NBTBase; -// private Class NBTTagList; - - private static Class CraftItemStack; - private static Class Item; - private static Class IStack; - - static { - try { - //CraftServerClass = getBukkitClass("CraftServer"); - //CraftServer = CraftServerClass.cast(Bukkit.getServer()); - NBTTagCompound = getMinecraftClass("NBTTagCompound"); - NBTBase = getMinecraftClass("NBTBase"); - /*try { - NBTTagList = getMinecraftClass("NBTTagList"); - } catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) { - e.printStackTrace(); - }*/ - CraftItemStack = getBukkitClass("inventory.CraftItemStack"); - try { - Item = getMinecraftClass("Item"); - } catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) { - e.printStackTrace(); - } - IStack = getMinecraftClass("ItemStack"); - } catch (ClassCastException | ClassNotFoundException e) { - e.printStackTrace(); - } - } - - public static String toJson(ItemStack item) { - if (item == null) - return null; - - Object nmsStack = asNMSCopy(item); - - try { - Method meth = IStack.getMethod("save", NBTTagCompound); - Object res = meth.invoke(nmsStack, NBTTagCompound.newInstance()); - return res.toString(); - } catch (Throwable e) { - e.printStackTrace(); - } - - return null; - } - - private static Class getBukkitClass(String nmsClassString) throws ClassNotFoundException { - return Class.forName("org.bukkit.craftbukkit." + Version.getCurrent() + "." + nmsClassString); - } - - public static Class getMinecraftClass(String nmsClassString) throws ClassNotFoundException { - return Class.forName("net.minecraft.server." + Version.getCurrent() + "." + nmsClassString); - } - - public ItemStack removeNbt(ItemStack item, String base, String path) { - if (item == null) - return null; - try { - Object nmsStack = asNMSCopy(item); - Method methTag = nmsStack.getClass().getMethod("getTag"); - Object tag = methTag.invoke(nmsStack); - if (tag == null) - return item; - - Method compountMeth = tag.getClass().getMethod("getCompound", String.class); - Object compountTag = compountMeth.invoke(tag, base); - - if (compountTag == null) - return item; - - Method meth = compountTag.getClass().getMethod("remove", String.class); - meth.invoke(compountTag, path); - - Method mm = tag.getClass().getMethod("set", String.class, NBTBase); - mm.invoke(tag, base, compountTag); - - Method meth2 = nmsStack.getClass().getMethod("setTag", NBTTagCompound); - meth2.invoke(nmsStack, tag); - return (ItemStack) asBukkitCopy(nmsStack); - } catch (Throwable e) { - e.printStackTrace(); - return null; - } - } - - public ItemStack removeNbt(ItemStack item, String path) { - if (item == null) - return null; - try { - Object nmsStack = asNMSCopy(item); - Method methTag = nmsStack.getClass().getMethod("getTag"); - Object tag = methTag.invoke(nmsStack); - if (tag == null) - return item; - - Method meth = tag.getClass().getMethod("remove", String.class); - meth.invoke(tag, path); - - Method meth2 = nmsStack.getClass().getMethod("setTag", NBTTagCompound); - meth2.invoke(nmsStack, tag); - return (ItemStack) asBukkitCopy(nmsStack); - } catch (Throwable e) { - e.printStackTrace(); - return null; - } - } - - public boolean hasNbt(ItemStack item, String base) { - if (item == null) - return false; - try { - Object nbt = getNbt(item); - if (nbt == null) - return false; - Method meth = nbt.getClass().getMethod("getCompound", String.class); - Object res = meth.invoke(nbt, base); - return res != null; - } catch (Throwable e) { - return false; - } - } - - public boolean hasNbtString(ItemStack item, String base) { - if (item == null) - return false; - try { - Object nbt = getNbt(item); - if (nbt == null) - return false; - Method meth = nbt.getClass().getMethod("getString", String.class); - Object res = meth.invoke(nbt, base); - return res != null; - } catch (Throwable e) { - return false; - } - } - - public static Object getNbt(ItemStack item) { - if (item == null) - return null; - try { - Object nmsStack = asNMSCopy(item); - Method methTag = nmsStack.getClass().getMethod("getTag"); - Object tag = methTag.invoke(nmsStack); - return tag; - } catch (Throwable e) { - return null; - } - } - - public Object getNbt(ItemStack item, String base, String path) { - if (item == null) - return null; - try { - Object nbt = getNbt(item); - if (nbt == null) - return null; - - Method compoundMeth = nbt.getClass().getMethod("getCompound", String.class); - Object compoundRes = compoundMeth.invoke(nbt, base); - - if (compoundRes == null) - return null; - - Method meth = compoundRes.getClass().getMethod("getString", String.class); - Object res = meth.invoke(compoundRes, path); - return res; - } catch (Throwable e) { - return null; - } - } - - public static ItemStack setNbt(ItemStack item, String path, String value) { - if (item == null) - return null; - try { - Object nmsStack = asNMSCopy(item); - if (nmsStack == null) - return item; - Method methTag = nmsStack.getClass().getMethod("getTag"); - Object tag = methTag.invoke(nmsStack); - if (tag == null) - tag = NBTTagCompound.newInstance(); - Method meth = tag.getClass().getMethod("setString", String.class, String.class); - meth.invoke(tag, path, value); - Method meth2 = nmsStack.getClass().getMethod("setTag", NBTTagCompound); - meth2.invoke(nmsStack, tag); - return (ItemStack) asBukkitCopy(nmsStack); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - public static Object getNbt(ItemStack item, String path) { - if (item == null) - return null; - try { - Object nbt = getNbt(item); - if (nbt == null) - return null; - - Method meth = nbt.getClass().getMethod("getString", String.class); - Object res = meth.invoke(nbt, path); - return res; - } catch (Throwable e) { - return null; - } - } - - public static Object asNMSCopy(ItemStack item) { - try { - Method meth = CraftItemStack.getMethod("asNMSCopy", ItemStack.class); - return meth.invoke(CraftItemStack, item); - } catch (Throwable e) { - e.printStackTrace(); - return null; - } - } - - public static Object asBukkitCopy(Object item) { - try { - Method meth = CraftItemStack.getMethod("asBukkitCopy", IStack); - return meth.invoke(CraftItemStack, item); - } catch (Throwable e) { - return null; - } - } - - public static String getItemMinecraftName(ItemStack item) { - try { - - Object nmsStack = asNMSCopy(item); - if (nmsStack == null) - return null; - if (Version.isCurrentEqualOrHigher(Version.v1_13_R1)) { - Object pre = nmsStack.getClass().getMethod("getItem").invoke(nmsStack); - Object n = pre.getClass().getMethod("getName").invoke(pre); - Class ll = Class.forName("net.minecraft.server." + Version.getCurrent() + ".LocaleLanguage"); - Object lla = ll.getMethod("a").invoke(ll); - return (String) lla.getClass().getMethod("a", String.class).invoke(lla, (String) n); - } - - Field field = Item.getField("REGISTRY"); - Object reg = field.get(field); - Method meth = reg.getClass().getMethod("b", Object.class); - meth.setAccessible(true); - Method secmeth = nmsStack.getClass().getMethod("getItem"); - Object res2 = secmeth.invoke(nmsStack); - Object res = meth.invoke(reg, res2); - return res.toString(); - } catch (Exception e) { - return null; - } - } - - public String getItemMinecraftNamePath(ItemStack item) { - try { - Object nmsStack = asNMSCopy(item); - Method itemMeth = Item.getMethod("getById", int.class); - @SuppressWarnings("deprecation") - Object res = itemMeth.invoke(Item, item.getType().getId()); - Method nameThingy = Item.getMethod("j", IStack); - Object resThingy = nameThingy.invoke(res, nmsStack); - return resThingy.toString(); - } catch (Throwable e) { - return null; - } - } - - public static ItemStack getItemInOffHand(org.bukkit.entity.Player player) { - return Version.getCurrent().isLower(Version.v1_9_R1) ? null : player.getInventory().getItemInOffHand(); - } - - public static int getEggId(ItemStack item) { - EntityType type = getEggType(item); - return type == null ? 0 : type.getTypeId(); - } - - public static EntityType getEggType(ItemStack item) { - if (!CMIMaterial.isMonsterEgg(item.getType())) - return null; - - if (Version.isCurrentEqual(Version.v1_12_R1)) { - try { - if (Version.isCurrentEqualOrLower(Version.v1_11_R1)) { - CMIEntityType cmiType = CMIEntityType.getById(item.getData().getData()); - if (cmiType != null) - return cmiType.getType(); - } - Object tag = getNbt(item); - Object base = tag.getClass().getMethod("getCompound", String.class).invoke(tag, "EntityTag"); - String type = (String) base.getClass().getMethod("getString", String.class).invoke(base, "id"); - return EntityType.fromName(type.replace("minecraft:", "").toUpperCase()); - } catch (Exception e) { - return null; - } - } - - CMIEntityType type = CMIEntityType.getByName(item.getType().toString().replace("_SPAWN_EGG", "")); - return type == null ? null : type.getType(); - } - - public static ItemStack setEggType(ItemStack item, EntityType etype) { - if (!item.getType().toString().contains("_EGG")) - return null; - try { - Object tag = getNbt(item); - - Object ttag = tag.getClass().getMethod("getCompound", String.class).invoke(tag, "EntityTag"); - - if (ttag == null) - ttag = NBTTagCompound.newInstance(); - - CMIEntityType ce = CMIEntityType.getByType(etype); - if (ce == null) - return item; - - ttag.getClass().getMethod("setString", String.class, String.class).invoke(ttag, "id", ce.getName()); - - tag.getClass().getMethod("set", String.class, NBTTagCompound).invoke(tag, "EntityTag", ttag); - setTag(item, tag); - - return (ItemStack) asBukkitCopy(item); - } catch (Exception e) { - return null; - } - } - - public static ItemStack setTag(ItemStack item, Object tag) { - try { - Object nmsStack = asNMSCopy(item); - if (nmsStack == null) { - return null; - } - Method meth2 = nmsStack.getClass().getMethod("setTag", NBTTagCompound); - meth2.invoke(nmsStack, tag); - return (ItemStack) asBukkitCopy(nmsStack); - } catch (Throwable e) { - if (Version.isCurrentEqualOrHigher(Version.v1_7_R4)) - e.printStackTrace(); - return item; - } - } - - public static ItemStack setSkullTexture(ItemStack item, String customProfileName, String texture) { - if (item == null) - return null; - try { - - GameProfile prof = new GameProfile(UUID.nameUUIDFromBytes(texture.getBytes()), null); - prof.getProperties().removeAll("textures"); - prof.getProperties().put("textures", new Property("textures", texture)); - -// ItemMeta headMeta = item.getItemMeta(); - SkullMeta headMeta = (SkullMeta) item.getItemMeta(); - - Field profileField = null; - try { - profileField = headMeta.getClass().getDeclaredField("profile"); - } catch (NoSuchFieldException | SecurityException e) { - e.printStackTrace(); - } - if (profileField != null) { - profileField.setAccessible(true); - try { - profileField.set(headMeta, prof); - } catch (IllegalArgumentException | IllegalAccessException e) { - e.printStackTrace(); - } - item.setItemMeta(headMeta); - } - - Object i = new CMINBT(item).setString("Id", UUID.nameUUIDFromBytes(texture.getBytes()).toString()); - - return i == null ? null : (ItemStack) i; - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/CMISlabType.java b/src/main/java/com/gamingmesh/jobs/CMILib/CMISlabType.java deleted file mode 100644 index 4ba19346..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/CMISlabType.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -public enum CMISlabType { - TOP, - BOTTOM, - DOUBLE, - NOTSLAB; -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/ConfigReader.java b/src/main/java/com/gamingmesh/jobs/CMILib/ConfigReader.java deleted file mode 100644 index 787bdbc8..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/ConfigReader.java +++ /dev/null @@ -1,465 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.nio.charset.Charset; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.HashMap; -import java.util.List; - -import org.bukkit.Location; -import org.bukkit.configuration.InvalidConfigurationException; -import org.bukkit.configuration.file.YamlConfiguration; - -import com.gamingmesh.jobs.Jobs; -import com.google.common.io.Files; - -/* - * Made by Zrips - */ - -public class ConfigReader extends YamlConfiguration { - private HashMap comments; - private HashMap contents; - private YamlConfiguration config; - private String p = null; - private File file = null; - private boolean recordContents = false; - - public ConfigReader(String fileName) { - this(new File(Jobs.getFolder(), fileName)); - } - - public ConfigReader(File file) { - super(); - comments = new HashMap<>(); - contents = new HashMap<>(); - this.file = file; - this.config = getyml(file); - } - - public void load() { - try { - this.load(file); - } catch (IOException | InvalidConfigurationException e) { - e.printStackTrace(); - } - } - - @Override - public void save(String file) throws IOException { - if (file == null) { - throw new IllegalArgumentException("File cannot be null"); - } - - save(new File(file)); - } - - @Override - public void save(File file) throws IOException { - if (file == null) { - throw new IllegalArgumentException("File cannot be null"); - } - Files.createParentDirs(file); - String data = insertComments(saveToString()); - PrintWriter writer = new PrintWriter(file, "UTF-8"); - try { - writer.write(data); - } finally { - writer.close(); - } - } - - private String insertComments(String yaml) { - if (!comments.isEmpty()) { - String[] yamlContents = yaml.split("[" + System.getProperty("line.separator") + "]"); - StringBuilder newContents = new StringBuilder(); - StringBuilder currentPath = new StringBuilder(); - boolean commentedPath = false; - boolean node = false; - int depth = 0; - - boolean firstLine = true; - for (final String line : yamlContents) { - if (firstLine) { - firstLine = false; - if (line.startsWith("#")) { - continue; - } - } - - boolean keyOk = true; - if (line.contains(": ")) { - int index = 0; - index = line.indexOf(": "); - if (index < 0) { - index = line.length() - 1; - } - int whiteSpace = 0; - for (int n = 0; n < line.length(); n++) { - if (line.charAt(n) == ' ') { - whiteSpace++; - } else { - break; - } - } - String key = line.substring(whiteSpace, index); - if (key.contains(" ")) - keyOk = false; - else if (key.contains("&")) - keyOk = false; - else if (key.contains(".")) - keyOk = false; - else if (key.contains("'")) - keyOk = false; - else if (key.contains("\"")) - keyOk = false; - } - - if (line.contains(": ") && keyOk || (line.length() > 1 && line.charAt(line.length() - 1) == ':')) { - commentedPath = false; - node = true; - - int index = 0; - index = line.indexOf(": "); - if (index < 0) { - index = line.length() - 1; - } - if (currentPath.toString().isEmpty()) { - currentPath = new StringBuilder(line.substring(0, index)); - } else { - int whiteSpace = 0; - for (int n = 0; n < line.length(); n++) { - if (line.charAt(n) == ' ') { - whiteSpace++; - } else { - break; - } - } - if (whiteSpace / 2 > depth) { - currentPath.append(".").append(line.substring(whiteSpace, index)); - depth++; - } else if (whiteSpace / 2 < depth) { - int newDepth = whiteSpace / 2; - for (int i = 0; i < depth - newDepth; i++) { - currentPath.replace(currentPath.lastIndexOf("."), currentPath.length(), ""); - } - int lastIndex = currentPath.lastIndexOf("."); - if (lastIndex < 0) { - currentPath = new StringBuilder(); - } else { - currentPath.replace(currentPath.lastIndexOf("."), currentPath.length(), "").append("."); - } - currentPath.append(line.substring(whiteSpace, index)); - depth = newDepth; - } else { - int lastIndex = currentPath.lastIndexOf("."); - if (lastIndex < 0) { - currentPath = new StringBuilder(); - } else { - currentPath.replace(currentPath.lastIndexOf("."), currentPath.length(), "").append("."); - } - currentPath.append(line.substring(whiteSpace, index)); - } - } - } else { - node = false; - } - StringBuilder newLine = new StringBuilder(line); - if (node) { - String comment = null; - if (!commentedPath) { - comment = comments.get(currentPath.toString()); - } - if (comment != null && !comment.isEmpty()) { - newLine.insert(0, System.getProperty("line.separator")).insert(0, comment); - comment = null; - commentedPath = true; - } - } - newLine.append(System.getProperty("line.separator")); - newContents.append(newLine.toString()); - } - - return newContents.toString(); - } - return yaml; - } - - public void appendComment(String path, String... commentLines) { - addComment(path, true, commentLines); - } - - public void addComment(String path, String... commentLines) { - addComment(path, false, commentLines); - } - - public void addComment(String path, boolean append, String... commentLines) { - if (this.p != null) - path = this.p + path; - - StringBuilder commentstring = new StringBuilder(); - if (append && comments.containsKey(path)) { - commentstring.append(comments.get(path)); - } - - String leadingSpaces = ""; - for (int n = 0; n < path.length(); n++) { - if (path.charAt(n) == '.') { - leadingSpaces += " "; - } - } - for (String line : commentLines) { - if (!line.isEmpty()) { - line = leadingSpaces + "# " + line; - } - if (commentstring.length() > 0) { - commentstring.append(System.getProperty("line.separator")); - } - commentstring.append(line); - } - comments.put(path, commentstring.toString()); - } - - public YamlConfiguration getyml(File file) { - YamlConfiguration config = new YamlConfiguration(); - FileInputStream fileinputstream = null; - - try { - fileinputstream = new FileInputStream(file); - InputStreamReader str = new InputStreamReader(fileinputstream, Charset.forName("UTF-8")); - - config.load(str); - str.close(); - } catch (FileNotFoundException e) { - } catch (InvalidConfigurationException | IOException e) { - saveToBackup(); - System.out.println(e.getLocalizedMessage()); - } finally { - if (fileinputstream != null) - try { - fileinputstream.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - return config; - } - - public void saveToBackup() { - saveToBackup(true); - } - - public void saveToBackup(boolean inform) { - File cc = new File(Jobs.getFolder(), "FileBackups"); - if (!cc.isDirectory()) - cc.mkdir(); - - Date date = new Date(); - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss "); - String newFileName = dateFormat.format(date) + file.getName(); - if (inform) - Jobs.consoleMsg("&cFailed to load " + file.getName() + "! Backup have been saved into " + Jobs.getFolder().getPath() + File.separator + "FileBackups" - + File.separator + newFileName); - - File f = new File(Jobs.getFolder(), "FileBackups" + File.separator + newFileName); -// file.renameTo(f); - try { - Files.copy(file, f); - } catch (IOException e) { - e.printStackTrace(); - } - } - - public void save() { - try { - save(file); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static void newLn(StringBuilder header) { - header.append(System.lineSeparator()); - } - - private static StringBuilder formStringBuilder(List list) { - StringBuilder header = new StringBuilder(); - for (String one : list) { - header.append(one); - newLn(header); - } - return header; - } - - public void header(List list) { - options().header(formStringBuilder(list).toString()); - } - - String[] waitingComment = null; - - private void checkWaitingComment(String path) { - if (waitingComment == null) - return; - addComment(path, waitingComment); - waitingComment = null; - } - - public YamlConfiguration getC() { - return config; - } - - public void copyDefaults(boolean value) { - getC().options().copyDefaults(value); - } - - private String process(String path, Object value) { - if (this.p != null) - path = this.p + path; - checkWaitingComment(path); - config.addDefault(path, value); - copySetting(path); - return path; - } - - public Boolean get(String path, Boolean boo) { - path = process(path, boo); - return config.getBoolean(path); - } - - public Object get(String path, Location boo) { - path = process(path, boo); - return config.get(path); - } - - public int get(String path, int boo) { - path = process(path, boo); - return config.getInt(path); - } - - public int get(String path, Integer boo) { - path = process(path, boo); - return config.getInt(path); - } - - public List getIntList(String path, List list) { - path = process(path, list); - return config.getIntegerList(path); - } - - public List get(String path, List list) { - path = process(path, list); - if (recordContents) { - contents.put(path, config.isList(path) ? config.getStringList(path) : list); - } - - List ls = config.getStringList(path); - for (int p = 0; p < ls.size(); p++) { - String st = convertUnicode(ls.get(p)); - ls.set(p, st); - } - - return ls; - } - - public String get(String path, String boo) { - path = process(path, boo); - if (recordContents) - contents.put(path, config.isString(path) ? config.getString(path) : boo); - - return convertUnicode(config.getString(path)); - } - - public Double get(String path, Double boo) { - path = process(path, boo); - return config.getDouble(path); - } - - private static String convertUnicode(String st) { - try { - if (!st.contains("\\u")) - return st; - - StringBuilder sb = new StringBuilder(st.length()); - for (int i = 0; i < st.length(); i++) { - char ch = st.charAt(i); - if (ch == '\\') { - char nextChar = (i == st.length() - 1) ? '\\' : st.charAt(i + 1); - if (nextChar >= '0' && nextChar <= '7') { - String code = "" + nextChar; - i++; - if ((i < st.length() - 1) && st.charAt(i + 1) >= '0' && st.charAt(i + 1) <= '7') { - code += st.charAt(i + 1); - i++; - if ((i < st.length() - 1) && st.charAt(i + 1) >= '0' && st.charAt(i + 1) <= '7') { - code += st.charAt(i + 1); - i++; - } - } - sb.append((char) Integer.parseInt(code, 8)); - continue; - } - switch (nextChar) { - case 'u': - if (i >= st.length() - 5) { - ch = 'u'; - break; - } - try { - int code = Integer.parseInt("" + st.charAt(i + 2) + st.charAt(i + 3) + st.charAt(i + 4) + st.charAt(i + 5), 16); - sb.append(Character.toChars(code)); - } catch (NumberFormatException e) { - sb.append("\\"); - continue; - } - i += 5; - continue; - default: - sb.append("\\"); - continue; - } - i++; - } - sb.append(ch); - } - return sb.toString(); - } catch (Exception e) { - e.printStackTrace(); - return st; - } - } - - private synchronized void copySetting(String path) { - set(path, config.get(path)); - } - - public void resetP() { - p = null; - } - - public void setP(String cmd) { - this.p = cmd; - } - - public String getPath() { - return this.p; - } - - public void setRecordContents(boolean recordContents) { - this.recordContents = recordContents; - } - - public HashMap getContents() { - return contents; - } - - public File getFile() { - return file; - } -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java b/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java deleted file mode 100644 index e3b9164a..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/ItemManager.java +++ /dev/null @@ -1,422 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import java.util.HashMap; -import java.util.UUID; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.MapMeta; -import org.bukkit.inventory.meta.PotionMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.potion.PotionData; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.potion.PotionType; - -import com.gamingmesh.jobs.Jobs; - -public class ItemManager { - - static HashMap byRealMaterial = new HashMap<>(); - static HashMap byId = new HashMap<>(); - static HashMap byName = new HashMap<>(); - - public HashMap idMap() { - return byId; - } - - public HashMap NameMap() { - return byName; - } - - static { - byRealMaterial.clear(); - for (CMIMaterial one : CMIMaterial.values()) { - if (one == null) - continue; - - // Ignoring legacy materials on new servers - if (Version.isCurrentEqualOrHigher(Version.v1_13_R1) && one.isLegacy()) { - continue; - } - - one.updateMaterial(); - Material mat = one.getMaterial(); - - if (mat == null) { - continue; - } - -// Integer id = one.getId(); - short data = one.getLegacyData(); - Integer legacyId = one.getLegacyId(); - String cmiName = one.getName().replace("_", "").replace(" ", "").toLowerCase(); - String materialName = one.toString().replace("_", "").replace(" ", "").toLowerCase(); - - String mojangName = null; - try { - if (Version.isCurrentEqualOrLower(Version.v1_14_R1) || mat.isItem()) - mojangName = CMIReflections.getItemMinecraftName(new ItemStack(mat)); - } catch (Exception e) { - e.printStackTrace(); - } - if (mojangName == null) { - mojangName = mat.toString(); - } - - mojangName = mojangName == null ? mat.toString().replace("_", "").replace(" ", "").toLowerCase() : mojangName.replace("_", "").replace(" ", "").toLowerCase(); - - if (one.isCanHavePotionType()) { - for (PotionType potType : PotionType.values()) { - byName.put(cmiName + ":" + potType.toString().toLowerCase(), one); - } - } - if (byName.containsKey(cmiName) && Version.isCurrentEqualOrLower(Version.v1_13_R1)) { - byName.put(cmiName + ":" + data, one); - } else - byName.put(cmiName, one); - - byName.put(materialName, one); - if (Version.isCurrentEqualOrLower(Version.v1_13_R1) && !byName.containsKey(cmiName + ":" + data)) - byName.put(cmiName + ":" + data, one); - - if (!one.getLegacyNames().isEmpty()) { - for (String oneL : one.getLegacyNames()) { - String legacyName = oneL.replace("_", "").replace(" ", "").toLowerCase(); - if (Version.isCurrentEqualOrLower(Version.v1_13_R1) && (byName.containsKey(legacyName) || data > 0)) { - byName.put(legacyName + ":" + data, one); - } - byName.put(legacyName, one); - } - } - - if (byName.containsKey(mojangName) && Version.isCurrentEqualOrLower(Version.v1_13_R1)) - byName.put(mojangName + ":" + data, one); - else - byName.put(mojangName, one); - - if (Version.isCurrentEqualOrLower(Version.v1_13_R1)) { - Integer id = one.getId(); - if (byName.containsKey(String.valueOf(id)) || data > 0) - byName.put(id + ":" + data, one); - else - byName.put(String.valueOf(id), one); - if (!byId.containsKey(id)) - byId.put(id, one); - if (!byId.containsKey(one.getLegacyId())) - byId.put(one.getLegacyId(), one); - if (one.getLegacyData() == 0) - byId.put(one.getLegacyId(), one); - if (byName.containsKey(String.valueOf(legacyId)) || data > 0) - byName.put(legacyId + ":" + data, one); - else - byName.put(String.valueOf(legacyId), one); - } - - byRealMaterial.put(mat, one); - } - } - - @Deprecated - public CMIItemStack getItem(Material mat) { - CMIMaterial cmat = CMIMaterial.get(mat); - return cmat == null || cmat == CMIMaterial.NONE ? null : new CMIItemStack(cmat); - } - - public static CMIItemStack getItem(CMIMaterial mat) { - return mat == null || mat == CMIMaterial.NONE ? null : new CMIItemStack(mat); - } - - public static CMIItemStack getItem(ItemStack item) { - if (item == null) - item = new ItemStack(Material.AIR); - CMIItemStack cm = getItem(CMIMaterial.get(item)); - if (cm == null) - return new CMIItemStack(Material.AIR); - cm.setItemStack(item); - return cm; - } - - HashMap headCache = new HashMap<>(); - - public CMIItemStack getItem(String name) { - return getItem(name, null); - } - - public CMIItemStack getItem(String name, CMIAsyncHead ahead) { - if (name == null) - return null; -// if (byBukkitName.isEmpty()) -// load(); - CMIItemStack cm = null; - String original = name.replace("minecraft:", ""); - name = name.toLowerCase().replace("minecraft:", ""); - name = name.replace("_", ""); - Integer amount = null; - CMIEntityType entityType = null; - - String tag = null; - - if (name.contains("{") && name.contains("}")) { - Pattern ptr = Pattern.compile("(\\{).+(\\})"); - Matcher match = ptr.matcher(name); - if (match.find()) { - tag = match.group(); - name = name.replace(match.group(), ""); - } - name = name.replace(" ", " "); - } - - String subdata = null; - if (name.contains(":")) { - CMIMaterial mat = byName.get(name); - if (mat != null) - return new CMIItemStack(mat); - try { - subdata = name.split(":")[1]; - } catch (Throwable e) { - - } - } - - if (name.contains("-")) { - String[] split = name.split("-"); - if (split.length > 1) { - String a = name.split("-")[1]; - try { - amount = Integer.parseInt(a); - } catch (Exception e) { - } - } - name = name.split("-")[0]; - } - - if (name.contains(">")) { - String[] split = name.split(">"); - if (split.length > 1) { - String a = name.split(">")[1]; - try { - amount = Integer.parseInt(a); - } catch (Exception e) { - } - } - name = name.split(">")[0]; - } - - short data = -999; - - if (name.contains(":")) { - try { - data = (short) Integer.parseInt(name.split(":")[1]); - } catch (Exception e) { - } - try { - entityType = CMIEntityType.getByName(name.split(":")[1]); - if (entityType != null) - data = (short) entityType.getId(); - } catch (Exception e) { - } - name = name.split(":")[0]; - } - - switch (name.toLowerCase()) { - case "skull": - cm = CMIMaterial.SKELETON_SKULL.newCMIItemStack(); - break; - case "door": - cm = CMIMaterial.SPRUCE_DOOR.newCMIItemStack(); - break; - case "head": - cm = CMIMaterial.PLAYER_HEAD.newCMIItemStack(); - data = 3; - - if (original.contains(":")) { - ItemStack old = headCache.get(original); - if (old != null) { - cm.setItemStack(old); - } else { - String[] split = original.split(":"); - if (split.length > 1) { - String d = split[1]; - - if (d.length() > 36 || d.startsWith("eyJ0ZXh0dXJlcy")) { - ItemStack skull = CMIItemStack.getHead(d); - headCache.put(original, skull); - cm.setItemStack(skull); - } else { - ItemStack skull = CMIMaterial.PLAYER_HEAD.newItemStack(); - SkullMeta skullMeta = (SkullMeta) skull.getItemMeta(); - if (d.length() == 36) { - try { - OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(UUID.fromString(d)); - skullMeta.setOwningPlayer(offPlayer); - skull.setItemMeta(skullMeta); - } catch (Exception e) { - } - } else { - if (Version.isCurrentEqualOrHigher(Version.v1_16_R3)) { - - if ((ahead != null && !ahead.isForce() || ahead == null) && Bukkit.getPlayer(d) != null) { - Player player = Bukkit.getPlayer(d); - skullMeta.setOwningPlayer(player); - skull.setItemMeta(skullMeta); - headCache.put(original, skull); - } else { - - if (ahead != null) { - ahead.setAsyncHead(true); - } - Bukkit.getScheduler().runTaskAsynchronously(Jobs.getInstance(), () -> { - OfflinePlayer offlineP = Bukkit.getOfflinePlayer(d); - if (offlineP != null) { - skullMeta.setOwningPlayer(offlineP); - skull.setItemMeta(skullMeta); - headCache.put(original, skull); - - // Forcing server to load skin information - Bukkit.createInventory(null, InventoryType.CHEST, "").addItem(skull); - - skull.setItemMeta(skullMeta); - headCache.put(original, skull); - - if (ahead != null) - ahead.afterAsyncUpdate(skull); - } - }); - } - - } else { - skullMeta.setOwner(d); - skull.setItemMeta(skullMeta); - } - - if (ahead == null || !ahead.isAsyncHead()) { - skull.setItemMeta(skullMeta); - headCache.put(original, skull); - } - } - } - } - } - } - break; - case "map": - cm = CMIMaterial.FILLED_MAP.newCMIItemStack(); - - if (original.contains(":") && data > 0) { - ItemStack stack = cm.getItemStack(); - MapMeta map = (MapMeta) stack.getItemMeta(); - map.setMapId(data); - stack.setItemMeta(map); - cm.setItemStack(stack); - return cm; - } - break; - default: - break; - } - - CMIMaterial cmat = CMIMaterial.get(subdata == null ? name : name + ":" + subdata); - if (cmat == null || cmat.equals(CMIMaterial.NONE)) { - cmat = CMIMaterial.get(name); - } - - if (cmat != null && !cmat.equals(CMIMaterial.NONE)) { - cm = cmat.newCMIItemStack(); - } else - cmat = CMIMaterial.get(subdata == null ? original : original + ":" + subdata); - - if (cmat != null && !cmat.equals(CMIMaterial.NONE)) - cm = cmat.newCMIItemStack(); - - if (cm == null) { - try { - Material match = Material.matchMaterial(original); - if (match != null) { - if (Version.isCurrentLower(Version.v1_13_R1) || !CMIMaterial.get(match).isLegacy() && CMIMaterial.get(match) != CMIMaterial.NONE) { - cm = new CMIItemStack(match); - } - } - } catch (Throwable e) { - e.printStackTrace(); - } - } - - if (cm != null && entityType != null) - cm.setEntityType(entityType); - - CMIItemStack ncm = null; - if (cm != null) - ncm = cm.clone(); - - if (ncm != null && data != -999) { - if (ncm.getMaxDurability() > 15) { - ncm.setData((short) 0); - } else { - ncm.setData(data); - } - } - -// if (ncm != null && tag != null) { -// ncm.setTag(CMIChatColor.translate(tag)); -// } - - if (ncm != null && amount != null) - ncm.setAmount(amount); - - if (ncm != null && subdata != null) { - if (ncm.getCMIType().isPotion() || ncm.getCMIType() == CMIMaterial.SPLASH_POTION - || ncm.getCMIType() == CMIMaterial.TIPPED_ARROW) { - Integer d = null; - PotionEffectType type = null; - Boolean upgraded = false; - Boolean extended = false; - String[] split = subdata.split("-"); - try { - d = Integer.parseInt(split.length > 0 ? split[0] : subdata); - type = PotionEffectType.getById(d); - } catch (Exception e) { - } - try { - String n = (split.length > 0 ? split[0] : subdata).replace("_", ""); - for (PotionEffectType one : PotionEffectType.values()) { - if (one == null) - continue; - if (n.equalsIgnoreCase(one.getName().replace("_", ""))) { - type = one; - break; - } - } - - if (split.length > 1) { - upgraded = Boolean.parseBoolean(split[1]); - } - if (split.length > 2) { - extended = Boolean.parseBoolean(split[2]); - } - ItemStack item = ncm.getItemStack(); - if (extended && upgraded) - extended = false; - PotionMeta meta = (PotionMeta) item.getItemMeta(); - meta.setBasePotionData(new PotionData(PotionType.getByEffect(type), extended, upgraded)); - item.setItemMeta(meta); - } catch (Exception e) { - e.printStackTrace(); - } - - } - } - - return ncm; - } - - public Material getMaterial(String name) { - CMIItemStack cm = getItem(name); - return cm == null ? Material.AIR : cm.getType(); - } -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/ItemReflection.java b/src/main/java/com/gamingmesh/jobs/CMILib/ItemReflection.java deleted file mode 100644 index 4552dd9e..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/ItemReflection.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright (C) 2017 Zrips - */ - -package com.gamingmesh.jobs.CMILib; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Entity; -import org.bukkit.inventory.ItemStack; - -public class ItemReflection { - - private static Class CraftServerClass; - private static Object CraftServer; - private static Class CraftItemStack; - private static Class Item; - private static Class IStack; - - static { - initialize(); - } - - private static void initialize() { - try { - CraftServerClass = getBukkitClass("CraftServer"); - CraftServer = CraftServerClass.cast(Bukkit.getServer()); - CraftItemStack = getBukkitClass("inventory.CraftItemStack"); - Item = getMinecraftClass("Item"); - IStack = getMinecraftClass("ItemStack"); - } catch (ClassCastException | ClassNotFoundException e) { - e.printStackTrace(); - } - } - - private static Class getBukkitClass(String nmsClassString) throws ClassNotFoundException { - return Class.forName("org.bukkit.craftbukkit." + Version.getCurrent() + "." + nmsClassString); - } - - public static Class getMinecraftClass(String nmsClassString) throws ClassNotFoundException { - return Class.forName("net.minecraft.server." + Version.getCurrent() + "." + nmsClassString); - } - - public static String getItemMinecraftName(ItemStack item) { - try { - Object nmsStack = asNMSCopy(item); - Field field = Item.getField("REGISTRY"); - Object reg = field.get(field); - Method meth = reg.getClass().getMethod("b", Object.class); - meth.setAccessible(true); - Method secmeth = nmsStack.getClass().getMethod("getItem"); - Object res2 = secmeth.invoke(nmsStack); - Object res = meth.invoke(reg, res2); - return res.toString(); - } catch (Throwable e) { - return null; - } - } - - public String getItemMinecraftNamePath(ItemStack item) { - try { - Object nmsStack = asNMSCopy(item); - Method itemMeth = Item.getMethod("getById", int.class); - @SuppressWarnings("deprecation") - Object res = itemMeth.invoke(Item, item.getType().getId()); - Method nameThingy = Item.getMethod("j", IStack); - Object resThingy = nameThingy.invoke(res, nmsStack); - return resThingy.toString(); - } catch (Throwable e) { - return null; - } - } - - public static Object asNMSCopy(ItemStack item) { - try { - Method meth = CraftItemStack.getMethod("asNMSCopy", ItemStack.class); - return meth.invoke(CraftItemStack, item); - } catch (Throwable e) { - return null; - } - } - - public Object asBukkitCopy(Object item) { - try { - Method meth = CraftItemStack.getMethod("asBukkitCopy", IStack); - return meth.invoke(CraftItemStack, item); - } catch (Throwable e) { - return null; - } - } - - public Object getCraftServer() { - return CraftServer; - } - - public static ItemStack getItemInOffHand(org.bukkit.entity.Player player) { - return Version.getCurrent().isLower(Version.v1_9_R1) ? null : player.getInventory().getItemInOffHand(); - } - - public void setEndermiteActive(Entity ent, boolean state) { - - } - -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/RawMessage.java b/src/main/java/com/gamingmesh/jobs/CMILib/RawMessage.java deleted file mode 100644 index 5ed96492..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/RawMessage.java +++ /dev/null @@ -1,607 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.regex.Matcher; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -public class RawMessage { - - List parts = new ArrayList(); - List onlyText = new ArrayList(); - - LinkedHashMap temp = new LinkedHashMap(); - - RawMessageFragment fragment = new RawMessageFragment(); - RawMessageFragment hoverFragment = new RawMessageFragment(); - - private RawMessageFragment frozenFragment = new RawMessageFragment(); - private boolean freezeFormat = false; - - private String combined = ""; - String combinedClean = ""; - - private boolean dontBreakLine = false; - - public void clear() { - parts = new ArrayList(); - onlyText = new ArrayList(); - combined = ""; - combinedClean = ""; - } - - private String textIntoJson(String text, boolean hover) { - if (text.isEmpty()) { - return ""; - } - if (text.equalsIgnoreCase(" ")) { - return " "; - } - text = CMIChatColor.deColorize(text); - - Matcher match = CMIChatColor.fullPattern.matcher(text); - String matcher = null; - - List fragments = new ArrayList(); - - RawMessageFragment f = hover ? hoverFragment : fragment; - - String lastText = ""; - while (match.find()) { - matcher = match.group(); - String[] split = text.split(matcher.replace("#", "\\#").replace("{", "\\{").replace("}", "\\}"), 2); - text = ""; - for (int i = 1; i < split.length; i++) { - text += split[i]; - } - if (split[0] != null && !split[0].isEmpty()) { - String t = split[0]; - - String t2 = lastText; - lastText = t; - - if (t2.endsWith(" ") && t.startsWith(" ")) { - t = t.substring(1); - } - - f.setText(t); - fragments.add(f); - f = new RawMessageFragment(f); - } - - if (matcher.startsWith(CMIChatColor.colorFontPrefix)) { - f.setFont(matcher); - continue; - } - - CMIChatColor color = CMIChatColor.getColor(matcher); - if (color == null) - continue; - - if (color.isColor()) { - f.setLastColor(color); - } else { - f.addFormat(color); - } - } - - if (!text.isEmpty()) { - - if (lastText.endsWith(" ") && text.startsWith(" ")) - text = text.substring(1); - - RawMessageFragment t = new RawMessageFragment(f); - - t.setText(text); - fragments.add(t); - } - - if (hover) - hoverFragment = f; - else - fragment = f; - - StringBuilder finalText = new StringBuilder(); - - for (RawMessageFragment one : fragments) { - if (!finalText.toString().isEmpty()) - finalText.append("},{"); - StringBuilder options = new StringBuilder(); - for (CMIChatColor format : one.getFormats()) { - if (!options.toString().isEmpty()) - options.append(','); - if (format.equals(CMIChatColor.UNDERLINE)) - options.append("\"underlined\":true"); - else if (format.equals(CMIChatColor.BOLD)) - options.append("\"bold\":true"); - else if (format.equals(CMIChatColor.ITALIC)) - options.append("\"italic\":true"); - else if (format.equals(CMIChatColor.STRIKETHROUGH)) - options.append("\"strikethrough\":true"); - else if (format.equals(CMIChatColor.OBFUSCATED)) - options.append("\"obfuscated\":true"); - } - if (!options.toString().isEmpty()) { - finalText.append(options.toString()); - finalText.append(','); - } - - if (one.getFont() != null) { - finalText.append("\"font\":\"" + one.getFont() + "\","); - - } - - if (one.getLastColor() != null) { - if (one.getLastColor().getHex() != null) - finalText.append("\"color\":\"#" + one.getLastColor().getHex() + "\","); - else if (one.getLastColor().getName() != null) { - finalText.append("\"color\":\"" + one.getLastColor().getName().toLowerCase() + "\","); - } - } - - String t = one.getText(); - - // Old server support, we need to add colors and formats to the text directly - if (Version.isCurrentLower(Version.v1_16_R1)) { - StringBuilder oldColors = new StringBuilder(); - if (one.getLastColor() != null && one.getLastColor().getName() != null) { - oldColors.append(one.getLastColor().getColorCode()); - } - for (CMIChatColor format : one.getFormats()) { - if (format.equals(CMIChatColor.UNDERLINE)) - oldColors.append("&n"); - else if (format.equals(CMIChatColor.BOLD)) - oldColors.append("&l"); - else if (format.equals(CMIChatColor.ITALIC)) - oldColors.append("&o"); - else if (format.equals(CMIChatColor.STRIKETHROUGH)) - oldColors.append("&m"); - else if (format.equals(CMIChatColor.OBFUSCATED)) - oldColors.append("&k"); - } - t = oldColors.toString() + t; - } - - finalText.append("\"text\":\"" + escape(t, hover ? false : this.isDontBreakLine()) + "\""); - } - - if (finalText.toString().isEmpty()) - return ""; -// CMIDebug.d(finalText); - return "{" + finalText.toString() + "}"; - } - - @Deprecated - public RawMessage add(String text, String hoverText, String command, String suggestion, String url) { - add(text, hoverText, command, suggestion, url, null); - return this; - } - - @Deprecated - public RawMessage add(String text, String hoverText, String command, String suggestion, String url, String insertion) { - this.addText(text); - this.addHover(hoverText); - this.addCommand(command); - this.addSuggestion(suggestion); - this.addUrl(url); - this.addInsertion(insertion); - return this; - } - - @Deprecated - public RawMessage addUrl(String text, String url) { - addUrl(text, url, null); - return this; - } - - @Deprecated - public RawMessage addUrl(String text, String url, String hoverText) { - this.addText(text); - this.addHover(hoverText); - this.addUrl(url); - return this; - } - - @Deprecated - public RawMessage add(String text) { - return add(text, null, null, null, null); - } - - @Deprecated - public RawMessage add(String text, String hoverText) { - return add(text, hoverText, null, null, null); - } - - @Deprecated - public RawMessage add(String text, List hoverText) { - - String hover = ""; - if (hoverText != null) - for (String one : hoverText) { - if (!hover.isEmpty()) - hover += "\n"; - hover += one; - } - return add(text, hover.isEmpty() ? null : hover, null, null, null); - } - - @Deprecated - public RawMessage add(String text, String hoverText, String command) { - return add(text, hoverText, command, null, null); - } - - @Deprecated - public RawMessage add(String text, String hoverText, String command, String suggestion) { - return add(text, hoverText, command, suggestion, null); - } - - @Deprecated - public RawMessage addHoverText(List hoverText) { - return addHover(hoverText); - } - - @Deprecated - public RawMessage addHoverText(String hover) { - return addHover(hover); - } - - public RawMessage addItem(String text, ItemStack item, String command, String suggestion, String insertion) { - this.addText(text); - this.addCommand(command); - this.addSuggestion(suggestion); - this.addInsertion(insertion); - this.addItem(item); - return this; - } - - public RawMessage addText(String text) { - if (text == null || text.isEmpty()) - return this; - if (temp.containsKey(RawMessagePartType.Text)) - build(); - -// if (this.isDontBreakLine()) { - onlyText.add(CMIChatColor.translate(text)); - -// text = escape(text, this.isDontBreakLine()); -// } - text = textIntoJson(text, false); - String f = ""; - if (text.isEmpty()) - f = "\"text\":\"\""; - else if (text.equalsIgnoreCase(" ")) - f = "\"text\":\" \""; - else - f = "\"text\":\"\",\"extra\":[" + CMIChatColor.translate(text).replace(CMIChatColor.colorReplacerPlaceholder, "&") + "]"; - temp.put(RawMessagePartType.Text, f); - return this; - } - - public RawMessage addHover(List hoverText) { - StringBuilder hover = new StringBuilder(); - if (hoverText != null) { - for (String one : hoverText) { - if (!hover.toString().isEmpty()) - hover.append("\n"); - hover.append(one); - } - } - return addHover(hover.toString()); - } - - public RawMessage addHover(String hover) { - hoverFragment = new RawMessageFragment(); - if (hover == null || hover.isEmpty()) - return this; - - hover = textIntoJson(hover, true); -// hover = escape(hover, false); - String f = ""; - if (hover.isEmpty()) - f = "\"text\":\"\""; - else if (hover.equalsIgnoreCase(" ")) - f = "\"text\":\" \""; - else - f = "\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[" + CMIChatColor.translate(hover).replace(CMIChatColor.colorReplacerPlaceholder, "&") + "]}}"; - temp.put(RawMessagePartType.HoverText, f); - return this; - } - - public RawMessage addCommand(String command) { - if (command == null || command.isEmpty()) - return this; - if (!command.startsWith("/")) - command = "/" + command; - command = escape(command, true); - String f = "\"clickEvent\":{\"action\":\"run_command\",\"value\":\"" + CMIChatColor.deColorize(command).replace(CMIChatColor.colorReplacerPlaceholder, "&") + "\"}"; - temp.put(RawMessagePartType.ClickCommand, f); - return this; - } - - public RawMessage addSuggestion(String suggestion) { - if (suggestion == null || suggestion.isEmpty()) - return this; - suggestion = escape(suggestion, true); - String f = "\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"" + CMIChatColor.deColorize(suggestion).replace(CMIChatColor.colorReplacerPlaceholder, "&") + "\"}"; - temp.put(RawMessagePartType.ClickSuggestion, f); - return this; - } - - public RawMessage addInsertion(String insertion) { - if (insertion == null || insertion.isEmpty()) - return this; - insertion = escape(insertion, true); - String f = "\"insertion\":\"" + CMIChatColor.deColorize(insertion).replace(CMIChatColor.colorReplacerPlaceholder, "&") + "\""; - temp.put(RawMessagePartType.ClickInsertion, f); - return this; - } - - public RawMessage addItem(ItemStack item) { - if (item == null) - return this; - String res = CMIReflections.toJson(item.clone()); - String f = "\"hoverEvent\":{\"action\":\"show_item\",\"value\":\"" + escape(res, true) + "\"}"; - temp.put(RawMessagePartType.HoverItem, f); - return this; - } - - public RawMessage addUrl(String url) { - if (url == null || url.isEmpty()) - return this; - - if (!url.toLowerCase().startsWith("http://") && !url.toLowerCase().startsWith("https://")) - url = "http://" + url; - - String f = "\"clickEvent\":{\"action\":\"open_url\",\"value\":\"" + CMIChatColor.deColorize(url).replace(CMIChatColor.colorReplacerPlaceholder, "&") + "\"}"; - - temp.put(RawMessagePartType.ClickLink, f); - return this; - } - - public RawMessage build() { - if (temp.isEmpty()) - return this; - - if (!temp.containsKey(RawMessagePartType.Text)) - return this; - String part = ""; - for (RawMessagePartType one : RawMessagePartType.values()) { - String t = temp.get(one); - if (t == null) - continue; - if (!part.isEmpty()) - part += ","; - part += t; - } - part = "{" + part + "}"; - temp.clear(); - parts.add(part); - return this; - } - - private static String escape(String s, boolean escapeNewLn) { - - if (s == null) - return null; - StringBuffer sb = new StringBuffer(); - escape(s, sb); - if (escapeNewLn) - return sb.toString().replace(nl, "\\\\n"); - return sb.toString().replace(nl, "\\n"); - } - - private static final String nl = "\u00A5n"; - - private static void escape(String s, StringBuffer sb) { - s = s.replace("\n", nl); - s = s.replace("\\n", nl); - for (int i = 0; i < s.length(); i++) { - char ch = s.charAt(i); - - switch (ch) { - case '"': - sb.append("\\\""); - break; - case '\n': - sb.append("\\n"); - break; - case '\\': - sb.append("\\\\"); - break; - case '\b': - sb.append("\\b"); - break; - case '\f': - sb.append("\\f"); - break; - case '\r': - sb.append("\\r"); - break; - case '\t': - sb.append("\\t"); - break; - case '/': - sb.append("\\/"); - break; - default: - if ((ch >= '\u0000' && ch <= '\u001F') || (ch >= '\u007F' && ch <= '\u009F') || (ch >= '\u2000' && ch <= '\u20FF')) { - String ss = Integer.toHexString(ch); - sb.append("\\u"); - for (int k = 0; k < 4 - ss.length(); k++) { - sb.append('0'); - } - sb.append(ss.toUpperCase()); - } else { - sb.append(ch); - } - } - } - -// for (int i = 0; i < s.length(); i++) { -// char ch = s.charAt(i); -// if (String.valueOf(ch).equals(nl)) { -// if (escapeNewLn) { -// sb.append("\\n"); -// } else { -// sb.append("\n"); -// } -// } else -// sb.append(ch); -// -// } - } - - public List softCombine() { - List ls = new ArrayList(); - String f = ""; - for (String part : parts) { - if (f.isEmpty()) - f = "[\"\","; - else { - if (f.length() > 30000) { - ls.add(f + "]"); - f = "[\"\"," + part; - continue; - } - f += ","; - } - f += part; - } - if (!f.isEmpty()) - f += "]"; - ls.add(f); - return ls; - } - - private RawMessage combine() { - String f = ""; - for (String part : parts) { - if (f.isEmpty()) - f = "[\"\","; - else - f += ","; - f += part; - } - if (!f.isEmpty()) - f += "]"; - - if (f.isEmpty()) - f = "{\"text\":\" \"}"; - - combined = f; - return this; - } - - public RawMessage combineClean() { - String f = ""; - for (String part : onlyText) { - f += part.replace("\\\"", "\""); - } - combinedClean = f; - return this; - } - - public RawMessage show(Player player) { - return show(player, true); - } - - public RawMessage show(Player player, boolean softCombined) { - if (player == null) - return this; - if (combined.isEmpty()) { - this.build(); - combine(); - } - - if (!player.isOnline()) - return this; - - if (softCombined) { - for (String one : softCombine()) { - if (one.isEmpty()) - continue; - RawMessageManager.send(player, one); - } - } else { - RawMessageManager.send(player, combined); - } - - return this; - } - - public int getFinalLenght() { - String f = ""; - for (String part : parts) { - if (f.isEmpty()) - f = "[\"\","; - else - f += ","; - f += part; - } - if (!f.isEmpty()) - f += "]"; - return f.length(); - } - - public RawMessage show(CommandSender sender) { - if (combined.isEmpty()) { - this.build(); - combine(); - } - if (sender instanceof Player) { - show((Player) sender); - } else { - sender.sendMessage(this.combineClean().combinedClean); - } - return this; - } - - public String getRaw() { - if (combined.isEmpty()) { - build(); - combine(); - } - return combined; - } - - public void setCombined(String combined) { - this.combined = combined; - } - - public String getShortRaw() { - build(); - String f = ""; - for (String part : parts) { - if (!f.isEmpty()) - f += ","; - f += part; - } - return f; - } - - public boolean isDontBreakLine() { - return dontBreakLine; - } - - public void setDontBreakLine(boolean dontBreakLine) { - this.dontBreakLine = dontBreakLine; - } - - public boolean isFormatFrozen() { - return freezeFormat; - } - - public void freezeFormat() { - frozenFragment = new RawMessageFragment(fragment); - this.freezeFormat = true; - } - - public void unFreezeFormat() { - fragment = new RawMessageFragment(frozenFragment); - this.freezeFormat = false; - } -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/RawMessageFragment.java b/src/main/java/com/gamingmesh/jobs/CMILib/RawMessageFragment.java deleted file mode 100644 index 6805338f..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/RawMessageFragment.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import java.util.HashSet; -import java.util.Set; - -public class RawMessageFragment { - - private CMIChatColor lastColor = null; - private Set formats = new HashSet(); - private String font = null; - private String text = ""; - - public RawMessageFragment() { - } - - public RawMessageFragment(RawMessageFragment old) { - this.lastColor = old.lastColor; - this.formats = new HashSet(old.formats); - this.font = old.font; - } - - public CMIChatColor getLastColor() { - return lastColor; - } - - public void setLastColor(CMIChatColor lastColor) { - this.lastColor = lastColor; - formats.clear(); - } - - public Set getFormats() { - return formats; - } - - public void setFormats(Set formats) { - this.formats = formats; - } - - public void addFormat(CMIChatColor format) { - if (format.isReset()) { - this.formats.clear(); - this.lastColor = null; - return; - } - this.formats.add(format); - } - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; - } - - public String getFont() { - return font; - } - - public void setFont(String font) { - if (font.startsWith(CMIChatColor.colorFontPrefix) && font.length() > CMIChatColor.colorFontPrefix.length()) - font = font.substring(CMIChatColor.colorFontPrefix.length()); - if (font.endsWith(CMIChatColor.colorCodeSuffix) && font.length() > CMIChatColor.colorCodeSuffix.length()) - font = font.substring(0, font.length() - CMIChatColor.colorCodeSuffix.length()); - this.font = font; - } -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/RawMessageManager.java b/src/main/java/com/gamingmesh/jobs/CMILib/RawMessageManager.java deleted file mode 100644 index db9282c5..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/RawMessageManager.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -public class RawMessageManager { - - private static Object packet; - private static Method getHandle; - private static Method sendPacket; - private static Field playerConnection; - private static Class nmsChatSerializer; - private static Class nmsIChatBaseComponent; - private static Class packetType; - - private static Class ChatMessageclz; - private static Class sub; - private static Object[] consts; - - static { - Version version = Version.getCurrent(); - try { - packetType = Class.forName("net.minecraft.server." + version + ".PacketPlayOutChat"); - Class typeCraftPlayer = Class.forName("org.bukkit.craftbukkit." + version + ".entity.CraftPlayer"); - Class typeNMSPlayer = Class.forName("net.minecraft.server." + version + ".EntityPlayer"); - Class typePlayerConnection = Class.forName("net.minecraft.server." + version + ".PlayerConnection"); - nmsChatSerializer = Class.forName(getChatSerializerClasspath()); - nmsIChatBaseComponent = Class.forName("net.minecraft.server." + version + ".IChatBaseComponent"); - getHandle = typeCraftPlayer.getMethod("getHandle"); - playerConnection = typeNMSPlayer.getField("playerConnection"); - sendPacket = typePlayerConnection.getMethod("sendPacket", Class.forName("net.minecraft.server." + version + ".Packet")); - if (Version.isCurrentHigher(Version.v1_11_R1)) { - ChatMessageclz = Class.forName("net.minecraft.server." + version + ".ChatMessageType"); - consts = ChatMessageclz.getEnumConstants(); - sub = consts[2].getClass(); - } - } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | NoSuchFieldException ex) { - Bukkit.getConsoleSender().sendMessage("Error {0} "); - Bukkit.getConsoleSender().sendMessage(ex.toString()); - } - } - - public static void send(CommandSender receivingPacket, String msg) { - if (receivingPacket instanceof Player) - send((Player) receivingPacket, msg); - else - receivingPacket.sendMessage(msg); - } - - public static void send(Player receivingPacket, String json) { - if (receivingPacket == null) - return; - if (!receivingPacket.isOnline()) - return; - if (json == null) - return; - - try { - Object serialized = nmsChatSerializer.getMethod("a", String.class).invoke(null, json); - if (Version.isCurrentHigher(Version.v1_15_R1)) - packet = packetType.getConstructor(nmsIChatBaseComponent, sub, UUID.class).newInstance(serialized, consts[1], receivingPacket.getUniqueId()); - else if (Version.isCurrentHigher(Version.v1_11_R1)) - packet = packetType.getConstructor(nmsIChatBaseComponent, sub).newInstance(serialized, consts[1]); - else if (Version.isCurrentHigher(Version.v1_7_R4)) { - packet = packetType.getConstructor(nmsIChatBaseComponent, byte.class).newInstance(serialized, (byte) 1); - } else { - packet = packetType.getConstructor(nmsIChatBaseComponent, int.class).newInstance(serialized, 1); - } - Object player = getHandle.invoke(receivingPacket); - Object connection = playerConnection.get(player); - sendPacket.invoke(connection, packet); - } catch (Exception ex) { - ex.printStackTrace(); - Bukkit.getConsoleSender().sendMessage("Failed to show json message with packets, using command approach"); - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "minecraft:tellraw \"" + receivingPacket.getName() + "\" " + json); - } - } - - private static String getChatSerializerClasspath() { - if (!Version.isCurrentHigher(Version.v1_8_R2)) - return "net.minecraft.server." + Version.getCurrent() + ".ChatSerializer"; - return "net.minecraft.server." + Version.getCurrent() + ".IChatBaseComponent$ChatSerializer";// 1_8_R2 moved to IChatBaseComponent - } -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/RawMessagePartType.java b/src/main/java/com/gamingmesh/jobs/CMILib/RawMessagePartType.java deleted file mode 100644 index 1194e75b..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/RawMessagePartType.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -public enum RawMessagePartType { - Text, HoverText, HoverItem, HoverEntity, HoverAchievement, ClickLink, ClickCommand, ClickSuggestion, ClickInsertion; -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/TitleMessageManager.java b/src/main/java/com/gamingmesh/jobs/CMILib/TitleMessageManager.java deleted file mode 100644 index b69200d0..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/TitleMessageManager.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.logging.Level; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import com.gamingmesh.jobs.Jobs; - -public class TitleMessageManager { - private static Method getHandle; - private static Method sendPacket; - private static Field playerConnection; - private static Class nmsIChatBaseComponent; - - private static Constructor nmsPacketPlayOutTitle; - private static Constructor nmsPacketPlayOutTimes; - private static Class enumTitleAction; - private static Method fromString; - private static boolean simpleTitleMessages = false; - - static { - if (Version.isCurrentHigher(Version.v1_7_R4)) { - Version version = Version.getCurrent(); - try { - Class typeCraftPlayer = Class.forName("org.bukkit.craftbukkit." + version + ".entity.CraftPlayer"); - Class typeNMSPlayer = Class.forName("net.minecraft.server." + version + ".EntityPlayer"); - Class typePlayerConnection = Class.forName("net.minecraft.server." + version + ".PlayerConnection"); - nmsIChatBaseComponent = Class.forName("net.minecraft.server." + version + ".IChatBaseComponent"); - getHandle = typeCraftPlayer.getMethod("getHandle"); - playerConnection = typeNMSPlayer.getField("playerConnection"); - sendPacket = typePlayerConnection.getMethod("sendPacket", Class.forName("net.minecraft.server." + version + ".Packet")); - } catch (ReflectiveOperationException | SecurityException ex) { - Bukkit.getLogger().log(Level.SEVERE, "Error {0}", ex); - } - - // Title - try { - Class typePacketPlayOutTitle = Class.forName(getPacketPlayOutTitleClasspath()); - enumTitleAction = Class.forName(getEnumTitleActionClasspath()); - nmsPacketPlayOutTitle = typePacketPlayOutTitle.getConstructor(enumTitleAction, nmsIChatBaseComponent); - nmsPacketPlayOutTimes = typePacketPlayOutTitle.getConstructor(int.class, int.class, int.class); - fromString = Class.forName("org.bukkit.craftbukkit." + version + ".util.CraftChatMessage").getMethod("fromString", String.class); - } catch (ReflectiveOperationException | SecurityException ex) { - simpleTitleMessages = true; - } - } - } - - public static void send(final Player receivingPacket, final Object title, final Object subtitle) { - send(receivingPacket, title, subtitle, 0, 40, 10); - } - - public static void send(final Player receivingPacket, final Object title, final Object subtitle, final int fadeIn, final int keep, final int fadeOut) { - Bukkit.getScheduler().runTaskAsynchronously(org.bukkit.plugin.java.JavaPlugin.getPlugin(Jobs.class), new Runnable() { - @Override - public void run() { - - String t = title == null ? "" : CMIChatColor.translate((String) title); - String s = subtitle == null ? "" : CMIChatColor.translate((String) subtitle); - - if (Version.isCurrentEqualOrLower(Version.v1_7_R4)) { - ActionBarManager.send(receivingPacket, t + s); - return; - } - - if (simpleTitleMessages) { - receivingPacket.sendMessage(t); - receivingPacket.sendMessage(s); - return; - } - try { - switch (Version.getCurrent()) { - case v1_12_R1: - case v1_13_R1: - case v1_13_R2: - case v1_14_R1: - case v1_15_R1: - case v1_16_R1: - default: - receivingPacket.sendTitle(t, s, fadeIn, keep, fadeOut); - break; - case v1_9_R1: - case v1_9_R2: - case v1_10_R1: - case v1_11_R1: - case v1_8_R1: - case v1_8_R2: - case v1_8_R3: - Object packetTimes = nmsPacketPlayOutTimes.newInstance(fadeIn, keep, fadeOut); - sendPacket(receivingPacket, packetTimes); - if (title != null) { - Object packetTitle = nmsPacketPlayOutTitle.newInstance(enumTitleAction.getField("TITLE").get(null), ((Object[]) fromString.invoke(null, t))[0]); - sendPacket(receivingPacket, packetTitle); - } - if (subtitle != null) { - if (title == null) { - Object packetTitle = nmsPacketPlayOutTitle.newInstance(enumTitleAction.getField("TITLE").get(null), ((Object[]) fromString.invoke(null, ""))[0]); - sendPacket(receivingPacket, packetTitle); - } - Object packetSubtitle = nmsPacketPlayOutTitle.newInstance(enumTitleAction.getField("SUBTITLE").get(null), ((Object[]) fromString.invoke(null, s))[0]); - sendPacket(receivingPacket, packetSubtitle); - } - break; - } - - } catch (ReflectiveOperationException | SecurityException | IllegalArgumentException ex) { - simpleTitleMessages = true; - Bukkit.getLogger().log(Level.SEVERE, "Your server can't fully support title messages. They will be shown in chat instead."); - } - return; - } - }); - } - - private static void sendPacket(Player player, Object packet) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { - Object handle = getHandle.invoke(player); - Object connection = playerConnection.get(handle); - sendPacket.invoke(connection, packet); - } - - private static String getPacketPlayOutTitleClasspath() { - return "net.minecraft.server." + Version.getCurrent() + ".PacketPlayOutTitle"; - } - - private static String getEnumTitleActionClasspath() { - return getPacketPlayOutTitleClasspath() + "$EnumTitleAction"; - } - -} diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/Version.java b/src/main/java/com/gamingmesh/jobs/CMILib/Version.java deleted file mode 100644 index 4550eb14..00000000 --- a/src/main/java/com/gamingmesh/jobs/CMILib/Version.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.gamingmesh.jobs.CMILib; - -import org.bukkit.Bukkit; - -public enum Version { - v1_7_R1, - v1_7_R2, - v1_7_R3, - v1_7_R4, - v1_8_R1, - v1_8_R2, - v1_8_R3, - v1_9_R1, - v1_9_R2, - v1_10_R1, - v1_11_R1, - v1_12_R1, - v1_13_R1, - v1_13_R2, - v1_14_R1, - v1_15_R1, - v1_16_R1, - v1_16_R2, - v1_16_R3, - v1_17_R1, - v1_17_R2, - v1_18_R1, - v1_18_R2, - v1_19_R1, - v1_19_R2, - v1_20_R1, - v1_20_R2, - v1_21_R1, - v1_21_R2, - v1_22_R1, - v1_22_R2; - - private Integer value; - private String shortVersion; - private static Version current; - - Version() { - try { - value = Integer.parseInt(name().replaceAll("[^\\d.]", "")); - } catch (NumberFormatException e) { - } - shortVersion = name().substring(0, name().length() - 3); - } - - public Integer getValue() { - return value; - } - - public String getShortVersion() { - return shortVersion; - } - - public static Version getCurrent() { - if (current != null) - return current; - - String[] v = Bukkit.getServer().getClass().getPackage().getName().split("\\."); - String vv = v[v.length - 1]; - for (Version one : values()) { - if (one.name().equalsIgnoreCase(vv)) { - current = one; - break; - } - } - return current; - } - - public boolean isLower(Version version) { - return getValue() < version.getValue(); - } - - public boolean isHigher(Version version) { - return getValue() > version.getValue(); - } - - public boolean isEqualOrLower(Version version) { - return getValue() <= version.getValue(); - } - - public boolean isEqualOrHigher(Version version) { - return getValue() >= version.getValue(); - } - - public static boolean isCurrentEqualOrHigher(Version v) { - return getCurrent().getValue() >= v.getValue(); - } - - public static boolean isCurrentHigher(Version v) { - return getCurrent().getValue() > v.getValue(); - } - - public static boolean isCurrentLower(Version v) { - return getCurrent().getValue() < v.getValue(); - } - - public static boolean isCurrentEqualOrLower(Version v) { - return getCurrent().getValue() <= v.getValue(); - } - - public static boolean isCurrentEqual(Version v) { - return getCurrent().getValue() == v.getValue(); - } -} \ No newline at end of file diff --git a/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java b/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java index 802cc569..ffa0c2ce 100644 --- a/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java +++ b/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java @@ -11,10 +11,6 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMIGUI.CMIGui; -import com.gamingmesh.jobs.CMIGUI.CMIGuiButton; -import com.gamingmesh.jobs.CMIGUI.GUIManager; -import com.gamingmesh.jobs.CMIGUI.GUIManager.GUIClickType; import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.Boost; import com.gamingmesh.jobs.container.CurrencyType; @@ -23,6 +19,12 @@ import com.gamingmesh.jobs.container.JobInfo; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; +import net.Zrips.CMILib.CMILib; +import net.Zrips.CMILib.GUI.CMIGui; +import net.Zrips.CMILib.GUI.CMIGuiButton; +import net.Zrips.CMILib.GUI.GUIManager; +import net.Zrips.CMILib.GUI.GUIManager.GUIClickType; + public class GuiManager { private Jobs plugin; @@ -306,8 +308,8 @@ public class GuiManager { i++; } - int guiSize = GUIManager.isOpenedGui(player) && GUIManager.getGui(player) != null ? - GUIManager.getGui(player).getInvSize().getFields() : Jobs.getGCManager().getJobsGUIRows() * 9; + int guiSize = CMILib.getInstance().getGUIManager().isOpenedGui(player) && CMILib.getInstance().getGUIManager().getGui(player) != null ? + CMILib.getInstance().getGUIManager().getGui(player).getInvSize().getFields() : Jobs.getGCManager().getJobsGUIRows() * 9; CMIGui gui = new CMIGui(player); gui.setTitle(Jobs.getLanguage().getMessage("command.info.gui.jobinfo", "[jobname]", job.getName())); @@ -456,8 +458,8 @@ public class GuiManager { i++; } - int guiSize = GUIManager.isOpenedGui(player) && GUIManager.getGui(player) != null ? - GUIManager.getGui(player).getInvSize().getFields() : Jobs.getGCManager().getJobsGUIRows() * 9; + int guiSize = CMILib.getInstance().getGUIManager().isOpenedGui(player) && CMILib.getInstance().getGUIManager().getGui(player) != null ? + CMILib.getInstance().getGUIManager().getGui(player).getInvSize().getFields() : Jobs.getGCManager().getJobsGUIRows() * 9; int backButton = Jobs.getGCManager().getJobsGUIBackButton(); CMIGui gui = new CMIGui(player); diff --git a/src/main/java/com/gamingmesh/jobs/ItemBoostManager.java b/src/main/java/com/gamingmesh/jobs/ItemBoostManager.java index 6cc6bdca..0b73ff0a 100644 --- a/src/main/java/com/gamingmesh/jobs/ItemBoostManager.java +++ b/src/main/java/com/gamingmesh/jobs/ItemBoostManager.java @@ -13,23 +13,30 @@ import java.util.Set; import org.bukkit.Color; import org.bukkit.enchantments.Enchantment; -import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.CMILib.CMIEnchantment; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.ConfigReader; import com.gamingmesh.jobs.container.BoostMultiplier; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobItems; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.FileHandler.ConfigReader; +import net.Zrips.CMILib.Items.CMIMaterial; + public class ItemBoostManager { private static final Map ITEMS = new HashMap<>(); private static final Map LEGACY = new HashMap<>(); - @SuppressWarnings("deprecation") - public static void load() { - ConfigReader cfg = new ConfigReader("boostedItems.yml"); + @SuppressWarnings("deprecation") + public static void load() { + ConfigReader cfg; + try { + cfg = new ConfigReader(Jobs.getInstance(), "boostedItems.yml"); + } catch (Exception e2) { + e2.printStackTrace(); + return; + } ITEMS.clear(); LEGACY.clear(); @@ -69,7 +76,12 @@ public class ItemBoostManager { } catch (IOException e1) { e1.printStackTrace(); } - cfg = new ConfigReader("boostedItems.yml"); + try { + cfg = new ConfigReader(Jobs.getInstance(), "boostedItems.yml"); + } catch (Exception e) { + e.printStackTrace(); + return; + } } Set keys = cfg.getC().getKeys(false); diff --git a/src/main/java/com/gamingmesh/jobs/Jobs.java b/src/main/java/com/gamingmesh/jobs/Jobs.java index 5538291b..4cc01326 100644 --- a/src/main/java/com/gamingmesh/jobs/Jobs.java +++ b/src/main/java/com/gamingmesh/jobs/Jobs.java @@ -18,42 +18,21 @@ package com.gamingmesh.jobs; -import com.gamingmesh.jobs.CMILib.RawMessage; -import com.gamingmesh.jobs.CMILib.Version; -import com.gamingmesh.jobs.CMILib.ActionBarManager; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.CMIReflections; -import com.gamingmesh.jobs.CMILib.VersionChecker; -import com.gamingmesh.jobs.Gui.GuiManager; -import com.gamingmesh.jobs.Placeholders.PlaceholderAPIHook; -import com.gamingmesh.jobs.Placeholders.Placeholder; -import com.gamingmesh.jobs.hooks.HookManager; -import com.gamingmesh.jobs.Signs.SignUtil; -import com.gamingmesh.jobs.api.JobsExpGainEvent; -import com.gamingmesh.jobs.api.JobsPrePaymentEvent; -import com.gamingmesh.jobs.commands.JobsCommands; -import com.gamingmesh.jobs.config.*; -import com.gamingmesh.jobs.container.*; -import com.gamingmesh.jobs.container.blockOwnerShip.BlockOwnerShip; -import com.gamingmesh.jobs.container.blockOwnerShip.BlockTypes; -import com.gamingmesh.jobs.dao.JobsDAO; -import com.gamingmesh.jobs.dao.JobsDAOData; -import com.gamingmesh.jobs.dao.JobsManager; -import com.gamingmesh.jobs.economy.*; -import com.gamingmesh.jobs.i18n.Language; -import com.gamingmesh.jobs.listeners.JobsListener; -import com.gamingmesh.jobs.listeners.JobsPayment14Listener; -import com.gamingmesh.jobs.listeners.JobsPaymentListener; -import com.gamingmesh.jobs.listeners.PistonProtectionListener; -import com.gamingmesh.jobs.selection.SelectionManager; -import com.gamingmesh.jobs.stuff.*; -import com.gamingmesh.jobs.stuff.complement.JobsChatEvent; -import com.gamingmesh.jobs.stuff.complement.Complement; -import com.gamingmesh.jobs.stuff.complement.Complement1; -import com.gamingmesh.jobs.stuff.complement.Complement2; -import com.gamingmesh.jobs.tasks.BufferedPaymentThread; -import com.gamingmesh.jobs.tasks.DatabaseSaveThread; +import java.io.File; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.WeakHashMap; +import java.util.concurrent.CompletableFuture; +import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.block.Block; @@ -64,11 +43,80 @@ import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; import org.bukkit.plugin.java.JavaPlugin; -import java.io.File; -import java.sql.SQLException; -import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.logging.Logger; +import com.gamingmesh.jobs.Gui.GuiManager; +import com.gamingmesh.jobs.Placeholders.Placeholder; +import com.gamingmesh.jobs.Placeholders.PlaceholderAPIHook; +import com.gamingmesh.jobs.Signs.SignUtil; +import com.gamingmesh.jobs.api.JobsExpGainEvent; +import com.gamingmesh.jobs.api.JobsPrePaymentEvent; +import com.gamingmesh.jobs.commands.JobsCommands; +import com.gamingmesh.jobs.config.BlockProtectionManager; +import com.gamingmesh.jobs.config.BossBarManager; +import com.gamingmesh.jobs.config.ConfigManager; +import com.gamingmesh.jobs.config.ExploreManager; +import com.gamingmesh.jobs.config.GeneralConfigManager; +import com.gamingmesh.jobs.config.LanguageManager; +import com.gamingmesh.jobs.config.NameTranslatorManager; +import com.gamingmesh.jobs.config.RestrictedAreaManager; +import com.gamingmesh.jobs.config.RestrictedBlockManager; +import com.gamingmesh.jobs.config.ScheduleManager; +import com.gamingmesh.jobs.config.ShopManager; +import com.gamingmesh.jobs.config.TitleManager; +import com.gamingmesh.jobs.config.YmlMaker; +import com.gamingmesh.jobs.container.ActionInfo; +import com.gamingmesh.jobs.container.ActionType; +import com.gamingmesh.jobs.container.ArchivedJobs; +import com.gamingmesh.jobs.container.BlockProtection; +import com.gamingmesh.jobs.container.Boost; +import com.gamingmesh.jobs.container.Convert; +import com.gamingmesh.jobs.container.CurrencyLimit; +import com.gamingmesh.jobs.container.CurrencyType; +import com.gamingmesh.jobs.container.DBAction; +import com.gamingmesh.jobs.container.FastPayment; +import com.gamingmesh.jobs.container.Job; +import com.gamingmesh.jobs.container.JobInfo; +import com.gamingmesh.jobs.container.JobProgression; +import com.gamingmesh.jobs.container.JobsPlayer; +import com.gamingmesh.jobs.container.Log; +import com.gamingmesh.jobs.container.PlayerInfo; +import com.gamingmesh.jobs.container.PlayerPoints; +import com.gamingmesh.jobs.container.Quest; +import com.gamingmesh.jobs.container.QuestProgression; +import com.gamingmesh.jobs.container.blockOwnerShip.BlockOwnerShip; +import com.gamingmesh.jobs.container.blockOwnerShip.BlockTypes; +import com.gamingmesh.jobs.dao.JobsDAO; +import com.gamingmesh.jobs.dao.JobsDAOData; +import com.gamingmesh.jobs.dao.JobsManager; +import com.gamingmesh.jobs.economy.BufferedEconomy; +import com.gamingmesh.jobs.economy.BufferedPayment; +import com.gamingmesh.jobs.economy.Economy; +import com.gamingmesh.jobs.economy.PaymentData; +import com.gamingmesh.jobs.economy.PointsData; +import com.gamingmesh.jobs.hooks.HookManager; +import com.gamingmesh.jobs.i18n.Language; +import com.gamingmesh.jobs.listeners.JobsListener; +import com.gamingmesh.jobs.listeners.JobsPayment14Listener; +import com.gamingmesh.jobs.listeners.JobsPaymentListener; +import com.gamingmesh.jobs.listeners.PistonProtectionListener; +import com.gamingmesh.jobs.selection.SelectionManager; +import com.gamingmesh.jobs.stuff.CMIScoreboardManager; +import com.gamingmesh.jobs.stuff.Loging; +import com.gamingmesh.jobs.stuff.TabComplete; +import com.gamingmesh.jobs.stuff.ToggleBarHandling; +import com.gamingmesh.jobs.stuff.VersionChecker; +import com.gamingmesh.jobs.stuff.complement.Complement; +import com.gamingmesh.jobs.stuff.complement.Complement1; +import com.gamingmesh.jobs.stuff.complement.Complement2; +import com.gamingmesh.jobs.stuff.complement.JobsChatEvent; +import com.gamingmesh.jobs.tasks.BufferedPaymentThread; +import com.gamingmesh.jobs.tasks.DatabaseSaveThread; + +import net.Zrips.CMILib.ActionBar.CMIActionBar; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Container.PageInfo; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.RawMessages.RawMessage; +import net.Zrips.CMILib.Version.Version; public class Jobs extends JavaPlugin { @@ -90,7 +138,7 @@ public class Jobs extends JavaPlugin { private static JobsManager dbManager; private static ConfigManager configManager; private static GeneralConfigManager gConfigManager; - private static CMIReflections reflections; + private static BufferedEconomy economy; private static PermissionHandler permissionHandler; private static PermissionManager permissionManager; @@ -229,12 +277,6 @@ public class Jobs extends JavaPlugin { return bpManager; } - public static CMIReflections getReflections() { - if (reflections == null) - reflections = new CMIReflections(); - return reflections; - } - public static JobsManager getDBManager() { if (dbManager == null) dbManager = new JobsManager(instance); @@ -764,8 +806,6 @@ public class Jobs extends JavaPlugin { HandlerList.unregisterAll(instance); - com.gamingmesh.jobs.CMIGUI.GUIManager.registerListener(); - if (Version.isCurrentEqualOrHigher(Version.v1_9_R1)) { pm.registerEvents(new com.gamingmesh.jobs.listeners.Listener1_9(), instance); } @@ -1284,7 +1324,7 @@ public class Jobs extends JavaPlugin { if ((time > System.currentTimeMillis() || bp.isPaid()) && bp.getAction() != DBAction.DELETE) { if (inform && player.canGetPaid(info)) { int sec = Math.round((time - System.currentTimeMillis()) / 1000L); - ActionBarManager.send(player.getPlayer(), lManager.getMessage("message.blocktimer", "[time]", sec)); + CMIActionBar.send(player.getPlayer(), lManager.getMessage("message.blocktimer", "[time]", sec)); } return false; @@ -1313,7 +1353,7 @@ public class Jobs extends JavaPlugin { if ((time > System.currentTimeMillis() || bp.isPaid()) && bp.getAction() != DBAction.DELETE) { if (inform && player.canGetPaid(info)) { int sec = Math.round((time - System.currentTimeMillis()) / 1000L); - ActionBarManager.send(player.getPlayer(), lManager.getMessage("message.blocktimer", "[time]", sec)); + CMIActionBar.send(player.getPlayer(), lManager.getMessage("message.blocktimer", "[time]", sec)); } getBpManager().add(block, cd); diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index 8831f461..fad88fd5 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -39,9 +39,6 @@ import org.bukkit.entity.Tameable; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.FireworkMeta; -import com.gamingmesh.jobs.CMILib.Version; -import com.gamingmesh.jobs.CMILib.ActionBarManager; -import com.gamingmesh.jobs.CMILib.CMIReflections; import com.gamingmesh.jobs.api.JobsJoinEvent; import com.gamingmesh.jobs.api.JobsLeaveEvent; import com.gamingmesh.jobs.api.JobsLevelUpEvent; @@ -64,6 +61,12 @@ import com.gamingmesh.jobs.hooks.HookManager; import com.gamingmesh.jobs.stuff.PerformCommands; import com.gamingmesh.jobs.stuff.Util; +import net.Zrips.CMILib.CMILib; +import net.Zrips.CMILib.ActionBar.CMIActionBar; +import net.Zrips.CMILib.Items.CMIItemStack; +import net.Zrips.CMILib.NBT.CMINBT; +import net.Zrips.CMILib.Version.Version; + public class PlayerManager { private final ConcurrentMap playersCache = new ConcurrentHashMap<>(); @@ -648,7 +651,7 @@ public class PlayerManager { if (player != null && (Jobs.getGCManager().LevelChangeActionBar || Jobs.getGCManager().LevelChangeChat)) { for (String line : message.split("\n")) { if (Jobs.getGCManager().LevelChangeActionBar) - ActionBarManager.send(player, line); + CMIActionBar.send(player, line); if (Jobs.getGCManager().LevelChangeChat) player.sendMessage(line); @@ -756,11 +759,11 @@ public class PlayerManager { for (String line : message.split("\n")) { if (Jobs.getGCManager().isBroadcastingLevelups()) { if (Jobs.getGCManager().BroadcastingLevelUpLevels.contains(oldLevel + 1) - || Jobs.getGCManager().BroadcastingLevelUpLevels.contains(0)) + || Jobs.getGCManager().BroadcastingLevelUpLevels.contains(0)) plugin.getComplement().broadcastMessage(line); } else if (player != null) { if (Jobs.getGCManager().LevelChangeActionBar) - ActionBarManager.send(player, line); + CMIActionBar.send(player, line); if (Jobs.getGCManager().LevelChangeChat) player.sendMessage(line); @@ -772,7 +775,7 @@ public class PlayerManager { if (player != null && Jobs.getGCManager().SoundTitleChangeUse) { try { player.getWorld().playSound(player.getLocation(), levelUpEvent.getTitleChangeSound(), levelUpEvent.getTitleChangeVolume(), - levelUpEvent.getTitleChangePitch()); + levelUpEvent.getTitleChangePitch()); } catch (Exception e) { // If it fails, we can ignore it } } @@ -792,7 +795,7 @@ public class PlayerManager { plugin.getComplement().broadcastMessage(line); } else if (player != null) { if (Jobs.getGCManager().TitleChangeActionBar) - ActionBarManager.send(player, line); + CMIActionBar.send(player, line); if (Jobs.getGCManager().TitleChangeChat) player.sendMessage(line); @@ -956,7 +959,7 @@ public class PlayerManager { // Check mainhand slot if (Jobs.getGCManager().boostedItemsInMainHand) { - jitems.add(getJobsItemByNbt(Util.getItemInMainHand(player))); + jitems.add(getJobsItemByNbt(CMIItemStack.getItemInMainHand(player))); } // Check offhand slot @@ -987,24 +990,24 @@ public class PlayerManager { private final String jobsItemBoost = "JobsItemBoost"; public boolean containsItemBoostByNBT(ItemStack item) { - return item != null && Jobs.getReflections().hasNbtString(item, jobsItemBoost); + return item != null && new CMINBT(item).hasNBT(jobsItemBoost); } public JobItems getJobsItemByNbt(ItemStack item) { if (item == null) return null; - Object itemName = CMIReflections.getNbt(item, jobsItemBoost); + Object itemName = new CMINBT(item).getString(jobsItemBoost); if (itemName == null || itemName.toString().isEmpty()) { // Checking old boost items and converting to new format if needed - if (Jobs.getReflections().hasNbt(item, jobsItemBoost)) { + if (new CMINBT(item).hasNBT(jobsItemBoost)) { for (Job one : Jobs.getJobs()) { - itemName = Jobs.getReflections().getNbt(item, jobsItemBoost, one.getName()); + itemName = new CMINBT(item).getString(jobsItemBoost + "." + one.getName()); if (itemName != null) { JobItems b = ItemBoostManager.getItemByKey(itemName.toString()); if (b != null) { - ItemStack ic = CMIReflections.setNbt(item, jobsItemBoost, b.getNode()); + ItemStack ic = (ItemStack) new CMINBT(item).setString(jobsItemBoost, b.getNode()); item.setItemMeta(ic.getItemMeta()); } break; diff --git a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java index 2087052a..493bcb29 100644 --- a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java +++ b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java @@ -17,12 +17,13 @@ import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.ConfigReader; -import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.TopList; +import net.Zrips.CMILib.FileHandler.ConfigReader; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Version.Version; + public class SignUtil { private final Map> signsByType = new HashMap<>(); @@ -137,8 +138,14 @@ public class SignUtil { File f = new File(Jobs.getFolder(), "Signs.yml"); YamlConfiguration conf = YamlConfiguration.loadConfiguration(f); - ConfigReader reader = new ConfigReader(f); - + ConfigReader reader = null; + try { + reader = new ConfigReader(f); + } catch (Exception e1) { + e1.printStackTrace(); + } + if (reader == null) + return; conf.options().copyDefaults(true); reader.addComment("Signs", "DO NOT EDIT THIS FILE BY HAND!"); diff --git a/src/main/java/com/gamingmesh/jobs/actions/BlockActionInfo.java b/src/main/java/com/gamingmesh/jobs/actions/BlockActionInfo.java index a3e9aa1e..e03befe0 100644 --- a/src/main/java/com/gamingmesh/jobs/actions/BlockActionInfo.java +++ b/src/main/java/com/gamingmesh/jobs/actions/BlockActionInfo.java @@ -20,9 +20,10 @@ package com.gamingmesh.jobs.actions; import org.bukkit.block.Block; -import com.gamingmesh.jobs.CMILib.CMIMaterial; import com.gamingmesh.jobs.container.ActionType; +import net.Zrips.CMILib.Items.CMIMaterial; + public class BlockActionInfo extends MaterialActionInfo { public BlockActionInfo(Block block, ActionType type) { super(block.getType(), CMIMaterial.getBlockData(block), type); diff --git a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java index 31d01f93..c0752b53 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java +++ b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java @@ -13,8 +13,6 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.ActionBarManager; -import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.Boost; import com.gamingmesh.jobs.container.CurrencyType; @@ -23,9 +21,12 @@ import com.gamingmesh.jobs.container.JobInfo; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.Title; -import com.gamingmesh.jobs.stuff.PageInfo; import com.gamingmesh.jobs.stuff.Util; +import net.Zrips.CMILib.ActionBar.CMIActionBar; +import net.Zrips.CMILib.Container.PageInfo; +import net.Zrips.CMILib.RawMessages.RawMessage; + public class JobsCommands implements CommandExecutor { public static final String LABEL = "jobs"; @@ -123,13 +124,13 @@ public class JobsCommands implements CommandExecutor { } if (page < 1) { - ActionBarManager.send(sender, Jobs.getLanguage().getMessage("general.error.noHelpPage")); + CMIActionBar.send(sender, Jobs.getLanguage().getMessage("general.error.noHelpPage")); return true; } PageInfo pi = new PageInfo(7, commands.size(), page); if (page > pi.getTotalPages()) { - ActionBarManager.send(sender, Jobs.getLanguage().getMessage("general.error.noHelpPage")); + CMIActionBar.send(sender, Jobs.getLanguage().getMessage("general.error.noHelpPage")); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/archive.java b/src/main/java/com/gamingmesh/jobs/commands/list/archive.java index 5e9830f6..43c5ae3f 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/archive.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/archive.java @@ -7,11 +7,12 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; +import net.Zrips.CMILib.RawMessages.RawMessage; + public class archive implements Cmd { @Override diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/area.java b/src/main/java/com/gamingmesh/jobs/commands/list/area.java index c88116c9..d41d3f78 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/area.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/area.java @@ -7,13 +7,14 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIMaterial; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.config.RestrictedAreaManager; import com.gamingmesh.jobs.container.CuboidArea; import com.gamingmesh.jobs.container.RestrictedArea; import com.gamingmesh.jobs.hooks.HookManager; +import net.Zrips.CMILib.Items.CMIMaterial; + public class area implements Cmd { @Override diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/blockinfo.java b/src/main/java/com/gamingmesh/jobs/commands/list/blockinfo.java index e5b086ec..121c4a01 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/blockinfo.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/blockinfo.java @@ -3,12 +3,14 @@ package com.gamingmesh.jobs.commands.list; import org.bukkit.block.Block; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; + import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.stuff.Util; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Version.Version; + public class blockinfo implements Cmd { @Override diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/bonus.java b/src/main/java/com/gamingmesh/jobs/commands/list/bonus.java index 917d5d01..428282ca 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/bonus.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/bonus.java @@ -2,10 +2,9 @@ package com.gamingmesh.jobs.commands.list; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; + import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.PlayerManager.BoostOf; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.Boost; import com.gamingmesh.jobs.container.CurrencyType; @@ -13,6 +12,9 @@ import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.hooks.HookManager; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.RawMessages.RawMessage; + public class bonus implements Cmd { @Override diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/bp.java b/src/main/java/com/gamingmesh/jobs/commands/list/bp.java index eb4a13d8..368869a5 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/bp.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/bp.java @@ -10,12 +10,13 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.BlockProtection; import com.gamingmesh.jobs.container.DBAction; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Version.Version; + public class bp implements Cmd { @SuppressWarnings("deprecation") diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/browse.java b/src/main/java/com/gamingmesh/jobs/commands/list/browse.java index 8bf0e2f4..d61197d5 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/browse.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/browse.java @@ -7,11 +7,12 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.Job; -import com.gamingmesh.jobs.stuff.PageInfo; + +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Container.PageInfo; +import net.Zrips.CMILib.RawMessages.RawMessage; public class browse implements Cmd { diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/demote.java b/src/main/java/com/gamingmesh/jobs/commands/list/demote.java index 1f4a2afe..fe08734a 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/demote.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/demote.java @@ -4,11 +4,12 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobsPlayer; +import net.Zrips.CMILib.Colors.CMIChatColor; + public class demote implements Cmd { @Override diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/edititembonus.java b/src/main/java/com/gamingmesh/jobs/commands/list/edititembonus.java index 57783c9d..1d733502 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/edititembonus.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/edititembonus.java @@ -7,15 +7,16 @@ import org.bukkit.inventory.ItemStack; import com.gamingmesh.jobs.ItemBoostManager; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.CMIReflections; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.BoostMultiplier; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobItems; import com.gamingmesh.jobs.container.JobsPlayer; -import com.gamingmesh.jobs.stuff.Util; + +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Items.CMIItemStack; +import net.Zrips.CMILib.NBT.CMINBT; public class edititembonus implements Cmd { @@ -70,7 +71,7 @@ public class edititembonus implements Cmd { if (jPlayer == null) return false; - ItemStack iih = Util.getItemInMainHand(player); + ItemStack iih = CMIItemStack.getItemInMainHand(player); if (iih == null || iih.getType() == Material.AIR) return false; @@ -78,14 +79,14 @@ public class edititembonus implements Cmd { case add: if (jobitem == null) return false; - iih = CMIReflections.setNbt(iih, "JobsItemBoost", jobitem.getNode()); - Util.setItemInMainHand(player, iih); + iih = (ItemStack) new CMINBT(iih).setString("JobsItemBoost", jobitem.getNode()); + CMIItemStack.setItemInMainHand(player, iih); break; case list: break; case remove: - iih = Jobs.getReflections().removeNbt(iih, "JobsItemBoost"); - Util.setItemInMainHand(player, iih); + iih = (ItemStack) new CMINBT(iih).remove("JobsItemBoost"); + CMIItemStack.setItemInMainHand(player, iih); break; default: break; @@ -93,7 +94,7 @@ public class edititembonus implements Cmd { sender.sendMessage(Jobs.getLanguage().getMessage("command.bonus.output.topline")); - Object key = CMIReflections.getNbt(iih, "JobsItemBoost"); + Object key = new CMINBT(iih).getString("JobsItemBoost"); if (key == null) return true; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/editjobs.java b/src/main/java/com/gamingmesh/jobs/commands/list/editjobs.java index d71c5c11..c6ca7f8b 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/editjobs.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/editjobs.java @@ -1,8 +1,12 @@ package com.gamingmesh.jobs.commands.list; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.ItemReflection; -import com.gamingmesh.jobs.CMILib.RawMessage; +import java.util.List; + +import org.bukkit.block.Block; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.config.ConfigManager.KeyValues; @@ -10,14 +14,12 @@ import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobInfo; -import com.gamingmesh.jobs.stuff.PageInfo; import com.gamingmesh.jobs.stuff.Util; -import org.bukkit.block.Block; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import java.util.List; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Container.PageInfo; +import net.Zrips.CMILib.Items.CMIItemStack; +import net.Zrips.CMILib.RawMessages.RawMessage; public class editjobs implements Cmd { @@ -335,11 +337,11 @@ public class editjobs implements Cmd { String key = args[3]; switch (args[3]) { case "hand": - ItemStack item = Util.getItemInMainHand(player); + ItemStack item = CMIItemStack.getItemInMainHand(player); key = item.getType().name() + "-" + item.getData().getData(); break; case "offhand": - item = ItemReflection.getItemInOffHand(player); + item = CMIItemStack.getItemInOffHand(player); key = item.getType().name() + "-" + item.getData().getData(); break; case "looking": diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java b/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java index 5e68f167..1c763243 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/editquests.java @@ -13,21 +13,22 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.CMIEntityType; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.ItemReflection; -import com.gamingmesh.jobs.CMILib.RawMessage; -import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobInfo; import com.gamingmesh.jobs.container.Quest; import com.gamingmesh.jobs.container.QuestObjective; -import com.gamingmesh.jobs.stuff.PageInfo; import com.gamingmesh.jobs.stuff.Util; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Container.PageInfo; +import net.Zrips.CMILib.Entities.CMIEntityType; +import net.Zrips.CMILib.Items.CMIItemStack; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.RawMessages.RawMessage; +import net.Zrips.CMILib.Version.Version; + public class editquests implements Cmd { @SuppressWarnings("deprecation") @@ -318,11 +319,11 @@ public class editquests implements Cmd { String key = args[4]; switch (args[4]) { case "hand": - ItemStack item = Util.getItemInMainHand(player); + ItemStack item = CMIItemStack.getItemInMainHand(player); key = item.getType().name() + "-" + item.getData().getData(); break; case "offhand": - item = ItemReflection.getItemInOffHand(player); + item = CMIItemStack.getItemInOffHand(player); key = item.getType().name() + "-" + item.getData().getData(); break; case "looking": diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/entitylist.java b/src/main/java/com/gamingmesh/jobs/commands/list/entitylist.java index 49e6848a..7c890ce4 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/entitylist.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/entitylist.java @@ -2,10 +2,12 @@ package com.gamingmesh.jobs.commands.list; import org.bukkit.command.CommandSender; import org.bukkit.entity.EntityType; + import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.commands.Cmd; +import net.Zrips.CMILib.Colors.CMIChatColor; + public class entitylist implements Cmd { @Override diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java b/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java index 6c75e568..ffbb63d7 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/gtop.java @@ -10,7 +10,8 @@ import org.bukkit.scoreboard.DisplaySlot; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.TopList; -import com.gamingmesh.jobs.stuff.PageInfo; + +import net.Zrips.CMILib.Container.PageInfo; public class gtop implements Cmd { diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java b/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java index 22dfe6e2..744efec8 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/itembonus.java @@ -17,9 +17,11 @@ import com.gamingmesh.jobs.container.JobItems; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.stuff.Util; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.RawMessage; + +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Items.CMIItemStack; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.RawMessages.RawMessage; public class itembonus implements Cmd { @@ -36,7 +38,7 @@ public class itembonus implements Cmd { if (jPlayer == null) return false; - ItemStack iih = Util.getItemInMainHand(player); + ItemStack iih = CMIItemStack.getItemInMainHand(player); List items = new ArrayList<>(); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/iteminfo.java b/src/main/java/com/gamingmesh/jobs/commands/list/iteminfo.java index f109c180..60cde1ce 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/iteminfo.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/iteminfo.java @@ -5,11 +5,14 @@ import org.bukkit.command.CommandSender; import org.bukkit.enchantments.EnchantmentTarget; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; + import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.stuff.Util; +import net.Zrips.CMILib.Items.CMIItemStack; +import net.Zrips.CMILib.Version.Version; + public class iteminfo implements Cmd { @Override @@ -25,7 +28,7 @@ public class iteminfo implements Cmd { return true; } - ItemStack iih = Util.getItemInMainHand((Player) sender); + ItemStack iih = CMIItemStack.getItemInMainHand((Player) sender); if (iih == null || iih.getType() == Material.AIR) return true; diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/join.java b/src/main/java/com/gamingmesh/jobs/commands/list/join.java index ec0d3535..d1e08c81 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/join.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/join.java @@ -8,7 +8,8 @@ import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; -import com.gamingmesh.jobs.CMILib.RawMessage; + +import net.Zrips.CMILib.RawMessages.RawMessage; public class join implements Cmd { diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/placeholders.java b/src/main/java/com/gamingmesh/jobs/commands/list/placeholders.java index aa66e984..7b7e41ec 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/placeholders.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/placeholders.java @@ -5,11 +5,12 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceHolders; import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceholderType; import com.gamingmesh.jobs.commands.Cmd; -import com.gamingmesh.jobs.stuff.PageInfo; + +import net.Zrips.CMILib.Container.PageInfo; +import net.Zrips.CMILib.RawMessages.RawMessage; public class placeholders implements Cmd { diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java index 259d80c9..67a3d432 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java @@ -15,7 +15,8 @@ import com.gamingmesh.jobs.container.Quest; import com.gamingmesh.jobs.container.QuestObjective; import com.gamingmesh.jobs.container.QuestProgression; import com.gamingmesh.jobs.stuff.TimeManage; -import com.gamingmesh.jobs.CMILib.RawMessage; + +import net.Zrips.CMILib.RawMessages.RawMessage; public class quests implements Cmd { diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/stats.java b/src/main/java/com/gamingmesh/jobs/commands/list/stats.java index 4fbfb7cf..2fcb9cec 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/stats.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/stats.java @@ -4,11 +4,12 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.RawMessage; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; +import net.Zrips.CMILib.RawMessages.RawMessage; + public class stats implements Cmd { @Override diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/top.java b/src/main/java/com/gamingmesh/jobs/commands/list/top.java index 58da0e8e..24c87c71 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/top.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/top.java @@ -11,7 +11,8 @@ import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.commands.Cmd; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.TopList; -import com.gamingmesh.jobs.stuff.PageInfo; + +import net.Zrips.CMILib.Container.PageInfo; public class top implements Cmd { diff --git a/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java b/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java index 6deb6099..a451adfd 100644 --- a/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/BlockProtectionManager.java @@ -9,10 +9,11 @@ import org.bukkit.World; import org.bukkit.block.Block; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIMaterial; import com.gamingmesh.jobs.container.BlockProtection; import com.gamingmesh.jobs.container.DBAction; +import net.Zrips.CMILib.Items.CMIMaterial; + public class BlockProtectionManager { private final HashMap>>> map = new HashMap<>(); diff --git a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java index b2a7fdb9..4434d784 100644 --- a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java @@ -9,13 +9,14 @@ import org.bukkit.boss.BarStyle; import org.bukkit.boss.BossBar; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.container.BossBarInfo; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.stuff.ToggleBarHandling; +import net.Zrips.CMILib.Version.Version; + public class BossBarManager { private Jobs plugin; diff --git a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java index f238e77a..8d4e35df 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ConfigManager.java @@ -37,12 +37,7 @@ import org.bukkit.inventory.meta.EnchantmentStorageMeta; import com.gamingmesh.jobs.ItemBoostManager; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.CMILib.CMIEnchantment; -import com.gamingmesh.jobs.CMILib.CMIEntityType; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.ConfigReader; -import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.BoostMultiplier; import com.gamingmesh.jobs.container.CurrencyType; @@ -60,6 +55,12 @@ import com.gamingmesh.jobs.resources.jfep.ParseError; import com.gamingmesh.jobs.resources.jfep.Parser; import com.gamingmesh.jobs.stuff.Util; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Entities.CMIEntityType; +import net.Zrips.CMILib.FileHandler.ConfigReader; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Version.Version; + public class ConfigManager { @Deprecated @@ -79,7 +80,16 @@ public class ConfigManager { } private void updateExampleFile() { - ConfigReader cfg = new ConfigReader(new File(Jobs.getFolder(), "jobs" + File.separator + EXAMPLEJOBNAME.toUpperCase() + ".yml")); + ConfigReader cfg = null; + try { + cfg = new ConfigReader(new File(Jobs.getFolder(), "jobs" + File.separator + EXAMPLEJOBNAME.toUpperCase() + ".yml")); + } catch (Exception e) { + e.printStackTrace(); + } + + if (cfg == null) + return; + if (!cfg.getFile().isFile()) return; cfg.load(); @@ -888,7 +898,14 @@ public class ConfigManager { Jobs.getPluginLogger().info("Done. Migrated jobs amount: " + jobFiles.size()); } - ConfigReader cfg = new ConfigReader("jobConfig.yml"); + ConfigReader cfg = null; + try { + cfg = new ConfigReader(Jobs.getInstance(), "jobConfig.yml"); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + cfg.saveToBackup(false); cfg.header(Arrays.asList("-----------------------------------------------------", "Jobs have been moved into jobs subfolder", diff --git a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java index 657a7b96..937a4df4 100644 --- a/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/GeneralConfigManager.java @@ -37,13 +37,14 @@ import org.bukkit.inventory.ItemStack; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.CMIEnchantment; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.ConfigReader; -import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.container.CurrencyLimit; import com.gamingmesh.jobs.container.CurrencyType; import com.gamingmesh.jobs.resources.jfep.Parser; +import net.Zrips.CMILib.FileHandler.ConfigReader; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Version.Version; + public class GeneralConfigManager { public List BroadcastingLevelUpLevels = new ArrayList<>(); @@ -281,7 +282,14 @@ public class GeneralConfigManager { * loads from Jobs/generalConfig.yml */ private void loadGeneralSettings() { - c = new ConfigReader("generalConfig.yml"); + try { + c = new ConfigReader(Jobs.getInstance(), "generalConfig.yml"); + } catch (Exception e1) { + e1.printStackTrace(); + } + + if (c == null) + return; c.header(Arrays.asList("General configuration.", " The general configuration for the jobs plugin mostly includes how often the plugin", diff --git a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java index b1b6ab31..d1b14514 100644 --- a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java @@ -7,9 +7,10 @@ import java.util.Iterator; import java.util.List; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.ConfigReader; import com.gamingmesh.jobs.stuff.Util; +import net.Zrips.CMILib.FileHandler.ConfigReader; + public class LanguageManager { public final List signKeys = new ArrayList<>(); @@ -60,7 +61,13 @@ public class LanguageManager { f = new File(Jobs.getFolder(), "locale" + File.separator + "messages_" + lang + ".yml"); } - ConfigReader c = new ConfigReader(f); + ConfigReader c; + try { + c = new ConfigReader(f); + } catch (Exception e) { + e.printStackTrace(); + continue; + } c.copyDefaults(true); Jobs.getGCManager().getCommandArgs().clear(); diff --git a/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java b/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java index 4d2ad608..9c2b0991 100644 --- a/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/NameTranslatorManager.java @@ -1,7 +1,12 @@ package com.gamingmesh.jobs.config; import java.io.File; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; import org.bukkit.configuration.ConfigurationSection; @@ -10,15 +15,16 @@ import org.bukkit.entity.EntityType; import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.CMILib.CMIEnchantment; -import com.gamingmesh.jobs.CMILib.CMIEntityType; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.ConfigReader; import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.JobInfo; import com.gamingmesh.jobs.container.NameList; import com.gamingmesh.jobs.hooks.HookManager; import com.gamingmesh.jobs.stuff.Util; +import net.Zrips.CMILib.Entities.CMIEntityType; +import net.Zrips.CMILib.FileHandler.ConfigReader; +import net.Zrips.CMILib.Items.CMIMaterial; + public class NameTranslatorManager { private final Map listOfNames = new HashMap<>(); @@ -299,7 +305,13 @@ public class NameTranslatorManager { f = new File(tWordsFolder, "Words_" + lang + ".yml"); } - ConfigReader c = new ConfigReader(f); + ConfigReader c; + try { + c = new ConfigReader(f); + } catch (Exception e) { + e.printStackTrace(); + continue; + } c.copyDefaults(true); for (CMIMaterial mat : CMIMaterial.values()) { diff --git a/src/main/java/com/gamingmesh/jobs/config/RestrictedBlockManager.java b/src/main/java/com/gamingmesh/jobs/config/RestrictedBlockManager.java index f22a107e..be66c1d4 100644 --- a/src/main/java/com/gamingmesh/jobs/config/RestrictedBlockManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/RestrictedBlockManager.java @@ -4,10 +4,12 @@ import java.util.HashMap; import java.util.Map; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIItemStack; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.ConfigReader; -import com.gamingmesh.jobs.CMILib.ItemManager; + +import net.Zrips.CMILib.CMILib; +import net.Zrips.CMILib.FileHandler.ConfigReader; +import net.Zrips.CMILib.Items.CMIItemStack; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Items.ItemManager; public class RestrictedBlockManager { @@ -21,7 +23,15 @@ public class RestrictedBlockManager { if (!Jobs.getGCManager().useBlockProtection) return; - ConfigReader cfg = new ConfigReader("restrictedBlocks.yml"); + ConfigReader cfg = null; + try { + cfg = new ConfigReader(Jobs.getInstance(), "restrictedBlocks.yml"); + } catch (Exception e) { + e.printStackTrace(); + } + + if (cfg == null) + return; cfg.addComment("blocksTimer", "Block protected by timer in sec", "Category name can be any you like to be easily recognized", @@ -33,7 +43,7 @@ public class RestrictedBlockManager { if (section != null) { for (String one : section.getKeys(false)) { if ((section.isString(one + ".id") || section.isInt(one + ".id")) && section.isInt(one + ".cd")) { - CMIItemStack cm = ItemManager.getItem(CMIMaterial.get(section.getString(one + ".id"))); + CMIItemStack cm = CMIMaterial.get(section.getString(one + ".id")).newCMIItemStack(); CMIMaterial mat = cm == null ? null : cm.getCMIType(); if (mat == null || !mat.isBlock()) { diff --git a/src/main/java/com/gamingmesh/jobs/config/ShopManager.java b/src/main/java/com/gamingmesh/jobs/config/ShopManager.java index 1e2cbdf9..323d3f4e 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ShopManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ShopManager.java @@ -5,8 +5,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.UUID; import java.util.Map.Entry; +import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -22,14 +22,7 @@ import org.bukkit.potion.PotionData; import org.bukkit.potion.PotionType; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMIGUI.CMIGui; -import com.gamingmesh.jobs.CMIGUI.CMIGuiButton; -import com.gamingmesh.jobs.CMIGUI.GUIManager.GUIClickType; -import com.gamingmesh.jobs.CMIGUI.GUIManager.GUIRows; -import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.CMILib.CMIEnchantment; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.container.BoostMultiplier; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobItems; @@ -39,6 +32,14 @@ import com.gamingmesh.jobs.container.ShopItem; import com.gamingmesh.jobs.stuff.GiveItem; import com.gamingmesh.jobs.stuff.Util; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.GUI.CMIGui; +import net.Zrips.CMILib.GUI.CMIGuiButton; +import net.Zrips.CMILib.GUI.GUIManager.GUIClickType; +import net.Zrips.CMILib.GUI.GUIManager.GUIRows; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Version.Version; + @SuppressWarnings("deprecation") public class ShopManager { diff --git a/src/main/java/com/gamingmesh/jobs/config/TitleManager.java b/src/main/java/com/gamingmesh/jobs/config/TitleManager.java index 5b018de6..301e6b28 100644 --- a/src/main/java/com/gamingmesh/jobs/config/TitleManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/TitleManager.java @@ -7,10 +7,11 @@ import java.util.List; import org.bukkit.configuration.ConfigurationSection; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.ConfigReader; import com.gamingmesh.jobs.container.Title; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.FileHandler.ConfigReader; + public class TitleManager { protected final List titles = new ArrayList<>(); @@ -43,7 +44,13 @@ public class TitleManager { void load() { titles.clear(); - ConfigReader c = new ConfigReader("titleConfig.yml"); + ConfigReader c; + try { + c = new ConfigReader(Jobs.getInstance(), "titleConfig.yml"); + } catch (Exception e) { + e.printStackTrace(); + return; + } c.copyDefaults(true); c.header(Arrays.asList( diff --git a/src/main/java/com/gamingmesh/jobs/container/ArmorTypes.java b/src/main/java/com/gamingmesh/jobs/container/ArmorTypes.java index e7f231bb..ef0b1d3a 100644 --- a/src/main/java/com/gamingmesh/jobs/container/ArmorTypes.java +++ b/src/main/java/com/gamingmesh/jobs/container/ArmorTypes.java @@ -2,7 +2,7 @@ package com.gamingmesh.jobs.container; import org.bukkit.inventory.ItemStack; -import com.gamingmesh.jobs.CMILib.CMIMaterial; +import net.Zrips.CMILib.Items.CMIMaterial; public enum ArmorTypes { HELMET(5), CHESTPLATE(6), LEGGINGS(7), BOOTS(8), ELYTRA(6); diff --git a/src/main/java/com/gamingmesh/jobs/container/Job.java b/src/main/java/com/gamingmesh/jobs/container/Job.java index e79dd816..f23aa96d 100644 --- a/src/main/java/com/gamingmesh/jobs/container/Job.java +++ b/src/main/java/com/gamingmesh/jobs/container/Job.java @@ -36,11 +36,12 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.CMIMaterial; import com.gamingmesh.jobs.actions.PotionItemActionInfo; import com.gamingmesh.jobs.resources.jfep.Parser; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Items.CMIMaterial; + public class Job { private Map<ActionType, List<JobInfo>> jobInfo = new EnumMap<>(ActionType.class); diff --git a/src/main/java/com/gamingmesh/jobs/container/JobInfo.java b/src/main/java/com/gamingmesh/jobs/container/JobInfo.java index cc37bf12..f524a05d 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobInfo.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobInfo.java @@ -19,9 +19,10 @@ package com.gamingmesh.jobs.container; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.resources.jfep.Parser; +import net.Zrips.CMILib.Colors.CMIChatColor; + public class JobInfo { private ActionType actionType; private int id; diff --git a/src/main/java/com/gamingmesh/jobs/container/JobItems.java b/src/main/java/com/gamingmesh/jobs/container/JobItems.java index af30a41d..33d8e648 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobItems.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobItems.java @@ -34,10 +34,11 @@ import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.inventory.meta.PotionMeta; import org.bukkit.potion.PotionEffectType; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.CMIReflections; -import com.gamingmesh.jobs.CMILib.Version; +import net.Zrips.CMILib.CMILib; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.NBT.CMINBT; +import net.Zrips.CMILib.Version.Version; @SuppressWarnings("deprecation") public class JobItems { @@ -124,7 +125,8 @@ public class JobItems { } item.setAmount(amount); - item = CMIReflections.setNbt(item, "JobsItemBoost", node); + CMINBT nbt = new CMINBT(item); + item = (ItemStack) nbt.setString("JobsItemBoost", node); } public String getNode() { diff --git a/src/main/java/com/gamingmesh/jobs/container/JobLimitedItems.java b/src/main/java/com/gamingmesh/jobs/container/JobLimitedItems.java index e5afe90c..3e7e9a7f 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobLimitedItems.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobLimitedItems.java @@ -28,8 +28,8 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.CMIMaterial; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Items.CMIMaterial; public class JobLimitedItems { private String node; diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 973a067c..2878e9ae 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -32,9 +32,6 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.ActionBarManager; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.CMIMaterial; import com.gamingmesh.jobs.Signs.SignTopType; import com.gamingmesh.jobs.api.JobsLevelUpEvent; import com.gamingmesh.jobs.container.blockOwnerShip.BlockTypes; @@ -43,6 +40,10 @@ import com.gamingmesh.jobs.economy.PaymentData; import com.gamingmesh.jobs.resources.jfep.Parser; import com.gamingmesh.jobs.stuff.TimeManage; +import net.Zrips.CMILib.ActionBar.CMIActionBar; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Items.CMIMaterial; + public class JobsPlayer { private final Jobs plugin = org.bukkit.plugin.java.JavaPlugin.getPlugin(Jobs.class); @@ -237,7 +238,7 @@ public class JobsPlayer { } if (data.isAnnounceTime(limit.getAnnouncementDelay()) && player.isOnline()) - ActionBarManager.send(player, Jobs.getLanguage().getMessage("command.limit.output." + name + "time", "%time%", TimeManage.to24hourShort(data.getLeftTime(type)))); + CMIActionBar.send(player, Jobs.getLanguage().getMessage("command.limit.output." + name + "time", "%time%", TimeManage.to24hourShort(data.getLeftTime(type)))); if (data.isReseted(type)) data.setReseted(type, false); diff --git a/src/main/java/com/gamingmesh/jobs/container/Schedule.java b/src/main/java/com/gamingmesh/jobs/container/Schedule.java index 3e82922f..a918a710 100644 --- a/src/main/java/com/gamingmesh/jobs/container/Schedule.java +++ b/src/main/java/com/gamingmesh/jobs/container/Schedule.java @@ -5,7 +5,8 @@ import java.util.Arrays; import java.util.List; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIChatColor; + +import net.Zrips.CMILib.Colors.CMIChatColor; public class Schedule { diff --git a/src/main/java/com/gamingmesh/jobs/container/Title.java b/src/main/java/com/gamingmesh/jobs/container/Title.java index 20bea30c..8d31ae1e 100644 --- a/src/main/java/com/gamingmesh/jobs/container/Title.java +++ b/src/main/java/com/gamingmesh/jobs/container/Title.java @@ -20,7 +20,7 @@ package com.gamingmesh.jobs.container; import org.bukkit.ChatColor; -import com.gamingmesh.jobs.CMILib.CMIChatColor; +import net.Zrips.CMILib.Colors.CMIChatColor; /** * Container class for titles diff --git a/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockOwnerShip.java b/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockOwnerShip.java index fd2471c6..c4250c83 100644 --- a/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockOwnerShip.java +++ b/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockOwnerShip.java @@ -15,276 +15,277 @@ import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIMaterial; import com.gamingmesh.jobs.config.YmlMaker; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.stuff.blockLoc; +import net.Zrips.CMILib.Items.CMIMaterial; + public class BlockOwnerShip { - private CMIMaterial material; - private BlockTypes type; - private String metadataName = ""; + private CMIMaterial material; + private BlockTypes type; + private String metadataName = ""; - private final Map<UUID, List<blockLoc>> blockOwnerShips = new HashMap<>(); + private final Map<UUID, List<blockLoc>> blockOwnerShips = new HashMap<>(); - private final Jobs plugin = org.bukkit.plugin.java.JavaPlugin.getPlugin(Jobs.class); + private final Jobs plugin = org.bukkit.plugin.java.JavaPlugin.getPlugin(Jobs.class); - public BlockOwnerShip(CMIMaterial type) { - // Type should be any type of furnace, smoker or brewing stand - if (type != CMIMaterial.FURNACE && type != CMIMaterial.LEGACY_BURNING_FURNACE - && type != CMIMaterial.BLAST_FURNACE && type != CMIMaterial.SMOKER && type != CMIMaterial.BREWING_STAND - && type != CMIMaterial.LEGACY_BREWING_STAND) { - throw new IllegalArgumentException("Material types should be any type of furnace, smoker or brewing stand"); - } - - material = type; - - switch (this.type = BlockTypes.getFromCMIMaterial(type)) { - case BLAST_FURNACE: - metadataName = "jobsBlastFurnaceOwner"; - break; - case BREWING_STAND: - metadataName = "jobsBrewingOwner"; - break; - case FURNACE: - metadataName = "jobsFurnaceOwner"; - break; - case SMOKER: - metadataName = "jobsSmokerOwner"; - break; - default: - break; - } + public BlockOwnerShip(CMIMaterial type) { + // Type should be any type of furnace, smoker or brewing stand + if (type != CMIMaterial.FURNACE && type != CMIMaterial.LEGACY_BURNING_FURNACE + && type != CMIMaterial.BLAST_FURNACE && type != CMIMaterial.SMOKER && type != CMIMaterial.BREWING_STAND + && type != CMIMaterial.LEGACY_BREWING_STAND) { + throw new IllegalArgumentException("Material types should be any type of furnace, smoker or brewing stand"); } - public BlockTypes getType() { - return type; + material = type; + + switch (this.type = BlockTypes.getFromCMIMaterial(type)) { + case BLAST_FURNACE: + metadataName = "jobsBlastFurnaceOwner"; + break; + case BREWING_STAND: + metadataName = "jobsBrewingOwner"; + break; + case FURNACE: + metadataName = "jobsFurnaceOwner"; + break; + case SMOKER: + metadataName = "jobsSmokerOwner"; + break; + default: + break; + } + } + + public BlockTypes getType() { + return type; + } + + public CMIMaterial getMaterial() { + return material; + } + + public String getMetadataName() { + return metadataName; + } + + public Map<UUID, List<blockLoc>> getBlockOwnerShips() { + return blockOwnerShips; + } + + public ownershipFeedback register(Player player, Block block) { + if (type != BlockTypes.getFromCMIMaterial(CMIMaterial.get(block))) { + return ownershipFeedback.invalid; } - public CMIMaterial getMaterial() { - return material; + JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); + if (jPlayer == null) { + return ownershipFeedback.invalid; } - public String getMetadataName() { - return metadataName; + int max = jPlayer.getMaxOwnerShipAllowed(type); + int have = getTotal(jPlayer.getUniqueId()); + + boolean owner = false; + List<MetadataValue> data = getBlockMetadatas(block); + if (!data.isEmpty()) { + if (!data.get(0).asString().equals(jPlayer.getUniqueId().toString())) { + return ownershipFeedback.notOwn; + } + + if (have > max && max > 0) { + remove(block); + } + + owner = true; } - public Map<UUID, List<blockLoc>> getBlockOwnerShips() { - return blockOwnerShips; + if (owner) + return ownershipFeedback.old; + + if (have >= max && max > 0) + return ownershipFeedback.tooMany; + + block.setMetadata(metadataName, new FixedMetadataValue(plugin, jPlayer.getUniqueId().toString())); + + if (!Jobs.getGCManager().isBrewingStandsReassign() && !Jobs.getGCManager().isFurnacesReassign() + && !Jobs.getGCManager().BlastFurnacesReassign && !Jobs.getGCManager().SmokerReassign) { + return ownershipFeedback.newReg; } - public ownershipFeedback register(Player player, Block block) { - if (type != BlockTypes.getFromCMIMaterial(CMIMaterial.get(block))) { - return ownershipFeedback.invalid; - } + List<blockLoc> ls = blockOwnerShips.getOrDefault(jPlayer.getUniqueId(), new ArrayList<>()); + ls.add(new blockLoc(block.getLocation())); + blockOwnerShips.put(jPlayer.getUniqueId(), ls); + return ownershipFeedback.newReg; + } - JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player); - if (jPlayer == null) { - return ownershipFeedback.invalid; - } + public boolean remove(Block block) { + UUID uuid = null; + List<MetadataValue> data = getBlockMetadatas(block); - int max = jPlayer.getMaxOwnerShipAllowed(type); - int have = getTotal(jPlayer.getUniqueId()); - - boolean owner = false; - List<MetadataValue> data = getBlockMetadatas(block); - if (!data.isEmpty()) { - if (!data.get(0).asString().equals(jPlayer.getUniqueId().toString())) { - return ownershipFeedback.notOwn; - } - - if (have > max && max > 0) { - remove(block); - } - - owner = true; - } - - if (owner) - return ownershipFeedback.old; - - if (have >= max && max > 0) - return ownershipFeedback.tooMany; - - block.setMetadata(metadataName, new FixedMetadataValue(plugin, jPlayer.getUniqueId().toString())); - - if (!Jobs.getGCManager().isBrewingStandsReassign() && !Jobs.getGCManager().isFurnacesReassign() - && !Jobs.getGCManager().BlastFurnacesReassign && !Jobs.getGCManager().SmokerReassign) { - return ownershipFeedback.newReg; - } - - List<blockLoc> ls = blockOwnerShips.getOrDefault(jPlayer.getUniqueId(), new ArrayList<>()); - ls.add(new blockLoc(block.getLocation())); - blockOwnerShips.put(jPlayer.getUniqueId(), ls); - return ownershipFeedback.newReg; + if (!data.isEmpty()) { + try { + uuid = UUID.fromString(data.get(0).asString()); + } catch (IllegalArgumentException e) { + } } - public boolean remove(Block block) { - UUID uuid = null; - List<MetadataValue> data = getBlockMetadatas(block); - - if (!data.isEmpty()) { - try { - uuid = UUID.fromString(data.get(0).asString()); - } catch (IllegalArgumentException e) { - } - } - - if (uuid == null) { - return false; - } - - List<blockLoc> ls = blockOwnerShips.getOrDefault(uuid, new ArrayList<>()); - org.bukkit.Location blockLoc = block.getLocation(); - - for (blockLoc one : ls) { - if (one.getLocation().equals(blockLoc)) { - block.removeMetadata(metadataName, plugin); - ls.remove(one); - return true; - } - } - - return false; + if (uuid == null) { + return false; } - public int clear(UUID uuid) { - List<blockLoc> ls = blockOwnerShips.remove(uuid); - if (ls == null) - return 0; + List<blockLoc> ls = blockOwnerShips.getOrDefault(uuid, new ArrayList<>()); + org.bukkit.Location blockLoc = block.getLocation(); - for (blockLoc one : ls) { - one.getBlock().removeMetadata(metadataName, plugin); - } - - return ls.size(); + for (blockLoc one : ls) { + if (one.getLocation().equals(blockLoc)) { + block.removeMetadata(metadataName, plugin); + ls.remove(one); + return true; + } } - public List<MetadataValue> getBlockMetadatas(Block block) { - return block.getMetadata(metadataName); + return false; + } + + public int clear(UUID uuid) { + List<blockLoc> ls = blockOwnerShips.remove(uuid); + if (ls == null) + return 0; + + for (blockLoc one : ls) { + one.getBlock().removeMetadata(metadataName, plugin); } - public int getTotal(UUID uuid) { - List<blockLoc> list = blockOwnerShips.get(uuid); - return list == null ? 0 : list.size(); + return ls.size(); + } + + public List<MetadataValue> getBlockMetadatas(Block block) { + return block.getMetadata(metadataName); + } + + public int getTotal(UUID uuid) { + List<blockLoc> list = blockOwnerShips.get(uuid); + return list == null ? 0 : list.size(); + } + + public void load() { + YmlMaker f = new YmlMaker(Jobs.getFolder(), "furnaceBrewingStands.yml"); + YmlMaker f2 = new YmlMaker(Jobs.getFolder(), "blockOwnerShips.yml"); + if (!f.exists() && !f2.exists()) + return; + + if (f.exists()) { + f.getConfigFile().renameTo(f2.getConfigFile()); } - public void load() { - YmlMaker f = new YmlMaker(Jobs.getFolder(), "furnaceBrewingStands.yml"); - YmlMaker f2 = new YmlMaker(Jobs.getFolder(), "blockOwnerShips.yml"); - if (!f.exists() && !f2.exists()) - return; + f = f2; - if (f.exists()) { - f.getConfigFile().renameTo(f2.getConfigFile()); - } + String path = (type == BlockTypes.FURNACE ? "Furnace" + : type == BlockTypes.BLAST_FURNACE ? "BlastFurnace" + : type == BlockTypes.BREWING_STAND ? "Brewing" : type == BlockTypes.SMOKER ? "Smoker" : ""); - f = f2; + if (isReassignDisabled()) + return; - String path = (type == BlockTypes.FURNACE ? "Furnace" - : type == BlockTypes.BLAST_FURNACE ? "BlastFurnace" - : type == BlockTypes.BREWING_STAND ? "Brewing" : type == BlockTypes.SMOKER ? "Smoker" : ""); - - if (isReassignDisabled()) - return; - - ConfigurationSection section = f.getConfig().getConfigurationSection(path); - if (section == null) { - return; - } - - int total = 0; - for (String one : section.getKeys(false)) { - String value = section.getString(one); - List<String> ls = new ArrayList<>(); - - if (value.contains(";")) - ls.addAll(Arrays.asList(value.split(";"))); - else - ls.add(value); - - UUID uuid; - try { - uuid = UUID.fromString(one); - } catch (IllegalArgumentException e) { - continue; - } - - List<blockLoc> blist = new ArrayList<>(); - for (String oneL : ls) { - blockLoc bl = new blockLoc(oneL); - Block block = bl.getBlock(); - if (block == null) - continue; - - block.removeMetadata(metadataName, plugin); - block.setMetadata(metadataName, new FixedMetadataValue(plugin, one)); - - blist.add(bl); - total++; - } - - if (!blist.isEmpty()) { - blockOwnerShips.put(uuid, blist); - } - } - - if (total > 0) { - Jobs.consoleMsg("&e[Jobs] Loaded " + total + " " + path.toLowerCase() + " for reassigning."); - } + ConfigurationSection section = f.getConfig().getConfigurationSection(path); + if (section == null) { + return; } - public void save() { - YmlMaker f = new YmlMaker(Jobs.getFolder(), "furnaceBrewingStands.yml"); - if (f.exists()) { - f.getConfigFile().renameTo(new File(Jobs.getFolder(), "blockOwnerShips.yml")); - } + int total = 0; + for (String one : section.getKeys(false)) { + String value = section.getString(one); + List<String> ls = new ArrayList<>(); - f = new YmlMaker(Jobs.getFolder(), "blockOwnerShips.yml"); + if (value.contains(";")) + ls.addAll(Arrays.asList(value.split(";"))); + else + ls.add(value); - if (blockOwnerShips.isEmpty() && f.getConfigFile().length() == 0L) { - f.getConfigFile().delete(); - return; - } + UUID uuid; + try { + uuid = UUID.fromString(one); + } catch (IllegalArgumentException e) { + continue; + } - f.createNewFile(); - f.saveDefaultConfig(); + List<blockLoc> blist = new ArrayList<>(); + for (String oneL : ls) { + blockLoc bl = new blockLoc(oneL); + Block block = bl.getBlock(); + if (block == null) + continue; - if (isReassignDisabled()) { - return; - } + block.removeMetadata(metadataName, plugin); + block.setMetadata(metadataName, new FixedMetadataValue(plugin, one)); - String path = (type == BlockTypes.FURNACE ? "Furnace" - : type == BlockTypes.BLAST_FURNACE ? "BlastFurnace" - : type == BlockTypes.BREWING_STAND ? "Brewing" : type == BlockTypes.SMOKER ? "Smoker" : ""); - f.getConfig().set(path, null); + blist.add(bl); + total++; + } - for (Map.Entry<UUID, List<blockLoc>> one : blockOwnerShips.entrySet()) { - String full = ""; - - for (blockLoc oneL : one.getValue()) { - if (!full.isEmpty()) - full += ";"; - - full += oneL.toString(); - } - - if (!full.isEmpty()) - f.getConfig().set(path + "." + one.getKey().toString(), full); - } - - f.saveConfig(); + if (!blist.isEmpty()) { + blockOwnerShips.put(uuid, blist); + } } - public boolean isReassignDisabled() { - return (type == BlockTypes.FURNACE && !Jobs.getGCManager().isFurnacesReassign()) - || (type == BlockTypes.BLAST_FURNACE && !Jobs.getGCManager().BlastFurnacesReassign) - || (type == BlockTypes.BREWING_STAND && !Jobs.getGCManager().isBrewingStandsReassign()) - || (type == BlockTypes.SMOKER && !Jobs.getGCManager().SmokerReassign); + if (total > 0) { + Jobs.consoleMsg("&e[Jobs] Loaded " + total + " " + path.toLowerCase() + " for reassigning."); + } + } + + public void save() { + YmlMaker f = new YmlMaker(Jobs.getFolder(), "furnaceBrewingStands.yml"); + if (f.exists()) { + f.getConfigFile().renameTo(new File(Jobs.getFolder(), "blockOwnerShips.yml")); } - public enum ownershipFeedback { - invalid, tooMany, newReg, old, notOwn + f = new YmlMaker(Jobs.getFolder(), "blockOwnerShips.yml"); + + if (blockOwnerShips.isEmpty() && f.getConfigFile().length() == 0L) { + f.getConfigFile().delete(); + return; } + + f.createNewFile(); + f.saveDefaultConfig(); + + if (isReassignDisabled()) { + return; + } + + String path = (type == BlockTypes.FURNACE ? "Furnace" + : type == BlockTypes.BLAST_FURNACE ? "BlastFurnace" + : type == BlockTypes.BREWING_STAND ? "Brewing" : type == BlockTypes.SMOKER ? "Smoker" : ""); + f.getConfig().set(path, null); + + for (Map.Entry<UUID, List<blockLoc>> one : blockOwnerShips.entrySet()) { + String full = ""; + + for (blockLoc oneL : one.getValue()) { + if (!full.isEmpty()) + full += ";"; + + full += oneL.toString(); + } + + if (!full.isEmpty()) + f.getConfig().set(path + "." + one.getKey().toString(), full); + } + + f.saveConfig(); + } + + public boolean isReassignDisabled() { + return (type == BlockTypes.FURNACE && !Jobs.getGCManager().isFurnacesReassign()) + || (type == BlockTypes.BLAST_FURNACE && !Jobs.getGCManager().BlastFurnacesReassign) + || (type == BlockTypes.BREWING_STAND && !Jobs.getGCManager().isBrewingStandsReassign()) + || (type == BlockTypes.SMOKER && !Jobs.getGCManager().SmokerReassign); + } + + public enum ownershipFeedback { + invalid, tooMany, newReg, old, notOwn + } } diff --git a/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockTypes.java b/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockTypes.java index db2975a1..01ca623a 100644 --- a/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockTypes.java +++ b/src/main/java/com/gamingmesh/jobs/container/blockOwnerShip/BlockTypes.java @@ -1,35 +1,37 @@ package com.gamingmesh.jobs.container.blockOwnerShip; -import com.gamingmesh.jobs.CMILib.CMIMaterial; +import net.Zrips.CMILib.Items.CMIMaterial; public enum BlockTypes { - BREWING_STAND("BREWING_STAND", "LEGACY_BREWING_STAND"), FURNACE("FURNACE", "LEGACY_BURNING_FURNACE"), SMOKER, - BLAST_FURNACE; + BREWING_STAND("BREWING_STAND", "LEGACY_BREWING_STAND"), + FURNACE("FURNACE", "LEGACY_BURNING_FURNACE"), + SMOKER, + BLAST_FURNACE; - private String[] names; + private String[] names; - BlockTypes() { - names = new String[] { toString() }; - } + BlockTypes() { + names = new String[] { toString() }; + } - BlockTypes(String... names) { - this.names = names; - } + BlockTypes(String... names) { + this.names = names; + } - public String[] getNames() { - return names; - } + public String[] getNames() { + return names; + } - public static BlockTypes getFromCMIMaterial(CMIMaterial type) { - for (BlockTypes b : values()) { - for (String name : b.names) { - if (name.equals(type.name())) { - return b; - } - } + public static BlockTypes getFromCMIMaterial(CMIMaterial type) { + for (BlockTypes b : values()) { + for (String name : b.names) { + if (name.equals(type.name())) { + return b; } - - return null; + } } + + return null; + } } diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsManager.java b/src/main/java/com/gamingmesh/jobs/dao/JobsManager.java index b2b18d54..9eec2651 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsManager.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsManager.java @@ -3,7 +3,8 @@ package com.gamingmesh.jobs.dao; import java.io.IOException; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.ConfigReader; + +import net.Zrips.CMILib.FileHandler.ConfigReader; public class JobsManager { private JobsDAO dao; diff --git a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java index 0102c062..80ce4897 100644 --- a/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java +++ b/src/main/java/com/gamingmesh/jobs/economy/BufferedEconomy.java @@ -18,18 +18,6 @@ package com.gamingmesh.jobs.economy; -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.ActionBarManager; -import com.gamingmesh.jobs.CMILib.Version; -import com.gamingmesh.jobs.api.JobsPaymentEvent; -import com.gamingmesh.jobs.container.CurrencyType; -import com.gamingmesh.jobs.container.JobsPlayer; -import com.gamingmesh.jobs.stuff.ToggleBarHandling; -import com.gamingmesh.jobs.tasks.BufferedPaymentTask; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; - import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -37,6 +25,20 @@ import java.util.UUID; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; +import org.bukkit.entity.Player; + +import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.api.JobsPaymentEvent; +import com.gamingmesh.jobs.container.CurrencyType; +import com.gamingmesh.jobs.container.JobsPlayer; +import com.gamingmesh.jobs.stuff.ToggleBarHandling; +import com.gamingmesh.jobs.tasks.BufferedPaymentTask; + +import net.Zrips.CMILib.ActionBar.CMIActionBar; +import net.Zrips.CMILib.Version.Version; + public class BufferedEconomy { private Jobs plugin; @@ -171,7 +173,7 @@ public class BufferedEconomy { } if (Jobs.getGCManager().ActionBarsMessageByDefault && serverTaxesAccount.isOnline()) { - ActionBarManager.send(Bukkit.getPlayer(serverAccountName), + CMIActionBar.send(Bukkit.getPlayer(serverAccountName), Jobs.getLanguage().getMessage("message.taxes", "[amount]", (int) (totalAmount * 100) / 100.0)); } } @@ -201,7 +203,7 @@ public class BufferedEconomy { payment.getPayment().putAll(jobsPaymentEvent.getPayment()); if (Jobs.getGCManager().UseServerAccount && !hasMoney) { - ActionBarManager.send(payment.getOfflinePlayer().getPlayer(), Jobs.getLanguage().getMessage("economy.error.nomoney")); + CMIActionBar.send(payment.getOfflinePlayer().getPlayer(), Jobs.getLanguage().getMessage("economy.error.nomoney")); continue; } @@ -271,7 +273,7 @@ public class BufferedEconomy { boolean showInActionbar = ToggleBarHandling.getActionBarToggle().getOrDefault(playerUUID.toString(), Jobs.getGCManager().ActionBarsMessageByDefault); if (showInActionbar) { - ActionBarManager.send(abp, message); + CMIActionBar.send(abp, message); } else { abp.sendMessage(message); } diff --git a/src/main/java/com/gamingmesh/jobs/i18n/Language.java b/src/main/java/com/gamingmesh/jobs/i18n/Language.java index cd73d1b1..cf551599 100644 --- a/src/main/java/com/gamingmesh/jobs/i18n/Language.java +++ b/src/main/java/com/gamingmesh/jobs/i18n/Language.java @@ -27,9 +27,10 @@ import java.util.regex.Pattern; import org.bukkit.configuration.file.FileConfiguration; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIChatColor; import com.gamingmesh.jobs.config.YmlMaker; +import net.Zrips.CMILib.Colors.CMIChatColor; + public class Language { public FileConfiguration enlocale, customlocale; diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java index ddd9b0a0..28fe507c 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsListener.java @@ -66,10 +66,6 @@ import org.bukkit.permissions.PermissionDefault; import org.bukkit.plugin.PluginManager; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.ActionBarManager; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.Signs.SignTopType; import com.gamingmesh.jobs.Signs.SignUtil; import com.gamingmesh.jobs.Signs.jobsSign; @@ -81,9 +77,14 @@ import com.gamingmesh.jobs.container.JobLimitedItems; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsArmorChangeEvent; import com.gamingmesh.jobs.container.JobsArmorChangeEvent.EquipMethod; -import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.container.JobsPlayer; +import net.Zrips.CMILib.ActionBar.CMIActionBar; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Items.CMIItemStack; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Version.Version; + public class JobsListener implements Listener { private Jobs plugin; @@ -118,7 +119,7 @@ public class JobsListener implements Listener { return; Player player = event.getPlayer(); - if (Util.getItemInMainHand(player).getType() != CMIMaterial.get(Jobs.getGCManager().getSelectionTool()).getMaterial()) + if (CMIItemStack.getItemInMainHand(player).getType() != CMIMaterial.get(Jobs.getGCManager().getSelectionTool()).getMaterial()) return; if (!Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()) || !player.hasPermission("jobs.area.select")) @@ -370,7 +371,7 @@ public class JobsListener implements Listener { @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onLimitedItemInteract(PlayerInteractEvent event) { Player player = event.getPlayer(); - ItemStack iih = Util.getItemInMainHand(player); + ItemStack iih = CMIItemStack.getItemInMainHand(player); if (iih.getType() == Material.AIR) return; @@ -411,7 +412,7 @@ public class JobsListener implements Listener { if (meinOk != null) { event.setCancelled(true); - ActionBarManager.send(player, Jobs.getLanguage().getMessage("limitedItem.error.levelup", "[jobname]", meinOk)); + CMIActionBar.send(player, Jobs.getLanguage().getMessage("limitedItem.error.levelup", "[jobname]", meinOk)); } } diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 29244ff1..4854d4df 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -18,24 +18,11 @@ package com.gamingmesh.jobs.listeners; -import com.gamingmesh.jobs.CMILib.*; -import com.gamingmesh.jobs.ItemBoostManager; -import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.actions.*; -import com.gamingmesh.jobs.api.JobsChunkChangeEvent; -import com.gamingmesh.jobs.container.*; -import com.gamingmesh.jobs.container.blockOwnerShip.BlockOwnerShip; -import com.gamingmesh.jobs.container.blockOwnerShip.BlockOwnerShip.ownershipFeedback; -import com.gamingmesh.jobs.hooks.HookManager; -import com.gamingmesh.jobs.hooks.JobsHook; -import com.gamingmesh.jobs.stuff.Util; -import com.gmail.nossr50.config.experience.ExperienceConfig; -import com.gmail.nossr50.datatypes.player.McMMOPlayer; -import com.gmail.nossr50.util.player.UserManager; -import com.google.common.base.Objects; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeUnit; -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Location; @@ -45,7 +32,16 @@ import org.bukkit.block.BrewingStand; import org.bukkit.block.Furnace; import org.bukkit.block.data.Ageable; import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.*; +import org.bukkit.entity.Damageable; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Sheep; +import org.bukkit.entity.Tameable; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -65,9 +61,9 @@ import org.bukkit.event.entity.SlimeSplitEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingPlaceEvent; import org.bukkit.event.inventory.BrewEvent; -import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.CraftItemEvent; import org.bukkit.event.inventory.FurnaceSmeltEvent; +import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryMoveItemEvent; import org.bukkit.event.inventory.InventoryType; @@ -89,10 +85,45 @@ import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import org.bukkit.permissions.PermissionAttachmentInfo; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.TimeUnit; +import com.gamingmesh.jobs.ItemBoostManager; +import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.CMILib.CMIEnchantment; +import com.gamingmesh.jobs.actions.BlockActionInfo; +import com.gamingmesh.jobs.actions.BlockCollectInfo; +import com.gamingmesh.jobs.actions.CustomKillInfo; +import com.gamingmesh.jobs.actions.EnchantActionInfo; +import com.gamingmesh.jobs.actions.EntityActionInfo; +import com.gamingmesh.jobs.actions.ExploreActionInfo; +import com.gamingmesh.jobs.actions.ItemActionInfo; +import com.gamingmesh.jobs.actions.ItemNameActionInfo; +import com.gamingmesh.jobs.actions.PotionItemActionInfo; +import com.gamingmesh.jobs.api.JobsChunkChangeEvent; +import com.gamingmesh.jobs.container.ActionType; +import com.gamingmesh.jobs.container.ExploreRespond; +import com.gamingmesh.jobs.container.FastPayment; +import com.gamingmesh.jobs.container.JobItems; +import com.gamingmesh.jobs.container.JobProgression; +import com.gamingmesh.jobs.container.JobsPlayer; +import com.gamingmesh.jobs.container.blockOwnerShip.BlockOwnerShip; +import com.gamingmesh.jobs.container.blockOwnerShip.BlockOwnerShip.ownershipFeedback; +import com.gamingmesh.jobs.hooks.HookManager; +import com.gamingmesh.jobs.hooks.JobsHook; +import com.gamingmesh.jobs.stuff.Util; +import com.gmail.nossr50.config.experience.ExperienceConfig; +import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.util.player.UserManager; +import com.google.common.base.Objects; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; + +import net.Zrips.CMILib.CMILib; +import net.Zrips.CMILib.ActionBar.CMIActionBar; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Entities.CMIEntityType; +import net.Zrips.CMILib.Items.CMIItemStack; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Items.ItemManager; +import net.Zrips.CMILib.Version.Version; public final class JobsPaymentListener implements Listener { @@ -100,13 +131,13 @@ public final class JobsPaymentListener implements Listener { private final String blockMetadata = "BlockOwner"; private final Cache<UUID, Double> damageDealtByPlayers = CacheBuilder.newBuilder() - .expireAfterWrite(5, TimeUnit.MINUTES) - .weakKeys() - .build(); + .expireAfterWrite(5, TimeUnit.MINUTES) + .weakKeys() + .build(); private final Cache<UUID, Entity> punchedEndCrystals = CacheBuilder.newBuilder() - .expireAfterWrite(10, TimeUnit.SECONDS) - .weakKeys() - .build(); + .expireAfterWrite(10, TimeUnit.SECONDS) + .weakKeys() + .build(); private Cache<UUID, Long> cowMilkingTimer; public JobsPaymentListener(Jobs plugin) { @@ -114,9 +145,9 @@ public final class JobsPaymentListener implements Listener { if (Jobs.getGCManager().CowMilkingTimer > 0) { cowMilkingTimer = CacheBuilder.newBuilder() - .expireAfterWrite(Jobs.getGCManager().CowMilkingTimer, TimeUnit.MILLISECONDS) - .weakKeys() - .build(); + .expireAfterWrite(Jobs.getGCManager().CowMilkingTimer, TimeUnit.MILLISECONDS) + .weakKeys() + .build(); } } @@ -176,7 +207,7 @@ public final class JobsPaymentListener implements Listener { if (resultStack.hasItemMeta() && resultStack.getItemMeta().hasDisplayName()) { Jobs.action(jPlayer, new ItemNameActionInfo(CMIChatColor.stripColor(plugin - .getComplement().getDisplayName(resultStack.getItemMeta())), ActionType.VTRADE)); + .getComplement().getDisplayName(resultStack.getItemMeta())), ActionType.VTRADE)); } else if (currentItem != null) { Jobs.action(jPlayer, new ItemActionInfo(currentItem, ActionType.VTRADE)); } @@ -199,7 +230,7 @@ public final class JobsPaymentListener implements Listener { newItemsCount--; if (resultStack.hasItemMeta() && resultStack.getItemMeta().hasDisplayName()) Jobs.action(jPlayer, new ItemNameActionInfo(CMIChatColor.stripColor(plugin - .getComplement().getDisplayName(resultStack.getItemMeta())), ActionType.VTRADE)); + .getComplement().getDisplayName(resultStack.getItemMeta())), ActionType.VTRADE)); else Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.VTRADE)); } @@ -216,7 +247,7 @@ public final class JobsPaymentListener implements Listener { Player player = event.getPlayer(); - ItemStack itemInHand = Util.getItemInMainHand(player); + ItemStack itemInHand = CMIItemStack.getItemInMainHand(player); if (itemInHand.getType() != Material.BUCKET && itemInHand.getType() != Material.BOWL) { return; } @@ -399,7 +430,7 @@ public final class JobsPaymentListener implements Listener { // Protection for block break with silktouch if (Jobs.getGCManager().useSilkTouchProtection) { - ItemStack item = Util.getItemInMainHand(player); + ItemStack item = CMIItemStack.getItemInMainHand(player); if (item.getType() != Material.AIR && Jobs.getBpManager().isInBp(block)) { for (Enchantment one : item.getEnchantments().keySet()) { @@ -438,7 +469,7 @@ public final class JobsPaymentListener implements Listener { return; if (Version.isCurrentEqualOrLower(Version.v1_12_R1) - && ItemManager.getItem(event.getItemInHand()).isSimilar(CMIMaterial.BONE_MEAL.newCMIItemStack())) + && CMILib.getInstance().getItemManager().getItem(event.getItemInHand()).isSimilar(CMIMaterial.BONE_MEAL.newCMIItemStack())) return; Player player = event.getPlayer(); @@ -696,7 +727,7 @@ public final class JobsPaymentListener implements Listener { Jobs.action(jPlayer, new PotionItemActionInfo(currentItem, ActionType.CRAFT, potion.getBasePotionData().getType())); } else if (resultStack.hasItemMeta() && resultStack.getItemMeta().hasDisplayName()) { Jobs.action(jPlayer, new ItemNameActionInfo(CMIChatColor.stripColor(plugin - .getComplement().getDisplayName(resultStack.getItemMeta())), ActionType.CRAFT)); + .getComplement().getDisplayName(resultStack.getItemMeta())), ActionType.CRAFT)); } else if (currentItem != null) { Jobs.action(jPlayer, new ItemActionInfo(currentItem, ActionType.CRAFT)); } @@ -723,7 +754,7 @@ public final class JobsPaymentListener implements Listener { if (resultItemMeta != null && resultItemMeta.hasDisplayName()) Jobs.action(jPlayer, new ItemNameActionInfo(CMIChatColor.stripColor(plugin - .getComplement().getDisplayName(resultItemMeta)), ActionType.CRAFT)); + .getComplement().getDisplayName(resultItemMeta)), ActionType.CRAFT)); else Jobs.action(jPlayer, new ItemActionInfo(resultStack, ActionType.CRAFT)); } @@ -1140,7 +1171,8 @@ public final class JobsPaymentListener implements Listener { try { // So lets remove meta in case some plugin removes entity in wrong way. lVictim.removeMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), plugin); - } catch (Exception ignored) { } + } catch (Exception ignored) { + } return; } @@ -1155,7 +1187,7 @@ public final class JobsPaymentListener implements Listener { damageDealtByPlayers.invalidate(lVictimUUID); if (perc < Jobs.getGCManager().MonsterDamagePercentage) - return; + return; } } @@ -1332,7 +1364,7 @@ public final class JobsPaymentListener implements Listener { continue; Player p = (Player) one; - if (!Util.getItemInMainHand(p).getType().toString().equalsIgnoreCase("ARMOR_STAND")) + if (!CMIItemStack.getItemInMainHand(p).getType().toString().equalsIgnoreCase("ARMOR_STAND")) continue; double d = p.getLocation().distance(loc); @@ -1477,7 +1509,7 @@ public final class JobsPaymentListener implements Listener { if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle()) return; - Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new ItemActionInfo(Util.getItemInMainHand(player), ActionType.EAT)); + Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new ItemActionInfo(CMIItemStack.getItemInMainHand(player), ActionType.EAT)); } @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @@ -1558,7 +1590,7 @@ public final class JobsPaymentListener implements Listener { CMIMaterial cmat = CMIMaterial.get(block); JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(p); - Material hand = Util.getItemInMainHand(p).getType(); + Material hand = CMIItemStack.getItemInMainHand(p).getType(); if (event.useInteractedBlock() != org.bukkit.event.Event.Result.DENY && event.getAction() == Action.RIGHT_CLICK_BLOCK && jPlayer != null && !p.isSneaking()) { @@ -1616,9 +1648,9 @@ public final class JobsPaymentListener implements Listener { report = true; if (report) - ActionBarManager.send(p, Jobs.getLanguage().getMessage("general.error.noRegistration", "[block]", name)); + CMIActionBar.send(p, Jobs.getLanguage().getMessage("general.error.noRegistration", "[block]", name)); } else if (done == ownershipFeedback.newReg && jPlayer != null) { - ActionBarManager.send(p, Jobs.getLanguage().getMessage("general.error.newRegistration", "[block]", name, + CMIActionBar.send(p, Jobs.getLanguage().getMessage("general.error.newRegistration", "[block]", name, "[current]", blockOwner.getTotal(jPlayer.getUniqueId()), "[max]", jPlayer.getMaxOwnerShipAllowed(blockOwner.getType()) == 0 ? "-" : jPlayer.getMaxOwnerShipAllowed(blockOwner.getType()))); } @@ -1630,14 +1662,14 @@ public final class JobsPaymentListener implements Listener { // Prevent item durability loss if (!Jobs.getGCManager().payItemDurabilityLoss && hand.getMaxDurability() - - Util.getDurability(Util.getItemInMainHand(p)) != hand.getMaxDurability()) + - Util.getDurability(CMIItemStack.getItemInMainHand(p)) != hand.getMaxDurability()) return; - // either it's version 1.13+ and we're trying to strip a normal log like oak, - // or it's 1.16+ and we're trying to strip a fungi like warped stem - if ((Version.isCurrentEqualOrHigher(Version.v1_13_R1) && (block.getType().toString().endsWith("_LOG") || block.getType().toString().endsWith("_WOOD"))) || - (Version.isCurrentEqualOrHigher(Version.v1_16_R1) && (block.getType().toString().endsWith("_STEM") || block.getType().toString().endsWith("_HYPHAE")))) - Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.STRIPLOGS), block), 1); + // either it's version 1.13+ and we're trying to strip a normal log like oak, + // or it's 1.16+ and we're trying to strip a fungi like warped stem + if ((Version.isCurrentEqualOrHigher(Version.v1_13_R1) && (block.getType().toString().endsWith("_LOG") || block.getType().toString().endsWith("_WOOD"))) || + (Version.isCurrentEqualOrHigher(Version.v1_16_R1) && (block.getType().toString().endsWith("_STEM") || block.getType().toString().endsWith("_HYPHAE")))) + Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.STRIPLOGS), block), 1); } } @@ -1707,7 +1739,7 @@ public final class JobsPaymentListener implements Listener { if (Jobs.getGCManager().payItemDurabilityLoss) return true; - ItemStack hand = Util.getItemInMainHand(p); + ItemStack hand = CMIItemStack.getItemInMainHand(p); java.util.Map<Enchantment, Integer> got = Jobs.getGCManager().whiteListedItems.get(CMIMaterial.get(hand)); if (got == null) diff --git a/src/main/java/com/gamingmesh/jobs/stuff/CMIScoreboardManager.java b/src/main/java/com/gamingmesh/jobs/stuff/CMIScoreboardManager.java index fcb98094..ad1f51af 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/CMIScoreboardManager.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/CMIScoreboardManager.java @@ -13,11 +13,12 @@ import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.CMIReflections; -import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.container.ScoreboardInfo; +import net.Zrips.CMILib.CMILib; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Version.Version; + public class CMIScoreboardManager { private java.util.concurrent.ConcurrentMap<UUID, ScoreboardInfo> timerMap = new ConcurrentHashMap<>(); @@ -155,7 +156,7 @@ public class CMIScoreboardManager { } private static Class<?> getNMSClass(String nmsClassString) throws ClassNotFoundException { - return CMIReflections.getMinecraftClass(nmsClassString); + return CMILib.getInstance().getReflectionManager().getMinecraftClass(nmsClassString); } private static Object getConnection(Player player) throws Exception { diff --git a/src/main/java/com/gamingmesh/jobs/stuff/Debug.java b/src/main/java/com/gamingmesh/jobs/stuff/Debug.java deleted file mode 100644 index 79f0d903..00000000 --- a/src/main/java/com/gamingmesh/jobs/stuff/Debug.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.gamingmesh.jobs.stuff; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; - -public class Debug { - public static void D(Object... message) { - Player player = Bukkit.getPlayer("Zrips"); - if (player == null || !player.isOnline()) - return; - - String FullMessage = ""; - int i = 1; - ChatColor cl = ChatColor.GRAY; - for (Object one : message) { - i++; - if (i >= 2) { - i = 0; - if (cl == ChatColor.GRAY) - cl = ChatColor.WHITE; - else - cl = ChatColor.GRAY; - FullMessage += cl; - } - FullMessage += String.valueOf(one) + " "; - } - player.sendMessage(ChatColor.DARK_GRAY + "[CMID] " + ChatColor.DARK_AQUA + FullMessage); - } -} diff --git a/src/main/java/com/gamingmesh/jobs/stuff/GiveItem.java b/src/main/java/com/gamingmesh/jobs/stuff/GiveItem.java index 5db9267f..7a8bf7b1 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/GiveItem.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/GiveItem.java @@ -10,8 +10,8 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.EnchantmentStorageMeta; import org.bukkit.inventory.meta.ItemMeta; -import com.gamingmesh.jobs.CMILib.CMIChatColor; -import com.gamingmesh.jobs.CMILib.CMIMaterial; +import net.Zrips.CMILib.Colors.CMIChatColor; +import net.Zrips.CMILib.Items.CMIMaterial; public class GiveItem { diff --git a/src/main/java/com/gamingmesh/jobs/stuff/PageInfo.java b/src/main/java/com/gamingmesh/jobs/stuff/PageInfo.java deleted file mode 100644 index c51932ff..00000000 --- a/src/main/java/com/gamingmesh/jobs/stuff/PageInfo.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.gamingmesh.jobs.stuff; - -public class PageInfo { - - private int totalEntries = 0, - totalPages = 0, - start = 0, - end = 0, - currentPage = 0, - currentEntry = 0, - perPage = 6; - - public PageInfo(int perPage, int totalEntries, int currentPage) { - this.perPage = perPage; - this.totalEntries = totalEntries; - this.currentPage = currentPage < 1 ? 1 : currentPage; - - calculate(); - } - - public int getPositionForOutput() { - return currentEntry; - } - - public int getPositionForOutput(int place) { - return start + place + 1; - } - - private void calculate() { - start = (currentPage - 1) * perPage; - end = start + perPage - 1; - - if (end + 1 > totalEntries) - end = totalEntries - 1; - - totalPages = (int) Math.ceil((double) totalEntries / (double) perPage); - } - - public boolean isInRange(int place) { - return place >= start && place <= end; - } - - public boolean isEntryOk() { - currentEntry++; - return isContinueNoAdd(); - } - - public boolean isContinue() { - return !isEntryOk(); - } - - public boolean isContinueNoAdd() { - int entry = currentEntry - 1; - return entry >= start && entry <= end; - } - - public boolean isBreak() { - return currentEntry - 1 > end; - } - - public boolean isPageOk() { - return isPageOk(currentPage); - } - - public boolean isPageOk(int page) { - return (totalPages < page || page < 1) ? false : true; - } - - public int getStart() { - return start; - } - - public int getEnd() { - return end; - } - - public int getTotalPages() { - return totalPages; - } - - public int getCurrentPage() { - return currentPage; - } - - public int getTotalEntries() { - return totalEntries; - } - - public int getNextPageNumber() { - int page = currentPage + 1; - return page > totalPages ? totalPages : page; - } - - public int getPrevPageNumber() { - int prev = currentPage - 1; - return prev < 1 ? 1 : prev; - } -} diff --git a/src/main/java/com/gamingmesh/jobs/stuff/Util.java b/src/main/java/com/gamingmesh/jobs/stuff/Util.java index 5c199937..67a86f6c 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/Util.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/Util.java @@ -34,10 +34,11 @@ import org.bukkit.potion.PotionType; import org.bukkit.util.BlockIterator; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.CMILib.CMIMaterial; -import com.gamingmesh.jobs.CMILib.Version; import com.gamingmesh.jobs.container.JobsWorld; +import net.Zrips.CMILib.Items.CMIMaterial; +import net.Zrips.CMILib.Version.Version; + public class Util { private static Map<UUID, String> jobsEditorMap = new HashMap<>(), questsEditorMap = new HashMap<>(); @@ -125,19 +126,6 @@ public class Util { } } - public static ItemStack getItemInMainHand(Player player) { - if (Version.isCurrentHigher(Version.v1_8_R3)) - return player.getInventory().getItemInMainHand(); - return player.getItemInHand(); - } - - public static void setItemInMainHand(Player player, ItemStack item) { - if (Version.isCurrentHigher(Version.v1_8_R3)) - player.getInventory().setItemInMainHand(item); - else - player.setItemInHand(item); - } - @SuppressWarnings("deprecation") public static ItemStack getSkull(String skullOwner) { ItemStack item = CMIMaterial.PLAYER_HEAD.newItemStack(); @@ -181,11 +169,6 @@ public class Util { return null; } - public static String firstToUpperCase(String name) { - name = name.toLowerCase().replace('_', ' '); - return name.substring(0, 1).toUpperCase() + name.substring(1); - } - public static Map<UUID, String> getJobsEditorMap() { return jobsEditorMap; } diff --git a/src/main/java/com/gamingmesh/jobs/CMILib/VersionChecker.java b/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java similarity index 95% rename from src/main/java/com/gamingmesh/jobs/CMILib/VersionChecker.java rename to src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java index 76615fdd..22e8cf3a 100644 --- a/src/main/java/com/gamingmesh/jobs/CMILib/VersionChecker.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/VersionChecker.java @@ -1,4 +1,4 @@ -package com.gamingmesh.jobs.CMILib; +package com.gamingmesh.jobs.stuff; import java.io.BufferedReader; import java.io.InputStreamReader; diff --git a/src/main/java/com/gamingmesh/jobs/stuff/complement/Complement.java b/src/main/java/com/gamingmesh/jobs/stuff/complement/Complement.java index 828b2520..02359a15 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/complement/Complement.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/complement/Complement.java @@ -9,7 +9,7 @@ import org.bukkit.event.block.SignChangeEvent; import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.meta.ItemMeta; -import com.gamingmesh.jobs.CMILib.CMIChatColor; +import net.Zrips.CMILib.Colors.CMIChatColor; public interface Complement { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8c395114..61f83d8d 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -5,6 +5,7 @@ version: ${project.version} api-version: "1.13" website: https://www.spigotmc.org/resources/4216/ authors: [Zrips, montlikadani] +depend: [CMILib] softdepend: [Vault, Essentials, MythicMobs, McMMO, mcMMO, WorldGuard, MyPet, PlaceholderAPI, EcoEnchants] commands: jobs: