diff options
11 files changed, 242 insertions, 59 deletions
diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java index ba5f97c71..a1c46c3ea 100644 --- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java +++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java @@ -1,18 +1,22 @@ package com.earth2me.essentials; -import com.earth2me.essentials.craftbukkit.OfflineBedLocation; import static com.earth2me.essentials.I18n._; import java.net.InetSocketAddress; import java.util.*; import lombok.Delegate; import org.bukkit.*; import org.bukkit.block.Block; +import org.bukkit.conversations.Conversation; import org.bukkit.entity.*; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryView; +import org.bukkit.inventory.InventoryView.Property; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.map.MapView; +import org.bukkit.metadata.MetadataValue; import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionAttachment; import org.bukkit.permissions.PermissionAttachmentInfo; @@ -908,4 +912,119 @@ public class OfflinePlayer implements Player { return EntityType.PLAYER; } + + @Override + public <T> void playEffect(Location lctn, Effect effect, T t) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean setWindowProperty(Property prprt, int i) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InventoryView getOpenInventory() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InventoryView openInventory(Inventory invntr) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InventoryView openWorkbench(Location lctn, boolean bln) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InventoryView openEnchanting(Location lctn, boolean bln) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void openInventory(InventoryView iv) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void closeInventory() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ItemStack getItemOnCursor() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setItemOnCursor(ItemStack is) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMetadata(String string, MetadataValue mv) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public List<MetadataValue> getMetadata(String string) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean hasMetadata(String string) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void removeMetadata(String string, Plugin plugin) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + + @Override + public boolean isConversing() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void acceptConversationInput(String string) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean beginConversation(Conversation c) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void abandonConversation(Conversation c) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void sendMessage(String[] strings) + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandkillall.java b/Essentials/src/com/earth2me/essentials/commands/Commandkillall.java index b9679e8b9..c0b47d20f 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandkillall.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandkillall.java @@ -125,7 +125,7 @@ public class Commandkillall extends EssentialsCommand { if (entity instanceof Animals || entity instanceof NPC || entity instanceof Snowman || entity instanceof WaterMob) { - EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST); + EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST); ess.getServer().getPluginManager().callEvent(event); entity.remove(); numKills++; @@ -135,7 +135,7 @@ public class Commandkillall extends EssentialsCommand { if (entity instanceof Monster || entity instanceof ComplexLivingEntity || entity instanceof Flying || entity instanceof Slime) { - EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST); + EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST); ess.getServer().getPluginManager().callEvent(event); entity.remove(); numKills++; @@ -143,14 +143,14 @@ public class Commandkillall extends EssentialsCommand } else if (all) { - EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST); + EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST); ess.getServer().getPluginManager().callEvent(event); entity.remove(); numKills++; } else if (entityClass != null && entityClass.isAssignableFrom(entity.getClass())) { - EntityDeathEvent event = new EntityDeathEvent(entity, Collections.EMPTY_LIST); + EntityDeathEvent event = new EntityDeathEvent((LivingEntity)entity, Collections.EMPTY_LIST); ess.getServer().getPluginManager().callEvent(event); entity.remove(); numKills++; diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeInventory.java b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeInventory.java index 992791710..01e7bd5b2 100644 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeInventory.java +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeInventory.java @@ -1,8 +1,13 @@ package com.earth2me.essentials.craftbukkit; import java.util.HashMap; +import java.util.List; +import java.util.ListIterator; import org.bukkit.Material; +import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; @@ -187,4 +192,34 @@ public class FakeInventory implements Inventory items[i] = null; } } + + @Override + public List<HumanEntity> getViewers() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getTitle() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InventoryType getType() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public InventoryHolder getHolder() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ListIterator<ItemStack> iterator() + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java index f39c6e451..91e5d5239 100644 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java +++ b/Essentials/src/com/earth2me/essentials/craftbukkit/FakeWorld.java @@ -12,6 +12,7 @@ import org.bukkit.entity.*; import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.ChunkGenerator; import org.bukkit.inventory.ItemStack; +import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; import org.bukkit.util.Vector; @@ -590,4 +591,40 @@ public class FakeWorld implements World { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public <T> void playEffect(Location lctn, Effect effect, T t) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public <T> void playEffect(Location lctn, Effect effect, T t, int i) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void setMetadata(String string, MetadataValue mv) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public List<MetadataValue> getMetadata(String string) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public boolean hasMetadata(String string) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public void removeMetadata(String string, Plugin plugin) + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/Essentials/src/com/earth2me/essentials/craftbukkit/ShowInventory.java b/Essentials/src/com/earth2me/essentials/craftbukkit/ShowInventory.java deleted file mode 100644 index fb2050ce4..000000000 --- a/Essentials/src/com/earth2me/essentials/craftbukkit/ShowInventory.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.earth2me.essentials.craftbukkit; - -import java.util.logging.Level; -import java.util.logging.Logger; -import net.minecraft.server.EntityPlayer; -import net.minecraft.server.IInventory; -import net.minecraft.server.PlayerInventory; -import org.bukkit.craftbukkit.entity.CraftPlayer; -import org.bukkit.craftbukkit.inventory.CraftInventoryPlayer; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - - -public class ShowInventory -{ - public static void showEmptyInventory(final Player player) - { - try - { - final EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle(); - final CraftInventoryPlayer inv = new CraftInventoryPlayer(new PlayerInventory(((CraftPlayer)player).getHandle())); - inv.clear(); - entityPlayer.a((IInventory)inv.getInventory()); - } - catch (Throwable ex) - { - Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex); - } - } - - public static void showFilledInventory(final Player player, final ItemStack stack) - { - try - { - final EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle(); - final CraftInventoryPlayer inv = new CraftInventoryPlayer(new PlayerInventory(((CraftPlayer)player).getHandle())); - inv.clear(); - InventoryWorkaround.addItem(inv, true, stack); - entityPlayer.a((IInventory)inv.getInventory()); - } - catch (Throwable ex) - { - Logger.getLogger("Minecraft").log(Level.SEVERE, null, ex); - } - } -} diff --git a/Essentials/src/com/earth2me/essentials/signs/SignDisposal.java b/Essentials/src/com/earth2me/essentials/signs/SignDisposal.java index f747ac07c..77e6164e5 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignDisposal.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignDisposal.java @@ -2,7 +2,7 @@ package com.earth2me.essentials.signs; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.User; -import com.earth2me.essentials.craftbukkit.ShowInventory; +import org.bukkit.event.inventory.InventoryType; public class SignDisposal extends EssentialsSign @@ -15,7 +15,7 @@ public class SignDisposal extends EssentialsSign @Override protected boolean onSignInteract(final ISign sign, final User player, final String username, final IEssentials ess) { - ShowInventory.showEmptyInventory(player.getBase()); + player.getBase().openInventory(ess.getServer().createInventory(player, InventoryType.CHEST)); return true; } } diff --git a/Essentials/src/com/earth2me/essentials/signs/SignFree.java b/Essentials/src/com/earth2me/essentials/signs/SignFree.java index 7af7dffd7..a69b4155f 100644 --- a/Essentials/src/com/earth2me/essentials/signs/SignFree.java +++ b/Essentials/src/com/earth2me/essentials/signs/SignFree.java @@ -4,8 +4,9 @@ import static com.earth2me.essentials.I18n._; import com.earth2me.essentials.IEssentials; import com.earth2me.essentials.Trade; import com.earth2me.essentials.User; -import com.earth2me.essentials.craftbukkit.ShowInventory; import org.bukkit.Material; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; @@ -33,7 +34,9 @@ public class SignFree extends EssentialsSign } item.setAmount(item.getType().getMaxStackSize() * 9 * 4); - ShowInventory.showFilledInventory(player.getBase(), item); + 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/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java b/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java index 85c00c1b6..efe66d585 100644 --- a/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java +++ b/Essentials/src/com/earth2me/essentials/textreader/HelpInput.java @@ -30,9 +30,9 @@ public class HelpInput implements IText try { final PluginDescriptionFile desc = p.getDescription(); - final HashMap<String, HashMap<String, Object>> cmds = (HashMap<String, HashMap<String, Object>>)desc.getCommands(); + final Map<String, Map<String, Object>> cmds = desc.getCommands(); pluginName = p.getDescription().getName().toLowerCase(Locale.ENGLISH); - for (Map.Entry<String, HashMap<String, Object>> k : cmds.entrySet()) + for (Map.Entry<String, Map<String, Object>> k : cmds.entrySet()) { try { @@ -57,7 +57,7 @@ public class HelpInput implements IText { if (ess.getSettings().showNonEssCommandsInHelp()) { - final HashMap<String, Object> value = k.getValue(); + final Map<String, Object> value = k.getValue(); Object permissions = null; if (value.containsKey(PERMISSION)) { diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java index a7335a957..58fdfc5fe 100644 --- a/Essentials/test/com/earth2me/essentials/FakeServer.java +++ b/Essentials/test/com/earth2me/essentials/FakeServer.java @@ -13,7 +13,11 @@ import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.PluginCommand; import org.bukkit.entity.Player; +import org.bukkit.event.inventory.InventoryType; import org.bukkit.generator.ChunkGenerator; +import org.bukkit.help.HelpMap; +import org.bukkit.inventory.Inventory; +import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.Recipe; import org.bukkit.map.MapView; @@ -677,4 +681,28 @@ public class FakeServer implements Server { throw new UnsupportedOperationException("Not supported yet."); } + + @Override + public HelpMap getHelpMap() + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Inventory createInventory(InventoryHolder ih, InventoryType it) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Inventory createInventory(InventoryHolder ih, int i) + { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Inventory createInventory(InventoryHolder ih, int i, String string) + { + throw new UnsupportedOperationException("Not supported yet."); + } } diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java b/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java index b9cddc38c..c06aa2e64 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java +++ b/EssentialsUpdate/src/com/earth2me/essentials/update/VersionInfo.java @@ -16,7 +16,7 @@ public class VersionInfo public VersionInfo(final Configuration updateConfig, final String path) { - changelog = updateConfig.getList(path + ".changelog", Collections.<String>emptyList()); + changelog = updateConfig.getStringList(path + ".changelog"); minBukkit = updateConfig.getInt(path + ".min-bukkit", 0); maxBukkit = updateConfig.getInt(path + ".max-bukkit", 0); modules = new HashMap<String, ModuleInfo>(); diff --git a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java index 02b35c3d6..82d9ee627 100644 --- a/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java +++ b/EssentialsUpdate/src/com/earth2me/essentials/update/states/InstallationFinishedEvent.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.update.states; import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; public class InstallationFinishedEvent extends Event @@ -9,4 +10,10 @@ public class InstallationFinishedEvent extends Event { super(); } + + @Override + public HandlerList getHandlers() + { + throw new UnsupportedOperationException("Not supported yet."); + } } |