mirror of
https://github.com/songoda/SongodaCore.git
synced 2025-02-11 09:01:34 +01:00
Merge branch 'development'
This commit is contained in:
commit
c6b6c8849f
@ -4,7 +4,7 @@ stages:
|
||||
variables:
|
||||
name: "SongodaCore"
|
||||
path: "/builds/$CI_PROJECT_PATH"
|
||||
version: "2.3.23"
|
||||
version: "2.3.24"
|
||||
|
||||
build:
|
||||
stage: build
|
||||
|
@ -2,8 +2,8 @@ package com.songoda.core.gui;
|
||||
|
||||
import com.songoda.core.compatibility.CompatibleMaterial;
|
||||
import com.songoda.core.gui.methods.Clickable;
|
||||
import com.songoda.core.nms.CoreNMS;
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.AnvilCore;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import com.songoda.core.nms.NmsManager;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -115,7 +115,7 @@ public class AnvilGui extends Gui {
|
||||
|
||||
@Override
|
||||
protected void createInventory() {
|
||||
CoreNMS nms = NmsManager.getNMS();
|
||||
AnvilCore nms = NmsManager.getAnvil();
|
||||
if (nms != null) {
|
||||
anvil = nms.createAnvil(player, new GuiHolder(guiManager, this));
|
||||
anvil.setCustomTitle(title);
|
||||
|
@ -77,7 +77,7 @@ public class WorldGuardHook {
|
||||
* @return false if the pvp flag is not set for this region, or is set to DENY
|
||||
*/
|
||||
public static boolean isPvpAllowed(@NotNull Location loc) {
|
||||
return canHook ? Objects.equals(WorldGuardFlagHandler.getBooleanFlag(loc, "pvp"), Boolean.TRUE) : false;
|
||||
return canHook && Objects.equals(WorldGuardFlagHandler.getBooleanFlag(loc, "pvp"), Boolean.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,8 +86,18 @@ public class WorldGuardHook {
|
||||
* @param loc Location to check
|
||||
* @return false if the block-break flag is not set for this region, or is set to DENY
|
||||
*/
|
||||
public boolean isBreakAllowed(@NotNull Location loc) {
|
||||
return canHook ? Objects.equals(WorldGuardFlagHandler.getBooleanFlag(loc, "block-break"), Boolean.TRUE) : false;
|
||||
public static boolean isBreakAllowed(@NotNull Location loc) {
|
||||
return canHook && Objects.equals(WorldGuardFlagHandler.getBooleanFlag(loc, "block-break"), Boolean.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if the use flag is set and is set to ALLOW
|
||||
*
|
||||
* @param loc Location to check
|
||||
* @return false if the use flag is not set for this region, or is set to DENY
|
||||
*/
|
||||
public static boolean isInteractAllowed(@NotNull Location loc) {
|
||||
return canHook && Objects.equals(WorldGuardFlagHandler.getBooleanFlag(loc, "use"), Boolean.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -96,8 +106,8 @@ public class WorldGuardHook {
|
||||
* @param loc Location to check
|
||||
* @return false if the other-explosion flag is not set for this region, or is set to DENY
|
||||
*/
|
||||
public boolean isExplosionsAllowed(@NotNull Location loc) {
|
||||
return canHook ? Objects.equals(WorldGuardFlagHandler.getBooleanFlag(loc, "other-explosion"), Boolean.TRUE) : false;
|
||||
public static boolean isExplosionsAllowed(@NotNull Location loc) {
|
||||
return canHook && Objects.equals(WorldGuardFlagHandler.getBooleanFlag(loc, "other-explosion"), Boolean.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -106,8 +116,8 @@ public class WorldGuardHook {
|
||||
* @param loc Location to check
|
||||
* @return false if the mob-spawning flag is not set for this region, or is set to DENY
|
||||
*/
|
||||
public boolean isMobSpawningAllowed(@NotNull Location loc) {
|
||||
return canHook ? Objects.equals(WorldGuardFlagHandler.getBooleanFlag(loc, "mob-spawning"), Boolean.TRUE) : false;
|
||||
public static boolean isMobSpawningAllowed(@NotNull Location loc) {
|
||||
return canHook && Objects.equals(WorldGuardFlagHandler.getBooleanFlag(loc, "mob-spawning"), Boolean.TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,57 +1,90 @@
|
||||
package com.songoda.core.nms;
|
||||
|
||||
import com.songoda.core.nms.anvil.AnvilCore;
|
||||
import com.songoda.core.nms.nbt.NBTCore;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class NmsManager {
|
||||
|
||||
private final static String serverPackagePath = Bukkit.getServer().getClass().getPackage().getName();
|
||||
private final static String serverPackageVersion = serverPackagePath.substring(serverPackagePath.lastIndexOf('.') + 1);
|
||||
private final static CoreNMS nms = _getNMS();
|
||||
private final static AnvilCore anvil;
|
||||
private final static NBTCore nbt;
|
||||
|
||||
private static CoreNMS _getNMS() {
|
||||
// try {
|
||||
// return (CoreNMS) Class.forName("com.songoda.core.nms." + serverPackageVersion + ".NMS").newInstance();
|
||||
// } catch (Exception ex) {
|
||||
// Logger.getLogger(NmsManager.class.getName()).log(Level.SEVERE, "Failed to load NMS for this server version", ex);
|
||||
// }
|
||||
// this block was only added to keep minimizeJar happy
|
||||
static {
|
||||
switch (serverPackageVersion) {
|
||||
case "v1_8_R1":
|
||||
return new com.songoda.core.nms.v1_8_R1.NMS();
|
||||
anvil = new com.songoda.core.nms.v1_8_R1.anvil.AnvilCore();
|
||||
nbt = new com.songoda.core.nms.v1_8_R1.nbt.NBTCoreImpl();
|
||||
break;
|
||||
case "v1_8_R2":
|
||||
return new com.songoda.core.nms.v1_8_R2.NMS();
|
||||
anvil = new com.songoda.core.nms.v1_8_R2.anvil.AnvilCore();
|
||||
nbt = new com.songoda.core.nms.v1_8_R2.nbt.NBTCoreImpl();
|
||||
break;
|
||||
case "v1_8_R3":
|
||||
return new com.songoda.core.nms.v1_8_R3.NMS();
|
||||
anvil = new com.songoda.core.nms.v1_8_R3.anvil.AnvilCore();
|
||||
nbt = new com.songoda.core.nms.v1_8_R3.nbt.NBTCoreImpl();
|
||||
break;
|
||||
case "v1_9_R1":
|
||||
return new com.songoda.core.nms.v1_9_R1.NMS();
|
||||
anvil = new com.songoda.core.nms.v1_9_R1.anvil.AnvilCore();
|
||||
nbt = new com.songoda.core.nms.v1_9_R1.nbt.NBTCoreImpl();
|
||||
break;
|
||||
case "v1_9_R2":
|
||||
return new com.songoda.core.nms.v1_9_R2.NMS();
|
||||
anvil = new com.songoda.core.nms.v1_9_R2.anvil.AnvilCore();
|
||||
nbt = new com.songoda.core.nms.v1_9_R2.nbt.NBTCoreImpl();
|
||||
break;
|
||||
case "v1_10_R1":
|
||||
return new com.songoda.core.nms.v1_10_R1.NMS();
|
||||
anvil = new com.songoda.core.nms.v1_10_R1.anvil.AnvilCore();
|
||||
nbt = new com.songoda.core.nms.v1_10_R1.nbt.NBTCoreImpl();
|
||||
break;
|
||||
case "v1_11_R1":
|
||||
return new com.songoda.core.nms.v1_11_R1.NMS();
|
||||
anvil = new com.songoda.core.nms.v1_11_R1.anvil.AnvilCore();
|
||||
nbt = new com.songoda.core.nms.v1_11_R1.nbt.NBTCoreImpl();
|
||||
break;
|
||||
case "v1_12_R1":
|
||||
return new com.songoda.core.nms.v1_12_R1.NMS();
|
||||
anvil = new com.songoda.core.nms.v1_12_R1.anvil.AnvilCore();
|
||||
nbt = new com.songoda.core.nms.v1_12_R1.nbt.NBTCoreImpl();
|
||||
break;
|
||||
case "v1_13_R1":
|
||||
return new com.songoda.core.nms.v1_13_R1.NMS();
|
||||
anvil = new com.songoda.core.nms.v1_13_R1.anvil.AnvilCore();
|
||||
nbt = new com.songoda.core.nms.v1_13_R1.nbt.NBTCoreImpl();
|
||||
break;
|
||||
case "v1_13_R2":
|
||||
return new com.songoda.core.nms.v1_13_R2.NMS();
|
||||
anvil = new com.songoda.core.nms.v1_13_R2.anvil.AnvilCore();
|
||||
nbt = new com.songoda.core.nms.v1_13_R2.nbt.NBTCoreImpl();
|
||||
break;
|
||||
case "v1_14_R1":
|
||||
return new com.songoda.core.nms.v1_14_R1.NMS();
|
||||
anvil = new com.songoda.core.nms.v1_14_R1.anvil.AnvilCore();
|
||||
nbt = new com.songoda.core.nms.v1_14_R1.nbt.NBTCoreImpl();
|
||||
break;
|
||||
case "v1_15_R1":
|
||||
return new com.songoda.core.nms.v1_15_R1.NMS();
|
||||
}
|
||||
anvil = new com.songoda.core.nms.v1_15_R1.anvil.AnvilCore();
|
||||
nbt = new com.songoda.core.nms.v1_15_R1.nbt.NBTCoreImpl();
|
||||
break;
|
||||
default:
|
||||
Logger.getLogger(NmsManager.class.getName()).log(Level.SEVERE, "Failed to load NMS for this server version: version {0} not found", serverPackageVersion);
|
||||
return null;
|
||||
anvil = null;
|
||||
nbt = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static CoreNMS getNMS() {
|
||||
return nms;
|
||||
public static AnvilCore getAnvil() {
|
||||
return anvil;
|
||||
}
|
||||
|
||||
public static boolean hasNMS() {
|
||||
return nms != null;
|
||||
public static boolean hasAnvil() {
|
||||
return anvil != null;
|
||||
}
|
||||
|
||||
public static NBTCore getNbt() {
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public static boolean hasNbt() {
|
||||
return nbt != null;
|
||||
}
|
||||
}
|
||||
|
@ -928,6 +928,42 @@ public class ItemUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static CompatibleMaterial getDyeColor(char color) {
|
||||
switch (color) {
|
||||
case '0':
|
||||
return CompatibleMaterial.BLACK_DYE;
|
||||
case '1':
|
||||
return CompatibleMaterial.BLUE_DYE;
|
||||
case '2':
|
||||
return CompatibleMaterial.GREEN_DYE;
|
||||
case '3':
|
||||
return CompatibleMaterial.CYAN_DYE;
|
||||
case '4':
|
||||
return CompatibleMaterial.BROWN_DYE;
|
||||
case '5':
|
||||
return CompatibleMaterial.PURPLE_DYE;
|
||||
case '6':
|
||||
return CompatibleMaterial.ORANGE_DYE;
|
||||
case '7':
|
||||
return CompatibleMaterial.LIGHT_GRAY_DYE;
|
||||
case '8':
|
||||
return CompatibleMaterial.GREEN_DYE;
|
||||
case 'a':
|
||||
return CompatibleMaterial.LIME_DYE;
|
||||
case 'b':
|
||||
return CompatibleMaterial.LIGHT_BLUE_DYE;
|
||||
case 'c':
|
||||
return CompatibleMaterial.RED_DYE;
|
||||
case 'd':
|
||||
return CompatibleMaterial.MAGENTA_DYE;
|
||||
case 'e':
|
||||
return CompatibleMaterial.YELLOW_DYE;
|
||||
case 'f':
|
||||
return CompatibleMaterial.WHITE_DYE;
|
||||
}
|
||||
return CompatibleMaterial.STONE;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Add an item to this inventory.
|
||||
|
@ -1,9 +1,9 @@
|
||||
package com.songoda.core.nms;
|
||||
package com.songoda.core.nms.anvil;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public interface CoreNMS {
|
||||
public interface AnvilCore {
|
||||
public CustomAnvil createAnvil(Player player);
|
||||
public CustomAnvil createAnvil(Player player, InventoryHolder holder);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package com.songoda.core.nms;
|
||||
package com.songoda.core.nms.anvil;
|
||||
|
||||
import com.songoda.core.nms.methods.AnvilTextChange;
|
||||
import com.songoda.core.nms.anvil.methods.AnvilTextChange;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.core.nms.methods;
|
||||
package com.songoda.core.nms.anvil.methods;
|
||||
|
||||
public interface AnvilTextChange {
|
||||
|
23
NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTCompound.java
Normal file
23
NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTCompound.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.songoda.core.nms.nbt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface NBTCompound {
|
||||
|
||||
NBTCompound set(String tag, String s);
|
||||
|
||||
NBTCompound set(String tag, boolean b);
|
||||
|
||||
NBTCompound set(String tag, int i);
|
||||
|
||||
NBTCompound set(String tag, long l);
|
||||
|
||||
NBTCompound set(String tag, short s);
|
||||
|
||||
NBTCompound set(String tag, byte b);
|
||||
|
||||
boolean has(String tag);
|
||||
|
||||
NBTObject getNBTObject(String tag);
|
||||
|
||||
}
|
11
NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTCore.java
Normal file
11
NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTCore.java
Normal file
@ -0,0 +1,11 @@
|
||||
package com.songoda.core.nms.nbt;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public interface NBTCore {
|
||||
|
||||
NBTItem of(ItemStack item);
|
||||
|
||||
NBTCompound newCompound();
|
||||
|
||||
}
|
9
NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTItem.java
Normal file
9
NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTItem.java
Normal file
@ -0,0 +1,9 @@
|
||||
package com.songoda.core.nms.nbt;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public interface NBTItem extends NBTCompound {
|
||||
|
||||
ItemStack finish();
|
||||
|
||||
}
|
18
NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTObject.java
Normal file
18
NMS/NMS-API/src/com/songoda/core/nms/nbt/NBTObject.java
Normal file
@ -0,0 +1,18 @@
|
||||
package com.songoda.core.nms.nbt;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface NBTObject {
|
||||
|
||||
String asString();
|
||||
|
||||
boolean asBoolean();
|
||||
|
||||
int asInt();
|
||||
|
||||
long asLong();
|
||||
|
||||
short asShort();
|
||||
|
||||
byte asByte();
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package com.songoda.core.nms.v1_10_R1;
|
||||
package com.songoda.core.nms.v1_10_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CoreNMS;
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class NMS implements CoreNMS {
|
||||
public class AnvilCore implements com.songoda.core.nms.anvil.AnvilCore {
|
||||
|
||||
@Override
|
||||
public CustomAnvil createAnvil(Player player) {
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.core.nms.v1_10_R1;
|
||||
package com.songoda.core.nms.v1_10_R1.anvil;
|
||||
|
||||
import net.minecraft.server.v1_10_R1.IInventory;
|
||||
import org.bukkit.Location;
|
@ -1,7 +1,7 @@
|
||||
package com.songoda.core.nms.v1_10_R1;
|
||||
package com.songoda.core.nms.v1_10_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.methods.AnvilTextChange;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.methods.AnvilTextChange;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
@ -0,0 +1,65 @@
|
||||
package com.songoda.core.nms.v1_10_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_10_R1.NBTTagCompound;
|
||||
|
||||
public class NBTCompoundImpl implements NBTCompound {
|
||||
|
||||
protected NBTTagCompound compound;
|
||||
|
||||
protected NBTCompoundImpl(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public NBTCompoundImpl() {
|
||||
this.compound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, String s) {
|
||||
compound.setString(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, boolean b) {
|
||||
compound.setBoolean(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, int i) {
|
||||
compound.setInt(tag, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, long l) {
|
||||
compound.setLong(tag, l);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, short s) {
|
||||
compound.setShort(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, byte b) {
|
||||
compound.setByte(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String tag) {
|
||||
return compound.hasKey(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTObject getNBTObject(String tag) {
|
||||
return new NBTObjectImpl(compound, tag);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.songoda.core.nms.v1_10_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTCore;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTCoreImpl implements NBTCore {
|
||||
|
||||
@Override
|
||||
public NBTItem of(ItemStack item) {
|
||||
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound newCompound() {
|
||||
return new NBTCompoundImpl();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.songoda.core.nms.v1_10_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import net.minecraft.server.v1_10_R1.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTItemImpl extends NBTCompoundImpl implements NBTItem {
|
||||
|
||||
private net.minecraft.server.v1_10_R1.ItemStack nmsItem;
|
||||
|
||||
public NBTItemImpl(net.minecraft.server.v1_10_R1.ItemStack nmsItem) {
|
||||
super(nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound());
|
||||
this.nmsItem = nmsItem;
|
||||
}
|
||||
|
||||
public ItemStack finish() {
|
||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.nms.v1_10_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_10_R1.NBTTagCompound;
|
||||
|
||||
public class NBTObjectImpl implements NBTObject {
|
||||
|
||||
private final NBTTagCompound compound;
|
||||
private final String tag;
|
||||
|
||||
public NBTObjectImpl(NBTTagCompound compound, String tag) {
|
||||
this.compound = compound;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return compound.getString(tag);
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return compound.getBoolean(tag);
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return compound.getInt(tag);
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return compound.getLong(tag);
|
||||
}
|
||||
|
||||
public short asShort() {
|
||||
return compound.getShort(tag);
|
||||
}
|
||||
|
||||
public byte asByte() {
|
||||
return compound.getByte(tag);
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package com.songoda.core.nms.v1_11_R1;
|
||||
package com.songoda.core.nms.v1_11_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CoreNMS;
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class NMS implements CoreNMS {
|
||||
public class AnvilCore implements com.songoda.core.nms.anvil.AnvilCore {
|
||||
|
||||
@Override
|
||||
public CustomAnvil createAnvil(Player player) {
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.core.nms.v1_11_R1;
|
||||
package com.songoda.core.nms.v1_11_R1.anvil;
|
||||
|
||||
import net.minecraft.server.v1_11_R1.ContainerAnvil;
|
||||
import net.minecraft.server.v1_11_R1.IInventory;
|
@ -1,7 +1,7 @@
|
||||
package com.songoda.core.nms.v1_11_R1;
|
||||
package com.songoda.core.nms.v1_11_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.methods.AnvilTextChange;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.methods.AnvilTextChange;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
@ -0,0 +1,65 @@
|
||||
package com.songoda.core.nms.v1_11_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_11_R1.NBTTagCompound;
|
||||
|
||||
public class NBTCompoundImpl implements NBTCompound {
|
||||
|
||||
protected NBTTagCompound compound;
|
||||
|
||||
protected NBTCompoundImpl(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public NBTCompoundImpl() {
|
||||
this.compound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, String s) {
|
||||
compound.setString(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, boolean b) {
|
||||
compound.setBoolean(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, int i) {
|
||||
compound.setInt(tag, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, long l) {
|
||||
compound.setLong(tag, l);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, short s) {
|
||||
compound.setShort(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, byte b) {
|
||||
compound.setByte(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String tag) {
|
||||
return compound.hasKey(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTObject getNBTObject(String tag) {
|
||||
return new NBTObjectImpl(compound, tag);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.songoda.core.nms.v1_11_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTCore;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTCoreImpl implements NBTCore {
|
||||
|
||||
@Override
|
||||
public NBTItem of(ItemStack item) {
|
||||
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound newCompound() {
|
||||
return new NBTCompoundImpl();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.songoda.core.nms.v1_11_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import net.minecraft.server.v1_11_R1.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_11_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTItemImpl extends NBTCompoundImpl implements NBTItem {
|
||||
|
||||
private net.minecraft.server.v1_11_R1.ItemStack nmsItem;
|
||||
|
||||
public NBTItemImpl(net.minecraft.server.v1_11_R1.ItemStack nmsItem) {
|
||||
super(nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound());
|
||||
this.nmsItem = nmsItem;
|
||||
}
|
||||
|
||||
public ItemStack finish() {
|
||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.nms.v1_11_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_11_R1.NBTTagCompound;
|
||||
|
||||
public class NBTObjectImpl implements NBTObject {
|
||||
|
||||
private final NBTTagCompound compound;
|
||||
private final String tag;
|
||||
|
||||
public NBTObjectImpl(NBTTagCompound compound, String tag) {
|
||||
this.compound = compound;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return compound.getString(tag);
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return compound.getBoolean(tag);
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return compound.getInt(tag);
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return compound.getLong(tag);
|
||||
}
|
||||
|
||||
public short asShort() {
|
||||
return compound.getShort(tag);
|
||||
}
|
||||
|
||||
public byte asByte() {
|
||||
return compound.getByte(tag);
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package com.songoda.core.nms.v1_12_R1;
|
||||
package com.songoda.core.nms.v1_12_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CoreNMS;
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class NMS implements CoreNMS {
|
||||
public class AnvilCore implements com.songoda.core.nms.anvil.AnvilCore {
|
||||
|
||||
@Override
|
||||
public CustomAnvil createAnvil(Player player) {
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.core.nms.v1_12_R1;
|
||||
package com.songoda.core.nms.v1_12_R1.anvil;
|
||||
|
||||
import net.minecraft.server.v1_12_R1.ContainerAnvil;
|
||||
import net.minecraft.server.v1_12_R1.IInventory;
|
@ -1,7 +1,7 @@
|
||||
package com.songoda.core.nms.v1_12_R1;
|
||||
package com.songoda.core.nms.v1_12_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.methods.AnvilTextChange;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.methods.AnvilTextChange;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
@ -0,0 +1,65 @@
|
||||
package com.songoda.core.nms.v1_12_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_12_R1.NBTTagCompound;
|
||||
|
||||
public class NBTCompoundImpl implements NBTCompound {
|
||||
|
||||
protected NBTTagCompound compound;
|
||||
|
||||
protected NBTCompoundImpl(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public NBTCompoundImpl() {
|
||||
this.compound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, String s) {
|
||||
compound.setString(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, boolean b) {
|
||||
compound.setBoolean(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, int i) {
|
||||
compound.setInt(tag, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, long l) {
|
||||
compound.setLong(tag, l);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, short s) {
|
||||
compound.setShort(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, byte b) {
|
||||
compound.setByte(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String tag) {
|
||||
return compound.hasKey(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTObject getNBTObject(String tag) {
|
||||
return new NBTObjectImpl(compound, tag);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.songoda.core.nms.v1_12_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTCore;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTCoreImpl implements NBTCore {
|
||||
|
||||
@Override
|
||||
public NBTItem of(ItemStack item) {
|
||||
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound newCompound() {
|
||||
return new NBTCompoundImpl();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.songoda.core.nms.v1_12_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import net.minecraft.server.v1_12_R1.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTItemImpl extends NBTCompoundImpl implements NBTItem {
|
||||
|
||||
private net.minecraft.server.v1_12_R1.ItemStack nmsItem;
|
||||
|
||||
public NBTItemImpl(net.minecraft.server.v1_12_R1.ItemStack nmsItem) {
|
||||
super(nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound());
|
||||
this.nmsItem = nmsItem;
|
||||
}
|
||||
|
||||
public ItemStack finish() {
|
||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.nms.v1_12_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_12_R1.NBTTagCompound;
|
||||
|
||||
public class NBTObjectImpl implements NBTObject {
|
||||
|
||||
private final NBTTagCompound compound;
|
||||
private final String tag;
|
||||
|
||||
public NBTObjectImpl(NBTTagCompound compound, String tag) {
|
||||
this.compound = compound;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return compound.getString(tag);
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return compound.getBoolean(tag);
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return compound.getInt(tag);
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return compound.getLong(tag);
|
||||
}
|
||||
|
||||
public short asShort() {
|
||||
return compound.getShort(tag);
|
||||
}
|
||||
|
||||
public byte asByte() {
|
||||
return compound.getByte(tag);
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package com.songoda.core.nms.v1_13_R1;
|
||||
package com.songoda.core.nms.v1_13_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CoreNMS;
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import org.bukkit.craftbukkit.v1_13_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class NMS implements CoreNMS {
|
||||
public class AnvilCore implements com.songoda.core.nms.anvil.AnvilCore {
|
||||
|
||||
@Override
|
||||
public CustomAnvil createAnvil(Player player) {
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.core.nms.v1_13_R1;
|
||||
package com.songoda.core.nms.v1_13_R1.anvil;
|
||||
|
||||
import net.minecraft.server.v1_13_R1.ContainerAnvil;
|
||||
import net.minecraft.server.v1_13_R1.IInventory;
|
@ -1,28 +1,23 @@
|
||||
package com.songoda.core.nms.v1_13_R1;
|
||||
package com.songoda.core.nms.v1_13_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.methods.AnvilTextChange;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import net.minecraft.server.v1_13_R1.BlockPosition;
|
||||
import net.minecraft.server.v1_13_R1.ChatMessage;
|
||||
import net.minecraft.server.v1_13_R1.ContainerAnvil;
|
||||
import net.minecraft.server.v1_13_R1.EntityHuman;
|
||||
import net.minecraft.server.v1_13_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_13_R1.IInventory;
|
||||
import net.minecraft.server.v1_13_R1.PacketPlayOutOpenWindow;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.methods.AnvilTextChange;
|
||||
import net.minecraft.server.v1_13_R1.*;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_13_R1.inventory.CraftInventoryView;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class AnvilView extends ContainerAnvil implements CustomAnvil {
|
||||
|
||||
EntityPlayer entity;
|
||||
Inventory inventory;
|
||||
String title = "Repairing";
|
||||
private final EntityPlayer entity;
|
||||
private final Inventory inventory;
|
||||
private String title = "Repairing";
|
||||
private int cost = -1;
|
||||
private boolean canUse = true;
|
||||
private AnvilTextChange textChange = null;
|
||||
@ -34,21 +29,12 @@ public class AnvilView extends ContainerAnvil implements CustomAnvil {
|
||||
|
||||
static {
|
||||
try {
|
||||
mc_ContainerAnvil_bukkitEntity = ContainerAnvil.class.getDeclaredField("bukkitEntity");
|
||||
mc_ContainerAnvil_bukkitEntity.setAccessible(true);
|
||||
mc_ContainerAnvil_repairInventory = ContainerAnvil.class.getDeclaredField("repairInventory");
|
||||
mc_ContainerAnvil_repairInventory.setAccessible(true);
|
||||
mc_ContainerAnvil_resultInventory = ContainerAnvil.class.getDeclaredField("resultInventory");
|
||||
mc_ContainerAnvil_resultInventory.setAccessible(true);
|
||||
} catch (NoSuchFieldException ignore) {
|
||||
try {
|
||||
mc_ContainerAnvil_repairInventory = ContainerAnvil.class.getDeclaredField("h");
|
||||
mc_ContainerAnvil_repairInventory.setAccessible(true);
|
||||
mc_ContainerAnvil_resultInventory = ContainerAnvil.class.getDeclaredField("g");
|
||||
mc_ContainerAnvil_resultInventory.setAccessible(true);
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(AnvilView.class.getName()).log(Level.SEVERE, "Anvil Setup Error", ex);
|
||||
}
|
||||
mc_ContainerAnvil_bukkitEntity = ContainerAnvil.class.getDeclaredField("bukkitEntity");
|
||||
mc_ContainerAnvil_bukkitEntity.setAccessible(true);
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(AnvilView.class.getName()).log(Level.SEVERE, "Anvil Setup Error", ex);
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.songoda.core.nms.v1_13_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_13_R1.NBTTagCompound;
|
||||
|
||||
public class NBTCompoundImpl implements NBTCompound {
|
||||
|
||||
protected NBTTagCompound compound;
|
||||
|
||||
protected NBTCompoundImpl(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public NBTCompoundImpl() {
|
||||
this.compound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, String s) {
|
||||
compound.setString(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, boolean b) {
|
||||
compound.setBoolean(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, int i) {
|
||||
compound.setInt(tag, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, long l) {
|
||||
compound.setLong(tag, l);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, short s) {
|
||||
compound.setShort(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, byte b) {
|
||||
compound.setByte(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String tag) {
|
||||
return compound.hasKey(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTObject getNBTObject(String tag) {
|
||||
return new NBTObjectImpl(compound, tag);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.songoda.core.nms.v1_13_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTCore;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTCoreImpl implements NBTCore {
|
||||
|
||||
@Override
|
||||
public NBTItem of(ItemStack item) {
|
||||
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound newCompound() {
|
||||
return new NBTCompoundImpl();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.songoda.core.nms.v1_13_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import net.minecraft.server.v1_13_R1.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_13_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTItemImpl extends NBTCompoundImpl implements NBTItem {
|
||||
|
||||
private net.minecraft.server.v1_13_R1.ItemStack nmsItem;
|
||||
|
||||
public NBTItemImpl(net.minecraft.server.v1_13_R1.ItemStack nmsItem) {
|
||||
super(nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound());
|
||||
this.nmsItem = nmsItem;
|
||||
}
|
||||
|
||||
public ItemStack finish() {
|
||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.nms.v1_13_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_13_R1.NBTTagCompound;
|
||||
|
||||
public class NBTObjectImpl implements NBTObject {
|
||||
|
||||
private final NBTTagCompound compound;
|
||||
private final String tag;
|
||||
|
||||
public NBTObjectImpl(NBTTagCompound compound, String tag) {
|
||||
this.compound = compound;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return compound.getString(tag);
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return compound.getBoolean(tag);
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return compound.getInt(tag);
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return compound.getLong(tag);
|
||||
}
|
||||
|
||||
public short asShort() {
|
||||
return compound.getShort(tag);
|
||||
}
|
||||
|
||||
public byte asByte() {
|
||||
return compound.getByte(tag);
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package com.songoda.core.nms.v1_13_R2;
|
||||
package com.songoda.core.nms.v1_13_R2.anvil;
|
||||
|
||||
import com.songoda.core.nms.CoreNMS;
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class NMS implements CoreNMS {
|
||||
public class AnvilCore implements com.songoda.core.nms.anvil.AnvilCore {
|
||||
|
||||
@Override
|
||||
public CustomAnvil createAnvil(Player player) {
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.core.nms.v1_13_R2;
|
||||
package com.songoda.core.nms.v1_13_R2.anvil;
|
||||
|
||||
import net.minecraft.server.v1_13_R2.ContainerAnvil;
|
||||
import net.minecraft.server.v1_13_R2.IInventory;
|
@ -1,7 +1,7 @@
|
||||
package com.songoda.core.nms.v1_13_R2;
|
||||
package com.songoda.core.nms.v1_13_R2.anvil;
|
||||
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.methods.AnvilTextChange;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.methods.AnvilTextChange;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
@ -0,0 +1,65 @@
|
||||
package com.songoda.core.nms.v1_13_R2.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||
|
||||
public class NBTCompoundImpl implements NBTCompound {
|
||||
|
||||
protected NBTTagCompound compound;
|
||||
|
||||
protected NBTCompoundImpl(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public NBTCompoundImpl() {
|
||||
this.compound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, String s) {
|
||||
compound.setString(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, boolean b) {
|
||||
compound.setBoolean(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, int i) {
|
||||
compound.setInt(tag, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, long l) {
|
||||
compound.setLong(tag, l);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, short s) {
|
||||
compound.setShort(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, byte b) {
|
||||
compound.setByte(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String tag) {
|
||||
return compound.hasKey(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTObject getNBTObject(String tag) {
|
||||
return new NBTObjectImpl(compound, tag);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.songoda.core.nms.v1_13_R2.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTCore;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTCoreImpl implements NBTCore {
|
||||
|
||||
@Override
|
||||
public NBTItem of(ItemStack item) {
|
||||
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound newCompound() {
|
||||
return new NBTCompoundImpl();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.songoda.core.nms.v1_13_R2.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_13_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTItemImpl extends NBTCompoundImpl implements NBTItem {
|
||||
|
||||
private net.minecraft.server.v1_13_R2.ItemStack nmsItem;
|
||||
|
||||
public NBTItemImpl(net.minecraft.server.v1_13_R2.ItemStack nmsItem) {
|
||||
super(nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound());
|
||||
this.nmsItem = nmsItem;
|
||||
}
|
||||
|
||||
public ItemStack finish() {
|
||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.nms.v1_13_R2.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_13_R2.NBTTagCompound;
|
||||
|
||||
public class NBTObjectImpl implements NBTObject {
|
||||
|
||||
private final NBTTagCompound compound;
|
||||
private final String tag;
|
||||
|
||||
public NBTObjectImpl(NBTTagCompound compound, String tag) {
|
||||
this.compound = compound;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return compound.getString(tag);
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return compound.getBoolean(tag);
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return compound.getInt(tag);
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return compound.getLong(tag);
|
||||
}
|
||||
|
||||
public short asShort() {
|
||||
return compound.getShort(tag);
|
||||
}
|
||||
|
||||
public byte asByte() {
|
||||
return compound.getByte(tag);
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +1,12 @@
|
||||
package com.songoda.core.nms.v1_14_R1;
|
||||
package com.songoda.core.nms.v1_14_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CoreNMS;
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import net.minecraft.server.v1_14_R1.EntityPlayer;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class NMS implements CoreNMS {
|
||||
public class AnvilCore implements com.songoda.core.nms.anvil.AnvilCore {
|
||||
|
||||
@Override
|
||||
public CustomAnvil createAnvil(Player player) {
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.core.nms.v1_14_R1;
|
||||
package com.songoda.core.nms.v1_14_R1.anvil;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.ContainerAnvil;
|
||||
import net.minecraft.server.v1_14_R1.IInventory;
|
@ -1,7 +1,7 @@
|
||||
package com.songoda.core.nms.v1_14_R1;
|
||||
package com.songoda.core.nms.v1_14_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.methods.AnvilTextChange;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.methods.AnvilTextChange;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.logging.Level;
|
@ -0,0 +1,65 @@
|
||||
package com.songoda.core.nms.v1_14_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_14_R1.NBTTagCompound;
|
||||
|
||||
public class NBTCompoundImpl implements NBTCompound {
|
||||
|
||||
protected NBTTagCompound compound;
|
||||
|
||||
protected NBTCompoundImpl(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public NBTCompoundImpl() {
|
||||
this.compound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, String s) {
|
||||
compound.setString(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, boolean b) {
|
||||
compound.setBoolean(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, int i) {
|
||||
compound.setInt(tag, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, long l) {
|
||||
compound.setLong(tag, l);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, short s) {
|
||||
compound.setShort(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, byte b) {
|
||||
compound.setByte(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String tag) {
|
||||
return compound.hasKey(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTObject getNBTObject(String tag) {
|
||||
return new NBTObjectImpl(compound, tag);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.songoda.core.nms.v1_14_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTCore;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTCoreImpl implements NBTCore {
|
||||
|
||||
@Override
|
||||
public NBTItem of(ItemStack item) {
|
||||
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound newCompound() {
|
||||
return new NBTCompoundImpl();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.songoda.core.nms.v1_14_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import net.minecraft.server.v1_14_R1.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTItemImpl extends NBTCompoundImpl implements NBTItem {
|
||||
|
||||
private net.minecraft.server.v1_14_R1.ItemStack nmsItem;
|
||||
|
||||
public NBTItemImpl(net.minecraft.server.v1_14_R1.ItemStack nmsItem) {
|
||||
super(nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound());
|
||||
this.nmsItem = nmsItem;
|
||||
}
|
||||
|
||||
public ItemStack finish() {
|
||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.nms.v1_14_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_14_R1.NBTTagCompound;
|
||||
|
||||
public class NBTObjectImpl implements NBTObject {
|
||||
|
||||
private final NBTTagCompound compound;
|
||||
private final String tag;
|
||||
|
||||
public NBTObjectImpl(NBTTagCompound compound, String tag) {
|
||||
this.compound = compound;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return compound.getString(tag);
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return compound.getBoolean(tag);
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return compound.getInt(tag);
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return compound.getLong(tag);
|
||||
}
|
||||
|
||||
public short asShort() {
|
||||
return compound.getShort(tag);
|
||||
}
|
||||
|
||||
public byte asByte() {
|
||||
return compound.getByte(tag);
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +1,12 @@
|
||||
package com.songoda.core.nms.v1_15_R1;
|
||||
package com.songoda.core.nms.v1_15_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CoreNMS;
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import net.minecraft.server.v1_15_R1.EntityPlayer;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class NMS implements CoreNMS {
|
||||
public class AnvilCore implements com.songoda.core.nms.anvil.AnvilCore {
|
||||
|
||||
@Override
|
||||
public CustomAnvil createAnvil(Player player) {
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.core.nms.v1_15_R1;
|
||||
package com.songoda.core.nms.v1_15_R1.anvil;
|
||||
|
||||
import net.minecraft.server.v1_15_R1.ContainerAnvil;
|
||||
import net.minecraft.server.v1_15_R1.IInventory;
|
@ -1,7 +1,7 @@
|
||||
package com.songoda.core.nms.v1_15_R1;
|
||||
package com.songoda.core.nms.v1_15_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.methods.AnvilTextChange;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.methods.AnvilTextChange;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
@ -0,0 +1,68 @@
|
||||
package com.songoda.core.nms.v1_15_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_15_R1.NBTTagCompound;
|
||||
import net.minecraft.server.v1_15_R1.NBTTagList;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class NBTCompoundImpl implements NBTCompound {
|
||||
|
||||
protected NBTTagCompound compound;
|
||||
|
||||
protected NBTCompoundImpl(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public NBTCompoundImpl() {
|
||||
this.compound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, String s) {
|
||||
compound.setString(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, boolean b) {
|
||||
compound.setBoolean(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, int i) {
|
||||
compound.setInt(tag, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, long l) {
|
||||
compound.setLong(tag, l);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, short s) {
|
||||
compound.setShort(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, byte b) {
|
||||
compound.setByte(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String tag) {
|
||||
return compound.hasKey(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTObject getNBTObject(String tag) {
|
||||
return new NBTObjectImpl(compound, tag);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.songoda.core.nms.v1_15_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTCore;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTCoreImpl implements NBTCore {
|
||||
|
||||
@Override
|
||||
public NBTItem of(ItemStack item) {
|
||||
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound newCompound() {
|
||||
return new NBTCompoundImpl();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.songoda.core.nms.v1_15_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import net.minecraft.server.v1_15_R1.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTItemImpl extends NBTCompoundImpl implements NBTItem {
|
||||
|
||||
private net.minecraft.server.v1_15_R1.ItemStack nmsItem;
|
||||
|
||||
public NBTItemImpl(net.minecraft.server.v1_15_R1.ItemStack nmsItem) {
|
||||
super(nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound());
|
||||
this.nmsItem = nmsItem;
|
||||
}
|
||||
|
||||
public ItemStack finish() {
|
||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.nms.v1_15_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_15_R1.NBTTagCompound;
|
||||
|
||||
public class NBTObjectImpl implements NBTObject {
|
||||
|
||||
private final NBTTagCompound compound;
|
||||
private final String tag;
|
||||
|
||||
public NBTObjectImpl(NBTTagCompound compound, String tag) {
|
||||
this.compound = compound;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return compound.getString(tag);
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return compound.getBoolean(tag);
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return compound.getInt(tag);
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return compound.getLong(tag);
|
||||
}
|
||||
|
||||
public short asShort() {
|
||||
return compound.getShort(tag);
|
||||
}
|
||||
|
||||
public byte asByte() {
|
||||
return compound.getByte(tag);
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package com.songoda.core.nms.v1_8_R1;
|
||||
package com.songoda.core.nms.v1_8_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CoreNMS;
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class NMS implements CoreNMS {
|
||||
public class AnvilCore implements com.songoda.core.nms.anvil.AnvilCore {
|
||||
|
||||
@Override
|
||||
public CustomAnvil createAnvil(Player player) {
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.core.nms.v1_8_R1;
|
||||
package com.songoda.core.nms.v1_8_R1.anvil;
|
||||
|
||||
import net.minecraft.server.v1_8_R1.IInventory;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftInventoryAnvil;
|
@ -1,7 +1,7 @@
|
||||
package com.songoda.core.nms.v1_8_R1;
|
||||
package com.songoda.core.nms.v1_8_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.methods.AnvilTextChange;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.methods.AnvilTextChange;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
@ -0,0 +1,65 @@
|
||||
package com.songoda.core.nms.v1_8_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_8_R1.NBTTagCompound;
|
||||
|
||||
public class NBTCompoundImpl implements NBTCompound {
|
||||
|
||||
protected NBTTagCompound compound;
|
||||
|
||||
protected NBTCompoundImpl(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public NBTCompoundImpl() {
|
||||
this.compound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, String s) {
|
||||
compound.setString(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, boolean b) {
|
||||
compound.setBoolean(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, int i) {
|
||||
compound.setInt(tag, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, long l) {
|
||||
compound.setLong(tag, l);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, short s) {
|
||||
compound.setShort(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, byte b) {
|
||||
compound.setByte(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String tag) {
|
||||
return compound.hasKey(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTObject getNBTObject(String tag) {
|
||||
return new NBTObjectImpl(compound, tag);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.songoda.core.nms.v1_8_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTCore;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTCoreImpl implements NBTCore {
|
||||
|
||||
@Override
|
||||
public NBTItem of(ItemStack item) {
|
||||
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound newCompound() {
|
||||
return new NBTCompoundImpl();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.songoda.core.nms.v1_8_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import net.minecraft.server.v1_8_R1.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTItemImpl extends NBTCompoundImpl implements NBTItem {
|
||||
|
||||
private net.minecraft.server.v1_8_R1.ItemStack nmsItem;
|
||||
|
||||
public NBTItemImpl(net.minecraft.server.v1_8_R1.ItemStack nmsItem) {
|
||||
super(nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound());
|
||||
this.nmsItem = nmsItem;
|
||||
}
|
||||
|
||||
public ItemStack finish() {
|
||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.nms.v1_8_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_8_R1.NBTTagCompound;
|
||||
|
||||
public class NBTObjectImpl implements NBTObject {
|
||||
|
||||
private final NBTTagCompound compound;
|
||||
private final String tag;
|
||||
|
||||
public NBTObjectImpl(NBTTagCompound compound, String tag) {
|
||||
this.compound = compound;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return compound.getString(tag);
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return compound.getBoolean(tag);
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return compound.getInt(tag);
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return compound.getLong(tag);
|
||||
}
|
||||
|
||||
public short asShort() {
|
||||
return compound.getShort(tag);
|
||||
}
|
||||
|
||||
public byte asByte() {
|
||||
return compound.getByte(tag);
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package com.songoda.core.nms.v1_8_R2;
|
||||
package com.songoda.core.nms.v1_8_R2.anvil;
|
||||
|
||||
import com.songoda.core.nms.CoreNMS;
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class NMS implements CoreNMS {
|
||||
public class AnvilCore implements com.songoda.core.nms.anvil.AnvilCore {
|
||||
|
||||
@Override
|
||||
public CustomAnvil createAnvil(Player player) {
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.core.nms.v1_8_R2;
|
||||
package com.songoda.core.nms.v1_8_R2.anvil;
|
||||
|
||||
import net.minecraft.server.v1_8_R2.IInventory;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftInventoryAnvil;
|
@ -1,7 +1,7 @@
|
||||
package com.songoda.core.nms.v1_8_R2;
|
||||
package com.songoda.core.nms.v1_8_R2.anvil;
|
||||
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.methods.AnvilTextChange;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.methods.AnvilTextChange;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
@ -0,0 +1,65 @@
|
||||
package com.songoda.core.nms.v1_8_R2.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_8_R2.NBTTagCompound;
|
||||
|
||||
public class NBTCompoundImpl implements NBTCompound {
|
||||
|
||||
protected NBTTagCompound compound;
|
||||
|
||||
protected NBTCompoundImpl(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public NBTCompoundImpl() {
|
||||
this.compound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, String s) {
|
||||
compound.setString(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, boolean b) {
|
||||
compound.setBoolean(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, int i) {
|
||||
compound.setInt(tag, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, long l) {
|
||||
compound.setLong(tag, l);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, short s) {
|
||||
compound.setShort(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, byte b) {
|
||||
compound.setByte(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String tag) {
|
||||
return compound.hasKey(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTObject getNBTObject(String tag) {
|
||||
return new NBTObjectImpl(compound, tag);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.songoda.core.nms.v1_8_R2.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTCore;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTCoreImpl implements NBTCore {
|
||||
|
||||
@Override
|
||||
public NBTItem of(ItemStack item) {
|
||||
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound newCompound() {
|
||||
return new NBTCompoundImpl();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.songoda.core.nms.v1_8_R2.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import net.minecraft.server.v1_8_R2.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTItemImpl extends NBTCompoundImpl implements NBTItem {
|
||||
|
||||
private net.minecraft.server.v1_8_R2.ItemStack nmsItem;
|
||||
|
||||
public NBTItemImpl(net.minecraft.server.v1_8_R2.ItemStack nmsItem) {
|
||||
super(nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound());
|
||||
this.nmsItem = nmsItem;
|
||||
}
|
||||
|
||||
public ItemStack finish() {
|
||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.nms.v1_8_R2.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_8_R2.NBTTagCompound;
|
||||
|
||||
public class NBTObjectImpl implements NBTObject {
|
||||
|
||||
private final NBTTagCompound compound;
|
||||
private final String tag;
|
||||
|
||||
public NBTObjectImpl(NBTTagCompound compound, String tag) {
|
||||
this.compound = compound;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return compound.getString(tag);
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return compound.getBoolean(tag);
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return compound.getInt(tag);
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return compound.getLong(tag);
|
||||
}
|
||||
|
||||
public short asShort() {
|
||||
return compound.getShort(tag);
|
||||
}
|
||||
|
||||
public byte asByte() {
|
||||
return compound.getByte(tag);
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package com.songoda.core.nms.v1_8_R3;
|
||||
package com.songoda.core.nms.v1_8_R3.anvil;
|
||||
|
||||
import com.songoda.core.nms.CoreNMS;
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class NMS implements CoreNMS {
|
||||
public class AnvilCore implements com.songoda.core.nms.anvil.AnvilCore {
|
||||
|
||||
@Override
|
||||
public CustomAnvil createAnvil(Player player) {
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.core.nms.v1_8_R3;
|
||||
package com.songoda.core.nms.v1_8_R3.anvil;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.IInventory;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventoryAnvil;
|
@ -1,7 +1,7 @@
|
||||
package com.songoda.core.nms.v1_8_R3;
|
||||
package com.songoda.core.nms.v1_8_R3.anvil;
|
||||
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.methods.AnvilTextChange;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.methods.AnvilTextChange;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
@ -0,0 +1,65 @@
|
||||
package com.songoda.core.nms.v1_8_R3.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||
|
||||
public class NBTCompoundImpl implements NBTCompound {
|
||||
|
||||
protected NBTTagCompound compound;
|
||||
|
||||
protected NBTCompoundImpl(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public NBTCompoundImpl() {
|
||||
this.compound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, String s) {
|
||||
compound.setString(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, boolean b) {
|
||||
compound.setBoolean(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, int i) {
|
||||
compound.setInt(tag, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, long l) {
|
||||
compound.setLong(tag, l);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, short s) {
|
||||
compound.setShort(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, byte b) {
|
||||
compound.setByte(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String tag) {
|
||||
return compound.hasKey(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTObject getNBTObject(String tag) {
|
||||
return new NBTObjectImpl(compound, tag);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.songoda.core.nms.v1_8_R3.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTCore;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTCoreImpl implements NBTCore {
|
||||
|
||||
@Override
|
||||
public NBTItem of(ItemStack item) {
|
||||
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound newCompound() {
|
||||
return new NBTCompoundImpl();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.songoda.core.nms.v1_8_R3.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTItemImpl extends NBTCompoundImpl implements NBTItem {
|
||||
|
||||
private net.minecraft.server.v1_8_R3.ItemStack nmsItem;
|
||||
|
||||
public NBTItemImpl(net.minecraft.server.v1_8_R3.ItemStack nmsItem) {
|
||||
super(nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound());
|
||||
this.nmsItem = nmsItem;
|
||||
}
|
||||
|
||||
public ItemStack finish() {
|
||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.nms.v1_8_R3.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||
|
||||
public class NBTObjectImpl implements NBTObject {
|
||||
|
||||
private final NBTTagCompound compound;
|
||||
private final String tag;
|
||||
|
||||
public NBTObjectImpl(NBTTagCompound compound, String tag) {
|
||||
this.compound = compound;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return compound.getString(tag);
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return compound.getBoolean(tag);
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return compound.getInt(tag);
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return compound.getLong(tag);
|
||||
}
|
||||
|
||||
public short asShort() {
|
||||
return compound.getShort(tag);
|
||||
}
|
||||
|
||||
public byte asByte() {
|
||||
return compound.getByte(tag);
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package com.songoda.core.nms.v1_9_R1;
|
||||
package com.songoda.core.nms.v1_9_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CoreNMS;
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class NMS implements CoreNMS {
|
||||
public class AnvilCore implements com.songoda.core.nms.anvil.AnvilCore {
|
||||
|
||||
@Override
|
||||
public CustomAnvil createAnvil(Player player) {
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.core.nms.v1_9_R1;
|
||||
package com.songoda.core.nms.v1_9_R1.anvil;
|
||||
|
||||
import net.minecraft.server.v1_9_R1.IInventory;
|
||||
import org.bukkit.Location;
|
@ -1,7 +1,7 @@
|
||||
package com.songoda.core.nms.v1_9_R1;
|
||||
package com.songoda.core.nms.v1_9_R1.anvil;
|
||||
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.methods.AnvilTextChange;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.methods.AnvilTextChange;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
@ -0,0 +1,65 @@
|
||||
package com.songoda.core.nms.v1_9_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_9_R1.NBTTagCompound;
|
||||
|
||||
public class NBTCompoundImpl implements NBTCompound {
|
||||
|
||||
protected NBTTagCompound compound;
|
||||
|
||||
protected NBTCompoundImpl(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public NBTCompoundImpl() {
|
||||
this.compound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, String s) {
|
||||
compound.setString(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, boolean b) {
|
||||
compound.setBoolean(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, int i) {
|
||||
compound.setInt(tag, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, long l) {
|
||||
compound.setLong(tag, l);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, short s) {
|
||||
compound.setShort(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, byte b) {
|
||||
compound.setByte(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String tag) {
|
||||
return compound.hasKey(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTObject getNBTObject(String tag) {
|
||||
return new NBTObjectImpl(compound, tag);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.songoda.core.nms.v1_9_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTCore;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTCoreImpl implements NBTCore {
|
||||
|
||||
@Override
|
||||
public NBTItem of(ItemStack item) {
|
||||
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound newCompound() {
|
||||
return new NBTCompoundImpl();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.songoda.core.nms.v1_9_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import net.minecraft.server.v1_9_R1.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTItemImpl extends NBTCompoundImpl implements NBTItem {
|
||||
|
||||
private net.minecraft.server.v1_9_R1.ItemStack nmsItem;
|
||||
|
||||
public NBTItemImpl(net.minecraft.server.v1_9_R1.ItemStack nmsItem) {
|
||||
super(nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound());
|
||||
this.nmsItem = nmsItem;
|
||||
}
|
||||
|
||||
public ItemStack finish() {
|
||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.nms.v1_9_R1.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_9_R1.NBTTagCompound;
|
||||
|
||||
public class NBTObjectImpl implements NBTObject {
|
||||
|
||||
private final NBTTagCompound compound;
|
||||
private final String tag;
|
||||
|
||||
public NBTObjectImpl(NBTTagCompound compound, String tag) {
|
||||
this.compound = compound;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return compound.getString(tag);
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return compound.getBoolean(tag);
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return compound.getInt(tag);
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return compound.getLong(tag);
|
||||
}
|
||||
|
||||
public short asShort() {
|
||||
return compound.getShort(tag);
|
||||
}
|
||||
|
||||
public byte asByte() {
|
||||
return compound.getByte(tag);
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
package com.songoda.core.nms.v1_9_R2;
|
||||
package com.songoda.core.nms.v1_9_R2.anvil;
|
||||
|
||||
import com.songoda.core.nms.CoreNMS;
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
public class NMS implements CoreNMS {
|
||||
public class AnvilCore implements com.songoda.core.nms.anvil.AnvilCore {
|
||||
|
||||
@Override
|
||||
public CustomAnvil createAnvil(Player player) {
|
@ -1,4 +1,4 @@
|
||||
package com.songoda.core.nms.v1_9_R2;
|
||||
package com.songoda.core.nms.v1_9_R2.anvil;
|
||||
|
||||
import net.minecraft.server.v1_9_R2.IInventory;
|
||||
import org.bukkit.Location;
|
@ -1,7 +1,7 @@
|
||||
package com.songoda.core.nms.v1_9_R2;
|
||||
package com.songoda.core.nms.v1_9_R2.anvil;
|
||||
|
||||
import com.songoda.core.nms.CustomAnvil;
|
||||
import com.songoda.core.nms.methods.AnvilTextChange;
|
||||
import com.songoda.core.nms.anvil.CustomAnvil;
|
||||
import com.songoda.core.nms.anvil.methods.AnvilTextChange;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
@ -0,0 +1,65 @@
|
||||
package com.songoda.core.nms.v1_9_R2.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_9_R2.NBTTagCompound;
|
||||
|
||||
public class NBTCompoundImpl implements NBTCompound {
|
||||
|
||||
protected NBTTagCompound compound;
|
||||
|
||||
protected NBTCompoundImpl(NBTTagCompound compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
|
||||
public NBTCompoundImpl() {
|
||||
this.compound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, String s) {
|
||||
compound.setString(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, boolean b) {
|
||||
compound.setBoolean(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, int i) {
|
||||
compound.setInt(tag, i);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, long l) {
|
||||
compound.setLong(tag, l);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, short s) {
|
||||
compound.setShort(tag, s);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound set(String tag, byte b) {
|
||||
compound.setByte(tag, b);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String tag) {
|
||||
return compound.hasKey(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTObject getNBTObject(String tag) {
|
||||
return new NBTObjectImpl(compound, tag);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.songoda.core.nms.v1_9_R2.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTCompound;
|
||||
import com.songoda.core.nms.nbt.NBTCore;
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTCoreImpl implements NBTCore {
|
||||
|
||||
@Override
|
||||
public NBTItem of(ItemStack item) {
|
||||
return new NBTItemImpl(CraftItemStack.asNMSCopy(item));
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTCompound newCompound() {
|
||||
return new NBTCompoundImpl();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package com.songoda.core.nms.v1_9_R2.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTItem;
|
||||
import net.minecraft.server.v1_9_R2.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class NBTItemImpl extends NBTCompoundImpl implements NBTItem {
|
||||
|
||||
private net.minecraft.server.v1_9_R2.ItemStack nmsItem;
|
||||
|
||||
public NBTItemImpl(net.minecraft.server.v1_9_R2.ItemStack nmsItem) {
|
||||
super(nmsItem.hasTag() ? nmsItem.getTag() : new NBTTagCompound());
|
||||
this.nmsItem = nmsItem;
|
||||
}
|
||||
|
||||
public ItemStack finish() {
|
||||
return CraftItemStack.asBukkitCopy(nmsItem);
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.songoda.core.nms.v1_9_R2.nbt;
|
||||
|
||||
import com.songoda.core.nms.nbt.NBTObject;
|
||||
import net.minecraft.server.v1_9_R2.NBTTagCompound;
|
||||
|
||||
public class NBTObjectImpl implements NBTObject {
|
||||
|
||||
private final NBTTagCompound compound;
|
||||
private final String tag;
|
||||
|
||||
public NBTObjectImpl(NBTTagCompound compound, String tag) {
|
||||
this.compound = compound;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public String asString() {
|
||||
return compound.getString(tag);
|
||||
}
|
||||
|
||||
public boolean asBoolean() {
|
||||
return compound.getBoolean(tag);
|
||||
}
|
||||
|
||||
public int asInt() {
|
||||
return compound.getInt(tag);
|
||||
}
|
||||
|
||||
public long asLong() {
|
||||
return compound.getLong(tag);
|
||||
}
|
||||
|
||||
public short asShort() {
|
||||
return compound.getShort(tag);
|
||||
}
|
||||
|
||||
public byte asByte() {
|
||||
return compound.getByte(tag);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user