summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-02-15 19:09:02 +0000
committerKHobbits <rob@khobbits.co.uk>2012-02-15 19:09:02 +0000
commit16a0f44b4d8e3f582547a4357b1e6e17b60b7316 (patch)
treecaaf1506c61405fd4646b00445823e7ae0f674ca
parent1a2acb43aeb2217b772351dcf8cf829e6dd6d8ac (diff)
parent7633b136e3f221d4c3b2cc0ee19ffbed97c1423b (diff)
downloadEssentials-16a0f44b4d8e3f582547a4357b1e6e17b60b7316.tar
Essentials-16a0f44b4d8e3f582547a4357b1e6e17b60b7316.tar.gz
Essentials-16a0f44b4d8e3f582547a4357b1e6e17b60b7316.tar.lz
Essentials-16a0f44b4d8e3f582547a4357b1e6e17b60b7316.tar.xz
Essentials-16a0f44b4d8e3f582547a4357b1e6e17b60b7316.zip
Merge remote branch 'remotes/origin/master' into release
-rw-r--r--Essentials/src/com/earth2me/essentials/OfflinePlayer.java56
-rw-r--r--Essentials/src/com/earth2me/essentials/Trade.java30
-rw-r--r--Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java24
-rw-r--r--Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java39
-rw-r--r--Essentials/src/config.yml32
-rw-r--r--Essentials/src/plugin.yml6
-rw-r--r--Essentials/test/com/earth2me/essentials/FakeServer.java12
-rw-r--r--EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java2
-rw-r--r--EssentialsChat/src/plugin.yml2
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java15
-rw-r--r--EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java37
-rw-r--r--lib/bukkit.jarbin4718663 -> 4730197 bytes
-rw-r--r--lib/craftbukkit.jarbin10691664 -> 10709594 bytes
13 files changed, 161 insertions, 94 deletions
diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
index fa0be02c7..18fc60cbc 100644
--- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
+++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
@@ -17,6 +17,8 @@ import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
@@ -857,4 +859,58 @@ public class OfflinePlayer implements Player
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public void hidePlayer(Player player)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void showPlayer(Player player)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean canSee(Player player)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean addPotionEffect(PotionEffect pe)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean addPotionEffect(PotionEffect pe, boolean bln)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean addPotionEffects(Collection<PotionEffect> clctn)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean hasPotionEffect(PotionEffectType pet)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void removePotionEffect(PotionEffectType pet)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public Collection<PotionEffect> getActivePotionEffects()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java
index 6cd9ce93a..933b54b3f 100644
--- a/Essentials/src/com/earth2me/essentials/Trade.java
+++ b/Essentials/src/com/earth2me/essentials/Trade.java
@@ -13,6 +13,7 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Location;
+import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
@@ -38,7 +39,7 @@ public class Trade
{
this(null, null, items, null, ess);
}
-
+
public Trade(final int exp, final IEssentials ess)
{
this(null, null, null, exp, ess);
@@ -79,9 +80,10 @@ public class Trade
{
throw new ChargeException(_("notEnoughMoney"));
}
-
- if (exp != null && exp > 0
- && SetExpFix.getTotalExperience(user) < exp) {
+
+ if (exp != null && exp > 0
+ && SetExpFix.getTotalExperience(user) < exp)
+ {
throw new ChargeException(_("notEnoughExperience"));
}
}
@@ -103,9 +105,25 @@ public class Trade
if (dropItems)
{
final Map<Integer, ItemStack> leftOver = InventoryWorkaround.addItem(user.getInventory(), true, getItemStack());
+ final Location loc = user.getLocation();
for (ItemStack itemStack : leftOver.values())
{
- InventoryWorkaround.dropItem(user.getLocation(), itemStack);
+ final int maxStackSize = itemStack.getType().getMaxStackSize();
+ final int stacks = itemStack.getAmount() / maxStackSize;
+ final int leftover = itemStack.getAmount() % maxStackSize;
+ final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
+ for (int i = 0; i < stacks; i++)
+ {
+ final ItemStack stack = itemStack.clone();
+ stack.setAmount(maxStackSize);
+ itemStacks[i] = loc.getWorld().dropItem(loc, stack);
+ }
+ if (leftover > 0)
+ {
+ final ItemStack stack = itemStack.clone();
+ stack.setAmount(leftover);
+ itemStacks[stacks] = loc.getWorld().dropItem(loc, stack);
+ }
}
}
else
@@ -173,7 +191,7 @@ public class Trade
{
return itemStack;
}
-
+
public Integer getExperience()
{
return exp;
diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java
index 57e2eda63..3fbb7874c 100644
--- a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java
+++ b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java
@@ -554,4 +554,28 @@ public class FakeWorld implements World
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public long getTicksPerAnimalSpawns()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setTicksPerAnimalSpawns(int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public long getTicksPerMonsterSpawns()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public void setTicksPerMonsterSpawns(int i)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java
index 308568452..a6d5d4fbc 100644
--- a/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java
+++ b/Essentials/src/com/earth2me/essentials/craftbukkit/InventoryWorkaround.java
@@ -1,17 +1,12 @@
package com.earth2me.essentials.craftbukkit;
-import com.earth2me.essentials.craftbukkit.FakeInventory;
import java.util.HashMap;
import java.util.Map;
-import org.bukkit.Location;
-import org.bukkit.entity.Item;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
/*
- * This class can be removed when
- * https://github.com/Bukkit/CraftBukkit/pull/193
- * is accepted to CraftBukkit
+ * This class can be removed when https://github.com/Bukkit/CraftBukkit/pull/193 is accepted to CraftBukkit
*/
public final class InventoryWorkaround
@@ -47,7 +42,7 @@ public final class InventoryWorkaround
{
return firstPartial(cinventory, item, forceDurability, item.getType().getMaxStackSize());
}
-
+
public static int firstPartial(final Inventory cinventory, final ItemStack item, final boolean forceDurability, final int maxAmount)
{
if (item == null)
@@ -93,10 +88,9 @@ public final class InventoryWorkaround
{
final Map<Integer, ItemStack> leftover = new HashMap<Integer, ItemStack>();
- /* TODO: some optimization
- * - Create a 'firstPartial' with a 'fromIndex'
- * - Record the lastPartial per Material
- * - Cache firstEmpty result
+ /*
+ * TODO: some optimization - Create a 'firstPartial' with a 'fromIndex' - Record the lastPartial per Material -
+ * Cache firstEmpty result
*/
// combine items
@@ -175,7 +169,7 @@ public final class InventoryWorkaround
final int amount = item.getAmount();
final int partialAmount = partialItem.getAmount();
-
+
// Check if it fully fits
if (amount + partialAmount <= maxAmount)
{
@@ -325,25 +319,4 @@ public final class InventoryWorkaround
}
return leftover.isEmpty();
}
-
- public static Item[] dropItem(final Location loc, final ItemStack itm)
- {
- final int maxStackSize = itm.getType().getMaxStackSize();
- final int stacks = itm.getAmount() / maxStackSize;
- final int leftover = itm.getAmount() % maxStackSize;
- final Item[] itemStacks = new Item[stacks + (leftover > 0 ? 1 : 0)];
- for (int i = 0; i < stacks; i++)
- {
- final ItemStack stack = itm.clone();
- stack.setAmount(maxStackSize);
- itemStacks[i] = loc.getWorld().dropItem(loc, stack);
- }
- if (leftover > 0)
- {
- final ItemStack stack = itm.clone();
- stack.setAmount(leftover);
- itemStacks[stacks] = loc.getWorld().dropItem(loc, stack);
- }
- return itemStacks;
- }
}
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index 0998220ba..00585f35f 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -291,8 +291,8 @@ sethome-multiple:
# essentials.sethome.multiple.staff
staff: 10
-#Set timeout in seconds for players to accept tpa before request is cancelled.
-#Set to 0 for no timeout
+# Set timeout in seconds for players to accept tpa before request is cancelled.
+# Set to 0 for no timeout
tpa-accept-cancellation: 0
############################################################
@@ -313,7 +313,7 @@ command-costs:
#example: 1000
# /kit tools costs $1500 PER USE
#kit-tools: 1500
-
+
# Set this to a currency symbol you want to use.
currency-symbol: '$'
@@ -346,22 +346,22 @@ hide-permissionless-help: true
############################################################
chat:
-
+
# If EssentialsChat is installed, this will define how far a player's voice travels, in blocks. Set to 0 to make all chat global.
# Note that users with the "essentials.chat.spy" permission will hear everything, regardless of this setting.
# Users with essentials.chat.shout can override this by prefixing text with an exclamation mark (!)
# Or with essentials.chat.question can override this by prefixing text with a question mark (?)
# You can add command costs for shout/question by adding chat-shout and chat-question to the command costs section."
radius: 0
-
+
# Chat formatting can be done in two ways, you can either define a standard format for all chat
# Or you can give a group specific chat format, to give some extra variation.
# If set to the default chat format which "should" be compatible with ichat.
# For more information of chat formatting, check out the wiki: http://ess.khhq.net/wiki/Chat_Formatting
-
+
format: '<{DISPLAYNAME}> {MESSAGE}'
#format: '&7[{GROUP}]&f {DISPLAYNAME}&7:&f {MESSAGE}'
-
+
group-formats:
# Default: '{WORLDNAME} {DISPLAYNAME}&7:&f {MESSAGE}'
# Admins: '{WORLDNAME} &c[{GROUP}]&f {DISPLAYNAME}&7:&c {MESSAGE}'
@@ -400,13 +400,13 @@ protect:
# Which blocks should people be prevented from placing
placement: 10,11,46,327
-
+
# Which items should people be prevented from using
usage: 327
-
+
# Which blocks should people be prevented from breaking
break:
-
+
# Which blocks should not be pushed by pistons
piston:
@@ -460,12 +460,12 @@ protect:
mushroom_cow: false
magma_cube: false
snowman: false
-
+
# Maximum height the creeper should explode. -1 allows them to explode everywhere.
# Set prevent.creeper-explosion to true, if you want to disable creeper explosions.
creeper:
max-height: -1
-
+
# Protect various blocks.
protect:
# Protect all signs
@@ -481,7 +481,7 @@ protect:
# Prevent placing blocks above protected rails, this is to stop a potential griefing
prevent-block-on-rails: false
-
+
# Store blocks / signs in memory before writing
memstore: false
@@ -510,14 +510,14 @@ protect:
# Burn, baby, burn! Should fire damage be disabled?
firedmg: false
-
+
# Should the damage after hit by a lightning be disabled?
lightning: false
# Should people with build: false in permissions be allowed to build
# Set true to disable building for those people
build: true
-
+
# Should people with build: false in permissions be allowed to use items
# Set true to disable using for those people
use: true
@@ -544,7 +544,7 @@ newbies:
# If not, set to ''
#announce-format: ''
announce-format: '&dWelcome {DISPLAYNAME}&d to the server!'
-
+
# When we spawn for the first time, which spawnpoint do we use?
# Set to "none" if you want to use the spawn point of the world.
spawnpoint: newbies
diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml
index 0ec1ee6d9..b9cbd5227 100644
--- a/Essentials/src/plugin.yml
+++ b/Essentials/src/plugin.yml
@@ -5,7 +5,7 @@ main: com.earth2me.essentials.Essentials
version: TeamCity
website: http://tiny.cc/EssentialsCommands
description: Provides an essential, core set of commands for Bukkit.
-authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits]
+authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5]
commands:
afk:
description: Marks you as away-from-keyboard.
@@ -120,7 +120,7 @@ commands:
aliases: [mem,memory,egc,emem,ememory]
give:
description: Give a player an item.
- usage: /<command> <player> <item|numeric> [amount <enchantmentname[:level]> ...]
+ usage: /<command> <player> <item|numeric> [amount <enchantmentname[:level]> ...]
aliases: [egive]
god:
description: Enables your godly powers.
@@ -220,7 +220,7 @@ commands:
aliases: [emute]
near:
description: Lists the players near by or around a player
- usage: /<command> [playername] [radius]
+ usage: /<command> [playername] [radius]
aliases: [nearby,enear,enearby]
nick:
description: Change your nickname or that of another player.
diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java
index 7090c26b6..14f81b605 100644
--- a/Essentials/test/com/earth2me/essentials/FakeServer.java
+++ b/Essentials/test/com/earth2me/essentials/FakeServer.java
@@ -654,4 +654,16 @@ public class FakeServer implements Server
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public int getTicksPerAnimalSpawns()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public int getTicksPerMonsterSpawns()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
index 21a71f046..436bb55e5 100644
--- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
+++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java
@@ -7,8 +7,6 @@ import java.util.Map;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.logging.Level;
import java.util.logging.Logger;
-import org.bukkit.event.Event.Priority;
-import org.bukkit.event.Event.Type;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
diff --git a/EssentialsChat/src/plugin.yml b/EssentialsChat/src/plugin.yml
index 6f899e33f..af0ed0c13 100644
--- a/EssentialsChat/src/plugin.yml
+++ b/EssentialsChat/src/plugin.yml
@@ -5,6 +5,6 @@ main: com.earth2me.essentials.chat.EssentialsChat
version: TeamCity
website: http://tiny.cc/EssentialsCommands
description: Provides chat control features for Essentials. Requires Permissions.
-authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, Okamosy]
+authors: [Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo, ceulemans, Xeology, KHobbits, md_5, Okamosy]
depend: [Essentials]
#softdepend: [Factions] \ No newline at end of file
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java
index 4ed1df602..7dd46451a 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/EssentialsHelp.java
@@ -7,16 +7,15 @@ import java.util.Map;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import org.bukkit.event.Event.Priority;
-import org.bukkit.event.Event.Type;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
-import org.bukkit.event.player.PlayerListener;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
-public class EssentialsHelp extends PlayerListener
+public class EssentialsHelp implements Listener
{
private transient Player chatUser;
private final transient Server server;
@@ -39,8 +38,7 @@ public class EssentialsHelp extends PlayerListener
public void registerEvents()
{
final PluginManager pluginManager = server.getPluginManager();
- pluginManager.registerEvent(Type.PLAYER_QUIT, this, Priority.Low, plugin);
- pluginManager.registerEvent(Type.PLAYER_CHAT, this, Priority.Low, plugin);
+ pluginManager.registerEvents(this, plugin);
}
public void onCommand(final CommandSender sender)
@@ -155,18 +153,17 @@ public class EssentialsHelp extends PlayerListener
ircBot = new IrcBot(player, "Ess_" + player.getName(), UsernameUtil.createUsername(player));
}
- @Override
+ @EventHandler
public void onPlayerChat(final PlayerChatEvent event)
{
if (event.getPlayer() == chatUser)
{
final boolean success = sendChatMessage(event.getPlayer(), event.getMessage());
event.setCancelled(success);
- return;
}
}
- @Override
+ @EventHandler
public void onPlayerQuit(final PlayerQuitEvent event)
{
closeConnection();
diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java
index 1b26f1d32..9fa587f8f 100644
--- a/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java
+++ b/EssentialsUpdate/src/com/earth2me/essentials/update/UpdateProcess.java
@@ -7,18 +7,15 @@ import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
-import org.bukkit.event.CustomEventListener;
-import org.bukkit.event.Event;
-import org.bukkit.event.Event.Priority;
-import org.bukkit.event.Event.Type;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerListener;
import org.bukkit.plugin.Plugin;
-import org.bukkit.plugin.PluginManager;
-public class UpdateProcess extends PlayerListener
+public class UpdateProcess implements Listener
{
private transient Player currentPlayer;
private final transient Plugin plugin;
@@ -34,21 +31,7 @@ public class UpdateProcess extends PlayerListener
public void registerEvents()
{
- final PluginManager pluginManager = plugin.getServer().getPluginManager();
- pluginManager.registerEvent(Type.PLAYER_QUIT, this, Priority.Low, plugin);
- pluginManager.registerEvent(Type.PLAYER_CHAT, this, Priority.Lowest, plugin);
- pluginManager.registerEvent(Type.PLAYER_JOIN, this, Priority.Normal, plugin);
- pluginManager.registerEvent(Type.CUSTOM_EVENT, new CustomEventListener()
- {
- @Override
- public void onCustomEvent(final Event event)
- {
- if (event instanceof InstallationFinishedEvent)
- {
- UpdateProcess.this.currentPlayer = null;
- }
- }
- }, Priority.Normal, plugin);
+ plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
public boolean selfUpdate()
@@ -110,7 +93,13 @@ public class UpdateProcess extends PlayerListener
return false;
}
- @Override
+ @EventHandler
+ public void onInstallationFinished(final InstallationFinishedEvent event)
+ {
+ UpdateProcess.this.currentPlayer = null;
+ }
+
+ @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerChat(final PlayerChatEvent event)
{
if (event.getPlayer() == currentPlayer)
@@ -130,7 +119,7 @@ public class UpdateProcess extends PlayerListener
}
}
- @Override
+ @EventHandler
public void onPlayerJoin(final PlayerJoinEvent event)
{
final Player player = event.getPlayer();
diff --git a/lib/bukkit.jar b/lib/bukkit.jar
index aa26f4f35..40205c8b1 100644
--- a/lib/bukkit.jar
+++ b/lib/bukkit.jar
Binary files differ
diff --git a/lib/craftbukkit.jar b/lib/craftbukkit.jar
index 190294358..a7dd67ee9 100644
--- a/lib/craftbukkit.jar
+++ b/lib/craftbukkit.jar
Binary files differ