Fixed Chest Error, and Fixed Unban TL Translation

This commit is contained in:
Driftay 2020-01-03 05:04:12 -05:00
parent 8f2e58733d
commit 98b40d325a
3 changed files with 14 additions and 28 deletions

View File

@ -48,7 +48,7 @@ public class CmdUnban extends FCommand {
context.faction.unban(target); context.faction.unban(target);
context.msg(TL.COMMAND_UNBAN_UNBANNED, context.fPlayer.getName(), target.getName()); 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 @Override

View File

@ -45,25 +45,16 @@ public class FChestListener implements Listener {
Player player = (Player) event.getWhoClicked(); Player player = (Player) event.getWhoClicked();
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player); FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
if (!fPlayer.isInFactionsChest()) return; if (!fPlayer.isInFactionsChest()) return;
if (event.getClick() == ClickType.UNKNOWN) { if (event.getClick() == ClickType.UNKNOWN) {
event.setCancelled(true); event.setCancelled(true);
player.sendMessage(CC.RedB + "(!) " + CC.Red + "You cannot use that click type inside the /f chest!"); player.sendMessage(CC.RedB + "(!) " + CC.Red + "You cannot use that click type inside the /f chest!");
return; return;
} }
ItemStack currentItem = event.getCurrentItem(); ItemStack currentItem = event.getCurrentItem();
if (event.getClick() == ClickType.NUMBER_KEY) { if (event.getClick() == ClickType.NUMBER_KEY) currentItem = event.getClickedInventory().getItem(event.getSlot());
currentItem = event.getClickedInventory().getItem(event.getSlot());
}
Material currentItemType = currentItem != null ? currentItem.getType() : Material.AIR; Material currentItemType = currentItem != null ? currentItem.getType() : Material.AIR;
ItemStack cursorItem = event.getCursor(); ItemStack cursorItem = event.getCursor();
if (event.getClick() == ClickType.NUMBER_KEY) { if (event.getClick() == ClickType.NUMBER_KEY) cursorItem = player.getInventory().getItem(event.getHotbarButton());
cursorItem = player.getInventory().getItem(event.getHotbarButton());
}
Material cursorItemType = cursorItem != null ? cursorItem.getType() : Material.AIR; Material cursorItemType = cursorItem != null ? cursorItem.getType() : Material.AIR;
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player); FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
Faction faction; Faction faction;
@ -72,22 +63,17 @@ public class FChestListener implements Listener {
player.sendMessage(CC.RedB + "(!) " + CC.Red + "You are no longer in your faction!"); player.sendMessage(CC.RedB + "(!) " + CC.Red + "You are no longer in your faction!");
return; 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 (event.getView().getTitle().equalsIgnoreCase(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fchest.Inventory-Title")))) {
if (currentItemType != Material.AIR) { if (currentItemType != Material.AIR) {
Inventory ours = faction.getChestInventory(); Inventory ours = faction.getChestInventory();
if (ours == null || !ours.contains(currentItem)) { if (ours == null) {
event.setCancelled(true); event.setCancelled(true);
player.sendMessage(CC.RedB + "(!) That item not longer exists!"); 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()))); 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(); player.closeInventory();
return; return;
} }
logRemoveItem(currentItem, fplayer, player); logRemoveItem(currentItem, fplayer, player);
} else if (cursorItemType != Material.AIR && !event.isShiftClick()) { } else if (cursorItemType != Material.AIR && !event.isShiftClick()) {
logAddItem(cursorItem, fplayer, player); logAddItem(cursorItem, fplayer, player);

View File

@ -472,7 +472,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
} }
private int getChestSize() { private int getChestSize() {
int size = 9; int size = FactionsPlugin.getInstance().getConfig().getInt("fchest.Default-Size");
switch (getUpgrade(UpgradeType.CHEST)) { switch (getUpgrade(UpgradeType.CHEST)) {
case 1: case 1:
size = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-1") * 9; 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; size = FactionsPlugin.getInstance().getConfig().getInt("fupgrades.MainMenu.Chest.Chest-Size.level-3") * 9;
break; break;
} }
return size; return size * 9;
} }