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