From 98b40d325ae4a120cf686ed03365ffa1dacfa89c Mon Sep 17 00:00:00 2001 From: Driftay Date: Fri, 3 Jan 2020 05:04:12 -0500 Subject: [PATCH] Fixed Chest Error, and Fixed Unban TL Translation --- .../massivecraft/factions/cmd/CmdUnban.java | 2 +- .../factions/cmd/audit/FChestListener.java | 36 ++++++------------- .../factions/zcore/persist/MemoryFaction.java | 4 +-- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/CmdUnban.java b/src/main/java/com/massivecraft/factions/cmd/CmdUnban.java index d9997ccc..81742a66 100644 --- a/src/main/java/com/massivecraft/factions/cmd/CmdUnban.java +++ b/src/main/java/com/massivecraft/factions/cmd/CmdUnban.java @@ -48,7 +48,7 @@ public class CmdUnban extends FCommand { context.faction.unban(target); context.msg(TL.COMMAND_UNBAN_UNBANNED, context.fPlayer.getName(), target.getName()); - target.msg(TL.COMMAND_UNBAN_TARGET.toString(), context.faction.getTag(target)); + target.msg(TL.COMMAND_UNBAN_TARGET, context.faction.getTag(target)); } @Override diff --git a/src/main/java/com/massivecraft/factions/cmd/audit/FChestListener.java b/src/main/java/com/massivecraft/factions/cmd/audit/FChestListener.java index 5807e04c..a29b21d5 100644 --- a/src/main/java/com/massivecraft/factions/cmd/audit/FChestListener.java +++ b/src/main/java/com/massivecraft/factions/cmd/audit/FChestListener.java @@ -45,25 +45,16 @@ public class FChestListener implements Listener { Player player = (Player) event.getWhoClicked(); FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player); if (!fPlayer.isInFactionsChest()) return; - if (event.getClick() == ClickType.UNKNOWN) { event.setCancelled(true); player.sendMessage(CC.RedB + "(!) " + CC.Red + "You cannot use that click type inside the /f chest!"); return; } - ItemStack currentItem = event.getCurrentItem(); - if (event.getClick() == ClickType.NUMBER_KEY) { - currentItem = event.getClickedInventory().getItem(event.getSlot()); - } - + if (event.getClick() == ClickType.NUMBER_KEY) currentItem = event.getClickedInventory().getItem(event.getSlot()); Material currentItemType = currentItem != null ? currentItem.getType() : Material.AIR; - ItemStack cursorItem = event.getCursor(); - if (event.getClick() == ClickType.NUMBER_KEY) { - cursorItem = player.getInventory().getItem(event.getHotbarButton()); - } - + if (event.getClick() == ClickType.NUMBER_KEY) cursorItem = player.getInventory().getItem(event.getHotbarButton()); Material cursorItemType = cursorItem != null ? cursorItem.getType() : Material.AIR; FPlayer fplayer = FPlayers.getInstance().getByPlayer(player); Faction faction; @@ -72,22 +63,17 @@ public class FChestListener implements Listener { player.sendMessage(CC.RedB + "(!) " + CC.Red + "You are no longer in your faction!"); return; } - - if (event.getClickedInventory() == null) { - return; - } - + if (event.getClickedInventory() == null) return; if (event.getView().getTitle().equalsIgnoreCase(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fchest.Inventory-Title")))) { if (currentItemType != Material.AIR) { - Inventory ours = faction.getChestInventory(); - if (ours == null || !ours.contains(currentItem)) { - event.setCancelled(true); - player.sendMessage(CC.RedB + "(!) That item not longer exists!"); - Bukkit.getLogger().info("[FactionChest] " + player.getName() + " tried to remove " + currentItem + " from /f chest when it didnt contain! Items: " + (ours == null ? "none" : Arrays.toString(ours.getContents()))); - player.closeInventory(); - return; - } - + Inventory ours = faction.getChestInventory(); + if (ours == null) { + event.setCancelled(true); + player.sendMessage(CC.RedB + "(!) That item not longer exists!"); + Bukkit.getLogger().info("[FactionChest] " + player.getName() + " tried to remove " + currentItem + " from /f chest when it didnt contain! Items: " + (ours == null ? "none" : Arrays.toString(ours.getContents()))); + player.closeInventory(); + return; + } logRemoveItem(currentItem, fplayer, player); } else if (cursorItemType != Material.AIR && !event.isShiftClick()) { logAddItem(cursorItem, fplayer, player); diff --git a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java index 64ddfc55..7f7a3443 100644 --- a/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java +++ b/src/main/java/com/massivecraft/factions/zcore/persist/MemoryFaction.java @@ -472,7 +472,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { } private int getChestSize() { - int size = 9; + int size = FactionsPlugin.getInstance().getConfig().getInt("fchest.Default-Size"); switch (getUpgrade(UpgradeType.CHEST)) { case 1: size = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-1") * 9; @@ -484,7 +484,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator { size = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-3") * 9; break; } - return size; + return size * 9; }