Update to 1.10

This commit is contained in:
ShadowRanger 2016-06-09 22:41:21 +10:00
parent d9c1b00b50
commit c3a8bc9486
14 changed files with 174 additions and 111 deletions

View file

@ -4,7 +4,7 @@
<groupId>com.lishid</groupId> <groupId>com.lishid</groupId>
<artifactId>openinv</artifactId> <artifactId>openinv</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>2.3.8</version> <version>2.3.9</version>
<name>OpenInv</name> <name>OpenInv</name>
<url>http://dev.bukkit.org/bukkit-plugins/openinv/</url> <url>http://dev.bukkit.org/bukkit-plugins/openinv/</url>
@ -23,14 +23,14 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId> <artifactId>bukkit</artifactId>
<version>1.9.4-R0.1-SNAPSHOT</version> <version>1.10-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId> <artifactId>craftbukkit</artifactId>
<version>1.9.4-R0.1-SNAPSHOT</version> <version>1.10-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View file

@ -10,7 +10,7 @@ import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import com.lishid.openinv.utils.UUIDUtil; import com.lishid.openinv.utils.UUIDUtils;
public class ConfigUpdater { public class ConfigUpdater {
@ -136,7 +136,7 @@ public class ConfigUpdater {
int converted = 0; int converted = 0;
for (String playerName : keys) { for (String playerName : keys) {
UUID uuid = UUIDUtil.getUUIDOf(playerName); UUID uuid = UUIDUtils.getPlayerUUID(playerName);
if (uuid != null) { if (uuid != null) {
boolean toggled = section.getBoolean(playerName + ".toggle", false); boolean toggled = section.getBoolean(playerName + ".toggle", false);

View file

@ -129,6 +129,7 @@ public class OpenInv extends JavaPlugin {
*/ */
public SpecialPlayerInventory getPlayerInventory(Player player, boolean createIfNull) { public SpecialPlayerInventory getPlayerInventory(Player player, boolean createIfNull) {
SpecialPlayerInventory inventory = inventories.get(player.getUniqueId()); SpecialPlayerInventory inventory = inventories.get(player.getUniqueId());
if (inventory == null && createIfNull) { if (inventory == null && createIfNull) {
inventory = new SpecialPlayerInventory(player, player.isOnline()); inventory = new SpecialPlayerInventory(player, player.isOnline());
inventories.put(player.getUniqueId(), inventory); inventories.put(player.getUniqueId(), inventory);
@ -146,6 +147,7 @@ public class OpenInv extends JavaPlugin {
*/ */
public SpecialEnderChest getPlayerEnderChest(Player player, boolean createIfNull) { public SpecialEnderChest getPlayerEnderChest(Player player, boolean createIfNull) {
SpecialEnderChest enderChest = enderChests.get(player.getUniqueId()); SpecialEnderChest enderChest = enderChests.get(player.getUniqueId());
if (enderChest == null && createIfNull) { if (enderChest == null && createIfNull) {
enderChest = new SpecialEnderChest(player, player.isOnline()); enderChest = new SpecialEnderChest(player, player.isOnline());
enderChests.put(player.getUniqueId(), enderChest); 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) { public static void showHelp(CommandSender sender) {
player.sendMessage(ChatColor.GREEN + "/openinv <player> - Opens a player's inventory."); sender.sendMessage(ChatColor.GREEN + "/openinv <player> - Opens a player's inventory.");
player.sendMessage(ChatColor.GREEN + " (aliases: oi, inv, open)"); sender.sendMessage(ChatColor.GREEN + " (aliases: oi, inv, open)");
player.sendMessage(ChatColor.GREEN + "/openender <player> - Opens a player's ender chest."); sender.sendMessage(ChatColor.GREEN + "/openender <player> - Opens a player's ender chest.");
player.sendMessage(ChatColor.GREEN + " (aliases: oe)"); sender.sendMessage(ChatColor.GREEN + " (aliases: oe)");
player.sendMessage(ChatColor.GREEN + "/searchinv <item> [minAmount] -"); sender.sendMessage(ChatColor.GREEN + "/searchinv <item> [minAmount] -");
player.sendMessage(ChatColor.GREEN + " Searches and lists players that have a specific item in their inventory."); sender.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 + " (aliases: si)");
player.sendMessage(ChatColor.GREEN + "/searchender <item> [minAmount] -"); sender.sendMessage(ChatColor.GREEN + "/searchender <item> [minAmount] -");
player.sendMessage(ChatColor.GREEN + " Searches and lists players that have a specific item in their ender chest."); sender.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 + " (aliases: se)");
player.sendMessage(ChatColor.GREEN + "/toggleopeninv - Toggles the item openinv function."); sender.sendMessage(ChatColor.GREEN + "/toggleopeninv - Toggles the item openinv function.");
player.sendMessage(ChatColor.GREEN + " (aliases: toi, toggleoi, toggleinv)"); sender.sendMessage(ChatColor.GREEN + " (aliases: toi, toggleoi, toggleinv)");
player.sendMessage(ChatColor.GREEN + "/anychest - Toggles the any chest function."); sender.sendMessage(ChatColor.GREEN + "/anychest - Toggles the any chest function.");
player.sendMessage(ChatColor.GREEN + " (aliases: ac)"); sender.sendMessage(ChatColor.GREEN + " (aliases: ac)");
player.sendMessage(ChatColor.GREEN + "/silentchest - Toggles the silent chest function."); sender.sendMessage(ChatColor.GREEN + "/silentchest - Toggles the silent chest function.");
player.sendMessage(ChatColor.GREEN + " (aliases: sc, silent)"); sender.sendMessage(ChatColor.GREEN + " (aliases: sc, silent)");
} }
/** /**

View file

@ -30,7 +30,7 @@ import org.bukkit.entity.Player;
import com.lishid.openinv.OpenInv; import com.lishid.openinv.OpenInv;
import com.lishid.openinv.Permissions; import com.lishid.openinv.Permissions;
import com.lishid.openinv.internal.SpecialEnderChest; import com.lishid.openinv.internal.SpecialEnderChest;
import com.lishid.openinv.utils.UUIDUtil; import com.lishid.openinv.utils.UUIDUtils;
public class OpenEnderCommand implements CommandExecutor { public class OpenEnderCommand implements CommandExecutor {
@ -55,7 +55,7 @@ public class OpenEnderCommand implements CommandExecutor {
} }
if (args.length > 0 && args[0].equalsIgnoreCase("?")) { if (args.length > 0 && args[0].equalsIgnoreCase("?")) {
OpenInv.showHelp((Player) sender); OpenInv.showHelp(sender);
return true; return true;
} }
@ -80,7 +80,7 @@ public class OpenEnderCommand implements CommandExecutor {
} }
} }
else { else {
uuid = UUIDUtil.getUUIDOf(args[0]); uuid = UUIDUtils.getPlayerUUID(args[0]);
if (uuid == null) { if (uuid == null) {
player.sendMessage(ChatColor.RED + "Player not found!"); player.sendMessage(ChatColor.RED + "Player not found!");
return true; return true;

View file

@ -25,12 +25,15 @@ import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import com.lishid.openinv.OpenInv; import com.lishid.openinv.OpenInv;
import com.lishid.openinv.Permissions; import com.lishid.openinv.Permissions;
import com.lishid.openinv.internal.SpecialPlayerInventory; import com.lishid.openinv.internal.SpecialPlayerInventory;
import com.lishid.openinv.utils.UUIDUtil; import com.lishid.openinv.utils.UUIDUtils;
public class OpenInvCommand implements CommandExecutor { public class OpenInvCommand implements CommandExecutor {
@ -42,12 +45,9 @@ public class OpenInvCommand implements CommandExecutor {
} }
@Override @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 (command.getName().equalsIgnoreCase("openinv")) {
if (!(sender instanceof Player)) { final boolean isConsole = sender instanceof ConsoleCommandSender;
sender.sendMessage(ChatColor.RED + "You can't use this command from the console.");
return true;
}
if (!OpenInv.hasPermission(sender, Permissions.PERM_OPENINV)) { if (!OpenInv.hasPermission(sender, Permissions.PERM_OPENINV)) {
sender.sendMessage(ChatColor.RED + "You do not have permission to access player inventories."); sender.sendMessage(ChatColor.RED + "You do not have permission to access player inventories.");
@ -55,34 +55,38 @@ public class OpenInvCommand implements CommandExecutor {
} }
if (args.length > 0 && args[0].equalsIgnoreCase("?")) { if (args.length > 0 && args[0].equalsIgnoreCase("?")) {
OpenInv.showHelp((Player) sender); OpenInv.showHelp(sender);
return true; return true;
} }
final Player player = (Player) sender; Player player = isConsole ? null : (Player) sender;
// History management
UUID history = openInvHistory.get(player.getUniqueId());
if (history == null) {
history = player.getUniqueId();
openInvHistory.put(player.getUniqueId(), history);
}
final UUID uuid; final UUID uuid;
// 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 (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());
if (history == null) {
history = player.getUniqueId();
openInvHistory.put(player.getUniqueId(), history);
}
uuid = history; uuid = history;
} } else {
else { uuid = UUIDUtils.getPlayerUUID(args[0]);
uuid = UUIDUtil.getUUIDOf(args[0]);
if (uuid == null) { if (uuid == null) {
player.sendMessage(ChatColor.RED + "Player not found!"); sender.sendMessage(ChatColor.RED + "Player not found!");
return true; return true;
} }
} }
final UUID playerUUID = player.getUniqueId(); final UUID playerUUID = isConsole ? null : player.getUniqueId();
Player target = Bukkit.getPlayer(uuid); Player target = Bukkit.getPlayer(uuid);
if (target == null) { if (target == null) {
@ -93,27 +97,40 @@ public class OpenInvCommand implements CommandExecutor {
// Try loading the player's data asynchronously // Try loading the player's data asynchronously
final Player target = plugin.getPlayerLoader().loadPlayer(uuid); final Player target = plugin.getPlayerLoader().loadPlayer(uuid);
if (target == null) { if (target == null) {
player.sendMessage(ChatColor.RED + "Player not found!"); sender.sendMessage(ChatColor.RED + "Player not found!");
return; return;
} }
// Open target's inventory synchronously // Open/output target's inventory synchronously
Bukkit.getScheduler().runTask(plugin, new Runnable() { if (isConsole) {
@Override Bukkit.getScheduler().runTask(plugin, new Runnable() {
public void run() { @Override
Player player = Bukkit.getPlayer(playerUUID); public void run() {
// If sender is no longer online after loading the target, abort! outputInventory(sender, target);
if (player == null) {
return;
} }
});
} else {
Bukkit.getScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
Player player = Bukkit.getPlayer(playerUUID);
// If sender is no longer online after loading the target, abort!
if (player == null) {
return;
}
openInventory(player, target); openInventory(player, target);
} }
}); });
}
} }
}); });
} else { } else {
openInventory(player, target); if (isConsole) {
outputInventory(sender, target);
} else {
openInventory(player, target);
}
} }
return true; return true;
@ -122,6 +139,28 @@ public class OpenInvCommand implements CommandExecutor {
return false; 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) { private void openInventory(Player player, Player target) {
// Null target check // Null target check
if (target == null) { if (target == null) {

View file

@ -18,25 +18,25 @@ package com.lishid.openinv.internal;
import java.util.Iterator; 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 org.bukkit.entity.Player;
import com.lishid.openinv.OpenInv; import com.lishid.openinv.OpenInv;
import net.minecraft.server.v1_9_R2.AxisAlignedBB; import net.minecraft.server.v1_10_R1.AxisAlignedBB;
import net.minecraft.server.v1_9_R2.Block; import net.minecraft.server.v1_10_R1.Block;
import net.minecraft.server.v1_9_R2.BlockChest; import net.minecraft.server.v1_10_R1.BlockChest;
import net.minecraft.server.v1_9_R2.BlockChest.Type; import net.minecraft.server.v1_10_R1.BlockChest.Type;
import net.minecraft.server.v1_9_R2.BlockPosition; import net.minecraft.server.v1_10_R1.BlockPosition;
import net.minecraft.server.v1_9_R2.Entity; import net.minecraft.server.v1_10_R1.Entity;
import net.minecraft.server.v1_9_R2.EntityOcelot; import net.minecraft.server.v1_10_R1.EntityOcelot;
import net.minecraft.server.v1_9_R2.EntityPlayer; import net.minecraft.server.v1_10_R1.EntityPlayer;
import net.minecraft.server.v1_9_R2.EnumDirection; import net.minecraft.server.v1_10_R1.EnumDirection;
import net.minecraft.server.v1_9_R2.ITileInventory; import net.minecraft.server.v1_10_R1.ITileInventory;
import net.minecraft.server.v1_9_R2.InventoryLargeChest; import net.minecraft.server.v1_10_R1.InventoryLargeChest;
import net.minecraft.server.v1_9_R2.TileEntity; import net.minecraft.server.v1_10_R1.TileEntity;
import net.minecraft.server.v1_9_R2.TileEntityChest; import net.minecraft.server.v1_10_R1.TileEntityChest;
import net.minecraft.server.v1_9_R2.World; import net.minecraft.server.v1_10_R1.World;
public class AnySilentChest { public class AnySilentChest {
@ -78,6 +78,7 @@ public class AnySilentChest {
return this.blockOnTop(world, position) || this.ocelotOnTop(world, position); return this.blockOnTop(world, position) || this.ocelotOnTop(world, position);
} }
@SuppressWarnings("deprecation")
private boolean blockOnTop(World world, BlockPosition position) { private boolean blockOnTop(World world, BlockPosition position) {
Block block = world.getType(position.up()).getBlock(); Block block = world.getType(position.up()).getBlock();
return block.isOccluding(block.getBlockData()); return block.isOccluding(block.getBlockData());

View file

@ -4,8 +4,8 @@ import java.util.Iterator;
import com.google.common.collect.Iterators; import com.google.common.collect.Iterators;
import net.minecraft.server.v1_9_R2.EnumDirection; import net.minecraft.server.v1_10_R1.EnumDirection;
import net.minecraft.server.v1_9_R2.EnumDirection.EnumDirectionLimit; import net.minecraft.server.v1_10_R1.EnumDirection.EnumDirectionLimit;
public enum EnumDirectionList implements Iterable<EnumDirection> { public enum EnumDirectionList implements Iterable<EnumDirection> {

View file

@ -18,14 +18,14 @@ package com.lishid.openinv.internal;
import java.lang.reflect.Field; 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.entity.HumanEntity;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import com.lishid.openinv.OpenInv; import com.lishid.openinv.OpenInv;
import com.lishid.openinv.Permissions; import com.lishid.openinv.Permissions;
import net.minecraft.server.v1_9_R2.IInventory; import net.minecraft.server.v1_10_R1.IInventory;
public class InventoryAccess { public class InventoryAccess {

View file

@ -20,15 +20,15 @@ import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; 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 org.bukkit.entity.Player;
import com.lishid.openinv.OpenInv; import com.lishid.openinv.OpenInv;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_9_R2.EntityPlayer; import net.minecraft.server.v1_10_R1.EntityPlayer;
import net.minecraft.server.v1_9_R2.MinecraftServer; import net.minecraft.server.v1_10_R1.MinecraftServer;
import net.minecraft.server.v1_9_R2.PlayerInteractManager; import net.minecraft.server.v1_10_R1.PlayerInteractManager;
public class PlayerDataManager { public class PlayerDataManager {

View file

@ -3,18 +3,18 @@ package com.lishid.openinv.internal;
import java.util.List; import java.util.List;
import org.bukkit.Location; 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.entity.HumanEntity;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import net.minecraft.server.v1_9_R2.ChestLock; import net.minecraft.server.v1_10_R1.ChestLock;
import net.minecraft.server.v1_9_R2.Container; import net.minecraft.server.v1_10_R1.Container;
import net.minecraft.server.v1_9_R2.ContainerChest; import net.minecraft.server.v1_10_R1.ContainerChest;
import net.minecraft.server.v1_9_R2.EntityHuman; import net.minecraft.server.v1_10_R1.EntityHuman;
import net.minecraft.server.v1_9_R2.IChatBaseComponent; import net.minecraft.server.v1_10_R1.IChatBaseComponent;
import net.minecraft.server.v1_9_R2.ITileInventory; import net.minecraft.server.v1_10_R1.ITileInventory;
import net.minecraft.server.v1_9_R2.ItemStack; import net.minecraft.server.v1_10_R1.ItemStack;
import net.minecraft.server.v1_9_R2.PlayerInventory; import net.minecraft.server.v1_10_R1.PlayerInventory;
public class SilentInventory implements ITileInventory { public class SilentInventory implements ITileInventory {

View file

@ -16,15 +16,18 @@
package com.lishid.openinv.internal; package com.lishid.openinv.internal;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftHumanEntity; import java.lang.reflect.Field;
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.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import net.minecraft.server.v1_9_R2.InventoryEnderChest; import net.minecraft.server.v1_10_R1.InventoryEnderChest;
import net.minecraft.server.v1_9_R2.InventorySubcontainer; import net.minecraft.server.v1_10_R1.InventorySubcontainer;
import net.minecraft.server.v1_10_R1.ItemStack;
public class SpecialEnderChest extends InventorySubcontainer { public class SpecialEnderChest extends InventorySubcontainer {
@ -41,8 +44,8 @@ public class SpecialEnderChest extends InventorySubcontainer {
super(enderChest.getName(), enderChest.hasCustomName(), enderChest.getSize()); super(enderChest.getName(), enderChest.hasCustomName(), enderChest.getSize());
this.owner = (CraftPlayer) p; this.owner = (CraftPlayer) p;
this.enderChest = enderChest; this.enderChest = enderChest;
this.items = this.enderChest.getContents();
this.playerOnline = online; this.playerOnline = online;
reflectContents(getClass().getSuperclass(), this, this.enderChest.getContents());
} }
private void saveOnExit() { 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) { private void linkInventory(InventoryEnderChest inventory) {
inventory.items = this.items; reflectContents(inventory.getClass(), inventory, this.items);
} }
public Inventory getBukkitInventory() { public Inventory getBukkitInventory() {
@ -61,6 +80,7 @@ public class SpecialEnderChest extends InventorySubcontainer {
public boolean inventoryRemovalCheck(boolean save) { public boolean inventoryRemovalCheck(boolean save) {
boolean offline = transaction.isEmpty() && !playerOnline; boolean offline = transaction.isEmpty() && !playerOnline;
if (offline && save) { if (offline && save) {
owner.saveData(); owner.saveData();
} }

View file

@ -18,16 +18,16 @@ package com.lishid.openinv.internal;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftHumanEntity; import org.bukkit.craftbukkit.v1_10_R1.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftInventory; import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftInventory;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import net.minecraft.server.v1_9_R2.ContainerUtil; import net.minecraft.server.v1_10_R1.ContainerUtil;
import net.minecraft.server.v1_9_R2.EntityHuman; import net.minecraft.server.v1_10_R1.EntityHuman;
import net.minecraft.server.v1_9_R2.ItemStack; import net.minecraft.server.v1_10_R1.ItemStack;
import net.minecraft.server.v1_9_R2.PlayerInventory; import net.minecraft.server.v1_10_R1.PlayerInventory;
public class SpecialPlayerInventory extends PlayerInventory { public class SpecialPlayerInventory extends PlayerInventory {
@ -80,6 +80,7 @@ public class SpecialPlayerInventory extends PlayerInventory {
public boolean inventoryRemovalCheck(boolean save) { public boolean inventoryRemovalCheck(boolean save) {
boolean offline = transaction.isEmpty() && !playerOnline; boolean offline = transaction.isEmpty() && !playerOnline;
if (offline && save) { if (offline && save) {
owner.saveData(); owner.saveData();
} }

View file

@ -10,9 +10,9 @@ import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public final class UUIDUtil { public final class UUIDUtils {
private UUIDUtil() {} private UUIDUtils() {}
private static Player getPlayer(String name) { private static Player getPlayer(String name) {
Validate.notNull(name, "Name cannot be null"); 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 * @param name the name of the player to get the UUID of
* @return the player's UUID or null * @return the player's UUID or null
*/ */
public static UUID getUUIDOf(String name) { public static UUID getPlayerUUID(String name) {
UUID uuid; UUID uuid;
Player player = getPlayer(name); Player player = getPlayer(name);

View file

@ -1,6 +1,6 @@
name: OpenInv name: OpenInv
main: com.lishid.openinv.OpenInv main: com.lishid.openinv.OpenInv
version: 2.3.8 version: 2.3.9
author: lishid author: lishid
authors: [ShadowRanger] authors: [ShadowRanger]
description: > description: >