git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1149 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
ementalo 2011-04-08 08:16:28 +00:00
parent 452f4ff0e7
commit f124c1f824
6 changed files with 86 additions and 6 deletions

View file

@ -17,9 +17,9 @@ public class InventoryWorkaround {
} }
public static int next(CraftInventory ci, ItemStack item, int start, boolean forceDurability, boolean forceAmount) { public static int next(CraftInventory ci, ItemStack item, int start, boolean forceDurability, boolean forceAmount) {
CraftItemStack[] inventory = ci.getContents(); ItemStack[] inventory = ci.getContents();
for (int i = start; i < inventory.length; i++) { for (int i = start; i < inventory.length; i++) {
CraftItemStack cItem = inventory[i]; ItemStack cItem = inventory[i];
if (item.getTypeId() == cItem.getTypeId() && (!forceAmount || item.getAmount() == cItem.getAmount()) && (!forceDurability || cItem.getDurability() == item.getDurability())) { if (item.getTypeId() == cItem.getTypeId() && (!forceAmount || item.getAmount() == cItem.getAmount()) && (!forceDurability || cItem.getDurability() == item.getDurability())) {
return i; return i;
} }
@ -55,7 +55,7 @@ public class InventoryWorkaround {
leftover.put(i, item); leftover.put(i, item);
break; break;
} else { } else {
CraftItemStack itemStack = ci.getItem(first); ItemStack itemStack = ci.getItem(first);
int amount = itemStack.getAmount(); int amount = itemStack.getAmount();
if (amount <= toDelete) { if (amount <= toDelete) {
@ -119,7 +119,7 @@ public class InventoryWorkaround {
leftover.put(i, item); leftover.put(i, item);
break; break;
} else { } else {
CraftItemStack itemStack = ci.getItem(slot); ItemStack itemStack = ci.getItem(slot);
int amount = itemStack.getAmount(); int amount = itemStack.getAmount();
if (amount <= mustHave) { if (amount <= mustHave) {

View file

@ -348,4 +348,44 @@ public class OfflinePlayer implements Player
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");
} }
public void saveData()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void loadData()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean isSleeping()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public int getSleepTicks()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public List<Entity> getNearbyEntities(double d, double d1, double d2)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean isDead()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public float getFallDistance()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void setFallDistance(float f)
{
throw new UnsupportedOperationException("Not supported yet.");
}
} }

View file

@ -413,4 +413,44 @@ public class PlayerWrapper implements Player
{ {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");
} }
public void saveData()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void loadData()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean isSleeping()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public int getSleepTicks()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public List<Entity> getNearbyEntities(double d, double d1, double d2)
{
throw new UnsupportedOperationException("Not supported yet.");
}
public boolean isDead()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public float getFallDistance()
{
throw new UnsupportedOperationException("Not supported yet.");
}
public void setFallDistance(float f)
{
throw new UnsupportedOperationException("Not supported yet.");
}
} }

View file

@ -33,7 +33,7 @@ public class User extends PlayerExtension implements Comparable<User>, IReplyTo
private CommandSender replyTo = null; private CommandSender replyTo = null;
private boolean isNew = false; private boolean isNew = false;
public String currentJail; public String currentJail;
public CraftItemStack[] savedInventory; public ItemStack[] savedInventory;
private User(Player base) private User(Player base)
{ {

View file

@ -30,7 +30,7 @@ public class Commandinvsee extends EssentialsCommand {
user.charge(this); user.charge(this);
if (user.savedInventory == null) { if (user.savedInventory == null) {
user.savedInventory = ((CraftInventory)user.getInventory()).getContents(); user.savedInventory = user.getInventory().getContents();
} }
((CraftInventory)user.getInventory()).setContents(((CraftInventory)invUser.getInventory()).getContents()); ((CraftInventory)user.getInventory()).setContents(((CraftInventory)invUser.getInventory()).getContents());
user.sendMessage("You see the inventory of "+invUser.getDisplayName()+"."); user.sendMessage("You see the inventory of "+invUser.getDisplayName()+".");

Binary file not shown.