diff options
Diffstat (limited to 'EssentialsSigns')
5 files changed, 23 insertions, 11 deletions
diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/EssentialsSign.java b/EssentialsSigns/src/com/earth2me/essentials/signs/EssentialsSign.java index 2a654600a..bfd9085a6 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/EssentialsSign.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/EssentialsSign.java @@ -267,7 +267,7 @@ public class EssentialsSign final Double money = trade.getMoney(); if (money != null) { - sign.setLine(index, Util.formatCurrency(money, ess)); + sign.setLine(index, Util.shortCurrency(money, ess)); } } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignDisposal.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignDisposal.java index a6c64ca0b..056c79e67 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignDisposal.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignDisposal.java @@ -2,7 +2,6 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.api.IEssentials; import com.earth2me.essentials.api.IUser; -import com.earth2me.essentials.craftbukkit.ShowInventory; public class SignDisposal extends EssentialsSign @@ -15,7 +14,10 @@ public class SignDisposal extends EssentialsSign @Override protected boolean onSignInteract(final ISign sign, final IUser player, final String username, final IEssentials ess) { - ShowInventory.showEmptyInventory(player.getBase()); + player.sendMessage("Bukkit broke this sign :("); + //TODO: wait for a fix in bukkit + //Problem: Items can be duplicated + //player.getBase().openInventory(ess.getServer().createInventory(player, 36)); return true; } } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignFree.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignFree.java index 4e77a2ad7..96ae2fdce 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignFree.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignFree.java @@ -4,8 +4,10 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.Trade; import com.earth2me.essentials.api.IEssentials; import com.earth2me.essentials.api.IUser; -import com.earth2me.essentials.craftbukkit.ShowInventory; +import com.earth2me.essentials.craftbukkit.InventoryWorkaround; import org.bukkit.Material; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; @@ -32,8 +34,15 @@ public class SignFree extends EssentialsSign throw new SignException(_("cantSpawnItem", "Air")); } - item.setAmount(item.getType().getMaxStackSize() * 9 * 4); - ShowInventory.showFilledInventory(player.getBase(), item); + item.setAmount(item.getType().getMaxStackSize()); + InventoryWorkaround.addItem(player.getInventory(), true, item); + player.sendMessage("Item added to your inventory."); + player.updateInventory(); + //TODO: wait for a fix in bukkit + //Problem: Items can be duplicated + //Inventory i = ess.getServer().createInventory(player, InventoryType.CHEST); + //i.addItem(item); + //player.openInventory(i); Trade.log("Sign", "Free", "Interact", username, null, username, new Trade(item, ess), sign.getBlock().getLocation(), ess); return true; } diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java index f658f7e11..e150edfa2 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignKit.java @@ -20,7 +20,7 @@ public class SignKit extends EssentialsSign protected boolean onSignCreate(final ISign sign, final IUser player, final String username, final IEssentials ess) throws SignException { validateTrade(sign, 3, ess); - + final String kitName = sign.getLine(1).toLowerCase(Locale.ENGLISH); if (kitName.isEmpty()) @@ -62,6 +62,7 @@ public class SignKit extends EssentialsSign final Kit kit = ess.getKits().getKit(kitName); ess.getKits().sendKit(player, kit); + //TODO: Implement Kits from 2.9 charge.charge(player); } catch (Exception ex) diff --git a/EssentialsSigns/src/com/earth2me/essentials/signs/SignTrade.java b/EssentialsSigns/src/com/earth2me/essentials/signs/SignTrade.java index d72043f56..21cdbf441 100644 --- a/EssentialsSigns/src/com/earth2me/essentials/signs/SignTrade.java +++ b/EssentialsSigns/src/com/earth2me/essentials/signs/SignTrade.java @@ -139,11 +139,11 @@ public class SignTrade extends EssentialsSign final Double money = getMoney(split[0]); if (money != null) { - if (Util.formatCurrency(money, ess).length() * 2 > 15) + if (Util.shortCurrency(money, ess).length() * 2 > 15) { throw new SignException("Line can be too long!"); } - sign.setLine(index, Util.formatCurrency(money, ess) + ":0"); + sign.setLine(index, Util.shortCurrency(money, ess) + ":0"); return; } } @@ -159,7 +159,7 @@ public class SignTrade extends EssentialsSign { throw new SignException(_("moreThanZero")); } - sign.setLine(index, Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount, ess).substring(1)); + sign.setLine(index, Util.shortCurrency(money, ess) + ":" + Util.shortCurrency(amount, ess).substring(1)); return; } } @@ -317,7 +317,7 @@ public class SignTrade extends EssentialsSign final Double amount = getDouble(split[1]); if (money != null && amount != null) { - final String newline = Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount + value, ess).substring(1); + final String newline = Util.shortCurrency(money, ess) + ":" + Util.shortCurrency(amount + value, ess).substring(1); if (newline.length() > 15) { throw new SignException("This sign is full: Line too long!"); |