mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2024-12-23 00:15:08 +00:00
Latest version 1.7.2
This commit is contained in:
parent
7d06601fe9
commit
ae20712d71
3 changed files with 29 additions and 10 deletions
|
@ -2,6 +2,7 @@
|
||||||
package lishid.openinv;
|
package lishid.openinv;
|
||||||
|
|
||||||
import lishid.openinv.commands.*;
|
import lishid.openinv.commands.*;
|
||||||
|
import lishid.openinv.utils.Metrics;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -24,6 +25,8 @@ public class OpenInv extends JavaPlugin {
|
||||||
//private final OpenInvInventoryListener inventoryListener = new OpenInvInventoryListener(this);
|
//private final OpenInvInventoryListener inventoryListener = new OpenInvInventoryListener(this);
|
||||||
public static PermissionHandler permissionHandler;
|
public static PermissionHandler permissionHandler;
|
||||||
public static OpenInv mainPlugin;
|
public static OpenInv mainPlugin;
|
||||||
|
private static Metrics metrics;
|
||||||
|
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,14 +55,23 @@ public class OpenInv extends JavaPlugin {
|
||||||
//pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Event.Priority.Monitor, this);
|
//pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Event.Priority.Monitor, this);
|
||||||
setupPermissions();
|
setupPermissions();
|
||||||
|
|
||||||
PluginDescriptionFile pdfFile = this.getDescription();
|
|
||||||
System.out.println("[" + pdfFile.getName() + "] version " + pdfFile.getVersion() + " enabled!" );
|
|
||||||
|
|
||||||
getCommand("openinv").setExecutor(new OpenInvPluginCommand(this));
|
getCommand("openinv").setExecutor(new OpenInvPluginCommand(this));
|
||||||
getCommand("searchinv").setExecutor(new SearchInvPluginCommand(this));
|
getCommand("searchinv").setExecutor(new SearchInvPluginCommand(this));
|
||||||
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));
|
||||||
|
|
||||||
|
//Metrics
|
||||||
|
try
|
||||||
|
{
|
||||||
|
metrics = new Metrics();
|
||||||
|
metrics.beginMeasuringPlugin(this);
|
||||||
|
}
|
||||||
|
catch(Exception e){ e.printStackTrace(); }
|
||||||
|
|
||||||
|
PluginDescriptionFile pdfFile = this.getDescription();
|
||||||
|
System.out.println("[" + pdfFile.getName() + "] version " + pdfFile.getVersion() + " enabled!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean GetPlayerItemOpenInvStatus(String name)
|
public static boolean GetPlayerItemOpenInvStatus(String name)
|
||||||
|
|
|
@ -126,14 +126,21 @@ public class OpenInvPlayerListener extends PlayerListener{
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try{
|
try{
|
||||||
Field ciField = player.getClass().getDeclaredField("ci");
|
Field windowID;
|
||||||
ciField.setAccessible(true);
|
try{
|
||||||
int ci = ciField.getInt(player);
|
windowID = player.getClass().getDeclaredField("cl");
|
||||||
ci = ci % 100 + 1;
|
}
|
||||||
ciField.setInt(player, ci);
|
catch(NoSuchFieldException e)
|
||||||
player.netServerHandler.sendPacket(new Packet100OpenWindow(ci, 0, ((IInventory)chest).getName(), ((IInventory)chest).getSize()));
|
{
|
||||||
|
windowID = player.getClass().getDeclaredField("ci");
|
||||||
|
}
|
||||||
|
windowID.setAccessible(true);
|
||||||
|
int id = windowID.getInt(player);
|
||||||
|
id = id % 100 + 1;
|
||||||
|
windowID.setInt(player, id);
|
||||||
|
player.netServerHandler.sendPacket(new Packet100OpenWindow(id, 0, ((IInventory)chest).getName(), ((IInventory)chest).getSize()));
|
||||||
player.activeContainer = new SilentContainerChest(player.inventory, ((IInventory)chest));
|
player.activeContainer = new SilentContainerChest(player.inventory, ((IInventory)chest));
|
||||||
player.activeContainer.windowId = ci;
|
player.activeContainer.windowId = id;
|
||||||
player.activeContainer.a((ICrafting)player);
|
player.activeContainer.a((ICrafting)player);
|
||||||
event.getPlayer().sendMessage("You are opening a chest silently.");
|
event.getPlayer().sendMessage("You are opening a chest silently.");
|
||||||
event.setUseInteractedBlock(Result.DENY);
|
event.setUseInteractedBlock(Result.DENY);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: OpenInv
|
name: OpenInv
|
||||||
main: lishid.openinv.OpenInv
|
main: lishid.openinv.OpenInv
|
||||||
version: 1.6.6
|
version: 1.7.2
|
||||||
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