From 5e4f0022dfc000692b6c0c4a88bb80c67bdbaf0d Mon Sep 17 00:00:00 2001 From: Connor Monahan Date: Mon, 19 Nov 2018 02:03:01 -0600 Subject: [PATCH] Fix UI glitches with WarHub and Dye color updates --- .../java/com/tommytony/war/ui/JoinZoneUI.java | 14 ++++++++------ .../com/tommytony/war/ui/UIConfigHelper.java | 18 +++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/war/src/main/java/com/tommytony/war/ui/JoinZoneUI.java b/war/src/main/java/com/tommytony/war/ui/JoinZoneUI.java index 89d1a85..71fbcce 100644 --- a/war/src/main/java/com/tommytony/war/ui/JoinZoneUI.java +++ b/war/src/main/java/com/tommytony/war/ui/JoinZoneUI.java @@ -26,12 +26,14 @@ public class JoinZoneUI extends ChestUI { ChatColor.DARK_GRAY + "Warzone doors located here")); item.setItemMeta(meta); int i = 0; - this.addItem(inv, i++, item, new Runnable() { - @Override - public void run() { - player.teleport(War.war.getWarHub().getLocation()); - } - }); + if (War.war.getWarHub() != null) { + this.addItem(inv, i++, item, new Runnable() { + @Override + public void run() { + player.teleport(War.war.getWarHub().getLocation()); + } + }); + } for (final Warzone zone : War.war.getEnabledWarzones()) { item = new ItemStack(Material.ENDER_PEARL); meta = item.getItemMeta(); diff --git a/war/src/main/java/com/tommytony/war/ui/UIConfigHelper.java b/war/src/main/java/com/tommytony/war/ui/UIConfigHelper.java index 1fd1636..6f8e88c 100644 --- a/war/src/main/java/com/tommytony/war/ui/UIConfigHelper.java +++ b/war/src/main/java/com/tommytony/war/ui/UIConfigHelper.java @@ -41,7 +41,7 @@ public class UIConfigHelper { } if (option.getConfigType() == Boolean.class) { status += config.resolveBoolean(option) ? ChatColor.GREEN + "true" : ChatColor.DARK_GRAY + "false"; - item = new Dye(config.resolveBoolean(option) ? DyeColor.LIME : DyeColor.GRAY).toItemStack(1); + item = new ItemStack(config.resolveBoolean(option) ? Material.LIME_DYE : Material.GRAY_DYE, 1); meta = item.getItemMeta(); meta.setDisplayName(name); meta.setLore(new ImmutableList.Builder().add(desc).add(status).add(inheritance).build()); @@ -55,7 +55,7 @@ public class UIConfigHelper { }); } else if (option.getConfigType() == Integer.class || option.getConfigType() == Double.class || option.getConfigType() == String.class) { status += ChatColor.LIGHT_PURPLE + config.resolveValue(option).toString(); - item = new Dye(DyeColor.PURPLE).toItemStack(1); + item = new ItemStack(Material.PURPLE_DYE, 1); meta = item.getItemMeta(); meta.setDisplayName(name); meta.setLore(new ImmutableList.Builder().add(desc).add(status).add(inheritance).build()); @@ -80,7 +80,7 @@ public class UIConfigHelper { }); } else if (option.getConfigType() == FlagReturn.class) { status += ChatColor.YELLOW + config.resolveValue(option).toString(); - item = new Dye(DyeColor.PINK).toItemStack(1); + item = new ItemStack(Material.PINK_DYE, 1); meta = item.getItemMeta(); meta.setDisplayName(name); meta.setLore(new ImmutableList.Builder().add(desc).add(status).add(inheritance).build()); @@ -103,7 +103,7 @@ public class UIConfigHelper { }); } else if (option.getConfigType() == TeamSpawnStyle.class) { status += ChatColor.YELLOW + config.resolveValue(option).toString(); - item = new Dye(DyeColor.PINK).toItemStack(1); + item = new ItemStack(Material.PINK_DYE, 1); meta = item.getItemMeta(); meta.setDisplayName(name); meta.setLore(new ImmutableList.Builder().add(desc).add(status).add(inheritance).build()); @@ -174,7 +174,7 @@ public class UIConfigHelper { } if (option.getConfigType() == Boolean.class) { status += config.getBoolean(option) ? ChatColor.GREEN + "true" : ChatColor.DARK_GRAY + "false"; - item = new Dye(config.getBoolean(option) ? DyeColor.LIME : DyeColor.GRAY).toItemStack(1); + item = new ItemStack(config.getBoolean(option) ? Material.LIME_DYE : Material.GRAY_DYE, 1); meta = item.getItemMeta(); meta.setDisplayName(name); meta.setLore(new ImmutableList.Builder().add(desc).add(status).add(inheritance).build()); @@ -188,7 +188,7 @@ public class UIConfigHelper { }); } else if (option.getConfigType() == Integer.class || option.getConfigType() == Double.class || option.getConfigType() == String.class) { status += ChatColor.LIGHT_PURPLE + config.getValue(option).toString(); - item = new Dye(DyeColor.PURPLE).toItemStack(1); + item = new ItemStack(Material.PURPLE_DYE, 1); meta = item.getItemMeta(); meta.setDisplayName(name); meta.setLore(new ImmutableList.Builder().add(desc).add(status).add(inheritance).build()); @@ -213,7 +213,7 @@ public class UIConfigHelper { }); } else if (option.getConfigType() == ScoreboardType.class) { status += ChatColor.YELLOW + config.getValue(option).toString(); - item = new Dye(DyeColor.PINK).toItemStack(1); + item = new ItemStack(Material.PINK_DYE, 1); meta = item.getItemMeta(); meta.setDisplayName(name); meta.setLore(new ImmutableList.Builder().add(desc).add(status).add(inheritance).build()); @@ -277,7 +277,7 @@ public class UIConfigHelper { } if (option.getConfigType() == Boolean.class) { status += config.getBoolean(option) ? ChatColor.GREEN + "true" : ChatColor.DARK_GRAY + "false"; - item = new Dye(config.getBoolean(option) ? DyeColor.LIME : DyeColor.GRAY).toItemStack(1); + item = new ItemStack(config.getBoolean(option) ? Material.LIME_DYE : Material.GRAY_DYE, 1); meta = item.getItemMeta(); meta.setDisplayName(name); meta.setLore(new ImmutableList.Builder().add(desc).add(status).build()); @@ -291,7 +291,7 @@ public class UIConfigHelper { }); } else if (option.getConfigType() == Integer.class || option.getConfigType() == Double.class || option.getConfigType() == String.class) { status += ChatColor.LIGHT_PURPLE + config.getValue(option).toString(); - item = new Dye(DyeColor.PURPLE).toItemStack(1); + item = new ItemStack(Material.PURPLE_DYE, 1); meta = item.getItemMeta(); meta.setDisplayName(name); meta.setLore(new ImmutableList.Builder().add(desc).add(status).build());