summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsnowleo <schneeleo@gmail.com>2011-10-11 12:51:53 +0200
committersnowleo <schneeleo@gmail.com>2011-10-11 12:51:53 +0200
commit5395b6f73a36e1e20b459e6a9c39ab6499f9d350 (patch)
tree3765a13ee3e7bf17758967b6d7c500df4b534a1e
parenta6bafca091c59cd00e65fbf7f3e1c43aac440858 (diff)
parent5851c5a88bfafd0446f0c167de022fc16cc928ad (diff)
downloadEssentials-5395b6f73a36e1e20b459e6a9c39ab6499f9d350.tar
Essentials-5395b6f73a36e1e20b459e6a9c39ab6499f9d350.tar.gz
Essentials-5395b6f73a36e1e20b459e6a9c39ab6499f9d350.tar.lz
Essentials-5395b6f73a36e1e20b459e6a9c39ab6499f9d350.tar.xz
Essentials-5395b6f73a36e1e20b459e6a9c39ab6499f9d350.zip
Merge branch 'master' into groupmanager
-rw-r--r--Essentials/src/com/earth2me/essentials/Backup.java7
-rw-r--r--Essentials/src/com/earth2me/essentials/Console.java32
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java1
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java16
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java24
-rw-r--r--Essentials/src/com/earth2me/essentials/FakeInventory.java190
-rw-r--r--Essentials/src/com/earth2me/essentials/ISettings.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/InventoryWorkaround.java16
-rw-r--r--Essentials/src/com/earth2me/essentials/OfflinePlayer.java19
-rw-r--r--Essentials/src/com/earth2me/essentials/PlayerExtension.java9
-rw-r--r--Essentials/src/com/earth2me/essentials/PlayerWrapper.java18
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java6
-rw-r--r--Essentials/src/com/earth2me/essentials/Trade.java49
-rw-r--r--Essentials/src/com/earth2me/essentials/api/Economy.java13
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandbanip.java17
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandcompass.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandessentials.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandkill.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandrepair.java8
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/Method.java17
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/Methods.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java23
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java23
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java12
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java38
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java27
-rw-r--r--Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java20
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignBuy.java4
-rw-r--r--Essentials/src/com/earth2me/essentials/signs/SignTrade.java78
-rw-r--r--Essentials/src/config.yml3
-rw-r--r--Essentials/src/items.csv60
-rw-r--r--Essentials/src/plugin.yml2
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java2
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java4
-rw-r--r--EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java2
-rw-r--r--lib/bukkit-0.0.1-SNAPSHOT.jarbin4358533 -> 4381379 bytes
-rw-r--r--lib/craftbukkit-0.0.1-SNAPSHOT.jarbin9565109 -> 9585907 bytes
38 files changed, 654 insertions, 111 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Backup.java b/Essentials/src/com/earth2me/essentials/Backup.java
index b7b441b1e..02a3d54ba 100644
--- a/Essentials/src/com/earth2me/essentials/Backup.java
+++ b/Essentials/src/com/earth2me/essentials/Backup.java
@@ -5,6 +5,7 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.CraftServer;
@@ -12,7 +13,7 @@ import org.bukkit.craftbukkit.CraftServer;
public class Backup implements Runnable
{
private static final Logger LOGGER = Logger.getLogger("Minecraft");
- private transient final CraftServer server;
+ private transient final Server server;
private transient final IEssentials ess;
private transient boolean running = false;
private transient int taskId = -1;
@@ -21,7 +22,7 @@ public class Backup implements Runnable
public Backup(final IEssentials ess)
{
this.ess = ess;
- server = (CraftServer)ess.getServer();
+ server = ess.getServer();
if (server.getOnlinePlayers().length > 0)
{
startTask();
@@ -60,7 +61,7 @@ public class Backup implements Runnable
return;
}
LOGGER.log(Level.INFO, Util.i18n("backupStarted"));
- final CommandSender cs = server.getServer().console;
+ final CommandSender cs = server.getConsoleSender();
server.dispatchCommand(cs, "save-all");
server.dispatchCommand(cs, "save-off");
diff --git a/Essentials/src/com/earth2me/essentials/Console.java b/Essentials/src/com/earth2me/essentials/Console.java
index 882c4f2c8..dcdb65a0d 100644
--- a/Essentials/src/com/earth2me/essentials/Console.java
+++ b/Essentials/src/com/earth2me/essentials/Console.java
@@ -2,33 +2,35 @@ package com.earth2me.essentials;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
-import org.bukkit.craftbukkit.CraftServer;
-public final class Console implements IReplyTo {
+
+public final class Console implements IReplyTo
+{
private static Console instance = new Console();
private CommandSender replyTo;
public final static String NAME = "Console";
-
- private Console() {
-
+
+ private Console()
+ {
}
-
- public static CommandSender getCommandSender(Server server) throws Exception {
- if (! (server instanceof CraftServer)) {
- throw new Exception(Util.i18n("invalidServer"));
- }
- return ((CraftServer)server).getServer().console;
+
+ public static CommandSender getCommandSender(Server server) throws Exception
+ {
+ return server.getConsoleSender();
}
- public void setReplyTo(CommandSender user) {
+ public void setReplyTo(CommandSender user)
+ {
replyTo = user;
}
- public CommandSender getReplyTo() {
+ public CommandSender getReplyTo()
+ {
return replyTo;
}
-
- public static Console getConsoleReplyTo() {
+
+ public static Console getConsoleReplyTo()
+ {
return instance;
}
}
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index fe0c3560c..6f9b9a944 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -164,6 +164,7 @@ public class Essentials extends JavaPlugin implements IEssentials
pm.registerEvent(Type.PLAYER_EGG_THROW, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_BUCKET_EMPTY, playerListener, Priority.High, this);
pm.registerEvent(Type.PLAYER_ANIMATION, playerListener, Priority.High, this);
+ pm.registerEvent(Type.PLAYER_BED_ENTER, playerListener, Priority.Lowest, this);
final EssentialsBlockListener blockListener = new EssentialsBlockListener(this);
pm.registerEvent(Type.BLOCK_PLACE, blockListener, Priority.Lowest, this);
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
index f5d6cec48..083fa1687 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsEntityListener.java
@@ -9,6 +9,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityListener;
import org.bukkit.event.entity.FoodLevelChangeEvent;
+import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack;
@@ -69,24 +70,29 @@ public class EssentialsEntityListener extends EntityListener
}
@Override
- public void onEntityDeath(EntityDeathEvent event)
+ public void onEntityDeath(final EntityDeathEvent event)
{
- if (event.getEntity() instanceof Player)
+ if (event instanceof PlayerDeathEvent)
{
- User user = ess.getUser(event.getEntity());
+ final PlayerDeathEvent pdevent = (PlayerDeathEvent)event;
+ final User user = ess.getUser(pdevent.getEntity());
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
{
user.setLastLocation();
user.sendMessage(Util.i18n("backAfterDeath"));
}
+ if (!ess.getSettings().areDeathMessagesEnabled())
+ {
+ pdevent.setDeathMessage("");
+ }
}
}
@Override
public void onFoodLevelChange(FoodLevelChangeEvent event)
- {
+ {
if (event.getEntity() instanceof Player && ess.getUser(event.getEntity()).isGodModeEnabled())
- {
+ {
//TODO: Remove the following line, when we're happy to remove backwards compatability with 1185.
event.setFoodLevel(20);
event.setCancelled(true);
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index 026e4632b..3d5851d93 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -14,6 +14,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerAnimationType;
+import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
@@ -94,9 +95,16 @@ public class EssentialsPlayerListener extends PlayerListener
final Location from = event.getFrom();
final Location to = event.getTo().clone();
to.setX(from.getX());
- to.setY(from.getBlock().getTypeId() == 0 ? from.getY() - 1 : from.getY());
+ to.setY(from.getY());
to.setZ(from.getZ());
- event.setTo(to);
+ try
+ {
+ event.setTo(Util.getSafeDestination(to));
+ }
+ catch (Exception ex)
+ {
+ event.setTo(to);
+ }
return;
}
@@ -380,4 +388,16 @@ public class EssentialsPlayerListener extends PlayerListener
user.updateActivity(true);
}
}
+
+ @Override
+ public void onPlayerBedEnter(PlayerBedEnterEvent event)
+ {
+ if (event.isCancelled()) {
+ return;
+ }
+ if (event.getPlayer().isSleepingIgnored()) {
+ event.setCancelled(true);
+ event.getPlayer().sendMessage("You can't go to bed, your sleep is ignored.");
+ }
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/FakeInventory.java b/Essentials/src/com/earth2me/essentials/FakeInventory.java
new file mode 100644
index 000000000..fef6db7d0
--- /dev/null
+++ b/Essentials/src/com/earth2me/essentials/FakeInventory.java
@@ -0,0 +1,190 @@
+package com.earth2me.essentials;
+
+import java.util.HashMap;
+import org.bukkit.Material;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+
+
+public class FakeInventory implements Inventory
+{
+ ItemStack[] items;
+
+ public FakeInventory(ItemStack[] items)
+ {
+ this.items = new ItemStack[items.length];
+ for (int i = 0; i < items.length; i++)
+ {
+ if (items[i] == null)
+ {
+ continue;
+ }
+ this.items[i] = new ItemStack(items[i].getTypeId(), items[i].getAmount(), items[i].getDurability());
+ }
+ }
+
+ @Override
+ public int getSize()
+ {
+ return items.length;
+ }
+
+ @Override
+ public String getName()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public ItemStack getItem(int i)
+ {
+ return items[i];
+ }
+
+ @Override
+ public void setItem(int i, ItemStack is)
+ {
+ items[i] = is;
+ }
+
+ @Override
+ public HashMap<Integer, ItemStack> addItem(ItemStack... iss)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public HashMap<Integer, ItemStack> removeItem(ItemStack... iss)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public ItemStack[] getContents()
+ {
+ return items;
+ }
+
+ @Override
+ public void setContents(ItemStack[] iss)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean contains(int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean contains(Material mtrl)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean contains(ItemStack is)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean contains(int i, int i1)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean contains(Material mtrl, int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean contains(ItemStack is, int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public HashMap<Integer, ? extends ItemStack> all(int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public HashMap<Integer, ? extends ItemStack> all(Material mtrl)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public HashMap<Integer, ? extends ItemStack> all(ItemStack is)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int first(int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int first(Material mtrl)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int first(ItemStack is)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int firstEmpty()
+ {
+ for (int i = 0; i < items.length; i++)
+ {
+ if (items[i] == null || items[i].getTypeId() == 0) {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public void remove(int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void remove(Material mtrl)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void remove(ItemStack is)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void clear(int i)
+ {
+ items[i] = null;
+ }
+
+ @Override
+ public void clear()
+ {
+ for (int i = 0; i < items.length; i++)
+ {
+ items[i] = null;
+ }
+ }
+}
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java
index 54d1b1495..d058d892a 100644
--- a/Essentials/src/com/earth2me/essentials/ISettings.java
+++ b/Essentials/src/com/earth2me/essentials/ISettings.java
@@ -132,4 +132,6 @@ public interface ISettings extends IConf
long getAutoAfkKick();
boolean getFreezeAfkPlayers();
+
+ boolean areDeathMessagesEnabled();
}
diff --git a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java
index 3f0f89af2..0470488b8 100644
--- a/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java
+++ b/Essentials/src/com/earth2me/essentials/InventoryWorkaround.java
@@ -64,6 +64,20 @@ public final class InventoryWorkaround
return -1;
}
+ public static boolean addAllItems(final Inventory cinventory, final boolean forceDurability, final ItemStack... items)
+ {
+ final Inventory fake = new FakeInventory(cinventory.getContents());
+ if (addItem(fake, forceDurability, items).isEmpty())
+ {
+ addItem(cinventory, forceDurability, items);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
public static Map<Integer, ItemStack> addItem(final Inventory cinventory, final boolean forceDurability, final ItemStack... items)
{
final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
@@ -106,7 +120,7 @@ public final class InventoryWorkaround
{
continue;
}
-
+
while (true)
{
// Do we already have a stack of it?
diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
index 1b0058f24..3ca0c17f4 100644
--- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
+++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
@@ -3,6 +3,7 @@ package com.earth2me.essentials;
import java.net.InetSocketAddress;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Achievement;
@@ -725,4 +726,22 @@ public class OfflinePlayer implements Player
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public int getTicksLived()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setTicksLived(int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Map<String, Object> serialize()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/PlayerExtension.java b/Essentials/src/com/earth2me/essentials/PlayerExtension.java
index ef63dacc3..9555bb1a7 100644
--- a/Essentials/src/com/earth2me/essentials/PlayerExtension.java
+++ b/Essentials/src/com/earth2me/essentials/PlayerExtension.java
@@ -16,15 +16,6 @@ public class PlayerExtension extends PlayerWrapper
super(base);
this.ess = ess;
}
-
- public float getCorrectedYaw()
- {
- float angle = (getLocation().getYaw() - 90.0f) % 360.0f;
- if (angle < 0) {
- angle += 360.0f;
- }
- return angle;
- }
public void showInventory(IInventory inventory)
{
diff --git a/Essentials/src/com/earth2me/essentials/PlayerWrapper.java b/Essentials/src/com/earth2me/essentials/PlayerWrapper.java
index 4b998af47..ccb61d891 100644
--- a/Essentials/src/com/earth2me/essentials/PlayerWrapper.java
+++ b/Essentials/src/com/earth2me/essentials/PlayerWrapper.java
@@ -755,5 +755,23 @@ public class PlayerWrapper implements Player
{
return base.getPlayerListName();
}
+
+ @Override
+ public int getTicksLived()
+ {
+ return base.getTicksLived();
+ }
+
+ @Override
+ public void setTicksLived(int i)
+ {
+ base.setTicksLived(i);
+ }
+
+ @Override
+ public Map<String, Object> serialize()
+ {
+ return base.serialize();
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index d6a649786..9d11d675b 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -523,4 +523,10 @@ public class Settings implements ISettings
{
return config.getBoolean("freeze-afk-players", false);
}
+
+ @Override
+ public boolean areDeathMessagesEnabled()
+ {
+ return config.getBoolean("death-messages", true);
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java
index 45c3d49a3..8c082be3e 100644
--- a/Essentials/src/com/earth2me/essentials/Trade.java
+++ b/Essentials/src/com/earth2me/essentials/Trade.java
@@ -18,22 +18,22 @@ public class Trade
private final transient Double money;
private final transient ItemStack itemStack;
private final transient IEssentials ess;
-
+
public Trade(final String command, final IEssentials ess)
{
this(command, null, null, ess);
}
-
+
public Trade(final double money, final IEssentials ess)
{
this(null, money, null, ess);
}
-
+
public Trade(final ItemStack items, final IEssentials ess)
{
this(null, null, items, ess);
}
-
+
private Trade(final String command, final Double money, final ItemStack item, final IEssentials ess)
{
this.command = command;
@@ -41,7 +41,7 @@ public class Trade
this.itemStack = item;
this.ess = ess;
}
-
+
public void isAffordableFor(final IUser user) throws ChargeException
{
final double mon = user.getMoney();
@@ -52,13 +52,13 @@ public class Trade
{
throw new ChargeException(Util.i18n("notEnoughMoney"));
}
-
+
if (getItemStack() != null
&& !InventoryWorkaround.containsItem(user.getInventory(), true, itemStack))
{
throw new ChargeException(Util.format("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase().replace("_", " ")));
}
-
+
if (command != null && !command.isEmpty()
&& !user.isAuthorized("essentials.nocommandcost.all")
&& !user.isAuthorized("essentials.nocommandcost." + command)
@@ -69,24 +69,38 @@ public class Trade
throw new ChargeException(Util.i18n("notEnoughMoney"));
}
}
-
+
public void pay(final IUser user)
{
+ pay(user, true);
+ }
+
+ public boolean pay(final IUser user, final boolean dropItems)
+ {
+ boolean success = true;
if (getMoney() != null && getMoney() > 0)
{
user.giveMoney(getMoney());
}
if (getItemStack() != null)
{
- final Map<Integer, ItemStack> leftOver = InventoryWorkaround.addItem(user.getInventory(), true, getItemStack());
- for (ItemStack itemStack : leftOver.values())
+ if (dropItems)
+ {
+ final Map<Integer, ItemStack> leftOver = InventoryWorkaround.addItem(user.getInventory(), true, getItemStack());
+ for (ItemStack itemStack : leftOver.values())
+ {
+ InventoryWorkaround.dropItem(user.getLocation(), itemStack);
+ }
+ }
+ else
{
- InventoryWorkaround.dropItem(user.getLocation(), itemStack);
+ success = InventoryWorkaround.addAllItems(user.getInventory(), true, getItemStack());
}
user.updateInventory();
}
+ return success;
}
-
+
public void charge(final IUser user) throws ChargeException
{
if (getMoney() != null)
@@ -120,18 +134,18 @@ public class Trade
user.takeMoney(cost);
}
}
-
+
public Double getMoney()
{
return money;
}
-
+
public ItemStack getItemStack()
{
return itemStack;
}
private static FileWriter fw = null;
-
+
public static void log(String type, String subtype, String event, String sender, Trade charge, String receiver, Trade pay, Location loc, IEssentials ess)
{
if (!ess.getSettings().isEcoLogEnabled())
@@ -225,10 +239,11 @@ public class Trade
Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex);
}
}
-
+
public static void closeLog()
{
- if (fw != null) {
+ if (fw != null)
+ {
try
{
fw.close();
diff --git a/Essentials/src/com/earth2me/essentials/api/Economy.java b/Essentials/src/com/earth2me/essentials/api/Economy.java
index 940207a6f..b0a267345 100644
--- a/Essentials/src/com/earth2me/essentials/api/Economy.java
+++ b/Essentials/src/com/earth2me/essentials/api/Economy.java
@@ -21,6 +21,7 @@ public final class Economy
}
private static final Logger logger = Logger.getLogger("Minecraft");
private static IEssentials ess;
+ private static final String noCallBeforeLoad = "Essentials API is called before Essentials is loaded.";
/**
* @param aEss the ess to set
@@ -66,6 +67,10 @@ public final class Economy
private static User getUserByName(String name)
{
+ if (ess == null)
+ {
+ throw new RuntimeException(noCallBeforeLoad);
+ }
User user;
Player player = ess.getServer().getPlayer(name);
if (player != null)
@@ -176,6 +181,10 @@ public final class Economy
*/
public static void resetBalance(String name) throws UserDoesNotExistException, NoLoanPermittedException
{
+ if (ess == null)
+ {
+ throw new RuntimeException(noCallBeforeLoad);
+ }
setMoney(name, ess.getSettings().getStartingBalance());
}
@@ -231,6 +240,10 @@ public final class Economy
*/
public static String format(double amount)
{
+ if (ess == null)
+ {
+ throw new RuntimeException(noCallBeforeLoad);
+ }
return Util.formatCurrency(amount, ess);
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java b/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java
index 3301afc87..591542bcb 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandbanip.java
@@ -1,5 +1,6 @@
package com.earth2me.essentials.commands;
+import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@@ -13,14 +14,24 @@ public class Commandbanip extends EssentialsCommand
}
@Override
- public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
+ public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
{
throw new NotEnoughArgumentsException();
}
- ess.getServer().banIP(args[0]);
- sender.sendMessage(Util.i18n("banIpAddress"));
+ final User u = ess.getUser(args[0]);
+
+ if (u == null)
+ {
+ ess.getServer().banIP(args[0]);
+ sender.sendMessage(Util.i18n("banIpAddress"));
+ }
+ else
+ {
+ ess.getServer().banIP(u.getAddress().getAddress().getHostAddress());
+ sender.sendMessage(Util.i18n("banIpAddress"));
+ }
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java b/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java
index bd07c2b9b..8d582a296 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandcompass.java
@@ -15,7 +15,7 @@ public class Commandcompass extends EssentialsCommand
@Override
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
{
- int r = (int)user.getCorrectedYaw();
+ int r = (int)user.getLocation().getYaw();
String dir;
if (r < 23) dir = "N";
else if (r < 68) dir = "NE";
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
index fda7061d5..328a4a8b5 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandessentials.java
@@ -56,7 +56,6 @@ public class Commandessentials extends EssentialsCommand
}
final String tuneStr = "1D#,1E,2F#,,2A#,1E,1D#,1E,2F#,2B,2D#,2E,2D#,2A#,2B,,2F#,,1D#,1E,2F#,2B,2C#,2A#,2B,2C#,2E,2D#,2E,2C#,,2F#,,2G#,,1D,1D#,,1C#,1D,1C#,1B,,1B,,1C#,,1D,,1D,1C#,1B,1C#,1D#,2F#,2G#,1D#,2F#,1C#,1D#,1B,1C#,1B,1D#,,2F#,,2G#,1D#,2F#,1C#,1D#,1B,1D,1D#,1D,1C#,1B,1C#,1D,,1B,1C#,1D#,2F#,1C#,1D,1C#,1B,1C#,,1B,,1C#,,2F#,,2G#,,1D,1D#,,1C#,1D,1C#,1B,,1B,,1C#,,1D,,1D,1C#,1B,1C#,1D#,2F#,2G#,1D#,2F#,1C#,1D#,1B,1C#,1B,1D#,,2F#,,2G#,1D#,2F#,1C#,1D#,1B,1D,1D#,1D,1C#,1B,1C#,1D,,1B,1C#,1D#,2F#,1C#,1D,1C#,1B,1C#,,1B,,1B,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1A#,,1B,,1F#,1G#,1B,,1F#,1G#,1B,1C#,1D#,1B,1E,1D#,1E,2F#,1B,,1B,,1F#,1G#,1B,1F#,1E,1D#,1C#,1B,,,,1F#,1B,,1F#,1G#,1B,,1F#,1G#,1B,1B,1C#,1D#,1B,1F#,1G#,1F#,1B,,1B,1A#,1B,1F#,1G#,1B,1E,1D#,1E,2F#,1B,,1B,,";
final String[] tune = tuneStr.split(",");
-
for (Player player : server.getOnlinePlayers())
{
final Location loc = player.getLocation();
@@ -91,7 +90,7 @@ public class Commandessentials extends EssentialsCommand
for (Player player : server.getOnlinePlayers())
{
Block block = noteBlocks.get(player);
- if (block == null)
+ if (block == null || block.getType() != Material.NOTE_BLOCK)
{
continue;
}
@@ -110,7 +109,10 @@ public class Commandessentials extends EssentialsCommand
ess.getScheduler().cancelTask(taskid);
for (Block block : noteBlocks.values())
{
- block.setType(Material.AIR);
+ if (block.getType() == Material.NOTE_BLOCK)
+ {
+ block.setType(Material.AIR);
+ }
}
noteBlocks.clear();
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java
index bf5cff75d..12eeb5182 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandgetpos.java
@@ -19,7 +19,7 @@ public class Commandgetpos extends EssentialsCommand
user.sendMessage("§7X: " + coords.getBlockX() + " (-North <-> +South)");
user.sendMessage("§7Y: " + coords.getBlockY() + " (+Up <-> -Down)");
user.sendMessage("§7Z: " + coords.getBlockZ() + " (+East <-> -West)");
- user.sendMessage("§7Yaw: " + user.getCorrectedYaw() + " (Rotation)");
+ user.sendMessage("§7Yaw: " + coords.getYaw() + " (Rotation)");
user.sendMessage("§7Pitch: " + coords.getPitch() + " (Head angle)");
}
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java
index 03afeadc4..e976faa42 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandkill.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandkill.java
@@ -4,6 +4,7 @@ import com.earth2me.essentials.Util;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
+import org.bukkit.event.entity.EntityDamageEvent;
public class Commandkill extends EssentialsCommand
@@ -23,6 +24,13 @@ public class Commandkill extends EssentialsCommand
for (Player p : server.matchPlayer(args[0]))
{
+ final EntityDamageEvent ede = new EntityDamageEvent(p, sender instanceof Player && ((Player)sender).getName().equals(p.getName()) ? EntityDamageEvent.DamageCause.SUICIDE : EntityDamageEvent.DamageCause.CUSTOM, 1000);
+ server.getPluginManager().callEvent(ede);
+ if (ede.isCancelled() && !sender.hasPermission("essentials.kill.force"))
+ {
+ continue;
+ }
+
p.setHealth(0);
sender.sendMessage(Util.format("kill", p.getDisplayName()));
}
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java
index 029901867..d6bcad464 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandrepair.java
@@ -30,6 +30,10 @@ public class Commandrepair extends EssentialsCommand
if (args[0].equalsIgnoreCase("hand"))
{
final ItemStack item = user.getItemInHand();
+ if (item == null)
+ {
+ throw new Exception(Util.i18n("repairInvalidType"));
+ }
final String itemName = item.getType().toString().toLowerCase();
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
@@ -84,6 +88,10 @@ public class Commandrepair extends EssentialsCommand
{
for (ItemStack item : items)
{
+ if (item == null)
+ {
+ continue;
+ }
final String itemName = item.getType().toString().toLowerCase();
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
try
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/Method.java b/Essentials/src/com/earth2me/essentials/register/payment/Method.java
index f8bd814ef..ea4477077 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/Method.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/Method.java
@@ -91,6 +91,23 @@ public interface Method
public boolean hasBankAccount(String bank, String name);
/**
+ * Forces an account creation
+ *
+ * @param name Account name
+ * @return <code>boolean</code>
+ */
+ public boolean createAccount(String name);
+
+ /**
+ * Forces an account creation
+ *
+ * @param name Account name
+ * @param balance Initial account balance
+ * @return <code>boolean</code>
+ */
+ public boolean createAccount(String name, Double balance);
+
+ /**
* Returns a <code>MethodAccount</code> class for an account <code>name</code>.
*
* @param name Account name
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/Methods.java b/Essentials/src/com/earth2me/essentials/register/payment/Methods.java
index 0fc65534f..34acf9837 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/Methods.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/Methods.java
@@ -2,6 +2,7 @@ package com.earth2me.essentials.register.payment;
import java.util.HashSet;
import java.util.Set;
+
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
@@ -168,7 +169,7 @@ public class Methods
}
plugin = manager.getPlugin(name);
- if (plugin == null)
+ if (plugin == null || !plugin.isEnabled())
{
continue;
}
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java
index 7c83c9b76..bc3893d5e 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE6.java
@@ -71,6 +71,29 @@ public class BOSE6 implements Method
|| this.BOSEconomy.isBankMember(bank, name);
}
+ public boolean createAccount(String name)
+ {
+ if (hasAccount(name))
+ {
+ return false;
+ }
+
+ this.BOSEconomy.registerPlayer(name);
+ return true;
+ }
+
+ public boolean createAccount(String name, Double balance)
+ {
+ if (hasAccount(name))
+ {
+ return false;
+ }
+
+ this.BOSEconomy.registerPlayer(name);
+ this.BOSEconomy.setPlayerMoney(name, balance, false);
+ return true;
+ }
+
public MethodAccount getAccount(String name)
{
if (!hasAccount(name))
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java
index 288e4a5c5..72d1f763e 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/BOSE7.java
@@ -70,6 +70,29 @@ public class BOSE7 implements Method
return this.BOSEconomy.isBankOwner(bank, name) || this.BOSEconomy.isBankMember(bank, name);
}
+ public boolean createAccount(String name)
+ {
+ if (hasAccount(name))
+ {
+ return false;
+ }
+
+ this.BOSEconomy.registerPlayer(name);
+ return true;
+ }
+
+ public boolean createAccount(String name, Double balance)
+ {
+ if (hasAccount(name))
+ {
+ return false;
+ }
+
+ this.BOSEconomy.registerPlayer(name);
+ this.BOSEconomy.setPlayerMoney(name, balance, false);
+ return true;
+ }
+
public MethodAccount getAccount(String name)
{
if (!hasAccount(name))
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java
index 6248b1b91..53d8ed120 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/MCUR.java
@@ -64,6 +64,18 @@ public class MCUR implements Method
return false;
}
+ public boolean createAccount(String name)
+ {
+ CurrencyList.setValue((String)CurrencyList.maxCurrency(name)[0], name, 0);
+ return true;
+ }
+
+ public boolean createAccount(String name, Double balance)
+ {
+ CurrencyList.setValue((String)CurrencyList.maxCurrency(name)[0], name, balance);
+ return true;
+ }
+
public MethodAccount getAccount(String name)
{
return new MCurrencyAccount(name);
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java
index fcdb7c43b..1f33df12c 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo4.java
@@ -64,6 +64,44 @@ public class iCo4 implements Method
return false;
}
+ public boolean createAccount(String name)
+ {
+ if (hasAccount(name))
+ {
+ return false;
+ }
+
+ try
+ {
+ com.nijiko.coelho.iConomy.iConomy.getBank().addAccount(name);
+ }
+ catch (Exception E)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public boolean createAccount(String name, Double balance)
+ {
+ if (hasAccount(name))
+ {
+ return false;
+ }
+
+ try
+ {
+ com.nijiko.coelho.iConomy.iConomy.getBank().addAccount(name, balance);
+ }
+ catch (Exception E)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
public MethodAccount getAccount(String name)
{
return new iCoAccount(com.nijiko.coelho.iConomy.iConomy.getBank().getAccount(name));
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java
index 462cb76d5..d56873c3f 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo5.java
@@ -67,6 +67,33 @@ public class iCo5 implements Method
return (hasBank(bank)) && com.iConomy.iConomy.getBank(bank).hasAccount(name);
}
+ public boolean createAccount(String name)
+ {
+ if (hasAccount(name))
+ {
+ return false;
+ }
+
+ return com.iConomy.iConomy.Accounts.create(name);
+ }
+
+ public boolean createAccount(String name, Double balance)
+ {
+ if (hasAccount(name))
+ {
+ return false;
+ }
+
+ if (!com.iConomy.iConomy.Accounts.create(name))
+ {
+ return false;
+ }
+
+ getAccount(name).set(balance);
+
+ return true;
+ }
+
public MethodAccount getAccount(String name)
{
return new iCoAccount(com.iConomy.iConomy.getAccount(name));
diff --git a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java
index b74367173..1feee30af 100644
--- a/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java
+++ b/Essentials/src/com/earth2me/essentials/register/payment/methods/iCo6.java
@@ -66,6 +66,26 @@ public class iCo6 implements Method
return false;
}
+ public boolean createAccount(String name)
+ {
+ if (hasAccount(name))
+ {
+ return false;
+ }
+
+ return (new Accounts()).create(name);
+ }
+
+ public boolean createAccount(String name, Double balance)
+ {
+ if (hasAccount(name))
+ {
+ return false;
+ }
+
+ return (new Accounts()).create(name, balance);
+ }
+
public MethodAccount getAccount(String name)
{
return new iCoAccount((new Accounts()).get(name));
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignBuy.java b/Essentials/src/com/earth2me/essentials/signs/SignBuy.java
index 6ee602ff5..39704ff0d 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignBuy.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignBuy.java
@@ -27,7 +27,9 @@ public class SignBuy extends EssentialsSign
final Trade items = getTrade(sign, 1, 2, player, ess);
final Trade charge = getTrade(sign, 3, ess);
charge.isAffordableFor(player);
- items.pay(player);
+ if (!items.pay(player, false)) {
+ throw new ChargeException("Inventory full");
+ }
charge.charge(player);
Trade.log("Sign", "Buy", "Interact", username, charge, username, items, sign.getBlock().getLocation(), ess);
return true;
diff --git a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
index bf85d827c..6c956165a 100644
--- a/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
+++ b/Essentials/src/com/earth2me/essentials/signs/SignTrade.java
@@ -10,7 +10,6 @@ import org.bukkit.inventory.ItemStack;
public class SignTrade extends EssentialsSign
{
-
public SignTrade()
{
super("Trade");
@@ -34,25 +33,33 @@ public class SignTrade extends EssentialsSign
{
if (sign.getLine(3).substring(2).equalsIgnoreCase(username))
{
+ final Trade store = rechargeSign(sign, ess, player);
+ Trade stored = null;
try
{
- final Trade stored = getTrade(sign, 1, true, true, ess);
+ stored = getTrade(sign, 1, true, true, ess);
substractAmount(sign, 1, stored, ess);
stored.pay(player);
- Trade.log("Sign", "Trade", "OwnerInteract", username, null, username, stored, sign.getBlock().getLocation(), ess);
- }
+ }
catch (SignException e)
{
- throw new SignException(Util.i18n("tradeSignEmptyOwner"));
- }
+ if (store == null)
+ {
+ throw new SignException(Util.i18n("tradeSignEmptyOwner"), e);
+ }
+ }
+ Trade.log("Sign", "Trade", "OwnerInteract", username, store, username, stored, sign.getBlock().getLocation(), ess);
}
else
{
final Trade charge = getTrade(sign, 1, false, false, ess);
final Trade trade = getTrade(sign, 2, false, true, ess);
charge.isAffordableFor(player);
+ if (!trade.pay(player, false))
+ {
+ throw new ChargeException("Full inventory");
+ }
substractAmount(sign, 2, trade, ess);
- trade.pay(player);
addAmount(sign, 1, charge, ess);
charge.charge(player);
Trade.log("Sign", "Trade", "Interact", sign.getLine(3), charge, username, trade, sign.getBlock().getLocation(), ess);
@@ -61,17 +68,48 @@ public class SignTrade extends EssentialsSign
return true;
}
+ private Trade rechargeSign(final ISign sign, final IEssentials ess, final User player) throws SignException, ChargeException
+ {
+ final Trade trade = getTrade(sign, 2, false, false, ess);
+ if (trade.getItemStack() != null && player.getItemInHand() != null
+ && trade.getItemStack().getTypeId() == player.getItemInHand().getTypeId()
+ && trade.getItemStack().getDurability() == player.getItemInHand().getDurability())
+ {
+ int amount = player.getItemInHand().getAmount();
+ amount -= amount % trade.getItemStack().getAmount();
+ if (amount > 0)
+ {
+ final Trade store = new Trade(new ItemStack(player.getItemInHand().getTypeId(), amount, player.getItemInHand().getDurability()), ess);
+ addAmount(sign, 2, store, ess);
+ store.charge(player);
+ return store;
+ }
+ }
+ return null;
+ }
+
@Override
protected boolean onSignBreak(final ISign sign, final User player, final String username, final IEssentials ess) throws SignException
{
if ((sign.getLine(3).length() > 3 && sign.getLine(3).substring(2).equalsIgnoreCase(username))
|| player.isAuthorized("essentials.signs.trade.override"))
{
- final Trade stored1 = getTrade(sign, 1, true, false, ess);
- final Trade stored2 = getTrade(sign, 2, true, false, ess);
- stored1.pay(player);
- stored2.pay(player);
- Trade.log("Sign", "Trade", "Break", username, stored2, username, stored1, sign.getBlock().getLocation(), ess);
+ try
+ {
+ final Trade stored1 = getTrade(sign, 1, true, false, ess);
+ final Trade stored2 = getTrade(sign, 2, true, false, ess);
+ stored1.pay(player);
+ stored2.pay(player);
+ Trade.log("Sign", "Trade", "Break", username, stored2, username, stored1, sign.getBlock().getLocation(), ess);
+ }
+ catch (SignException e)
+ {
+ if (player.isAuthorized("essentials.signs.trade.override"))
+ {
+ return true;
+ }
+ throw e;
+ }
return true;
}
else
@@ -128,7 +166,7 @@ public class SignTrade extends EssentialsSign
throw new SignException(Util.i18n("moreThanZero"));
}
String newline = amount + " " + split[1] + ":0";
- if ((newline + amount).length() > 16)
+ if ((newline + amount).length() > 15)
{
throw new SignException("Line can be too long!");
}
@@ -237,7 +275,12 @@ public class SignTrade extends EssentialsSign
final Double amount = getDouble(split[1]);
if (money != null && amount != null)
{
- sign.setLine(index, Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount + value, ess).substring(1));
+ final String newline = Util.formatCurrency(money, ess) + ":" + Util.formatCurrency(amount + value, ess).substring(1);
+ if (newline.length() > 15)
+ {
+ throw new SignException("Line too long!");
+ }
+ sign.setLine(index, newline);
return;
}
}
@@ -247,7 +290,12 @@ public class SignTrade extends EssentialsSign
final int stackamount = getIntegerPositive(split[0]);
final ItemStack item = getItemStack(split[1], stackamount, ess);
final int amount = getInteger(split[2]);
- sign.setLine(index, stackamount + " " + split[1] + ":" + (amount + Math.round(value)));
+ final String newline = stackamount + " " + split[1] + ":" + (amount + Math.round(value));
+ if (newline.length() > 15)
+ {
+ throw new SignException("Line too long!");
+ }
+ sign.setLine(index, newline);
return;
}
throw new SignException(Util.format("invalidSignLine", index + 1));
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index 61cb7aefa..b5ad0d95a 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -238,6 +238,9 @@ auto-afk-kick: -1
# The player has to use the command /afk to leave the afk mode.
freeze-afk-players: false
+# You can disable the death messages of minecraft here
+death-messages: true
+
############################################################
# +------------------------------------------------------+ #
# | EssentialsHome | #
diff --git a/Essentials/src/items.csv b/Essentials/src/items.csv
index 53fe31d6c..9dfe37218 100644
--- a/Essentials/src/items.csv
+++ b/Essentials/src/items.csv
@@ -501,20 +501,20 @@ detecttrack,28,0
detectrail,28,0
dtrack,28,0
drail,28,0
-stickypistonbase,29,0
-stickypiston,29,0
-stickpistonbase,29,0
-stickpiston,29,0
-stickyp,29,0
-spistonbase,29,0
-spiston,29,0
-pistonstickybase,29,0
-pistonsticky,29,0
-pistonstickbase,29,0
-pistonstick,29,0
-pistonsbase,29,0
-pistons,29,0
-psticky,29,0
+stickypistonbase,29,7
+stickypiston,29,7
+stickpistonbase,29,7
+stickpiston,29,7
+stickyp,29,7
+spistonbase,29,7
+spiston,29,7
+pistonstickybase,29,7
+pistonsticky,29,7
+pistonstickbase,29,7
+pistonstick,29,7
+pistonsbase,29,7
+pistons,29,7
+psticky,29,7
spiderweb,30,0
sweb,30,0
web,30,0
@@ -534,21 +534,21 @@ deadshrub,32,0
shrubdead,32,0
dshrub,32,0
shrubd,32,0
-normalpistonbase,33,0
-normalpiston,33,0
-normpistonbase,33,0
-normpiston,33,0
-npistonbase,33,0
-npiston,33,0
-pistonnormalbase,33,0
-pistonnormal,33,0
-pistonnormbase,33,0
-pistonnorm,33,0
-pistonnbase,33,0
-pistonn,33,0
-pistonbase,33,0
-piston,33,0
-pistonblock,33,0
+normalpistonbase,33,7
+normalpiston,33,7
+normpistonbase,33,7
+normpiston,33,7
+npistonbase,33,7
+npiston,33,7
+pistonnormalbase,33,7
+pistonnormal,33,7
+pistonnormbase,33,7
+pistonnorm,33,7
+pistonnbase,33,7
+pistonn,33,7
+pistonbase,33,7
+piston,33,7
+pistonblock,33,7
pistonextensionnormal,34,0
pistonextensionnorm,34,0
pistonextensionn,34,0
@@ -1259,10 +1259,12 @@ sfstone,97,0
stonesilverfish,97,0
fishstone,97,0
trapstone,97,0
+silverfish,97,0
stonebrick,98,0
stonebricks,98,0
stonebrickblock,98,0
stonebb,98,0
+sbrick,98,0
mossystonebrick,98,1
mossystonebricks,98,1
mossystonebrickblock,98,1
diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml
index 61a054c45..1240910ce 100644
--- a/Essentials/src/plugin.yml
+++ b/Essentials/src/plugin.yml
@@ -3,7 +3,7 @@ name: Essentials
main: com.earth2me.essentials.Essentials
# Note to developers: This next line cannot change, or the automatic versioning system will break.
version: TeamCity
-website: http://www.earth2me.net:8001/
+website: http://ci.earth2me.net/
description: Provides an essential, core set of commands for Bukkit.
authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits]
commands:
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
index 20b3756d0..7a10d9a92 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
@@ -25,7 +25,7 @@ public class EssentialsChat extends JavaPlugin
chatListener = new HashMap<String, IEssentialsChatListener>();
final EssentialsChatPlayerListener playerListener = new EssentialsChatPlayerListener(getServer(), ess, chatListener);
- pluginManager.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Highest, this);
+ pluginManager.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.High, this);
if (!this.getDescription().getVersion().equals(ess.getDescription().getVersion()))
{
LOGGER.log(Level.WARNING, Util.i18n("versionMismatchAll"));
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
index 49cee6001..cf8075377 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/GroupManager.java
@@ -159,7 +159,7 @@ public class GroupManager extends JavaPlugin {
}
};
scheduler = new ScheduledThreadPoolExecutor(1);
- int minutes = getConfig().getSaveInterval();
+ int minutes = getGMConfig().getSaveInterval();
scheduler.scheduleAtFixedRate(commiter, minutes, minutes, TimeUnit.MINUTES);
GroupManager.logger.info("Scheduled Data Saving is set for every " + minutes + " minutes!");
}
@@ -1755,7 +1755,7 @@ public class GroupManager extends JavaPlugin {
/**
* @return the config
*/
- public GMConfiguration getConfig() {
+ public GMConfiguration getGMConfig() {
return config;
}
diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
index 50e6ef547..0bcf9a827 100644
--- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
+++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java
@@ -111,7 +111,7 @@ public class WorldsHolder {
@SuppressWarnings("rawtypes")
public void mirrorSetUp() {
mirrors.clear();
- Map<String, Object> mirrorsMap = plugin.getConfig().getMirrorsMap();
+ Map<String, Object> mirrorsMap = plugin.getGMConfig().getMirrorsMap();
if (mirrorsMap != null) {
for (String source : mirrorsMap.keySet()) {
// Make sure all non mirrored worlds have a set of data files.
diff --git a/lib/bukkit-0.0.1-SNAPSHOT.jar b/lib/bukkit-0.0.1-SNAPSHOT.jar
index b348aa103..e901b2a2b 100644
--- a/lib/bukkit-0.0.1-SNAPSHOT.jar
+++ b/lib/bukkit-0.0.1-SNAPSHOT.jar
Binary files differ
diff --git a/lib/craftbukkit-0.0.1-SNAPSHOT.jar b/lib/craftbukkit-0.0.1-SNAPSHOT.jar
index 5e0ccde38..548ba80d3 100644
--- a/lib/craftbukkit-0.0.1-SNAPSHOT.jar
+++ b/lib/craftbukkit-0.0.1-SNAPSHOT.jar
Binary files differ