mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2024-12-22 16:05:03 +00:00
Updated for 1.8
This commit is contained in:
parent
70c75996c0
commit
8791143e66
6 changed files with 45 additions and 12 deletions
|
@ -4,6 +4,9 @@
|
|||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="lib" path="D:/Programs/Eclipse/Workspace/bukkit.jar" sourcepath="D:/Programs/Eclipse/Workspace/Bukkit-Source.zip"/>
|
||||
<classpathentry kind="lib" path="D:/Programs/Eclipse/Workspace/craftbukkit.jar" sourcepath="D:/Programs/Eclipse/Workspace/CraftBukkit-Source.zip"/>
|
||||
<classpathentry kind="lib" path="D:/Programs/Eclipse/Workspace/FakePermissions.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Programs/Eclipse/Workspace/PermissionsEx.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Programs/Eclipse/Workspace/Permissions.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Programs/Eclipse/Workspace/spout.jar" sourcepath="D:/Programs/Eclipse/Workspace/Spout.zip"/>
|
||||
<classpathentry kind="lib" path="D:/Programs/Eclipse/Workspace/spoutapi.jar" sourcepath="D:/Programs/Eclipse/Workspace/SpoutAPI.zip"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -74,8 +74,8 @@ public class OpenInv extends JavaPlugin {
|
|||
player.setHandle(entityplayer);
|
||||
}
|
||||
catch(Exception e)
|
||||
{}
|
||||
{
|
||||
System.out.println("[OpenInv] Error while trying to override player inventory, error: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
10
src/lishid/openinv/OpenInvInventoryListener.java
Normal file
10
src/lishid/openinv/OpenInvInventoryListener.java
Normal file
|
@ -0,0 +1,10 @@
|
|||
package lishid.openinv;
|
||||
|
||||
import org.bukkit.event.inventory.InventoryListener;
|
||||
|
||||
public class OpenInvInventoryListener extends InventoryListener{
|
||||
OpenInv plugin;
|
||||
public OpenInvInventoryListener(OpenInv scrap) {
|
||||
plugin = scrap;
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ import org.bukkit.entity.Player;
|
|||
|
||||
public class OpenInvPluginCommand implements CommandExecutor {
|
||||
private final OpenInv plugin;
|
||||
public static HashMap<Player, PlayerInventoryChest> offlineInv = new HashMap<Player, PlayerInventoryChest>();
|
||||
//public static HashMap<Player, PlayerInventoryChest> offlineInv = new HashMap<Player, PlayerInventoryChest>();
|
||||
public static HashMap<Player, OpenInvHistory> theOpenInvHistory = new HashMap<Player, OpenInvHistory>();
|
||||
public OpenInvPluginCommand(OpenInv plugin) {
|
||||
this.plugin = plugin;
|
||||
|
@ -33,6 +33,8 @@ public class OpenInvPluginCommand implements CommandExecutor {
|
|||
|
||||
//boolean Offline = false;
|
||||
Player player = (Player)sender;
|
||||
|
||||
//History management
|
||||
OpenInvHistory history = theOpenInvHistory.get(player);
|
||||
|
||||
if(history == null)
|
||||
|
@ -41,11 +43,22 @@ public class OpenInvPluginCommand implements CommandExecutor {
|
|||
theOpenInvHistory.put(player, history);
|
||||
}
|
||||
|
||||
//Toggleopeninv command
|
||||
if(command.getName().equalsIgnoreCase("toggleopeninv"))
|
||||
{
|
||||
if(OpenInvToggleState.openInvState.get(player.getName()) != null && OpenInvToggleState.openInvState.get(player.getName()) == 1)
|
||||
if(args.length > 0)
|
||||
{
|
||||
OpenInvToggleState.openInvState.put(player.getName(), 0);
|
||||
if(args[0].equalsIgnoreCase("check"))
|
||||
{
|
||||
if(OpenInvToggleState.openInvState.containsKey(player.getName()))
|
||||
player.sendMessage("OpenInv with stick is ON.");
|
||||
else
|
||||
player.sendMessage("OpenInv with stick is OFF.");
|
||||
}
|
||||
}
|
||||
if(OpenInvToggleState.openInvState.containsKey(player.getName()))
|
||||
{
|
||||
OpenInvToggleState.openInvState.remove(player.getName());
|
||||
player.sendMessage("OpenInv with stick is OFF.");
|
||||
}
|
||||
else
|
||||
|
@ -56,6 +69,7 @@ public class OpenInvPluginCommand implements CommandExecutor {
|
|||
return true;
|
||||
}
|
||||
|
||||
//Target selecting
|
||||
Player target;
|
||||
|
||||
if (args.length < 1) {
|
||||
|
@ -99,12 +113,15 @@ public class OpenInvPluginCommand implements CommandExecutor {
|
|||
return true;
|
||||
/*}*/
|
||||
}
|
||||
|
||||
//Check if target is the player him/her self
|
||||
if(target == player)
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "Cannot OpenInv yourself!");
|
||||
return true;
|
||||
}
|
||||
|
||||
//Permissions checks
|
||||
if (!PermissionRelay.hasPermission(player, "OpenInv.override") && PermissionRelay.hasPermission(target, "OpenInv.exempt")) {
|
||||
sender.sendMessage(ChatColor.RED + target.getDisplayName() + "'s inventory is protected!");
|
||||
return true;
|
||||
|
@ -116,6 +133,7 @@ public class OpenInvPluginCommand implements CommandExecutor {
|
|||
return true;
|
||||
}
|
||||
|
||||
//The actual openinv
|
||||
history.lastPlayer = target.getName();
|
||||
|
||||
// Get the EntityPlayer handle from the sender
|
||||
|
|
|
@ -13,18 +13,18 @@ public class PlayerInventoryChest extends InventoryPlayer
|
|||
this.items = inventory.items;
|
||||
this.itemInHandIndex = inventory.itemInHandIndex;
|
||||
this.e = inventory.e;
|
||||
this.b(inventory.j());
|
||||
this.b(inventory.l());
|
||||
inventory.d.defaultContainer = new ContainerPlayer(this, !inventory.d.world.isStatic);
|
||||
inventory.d.activeContainer = inventory.d.defaultContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return ((EntityPlayer)this.d).displayName + " (" + this.itemInHandIndex + ")";
|
||||
return ((EntityPlayer)this.d).displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a_(EntityHuman entityhuman)
|
||||
public boolean a(EntityHuman entityhuman)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: OpenInv
|
||||
main: lishid.openinv.OpenInv
|
||||
version: 1.3.3
|
||||
version: 1.4.1
|
||||
author: lishid
|
||||
description: >
|
||||
This plugin allows you to open another player's inventory as a chest
|
||||
|
@ -14,4 +14,6 @@ commands:
|
|||
usage: |
|
||||
/<command> <Item> [MinAmount] - Item can be the Item ID or the CraftBukkit Item Name, MinAmount is the minimum amount to be considered.
|
||||
toggleopeninv:
|
||||
description: Toggle the stick usage
|
||||
description: Toggle the stick openinv
|
||||
usage: |
|
||||
/<command> [check] - Checks whether stick openinv is enabled
|
Loading…
Reference in a new issue