mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2024-12-23 00:15:08 +00:00
Update to 1.10
This commit is contained in:
parent
d9c1b00b50
commit
c3a8bc9486
14 changed files with 174 additions and 111 deletions
6
pom.xml
6
pom.xml
|
@ -4,7 +4,7 @@
|
|||
<groupId>com.lishid</groupId>
|
||||
<artifactId>openinv</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>2.3.8</version>
|
||||
<version>2.3.9</version>
|
||||
<name>OpenInv</name>
|
||||
<url>http://dev.bukkit.org/bukkit-plugins/openinv/</url>
|
||||
|
||||
|
@ -23,14 +23,14 @@
|
|||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.9.4-R0.1-SNAPSHOT</version>
|
||||
<version>1.10-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.9.4-R0.1-SNAPSHOT</version>
|
||||
<version>1.10-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
|
|
@ -10,7 +10,7 @@ import org.bukkit.Material;
|
|||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import com.lishid.openinv.utils.UUIDUtil;
|
||||
import com.lishid.openinv.utils.UUIDUtils;
|
||||
|
||||
public class ConfigUpdater {
|
||||
|
||||
|
@ -136,7 +136,7 @@ public class ConfigUpdater {
|
|||
int converted = 0;
|
||||
|
||||
for (String playerName : keys) {
|
||||
UUID uuid = UUIDUtil.getUUIDOf(playerName);
|
||||
UUID uuid = UUIDUtils.getPlayerUUID(playerName);
|
||||
|
||||
if (uuid != null) {
|
||||
boolean toggled = section.getBoolean(playerName + ".toggle", false);
|
||||
|
|
|
@ -129,6 +129,7 @@ public class OpenInv extends JavaPlugin {
|
|||
*/
|
||||
public SpecialPlayerInventory getPlayerInventory(Player player, boolean createIfNull) {
|
||||
SpecialPlayerInventory inventory = inventories.get(player.getUniqueId());
|
||||
|
||||
if (inventory == null && createIfNull) {
|
||||
inventory = new SpecialPlayerInventory(player, player.isOnline());
|
||||
inventories.put(player.getUniqueId(), inventory);
|
||||
|
@ -146,6 +147,7 @@ public class OpenInv extends JavaPlugin {
|
|||
*/
|
||||
public SpecialEnderChest getPlayerEnderChest(Player player, boolean createIfNull) {
|
||||
SpecialEnderChest enderChest = enderChests.get(player.getUniqueId());
|
||||
|
||||
if (enderChest == null && createIfNull) {
|
||||
enderChest = new SpecialEnderChest(player, player.isOnline());
|
||||
enderChests.put(player.getUniqueId(), enderChest);
|
||||
|
@ -206,33 +208,33 @@ public class OpenInv extends JavaPlugin {
|
|||
}
|
||||
|
||||
/**
|
||||
* Outputs OpenInv help information to a player.
|
||||
* Outputs OpenInv help information to a CommandSender.
|
||||
*
|
||||
* @param player the player to show help to
|
||||
* @param sender the CommandSender to show help to
|
||||
*/
|
||||
public static void showHelp(Player player) {
|
||||
player.sendMessage(ChatColor.GREEN + "/openinv <player> - Opens a player's inventory.");
|
||||
player.sendMessage(ChatColor.GREEN + " (aliases: oi, inv, open)");
|
||||
public static void showHelp(CommandSender sender) {
|
||||
sender.sendMessage(ChatColor.GREEN + "/openinv <player> - Opens a player's inventory.");
|
||||
sender.sendMessage(ChatColor.GREEN + " (aliases: oi, inv, open)");
|
||||
|
||||
player.sendMessage(ChatColor.GREEN + "/openender <player> - Opens a player's ender chest.");
|
||||
player.sendMessage(ChatColor.GREEN + " (aliases: oe)");
|
||||
sender.sendMessage(ChatColor.GREEN + "/openender <player> - Opens a player's ender chest.");
|
||||
sender.sendMessage(ChatColor.GREEN + " (aliases: oe)");
|
||||
|
||||
player.sendMessage(ChatColor.GREEN + "/searchinv <item> [minAmount] -");
|
||||
player.sendMessage(ChatColor.GREEN + " Searches and lists players that have a specific item in their inventory.");
|
||||
player.sendMessage(ChatColor.GREEN + " (aliases: si)");
|
||||
sender.sendMessage(ChatColor.GREEN + "/searchinv <item> [minAmount] -");
|
||||
sender.sendMessage(ChatColor.GREEN + " Searches and lists players that have a specific item in their inventory.");
|
||||
sender.sendMessage(ChatColor.GREEN + " (aliases: si)");
|
||||
|
||||
player.sendMessage(ChatColor.GREEN + "/searchender <item> [minAmount] -");
|
||||
player.sendMessage(ChatColor.GREEN + " Searches and lists players that have a specific item in their ender chest.");
|
||||
player.sendMessage(ChatColor.GREEN + " (aliases: se)");
|
||||
sender.sendMessage(ChatColor.GREEN + "/searchender <item> [minAmount] -");
|
||||
sender.sendMessage(ChatColor.GREEN + " Searches and lists players that have a specific item in their ender chest.");
|
||||
sender.sendMessage(ChatColor.GREEN + " (aliases: se)");
|
||||
|
||||
player.sendMessage(ChatColor.GREEN + "/toggleopeninv - Toggles the item openinv function.");
|
||||
player.sendMessage(ChatColor.GREEN + " (aliases: toi, toggleoi, toggleinv)");
|
||||
sender.sendMessage(ChatColor.GREEN + "/toggleopeninv - Toggles the item openinv function.");
|
||||
sender.sendMessage(ChatColor.GREEN + " (aliases: toi, toggleoi, toggleinv)");
|
||||
|
||||
player.sendMessage(ChatColor.GREEN + "/anychest - Toggles the any chest function.");
|
||||
player.sendMessage(ChatColor.GREEN + " (aliases: ac)");
|
||||
sender.sendMessage(ChatColor.GREEN + "/anychest - Toggles the any chest function.");
|
||||
sender.sendMessage(ChatColor.GREEN + " (aliases: ac)");
|
||||
|
||||
player.sendMessage(ChatColor.GREEN + "/silentchest - Toggles the silent chest function.");
|
||||
player.sendMessage(ChatColor.GREEN + " (aliases: sc, silent)");
|
||||
sender.sendMessage(ChatColor.GREEN + "/silentchest - Toggles the silent chest function.");
|
||||
sender.sendMessage(ChatColor.GREEN + " (aliases: sc, silent)");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
|
|||
import com.lishid.openinv.OpenInv;
|
||||
import com.lishid.openinv.Permissions;
|
||||
import com.lishid.openinv.internal.SpecialEnderChest;
|
||||
import com.lishid.openinv.utils.UUIDUtil;
|
||||
import com.lishid.openinv.utils.UUIDUtils;
|
||||
|
||||
public class OpenEnderCommand implements CommandExecutor {
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class OpenEnderCommand implements CommandExecutor {
|
|||
}
|
||||
|
||||
if (args.length > 0 && args[0].equalsIgnoreCase("?")) {
|
||||
OpenInv.showHelp((Player) sender);
|
||||
OpenInv.showHelp(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class OpenEnderCommand implements CommandExecutor {
|
|||
}
|
||||
}
|
||||
else {
|
||||
uuid = UUIDUtil.getUUIDOf(args[0]);
|
||||
uuid = UUIDUtils.getPlayerUUID(args[0]);
|
||||
if (uuid == null) {
|
||||
player.sendMessage(ChatColor.RED + "Player not found!");
|
||||
return true;
|
||||
|
|
|
@ -25,12 +25,15 @@ import org.bukkit.ChatColor;
|
|||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.lishid.openinv.OpenInv;
|
||||
import com.lishid.openinv.Permissions;
|
||||
import com.lishid.openinv.internal.SpecialPlayerInventory;
|
||||
import com.lishid.openinv.utils.UUIDUtil;
|
||||
import com.lishid.openinv.utils.UUIDUtils;
|
||||
|
||||
public class OpenInvCommand implements CommandExecutor {
|
||||
|
||||
|
@ -42,12 +45,9 @@ public class OpenInvCommand implements CommandExecutor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("openinv")) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(ChatColor.RED + "You can't use this command from the console.");
|
||||
return true;
|
||||
}
|
||||
final boolean isConsole = sender instanceof ConsoleCommandSender;
|
||||
|
||||
if (!OpenInv.hasPermission(sender, Permissions.PERM_OPENINV)) {
|
||||
sender.sendMessage(ChatColor.RED + "You do not have permission to access player inventories.");
|
||||
|
@ -55,11 +55,20 @@ public class OpenInvCommand implements CommandExecutor {
|
|||
}
|
||||
|
||||
if (args.length > 0 && args[0].equalsIgnoreCase("?")) {
|
||||
OpenInv.showHelp((Player) sender);
|
||||
OpenInv.showHelp(sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
final Player player = (Player) sender;
|
||||
Player player = isConsole ? null : (Player) sender;
|
||||
final UUID uuid;
|
||||
|
||||
// Read from history if target is not named
|
||||
if (args.length < 1) {
|
||||
if (isConsole) {
|
||||
// TODO: Should this output the command's usage instead?
|
||||
sender.sendMessage(ChatColor.RED + "Player not found!");
|
||||
return true;
|
||||
}
|
||||
|
||||
// History management
|
||||
UUID history = openInvHistory.get(player.getUniqueId());
|
||||
|
@ -68,21 +77,16 @@ public class OpenInvCommand implements CommandExecutor {
|
|||
openInvHistory.put(player.getUniqueId(), history);
|
||||
}
|
||||
|
||||
final UUID uuid;
|
||||
|
||||
// Read from history if target is not named
|
||||
if (args.length < 1) {
|
||||
uuid = history;
|
||||
}
|
||||
else {
|
||||
uuid = UUIDUtil.getUUIDOf(args[0]);
|
||||
} else {
|
||||
uuid = UUIDUtils.getPlayerUUID(args[0]);
|
||||
if (uuid == null) {
|
||||
player.sendMessage(ChatColor.RED + "Player not found!");
|
||||
sender.sendMessage(ChatColor.RED + "Player not found!");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
final UUID playerUUID = player.getUniqueId();
|
||||
final UUID playerUUID = isConsole ? null : player.getUniqueId();
|
||||
|
||||
Player target = Bukkit.getPlayer(uuid);
|
||||
if (target == null) {
|
||||
|
@ -93,11 +97,19 @@ public class OpenInvCommand implements CommandExecutor {
|
|||
// Try loading the player's data asynchronously
|
||||
final Player target = plugin.getPlayerLoader().loadPlayer(uuid);
|
||||
if (target == null) {
|
||||
player.sendMessage(ChatColor.RED + "Player not found!");
|
||||
sender.sendMessage(ChatColor.RED + "Player not found!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Open target's inventory synchronously
|
||||
// Open/output target's inventory synchronously
|
||||
if (isConsole) {
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
outputInventory(sender, target);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Bukkit.getScheduler().runTask(plugin, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -111,10 +123,15 @@ public class OpenInvCommand implements CommandExecutor {
|
|||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (isConsole) {
|
||||
outputInventory(sender, target);
|
||||
} else {
|
||||
openInventory(player, target);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -122,6 +139,28 @@ public class OpenInvCommand implements CommandExecutor {
|
|||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void outputInventory(CommandSender sender, Player target) {
|
||||
// Get the inventory and open it
|
||||
SpecialPlayerInventory specialInv = plugin.getPlayerInventory(target, true);
|
||||
Inventory inventory = specialInv.getBukkitInventory();
|
||||
|
||||
for (int slot = 0; slot < inventory.getSize(); slot++) {
|
||||
ItemStack itemStack = inventory.getItem(slot);
|
||||
|
||||
if (itemStack != null) {
|
||||
String itemID = (itemStack.getDurability() != -1)
|
||||
? (itemStack.getTypeId() + ":" + itemStack.getDurability())
|
||||
: String.valueOf(itemStack.getTypeId());
|
||||
|
||||
sender.sendMessage(ChatColor.GREEN + "Slot " + slot + ": " + ChatColor.WHITE
|
||||
+ itemStack.getType().toString() + "(" + itemID + ") x" + itemStack.getAmount());
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.GREEN + "Slot " + slot + ": " + ChatColor.WHITE + "Empty");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void openInventory(Player player, Player target) {
|
||||
// Null target check
|
||||
if (target == null) {
|
||||
|
|
|
@ -18,25 +18,25 @@ package com.lishid.openinv.internal;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.lishid.openinv.OpenInv;
|
||||
|
||||
import net.minecraft.server.v1_9_R2.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_9_R2.Block;
|
||||
import net.minecraft.server.v1_9_R2.BlockChest;
|
||||
import net.minecraft.server.v1_9_R2.BlockChest.Type;
|
||||
import net.minecraft.server.v1_9_R2.BlockPosition;
|
||||
import net.minecraft.server.v1_9_R2.Entity;
|
||||
import net.minecraft.server.v1_9_R2.EntityOcelot;
|
||||
import net.minecraft.server.v1_9_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_9_R2.EnumDirection;
|
||||
import net.minecraft.server.v1_9_R2.ITileInventory;
|
||||
import net.minecraft.server.v1_9_R2.InventoryLargeChest;
|
||||
import net.minecraft.server.v1_9_R2.TileEntity;
|
||||
import net.minecraft.server.v1_9_R2.TileEntityChest;
|
||||
import net.minecraft.server.v1_9_R2.World;
|
||||
import net.minecraft.server.v1_10_R1.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_10_R1.Block;
|
||||
import net.minecraft.server.v1_10_R1.BlockChest;
|
||||
import net.minecraft.server.v1_10_R1.BlockChest.Type;
|
||||
import net.minecraft.server.v1_10_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_10_R1.Entity;
|
||||
import net.minecraft.server.v1_10_R1.EntityOcelot;
|
||||
import net.minecraft.server.v1_10_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_10_R1.EnumDirection;
|
||||
import net.minecraft.server.v1_10_R1.ITileInventory;
|
||||
import net.minecraft.server.v1_10_R1.InventoryLargeChest;
|
||||
import net.minecraft.server.v1_10_R1.TileEntity;
|
||||
import net.minecraft.server.v1_10_R1.TileEntityChest;
|
||||
import net.minecraft.server.v1_10_R1.World;
|
||||
|
||||
public class AnySilentChest {
|
||||
|
||||
|
@ -78,6 +78,7 @@ public class AnySilentChest {
|
|||
return this.blockOnTop(world, position) || this.ocelotOnTop(world, position);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private boolean blockOnTop(World world, BlockPosition position) {
|
||||
Block block = world.getType(position.up()).getBlock();
|
||||
return block.isOccluding(block.getBlockData());
|
||||
|
|
|
@ -4,8 +4,8 @@ import java.util.Iterator;
|
|||
|
||||
import com.google.common.collect.Iterators;
|
||||
|
||||
import net.minecraft.server.v1_9_R2.EnumDirection;
|
||||
import net.minecraft.server.v1_9_R2.EnumDirection.EnumDirectionLimit;
|
||||
import net.minecraft.server.v1_10_R1.EnumDirection;
|
||||
import net.minecraft.server.v1_10_R1.EnumDirection.EnumDirectionLimit;
|
||||
|
||||
public enum EnumDirectionList implements Iterable<EnumDirection> {
|
||||
|
||||
|
|
|
@ -18,14 +18,14 @@ package com.lishid.openinv.internal;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftInventory;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import com.lishid.openinv.OpenInv;
|
||||
import com.lishid.openinv.Permissions;
|
||||
|
||||
import net.minecraft.server.v1_9_R2.IInventory;
|
||||
import net.minecraft.server.v1_10_R1.IInventory;
|
||||
|
||||
public class InventoryAccess {
|
||||
|
||||
|
|
|
@ -20,15 +20,15 @@ import java.util.UUID;
|
|||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.CraftServer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.lishid.openinv.OpenInv;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.server.v1_9_R2.EntityPlayer;
|
||||
import net.minecraft.server.v1_9_R2.MinecraftServer;
|
||||
import net.minecraft.server.v1_9_R2.PlayerInteractManager;
|
||||
import net.minecraft.server.v1_10_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_10_R1.MinecraftServer;
|
||||
import net.minecraft.server.v1_10_R1.PlayerInteractManager;
|
||||
|
||||
public class PlayerDataManager {
|
||||
|
||||
|
|
|
@ -3,18 +3,18 @@ package com.lishid.openinv.internal;
|
|||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftHumanEntity;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftHumanEntity;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
import net.minecraft.server.v1_9_R2.ChestLock;
|
||||
import net.minecraft.server.v1_9_R2.Container;
|
||||
import net.minecraft.server.v1_9_R2.ContainerChest;
|
||||
import net.minecraft.server.v1_9_R2.EntityHuman;
|
||||
import net.minecraft.server.v1_9_R2.IChatBaseComponent;
|
||||
import net.minecraft.server.v1_9_R2.ITileInventory;
|
||||
import net.minecraft.server.v1_9_R2.ItemStack;
|
||||
import net.minecraft.server.v1_9_R2.PlayerInventory;
|
||||
import net.minecraft.server.v1_10_R1.ChestLock;
|
||||
import net.minecraft.server.v1_10_R1.Container;
|
||||
import net.minecraft.server.v1_10_R1.ContainerChest;
|
||||
import net.minecraft.server.v1_10_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_10_R1.IChatBaseComponent;
|
||||
import net.minecraft.server.v1_10_R1.ITileInventory;
|
||||
import net.minecraft.server.v1_10_R1.ItemStack;
|
||||
import net.minecraft.server.v1_10_R1.PlayerInventory;
|
||||
|
||||
public class SilentInventory implements ITileInventory {
|
||||
|
||||
|
|
|
@ -16,15 +16,18 @@
|
|||
|
||||
package com.lishid.openinv.internal;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftHumanEntity;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftInventory;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftHumanEntity;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftInventory;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
import net.minecraft.server.v1_9_R2.InventoryEnderChest;
|
||||
import net.minecraft.server.v1_9_R2.InventorySubcontainer;
|
||||
import net.minecraft.server.v1_10_R1.InventoryEnderChest;
|
||||
import net.minecraft.server.v1_10_R1.InventorySubcontainer;
|
||||
import net.minecraft.server.v1_10_R1.ItemStack;
|
||||
|
||||
public class SpecialEnderChest extends InventorySubcontainer {
|
||||
|
||||
|
@ -41,8 +44,8 @@ public class SpecialEnderChest extends InventorySubcontainer {
|
|||
super(enderChest.getName(), enderChest.hasCustomName(), enderChest.getSize());
|
||||
this.owner = (CraftPlayer) p;
|
||||
this.enderChest = enderChest;
|
||||
this.items = this.enderChest.getContents();
|
||||
this.playerOnline = online;
|
||||
reflectContents(getClass().getSuperclass(), this, this.enderChest.getContents());
|
||||
}
|
||||
|
||||
private void saveOnExit() {
|
||||
|
@ -51,8 +54,24 @@ public class SpecialEnderChest extends InventorySubcontainer {
|
|||
}
|
||||
}
|
||||
|
||||
private void reflectContents(Class clazz, InventorySubcontainer enderChest, ItemStack[] items) {
|
||||
try {
|
||||
Field itemsField = clazz.getDeclaredField("items");
|
||||
itemsField.setAccessible(true);
|
||||
itemsField.set(enderChest, items);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void linkInventory(InventoryEnderChest inventory) {
|
||||
inventory.items = this.items;
|
||||
reflectContents(inventory.getClass(), inventory, this.items);
|
||||
}
|
||||
|
||||
public Inventory getBukkitInventory() {
|
||||
|
@ -61,6 +80,7 @@ public class SpecialEnderChest extends InventorySubcontainer {
|
|||
|
||||
public boolean inventoryRemovalCheck(boolean save) {
|
||||
boolean offline = transaction.isEmpty() && !playerOnline;
|
||||
|
||||
if (offline && save) {
|
||||
owner.saveData();
|
||||
}
|
||||
|
|
|
@ -18,16 +18,16 @@ package com.lishid.openinv.internal;
|
|||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftHumanEntity;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftInventory;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftHumanEntity;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftInventory;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import net.minecraft.server.v1_9_R2.ContainerUtil;
|
||||
import net.minecraft.server.v1_9_R2.EntityHuman;
|
||||
import net.minecraft.server.v1_9_R2.ItemStack;
|
||||
import net.minecraft.server.v1_9_R2.PlayerInventory;
|
||||
import net.minecraft.server.v1_10_R1.ContainerUtil;
|
||||
import net.minecraft.server.v1_10_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_10_R1.ItemStack;
|
||||
import net.minecraft.server.v1_10_R1.PlayerInventory;
|
||||
|
||||
public class SpecialPlayerInventory extends PlayerInventory {
|
||||
|
||||
|
@ -80,6 +80,7 @@ public class SpecialPlayerInventory extends PlayerInventory {
|
|||
|
||||
public boolean inventoryRemovalCheck(boolean save) {
|
||||
boolean offline = transaction.isEmpty() && !playerOnline;
|
||||
|
||||
if (offline && save) {
|
||||
owner.saveData();
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ import org.bukkit.Bukkit;
|
|||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public final class UUIDUtil {
|
||||
public final class UUIDUtils {
|
||||
|
||||
private UUIDUtil() {}
|
||||
private UUIDUtils() {}
|
||||
|
||||
private static Player getPlayer(String name) {
|
||||
Validate.notNull(name, "Name cannot be null");
|
||||
|
@ -50,7 +50,7 @@ public final class UUIDUtil {
|
|||
* @param name the name of the player to get the UUID of
|
||||
* @return the player's UUID or null
|
||||
*/
|
||||
public static UUID getUUIDOf(String name) {
|
||||
public static UUID getPlayerUUID(String name) {
|
||||
UUID uuid;
|
||||
Player player = getPlayer(name);
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
name: OpenInv
|
||||
main: com.lishid.openinv.OpenInv
|
||||
version: 2.3.8
|
||||
version: 2.3.9
|
||||
author: lishid
|
||||
authors: [ShadowRanger]
|
||||
description: >
|
||||
|
|
Loading…
Reference in a new issue