Updated to R6

This commit is contained in:
snowleo 2012-03-01 16:15:37 +01:00
parent b44d738867
commit 02c1cb05c7
11 changed files with 242 additions and 59 deletions

View File

@ -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.");
}
}

View File

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

View File

@ -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.");
}
}

View File

@ -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.");
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -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.");
}
}

View File

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

View File

@ -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.");
}
}