mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2025-01-03 13:38:21 +00:00
Update to MC 1.4.4
This commit is contained in:
parent
ab04e461a8
commit
90cbd62859
6 changed files with 31 additions and 34 deletions
|
@ -60,7 +60,7 @@ public class OpenInv extends JavaPlugin
|
|||
pm.registerEvents(new OpenInvInventoryListener(), this);
|
||||
|
||||
getCommand("openinv").setExecutor(new OpenInvPluginCommand(this));
|
||||
getCommand("searchinv").setExecutor(new SearchInvPluginCommand(this));
|
||||
getCommand("searchinv").setExecutor(new SearchInvPluginCommand());
|
||||
getCommand("toggleopeninv").setExecutor(new ToggleOpenInvPluginCommand());
|
||||
getCommand("silentchest").setExecutor(new SilentChestPluginCommand(this));
|
||||
getCommand("anychest").setExecutor(new AnyChestPluginCommand(this));
|
||||
|
|
|
@ -88,15 +88,7 @@ public class OpenInvPluginCommand implements CommandExecutor
|
|||
// Read from history if target is not named
|
||||
if (args.length < 1)
|
||||
{
|
||||
if (history != null && history != "")
|
||||
{
|
||||
name = history;
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "OpenInv history is empty!");
|
||||
return true;
|
||||
}
|
||||
name = history;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -104,7 +96,7 @@ public class OpenInvPluginCommand implements CommandExecutor
|
|||
}
|
||||
|
||||
target = this.plugin.getServer().getPlayer(name);
|
||||
|
||||
|
||||
if (target == null)
|
||||
{
|
||||
// Offline inv here...
|
||||
|
@ -135,7 +127,7 @@ public class OpenInvPluginCommand implements CommandExecutor
|
|||
sender.sendMessage(ChatColor.RED + "Player " + name + " not found!");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Create an entity to load the player data
|
||||
final MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
final EntityPlayer entity = new EntityPlayer(server, server.getWorldServer(0), playername, new ItemInWorldManager(server.getWorldServer(0)));
|
||||
|
@ -183,7 +175,7 @@ public class OpenInvPluginCommand implements CommandExecutor
|
|||
// Record the target
|
||||
history = target.getName();
|
||||
openInvHistory.put(player, history);
|
||||
|
||||
|
||||
// Create the inventory
|
||||
OpenInvPlayerInventory inv = OpenInv.inventories.get(target.getName().toLowerCase());
|
||||
if (inv == null)
|
||||
|
@ -192,7 +184,7 @@ public class OpenInvPluginCommand implements CommandExecutor
|
|||
|
||||
OpenInv.inventories.put(target.getName().toLowerCase(), inv);
|
||||
}
|
||||
|
||||
|
||||
// Open the inventory
|
||||
(((CraftPlayer) player).getHandle()).openContainer(inv);
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
package lishid.openinv.commands;
|
||||
|
||||
import lishid.openinv.OpenInv;
|
||||
import lishid.openinv.Permissions;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -28,11 +28,9 @@ import org.bukkit.entity.Player;
|
|||
|
||||
public class SearchInvPluginCommand implements CommandExecutor
|
||||
{
|
||||
private final OpenInv plugin;
|
||||
|
||||
public SearchInvPluginCommand(OpenInv plugin)
|
||||
public SearchInvPluginCommand()
|
||||
{
|
||||
this.plugin = plugin;
|
||||
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||
|
@ -76,7 +74,7 @@ public class SearchInvPluginCommand implements CommandExecutor
|
|||
return false;
|
||||
}
|
||||
|
||||
for (Player templayer : plugin.getServer().getOnlinePlayers())
|
||||
for (Player templayer : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
if (templayer.getInventory().contains(material, count))
|
||||
{
|
||||
|
|
|
@ -39,7 +39,8 @@ public class OpenInvPlayerInventory extends PlayerInventory
|
|||
this.items = player.inventory.items;
|
||||
this.armor = player.inventory.armor;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClose(CraftHumanEntity who)
|
||||
{
|
||||
super.onClose(who);
|
||||
|
@ -70,7 +71,8 @@ public class OpenInvPlayerInventory extends PlayerInventory
|
|||
{
|
||||
playerOnline = false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack[] getContents()
|
||||
{
|
||||
ItemStack[] C = new ItemStack[getSize()];
|
||||
|
@ -78,12 +80,14 @@ public class OpenInvPlayerInventory extends PlayerInventory
|
|||
System.arraycopy(items, 0, C, items.length, armor.length);
|
||||
return C;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getSize()
|
||||
{
|
||||
return super.getSize() + 5;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(int i)
|
||||
{
|
||||
ItemStack[] is = this.items;
|
||||
|
@ -110,7 +114,8 @@ public class OpenInvPlayerInventory extends PlayerInventory
|
|||
|
||||
return is[i];
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack splitStack(int i, int j)
|
||||
{
|
||||
ItemStack[] is = this.items;
|
||||
|
@ -161,7 +166,8 @@ public class OpenInvPlayerInventory extends PlayerInventory
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack splitWithoutUpdate(int i)
|
||||
{
|
||||
ItemStack[] is = this.items;
|
||||
|
@ -198,7 +204,8 @@ public class OpenInvPlayerInventory extends PlayerInventory
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setItem(int i, ItemStack itemstack)
|
||||
{
|
||||
ItemStack[] is = this.items;
|
||||
|
@ -259,7 +266,8 @@ public class OpenInvPlayerInventory extends PlayerInventory
|
|||
else
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
if (player.name.length() > 16)
|
||||
|
@ -269,7 +277,8 @@ public class OpenInvPlayerInventory extends PlayerInventory
|
|||
return player.name;
|
||||
}
|
||||
|
||||
public boolean a(EntityHuman entityhuman)
|
||||
@Override
|
||||
public boolean a_(EntityHuman entityhuman)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -33,10 +33,8 @@ public class SilentContainerChest extends ContainerChest
|
|||
}
|
||||
|
||||
@Override
|
||||
public void a(EntityHuman paramEntityHuman)
|
||||
public void b(EntityHuman paramEntityHuman)
|
||||
{
|
||||
super.a(paramEntityHuman);
|
||||
// open signal
|
||||
inv.startOpen();
|
||||
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
name: OpenInv
|
||||
main: lishid.openinv.OpenInv
|
||||
version: 1.8.8
|
||||
version: 1.9.0
|
||||
author: lishid
|
||||
website: http://forums.bukkit.org/threads/15379/
|
||||
description: >
|
||||
|
|
Loading…
Reference in a new issue