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.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

View File

@ -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);

View File

@ -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;
}