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;
|
||||
|
||||
import lishid.openinv.commands.*;
|
||||
import lishid.openinv.utils.Metrics;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -24,6 +25,8 @@ public class OpenInv extends JavaPlugin {
|
|||
//private final OpenInvInventoryListener inventoryListener = new OpenInvInventoryListener(this);
|
||||
public static PermissionHandler permissionHandler;
|
||||
public static OpenInv mainPlugin;
|
||||
private static Metrics metrics;
|
||||
|
||||
public void onDisable() {
|
||||
}
|
||||
|
||||
|
@ -52,14 +55,23 @@ public class OpenInv extends JavaPlugin {
|
|||
//pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Event.Priority.Monitor, this);
|
||||
setupPermissions();
|
||||
|
||||
PluginDescriptionFile pdfFile = this.getDescription();
|
||||
System.out.println("[" + pdfFile.getName() + "] version " + pdfFile.getVersion() + " enabled!" );
|
||||
|
||||
getCommand("openinv").setExecutor(new OpenInvPluginCommand(this));
|
||||
getCommand("searchinv").setExecutor(new SearchInvPluginCommand(this));
|
||||
getCommand("toggleopeninv").setExecutor(new ToggleOpenInvPluginCommand());
|
||||
getCommand("silentchest").setExecutor(new SilentChestPluginCommand(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)
|
||||
|
|
|
@ -126,14 +126,21 @@ public class OpenInvPlayerListener extends PlayerListener{
|
|||
else
|
||||
{
|
||||
try{
|
||||
Field ciField = player.getClass().getDeclaredField("ci");
|
||||
ciField.setAccessible(true);
|
||||
int ci = ciField.getInt(player);
|
||||
ci = ci % 100 + 1;
|
||||
ciField.setInt(player, ci);
|
||||
player.netServerHandler.sendPacket(new Packet100OpenWindow(ci, 0, ((IInventory)chest).getName(), ((IInventory)chest).getSize()));
|
||||
Field windowID;
|
||||
try{
|
||||
windowID = player.getClass().getDeclaredField("cl");
|
||||
}
|
||||
catch(NoSuchFieldException e)
|
||||
{
|
||||
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.windowId = ci;
|
||||
player.activeContainer.windowId = id;
|
||||
player.activeContainer.a((ICrafting)player);
|
||||
event.getPlayer().sendMessage("You are opening a chest silently.");
|
||||
event.setUseInteractedBlock(Result.DENY);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: OpenInv
|
||||
main: lishid.openinv.OpenInv
|
||||
version: 1.6.6
|
||||
version: 1.7.2
|
||||
author: lishid
|
||||
website: http://forums.bukkit.org/threads/15379/
|
||||
description: >
|
||||
|
|
Loading…
Reference in a new issue