Remove unused PlayerInventory NMS stuff
This commit is contained in:
parent
cb8900d01e
commit
51b9f118ab
@ -66,7 +66,6 @@ import com.massivecraft.massivecore.mixin.MixinCommand;
|
||||
import com.massivecraft.massivecore.mixin.MixinDisplayName;
|
||||
import com.massivecraft.massivecore.mixin.MixinEvent;
|
||||
import com.massivecraft.massivecore.mixin.MixinGamemode;
|
||||
import com.massivecraft.massivecore.mixin.MixinInventory;
|
||||
import com.massivecraft.massivecore.mixin.MixinKick;
|
||||
import com.massivecraft.massivecore.mixin.MixinLog;
|
||||
import com.massivecraft.massivecore.mixin.MixinMessage;
|
||||
@ -87,7 +86,6 @@ import com.massivecraft.massivecore.nms.NmsEntityDamageEvent;
|
||||
import com.massivecraft.massivecore.nms.NmsEntityGet;
|
||||
import com.massivecraft.massivecore.nms.NmsItemStackTooltip;
|
||||
import com.massivecraft.massivecore.nms.NmsPermissions;
|
||||
import com.massivecraft.massivecore.nms.NmsPlayerInventoryCreate;
|
||||
import com.massivecraft.massivecore.nms.NmsRecipe;
|
||||
import com.massivecraft.massivecore.nms.NmsSkullMeta;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
@ -308,7 +306,6 @@ public class MassiveCore extends MassivePlugin
|
||||
NmsEntityGet.class,
|
||||
NmsItemStackTooltip.class,
|
||||
NmsPermissions.class,
|
||||
NmsPlayerInventoryCreate.class,
|
||||
NmsSkullMeta.class,
|
||||
NmsRecipe.class
|
||||
);
|
||||
@ -369,7 +366,6 @@ public class MassiveCore extends MassivePlugin
|
||||
MixinCommand.class,
|
||||
MixinDisplayName.class,
|
||||
MixinGamemode.class,
|
||||
MixinInventory.class,
|
||||
MixinKick.class,
|
||||
MixinLog.class,
|
||||
MixinMessage.class,
|
||||
|
@ -5,7 +5,6 @@ import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.collections.MassiveSet;
|
||||
import com.massivecraft.massivecore.command.requirement.RequirementIsPlayer;
|
||||
import com.massivecraft.massivecore.mixin.MixinInventory;
|
||||
import com.massivecraft.massivecore.util.InventoryUtil;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -119,7 +118,7 @@ public class CommandEditItemStacksOpen<O> extends CommandEditItemStacksAbstract<
|
||||
if (itemStacks == null) return null;
|
||||
|
||||
// Create Ret
|
||||
Inventory ret = MixinInventory.get().createInventory(me, 54, this.getProperty().getName());
|
||||
Inventory ret = Bukkit.createInventory(me, 54, this.getPropertyName());
|
||||
|
||||
// Fill Ret
|
||||
for (int i = 0; i < itemStacks.size(); i++)
|
||||
|
@ -1,35 +0,0 @@
|
||||
package com.massivecraft.massivecore.mixin;
|
||||
|
||||
import com.massivecraft.massivecore.nms.NmsPlayerInventoryCreate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
public class MixinInventory extends Mixin
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static MixinInventory d = new MixinInventory();
|
||||
private static MixinInventory i = d;
|
||||
public static MixinInventory get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// METHODS
|
||||
// -------------------------------------------- //
|
||||
|
||||
public PlayerInventory createPlayerInventory()
|
||||
{
|
||||
NmsPlayerInventoryCreate nmsPlayerInventory = NmsPlayerInventoryCreate.get();
|
||||
if ( ! nmsPlayerInventory.isAvailable()) return null;
|
||||
return nmsPlayerInventory.create();
|
||||
}
|
||||
|
||||
public Inventory createInventory(InventoryHolder holder, int size, String title)
|
||||
{
|
||||
return Bukkit.createInventory(holder, size, title);
|
||||
}
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
package com.massivecraft.massivecore.nms;
|
||||
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
public class NmsPlayerInventoryCreate extends Mixin
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// DEFAULT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static NmsPlayerInventoryCreate d = new NmsPlayerInventoryCreate().setAlternatives(
|
||||
NmsPlayerInventoryCreate17R4P.class
|
||||
);
|
||||
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static NmsPlayerInventoryCreate i = d;
|
||||
public static NmsPlayerInventoryCreate get() { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CREATE
|
||||
// -------------------------------------------- //
|
||||
|
||||
public PlayerInventory create()
|
||||
{
|
||||
throw notImplemented();
|
||||
}
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
package com.massivecraft.massivecore.nms;
|
||||
|
||||
import com.massivecraft.massivecore.particleeffect.ReflectionUtils;
|
||||
import com.massivecraft.massivecore.util.ReflectionUtil;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
public class NmsPlayerInventoryCreate17R4P extends NmsPlayerInventoryCreate
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// INSTANCE & CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static NmsPlayerInventoryCreate17R4P i = new NmsPlayerInventoryCreate17R4P();
|
||||
public static NmsPlayerInventoryCreate17R4P get () { return i; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private Class<?> classNmsPlayerInventory;
|
||||
private Class<?> classNmsEntityHuman;
|
||||
private Constructor<?> constructorNmsPlayerInventory;
|
||||
|
||||
private Class<?> classCraftInventoryPlayer;
|
||||
private Constructor<?> constructorCraftInventoryPlayer;
|
||||
|
||||
// -------------------------------------------- //
|
||||
// SETUP
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void setup() throws Throwable
|
||||
{
|
||||
this.classNmsPlayerInventory = ReflectionUtils.PackageType.MINECRAFT_SERVER.getClass("PlayerInventory");
|
||||
this.classNmsEntityHuman = ReflectionUtils.PackageType.MINECRAFT_SERVER.getClass("EntityHuman");
|
||||
this.constructorNmsPlayerInventory = ReflectionUtils.getConstructor(this.classNmsPlayerInventory, this.classNmsEntityHuman);
|
||||
|
||||
this.classCraftInventoryPlayer = ReflectionUtils.PackageType.CRAFTBUKKIT_INVENTORY.getClass("CraftInventoryPlayer");
|
||||
this.constructorCraftInventoryPlayer = ReflectionUtils.getConstructor(this.classCraftInventoryPlayer, this.classNmsPlayerInventory);
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CREATE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public PlayerInventory create()
|
||||
{
|
||||
Object nmsInventory = ReflectionUtil.invokeConstructor(this.constructorNmsPlayerInventory, (Object)null);
|
||||
return ReflectionUtil.invokeConstructor(this.constructorCraftInventoryPlayer, nmsInventory);
|
||||
}
|
||||
|
||||
}
|
@ -5,7 +5,6 @@ import com.massivecraft.massivecore.collections.MassiveList;
|
||||
import com.massivecraft.massivecore.comparator.ComparatorComparable;
|
||||
import com.massivecraft.massivecore.comparator.ComparatorEntryValue;
|
||||
import com.massivecraft.massivecore.event.EventMassiveCoreLorePriority;
|
||||
import com.massivecraft.massivecore.mixin.MixinInventory;
|
||||
import com.massivecraft.massivecore.predicate.PredicateStringStartsWith;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -963,15 +962,15 @@ public class InventoryUtil
|
||||
Inventory ret = null;
|
||||
if (inventory instanceof PlayerInventory && playerSupport)
|
||||
{
|
||||
ret = MixinInventory.get().createPlayerInventory();
|
||||
throw new UnsupportedOperationException("Can't clone player inventories.");
|
||||
}
|
||||
else
|
||||
{
|
||||
InventoryHolder holder = inventory.getHolder();
|
||||
int size = inventory.getSize();
|
||||
if (inventory instanceof PlayerInventory) size = SIZE_PLAYER_STORAGE;
|
||||
String title = "";
|
||||
ret = MixinInventory.get().createInventory(holder, size, title);
|
||||
String title = inventory.getType().getDefaultTitle();
|
||||
ret = Bukkit.createInventory(holder, size, title);
|
||||
}
|
||||
|
||||
// Fill
|
||||
|
Loading…
Reference in New Issue
Block a user