mirror of
https://github.com/TotalFreedomMC/OpenInv.git
synced 2024-12-22 16:05:03 +00:00
Updated to CraftBukkit 1.9
This commit is contained in:
parent
c4a9cb0a4a
commit
71ac05ae85
17 changed files with 115 additions and 72 deletions
|
@ -13,6 +13,7 @@ import org.bukkit.configuration.file.FileConfiguration;
|
|||
import com.lishid.openinv.utils.UUIDUtil;
|
||||
|
||||
public class ConfigUpdater {
|
||||
|
||||
private final OpenInv plugin;
|
||||
|
||||
private static final int CONFIG_VERSION = 2;
|
||||
|
@ -33,8 +34,7 @@ public class ConfigUpdater {
|
|||
if (isConfigOutdated()) {
|
||||
plugin.getLogger().info("[Config] Update found! Performing update...");
|
||||
performUpdate();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
plugin.getLogger().info("[Config] Update not required.");
|
||||
}
|
||||
}
|
||||
|
@ -137,6 +137,7 @@ public class ConfigUpdater {
|
|||
|
||||
for (String playerName : keys) {
|
||||
UUID uuid = UUIDUtil.getUUIDOf(playerName);
|
||||
|
||||
if (uuid != null) {
|
||||
boolean toggled = section.getBoolean(playerName + ".toggle", false);
|
||||
toggles.put(uuid, toggled);
|
||||
|
@ -152,9 +153,11 @@ public class ConfigUpdater {
|
|||
@SuppressWarnings("deprecation")
|
||||
private Material getMaterialById(int id) {
|
||||
Material material = Material.getMaterial(id);
|
||||
|
||||
if (material == null) {
|
||||
material = Material.STICK;
|
||||
}
|
||||
|
||||
return material;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,12 +45,8 @@ import com.lishid.openinv.listeners.OpenInvEntityListener;
|
|||
import com.lishid.openinv.listeners.OpenInvInventoryListener;
|
||||
import com.lishid.openinv.listeners.OpenInvPlayerListener;
|
||||
|
||||
/**
|
||||
* Open other player's inventory
|
||||
*
|
||||
* @author lishid
|
||||
*/
|
||||
public class OpenInv extends JavaPlugin {
|
||||
|
||||
public static final Map<UUID, SpecialPlayerInventory> inventories = new HashMap<UUID, SpecialPlayerInventory>();
|
||||
public static final Map<UUID, SpecialEnderChest> enderChests = new HashMap<UUID, SpecialEnderChest>();
|
||||
|
||||
|
@ -114,11 +110,11 @@ public class OpenInv extends JavaPlugin {
|
|||
|
||||
public static Object getFromConfig(String path, Object defaultValue) {
|
||||
Object val = mainPlugin.getConfig().get(path);
|
||||
|
||||
if (val == null) {
|
||||
mainPlugin.getConfig().set(path, defaultValue);
|
||||
return defaultValue;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
@ -216,12 +212,15 @@ public class OpenInv extends JavaPlugin {
|
|||
public static boolean hasPermission(Permissible player, String permission) {
|
||||
String[] parts = permission.split("\\.");
|
||||
String perm = "";
|
||||
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
if (player.hasPermission(perm + "*")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
perm += parts[i] + ".";
|
||||
}
|
||||
|
||||
return player.hasPermission(permission);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.lishid.openinv.OpenInv;
|
|||
import com.lishid.openinv.Permissions;
|
||||
|
||||
public class AnyChestCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("anychest")) {
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.lishid.openinv.internal.SpecialEnderChest;
|
|||
import com.lishid.openinv.utils.UUIDUtil;
|
||||
|
||||
public class OpenEnderCommand implements CommandExecutor {
|
||||
|
||||
private final OpenInv plugin;
|
||||
private final Map<UUID, UUID> openEnderHistory = new ConcurrentHashMap<UUID, UUID>();
|
||||
|
||||
|
@ -73,8 +74,7 @@ public class OpenEnderCommand implements CommandExecutor {
|
|||
if (args.length < 1) {
|
||||
if (history != null) {
|
||||
uuid = history;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "OpenEnder history is empty!");
|
||||
return true;
|
||||
}
|
||||
|
@ -111,6 +111,7 @@ public class OpenEnderCommand implements CommandExecutor {
|
|||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
openInventory(player, target);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.lishid.openinv.internal.SpecialPlayerInventory;
|
|||
import com.lishid.openinv.utils.UUIDUtil;
|
||||
|
||||
public class OpenInvCommand implements CommandExecutor {
|
||||
|
||||
private final OpenInv plugin;
|
||||
private final Map<UUID, UUID> openInvHistory = new ConcurrentHashMap<UUID, UUID>();
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.lishid.openinv.OpenInv;
|
|||
import com.lishid.openinv.Permissions;
|
||||
|
||||
public class SearchEnderCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("searchender")) {
|
||||
|
@ -30,11 +31,11 @@ public class SearchEnderCommand implements CommandExecutor {
|
|||
gData = args[0].split(":");
|
||||
material = Material.matchMaterial(gData[0]);
|
||||
}
|
||||
|
||||
if (args.length >= 2) {
|
||||
try {
|
||||
count = Integer.parseInt(args[1]);
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
} catch (NumberFormatException e) {
|
||||
sender.sendMessage(ChatColor.RED + "'" + args[1] + "' is not a number!");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.lishid.openinv.OpenInv;
|
|||
import com.lishid.openinv.Permissions;
|
||||
|
||||
public class SearchInvCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("searchinv")) {
|
||||
|
@ -46,11 +47,11 @@ public class SearchInvCommand implements CommandExecutor {
|
|||
gData = args[0].split(":");
|
||||
material = Material.matchMaterial(gData[0]);
|
||||
}
|
||||
|
||||
if (args.length >= 2) {
|
||||
try {
|
||||
count = Integer.parseInt(args[1]);
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
} catch (NumberFormatException e) {
|
||||
sender.sendMessage(ChatColor.RED + "'" + args[1] + "' is not a number!");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.lishid.openinv.OpenInv;
|
|||
import com.lishid.openinv.Permissions;
|
||||
|
||||
public class SilentChestCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("silentchest")) {
|
||||
|
|
|
@ -26,6 +26,7 @@ import com.lishid.openinv.OpenInv;
|
|||
import com.lishid.openinv.Permissions;
|
||||
|
||||
public class ToggleOpenInvCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("toggleopeninv")) {
|
||||
|
|
|
@ -29,6 +29,7 @@ import net.minecraft.server.v1_9_R1.BlockChest.Type;
|
|||
import org.bukkit.craftbukkit.v1_9_R1.entity.*;
|
||||
|
||||
public class AnySilentChest {
|
||||
|
||||
public boolean isAnyChestNeeded(Player p, int x, int y, int z) {
|
||||
// FOR REFERENCE, LOOK AT net.minecraft.server.BlockChest
|
||||
BlockPosition position = new BlockPosition(x, y, z);
|
||||
|
@ -37,16 +38,17 @@ public class AnySilentChest {
|
|||
BlockChest chest = (BlockChest) (((BlockChest) world.getType(position).getBlock()).g == Type.TRAP ?
|
||||
Block.getByName("trapped_chest") : Block.getByName("chest"));
|
||||
|
||||
// If block on top
|
||||
// If a block is on top
|
||||
if (topBlocking(world, position)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If block next to chest is chest and has a block on top
|
||||
// If the block next to the chest is chest and has a block on top
|
||||
for (EnumDirection direction : EnumDirectionList.HORIZONTAL) {
|
||||
BlockPosition sidePosition = position.shift(direction);
|
||||
Block var8 = world.getType(sidePosition).getBlock();
|
||||
if (var8 == chest) {
|
||||
Block block = world.getType(sidePosition).getBlock();
|
||||
|
||||
if (block == chest) {
|
||||
if (this.topBlocking(world, sidePosition)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -55,6 +57,7 @@ public class AnySilentChest {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean topBlocking(World world, BlockPosition position) {
|
||||
return this.blockOnTop(world, position) || this.ocelotOnTop(world, position);
|
||||
}
|
||||
|
@ -65,20 +68,22 @@ public class AnySilentChest {
|
|||
}
|
||||
|
||||
private boolean ocelotOnTop(World world, BlockPosition position) {
|
||||
Iterator var3 = world.a(EntityOcelot.class,
|
||||
Iterator iterator = world.a(EntityOcelot.class,
|
||||
new AxisAlignedBB((double) position.getX(), (double) (position.getY() + 1),
|
||||
(double) position.getZ(), (double) (position.getX() + 1),
|
||||
(double) (position.getY() + 2), (double) (position.getZ() + 1))).iterator();
|
||||
|
||||
EntityOcelot var5;
|
||||
EntityOcelot entityOcelot;
|
||||
|
||||
do {
|
||||
if (!var3.hasNext()) {
|
||||
if (!iterator.hasNext()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Entity var4 = (Entity) var3.next();
|
||||
var5 = (EntityOcelot) var4;
|
||||
} while (!var5.isSitting());
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
entityOcelot = (EntityOcelot) entity;
|
||||
} while (!entityOcelot.isSitting());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -107,12 +112,14 @@ public class AnySilentChest {
|
|||
for (EnumDirection direction : EnumDirectionList.HORIZONTAL) {
|
||||
BlockPosition side = position.shift(direction);
|
||||
Block block = world.getType(side).getBlock();
|
||||
|
||||
if (block == chest) {
|
||||
if (!anyChest && this.topBlocking(world, side)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
TileEntity sideTileEntity = world.getTileEntity(side);
|
||||
|
||||
if (sideTileEntity instanceof TileEntityChest) {
|
||||
if (direction != EnumDirection.WEST && direction != EnumDirection.NORTH) {
|
||||
tileInventory = new InventoryLargeChest("container.chestDouble", tileInventory, (TileEntityChest) sideTileEntity);
|
||||
|
@ -124,11 +131,14 @@ public class AnySilentChest {
|
|||
}
|
||||
|
||||
boolean returnValue = true;
|
||||
|
||||
if (silentChest) {
|
||||
tileInventory = new SilentInventory(tileInventory);
|
||||
|
||||
if (OpenInv.notifySilentChest()) {
|
||||
OpenInv.sendMessage(p, "You are opening a chest silently.");
|
||||
}
|
||||
|
||||
returnValue = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.server.v1_9_R1.EnumDirection;
|
|||
import net.minecraft.server.v1_9_R1.EnumDirection.EnumDirectionLimit;
|
||||
|
||||
public enum EnumDirectionList implements Iterable<EnumDirection> {
|
||||
|
||||
HORIZONTAL(EnumDirectionLimit.HORIZONTAL),
|
||||
VERTICAL(EnumDirectionLimit.VERTICAL);
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ import net.minecraft.server.v1_9_R1.*;
|
|||
import org.bukkit.craftbukkit.v1_9_R1.inventory.*;
|
||||
|
||||
public class InventoryAccess {
|
||||
|
||||
public boolean check(Inventory inventory, HumanEntity player) {
|
||||
IInventory inv = grabInventory(inventory);
|
||||
|
||||
|
@ -62,12 +63,12 @@ public class InventoryAccess {
|
|||
if (IInventory.class.isAssignableFrom(f.getDeclaringClass())) {
|
||||
try {
|
||||
result = (IInventory) f.get(inventory);
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
OpenInv.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,12 +31,14 @@ import net.minecraft.server.v1_9_R1.*;
|
|||
import org.bukkit.craftbukkit.v1_9_R1.*;
|
||||
|
||||
public class PlayerDataManager {
|
||||
|
||||
public Player loadPlayer(UUID uuid) {
|
||||
try {
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(uuid);
|
||||
if (player == null || !player.hasPlayedBefore()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
GameProfile profile = new GameProfile(uuid, player.getName());
|
||||
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
|
||||
// Create an entity to load the player data
|
||||
|
@ -44,14 +46,15 @@ public class PlayerDataManager {
|
|||
|
||||
// Get the bukkit entity
|
||||
Player target = entity.getBukkitEntity();
|
||||
|
||||
if (target != null) {
|
||||
// Load data
|
||||
target.loadData();
|
||||
|
||||
// Return the entity
|
||||
return target;
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
OpenInv.log(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ package com.lishid.openinv.internal;
|
|||
import net.minecraft.server.v1_9_R1.*;
|
||||
|
||||
public class SilentContainerChest extends ContainerChest {
|
||||
|
||||
public IInventory inv;
|
||||
|
||||
public SilentContainerChest(IInventory i1, IInventory i2, EntityHuman human) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.bukkit.inventory.InventoryHolder;
|
|||
import net.minecraft.server.v1_9_R1.*;
|
||||
|
||||
public class SilentInventory implements ITileInventory {
|
||||
|
||||
public ITileInventory inv;
|
||||
|
||||
public SilentInventory(ITileInventory inv) {
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.bukkit.craftbukkit.v1_9_R1.entity.*;
|
|||
import org.bukkit.craftbukkit.v1_9_R1.inventory.*;
|
||||
|
||||
public class SpecialEnderChest extends InventorySubcontainer {
|
||||
|
||||
private final CraftInventory inventory = new CraftInventory(this);
|
||||
private final InventoryEnderChest enderChest;
|
||||
private final CraftPlayer owner;
|
||||
|
|
|
@ -16,40 +16,67 @@
|
|||
|
||||
package com.lishid.openinv.internal;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import com.lishid.openinv.OpenInv;
|
||||
|
||||
// Volatile
|
||||
import net.minecraft.server.v1_9_R1.*;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.*;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.inventory.*;
|
||||
|
||||
/*
|
||||
* -----------------------------------------------
|
||||
* This class still needs to be updated for 1.9.
|
||||
*
|
||||
* It has been partially updated, but is very buggy
|
||||
* and does not work correctly.
|
||||
* -----------------------------------------------
|
||||
*/
|
||||
import com.lishid.openinv.OpenInv;
|
||||
|
||||
public class SpecialPlayerInventory extends PlayerInventory {
|
||||
|
||||
private final CraftInventory inventory = new CraftInventory(this);
|
||||
private final ItemStack[] extra = new ItemStack[5];
|
||||
private final ItemStack[][] g;
|
||||
private final ItemStack[][] arrays;
|
||||
private final CraftPlayer owner;
|
||||
private boolean playerOnline;
|
||||
|
||||
public SpecialPlayerInventory(Player p, boolean online) {
|
||||
super(((CraftPlayer) p).getHandle());
|
||||
this.owner = (CraftPlayer) p;
|
||||
System.arraycopy(player.inventory.items, 0, this.items, 0, this.items.length);
|
||||
System.arraycopy(player.inventory.armor, 0, this.armor, 0, this.armor.length);
|
||||
this.g = new ItemStack[][]{this.items, this.armor, this.extra};
|
||||
// applyContents();
|
||||
reflectContents(getClass().getSuperclass(), player.inventory, this);
|
||||
this.arrays = new ItemStack[][] { this.items, this.armor, this.extra };
|
||||
this.playerOnline = online;
|
||||
// OpenInv.inventories.put(owner.getUniqueId(), this);
|
||||
OpenInv.inventories.put(owner.getUniqueId(), this);
|
||||
}
|
||||
|
||||
private void reflectContents(Class clazz, PlayerInventory src, PlayerInventory dest) {
|
||||
// Items
|
||||
try {
|
||||
Field itemsField = clazz.getDeclaredField("items");
|
||||
itemsField.setAccessible(true);
|
||||
itemsField.set(dest, src.items);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// Armor
|
||||
try {
|
||||
Field armorField = clazz.getDeclaredField("armor");
|
||||
armorField.setAccessible(true);
|
||||
armorField.set(dest, src.armor);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SecurityException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public Inventory getBukkitInventory() {
|
||||
|
@ -57,19 +84,14 @@ public class SpecialPlayerInventory extends PlayerInventory {
|
|||
}
|
||||
|
||||
private void saveOnExit() {
|
||||
if (playerOnline) {
|
||||
linkInventory(player.inventory);
|
||||
}
|
||||
|
||||
if (transaction.isEmpty() && !playerOnline) {
|
||||
owner.saveData();
|
||||
// OpenInv.inventories.remove(owner.getUniqueId());
|
||||
OpenInv.inventories.remove(owner.getUniqueId());
|
||||
}
|
||||
}
|
||||
|
||||
private void linkInventory(PlayerInventory inventory) {
|
||||
System.arraycopy(this.items, 0, inventory.items, 0, inventory.items.length);
|
||||
System.arraycopy(this.armor, 0, inventory.armor, 0, inventory.armor.length);
|
||||
reflectContents(inventory.getClass(), inventory, this);
|
||||
}
|
||||
|
||||
public void playerOnline(Player player) {
|
||||
|
@ -104,17 +126,18 @@ public class SpecialPlayerInventory extends PlayerInventory {
|
|||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return super.getSize() + 5; // super.getSize() - this.extraSlots.length + 5;
|
||||
return super.getSize() - this.extraSlots.length + 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(int i) {
|
||||
ItemStack[] is = null;
|
||||
ItemStack[][] contents = this.g;
|
||||
ItemStack[][] contents = this.arrays;
|
||||
int j = contents.length;
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
ItemStack[] is2 = contents[k];
|
||||
|
||||
if (i < is2.length) {
|
||||
is = is2;
|
||||
break;
|
||||
|
@ -137,11 +160,12 @@ public class SpecialPlayerInventory extends PlayerInventory {
|
|||
@Override
|
||||
public ItemStack splitStack(int i, int j) {
|
||||
ItemStack[] is = null;
|
||||
ItemStack[][] contents = this.g;
|
||||
ItemStack[][] contents = this.arrays;
|
||||
int k = contents.length;
|
||||
|
||||
for (int l = 0; l < k; ++l) {
|
||||
ItemStack[] is2 = contents[l];
|
||||
|
||||
if (i < is2.length) {
|
||||
is = is2;
|
||||
break;
|
||||
|
@ -164,11 +188,12 @@ public class SpecialPlayerInventory extends PlayerInventory {
|
|||
@Override
|
||||
public ItemStack splitWithoutUpdate(int i) {
|
||||
ItemStack[] is = null;
|
||||
ItemStack[][] contents = this.g;
|
||||
ItemStack[][] contents = this.arrays;
|
||||
int j = contents.length;
|
||||
|
||||
for (int object = 0; object < j; ++object) {
|
||||
ItemStack[] is2 = contents[object];
|
||||
|
||||
if (i < is2.length) {
|
||||
is = is2;
|
||||
break;
|
||||
|
@ -177,7 +202,6 @@ public class SpecialPlayerInventory extends PlayerInventory {
|
|||
i -= is2.length;
|
||||
}
|
||||
|
||||
|
||||
if (is != null && is[i] != null) {
|
||||
if (is == this.items) {
|
||||
i = getReversedItemSlotNum(i);
|
||||
|
@ -198,11 +222,12 @@ public class SpecialPlayerInventory extends PlayerInventory {
|
|||
@Override
|
||||
public void setItem(int i, ItemStack itemStack) {
|
||||
ItemStack[] is = null;
|
||||
ItemStack[][] contents = this.g;
|
||||
ItemStack[][] contents = this.arrays;
|
||||
int j = contents.length;
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
ItemStack[] is2 = contents[k];
|
||||
|
||||
if (i < is2.length) {
|
||||
is = is2;
|
||||
break;
|
||||
|
@ -223,28 +248,19 @@ public class SpecialPlayerInventory extends PlayerInventory {
|
|||
|
||||
is[i] = itemStack;
|
||||
|
||||
// owner.getHandle().defaultContainer.b();
|
||||
owner.getHandle().defaultContainer.b();
|
||||
}
|
||||
}
|
||||
|
||||
private int getReversedItemSlotNum(int i) {
|
||||
if (i >= 27)
|
||||
return i - 27;
|
||||
else
|
||||
return i + 9;
|
||||
return (i >= 27) ? (i - 27) : (i + 9);
|
||||
}
|
||||
|
||||
private int getReversedArmorSlotNum(int i) {
|
||||
if (i == 0)
|
||||
return 3;
|
||||
if (i == 1)
|
||||
return 2;
|
||||
if (i == 2)
|
||||
return 1;
|
||||
if (i == 3)
|
||||
return 0;
|
||||
else
|
||||
return i;
|
||||
if (i == 0) return 3;
|
||||
if (i == 1) return 2;
|
||||
if (i == 2) return 1;
|
||||
return (i == 3) ? 0 : i;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue