mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
Refactor some Type names and javadocs
This commit is contained in:
parent
fdb900ec5d
commit
9911c406f8
@ -3,5 +3,11 @@ package com.gmail.nossr50.core.adapters;
|
||||
import com.gmail.nossr50.core.nbt.NBTBase;
|
||||
|
||||
public interface NBTAdapter {
|
||||
|
||||
/**
|
||||
* Transform our NBT type representation to its implementation on the target platform
|
||||
* @param nbtBase target NBT type representation
|
||||
* @return platform specific implementation of our NBT Type
|
||||
*/
|
||||
Object asNative(NBTBase nbtBase);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public class BukkitNBTAdapter implements NBTAdapter {
|
||||
case SHORT:
|
||||
return asNativeNBTShort((NBTShort) nbtBase);
|
||||
case INT:
|
||||
return asNativeNBTInt((NBTInteger) nbtBase);
|
||||
return asNativeNBTInt((NBTInt) nbtBase);
|
||||
case LONG:
|
||||
return asNativeNBTLong((NBTLong) nbtBase);
|
||||
case FLOAT:
|
||||
@ -34,9 +34,9 @@ public class BukkitNBTAdapter implements NBTAdapter {
|
||||
case COMPOUND:
|
||||
return ;
|
||||
case INT_ARRAY:
|
||||
break;
|
||||
return asNativeNBTIntArray((NBTIntArray) nbtBase);
|
||||
case LONG_ARRAY:
|
||||
break;
|
||||
return asNativeNBTLongArray((NBTLongArray) nbtBase);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -51,42 +51,105 @@ public class BukkitNBTAdapter implements NBTAdapter {
|
||||
return new NBTTagByte(nbtByte.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a NBTTagShort (NMS Type) from our NBTShort representation
|
||||
* @param nbtShort target NBTShort
|
||||
* @return NBTTagShort copy of our NBTShort representation
|
||||
*/
|
||||
private NBTTagShort asNativeNBTShort(NBTShort nbtShort) {
|
||||
return new NBTTagShort(nbtShort.getValue());
|
||||
}
|
||||
|
||||
private NBTTagInt asNativeNBTInt(NBTInteger nbtInteger) {
|
||||
return new NBTTagInt(nbtInteger.getValue());
|
||||
/**
|
||||
* Create a NBTTagInt (NMS Type) from our NBTInt representation
|
||||
* @param nbtInt target NBTInt
|
||||
* @return NBTTagInt copy of our NBTInt representation
|
||||
*/
|
||||
private NBTTagInt asNativeNBTInt(NBTInt nbtInt) {
|
||||
return new NBTTagInt(nbtInt.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a NBTTagLong (NMS Type) from our NBTLong representation
|
||||
* @param nbtLong target NBTLong
|
||||
* @return NBTTagLong copy of our NBTLong representation
|
||||
*/
|
||||
private NBTTagLong asNativeNBTLong(NBTLong nbtLong) {
|
||||
return new NBTTagLong(nbtLong.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a NBTTagFloat (NMS Type) from our NBTFloat representation
|
||||
* @param nbtFloat target NBTFloat
|
||||
* @return NBTTagFloat copy of our NBTFloat representation
|
||||
*/
|
||||
private NBTTagFloat asNativeNBTFloat(NBTFloat nbtFloat) {
|
||||
return new NBTTagFloat(nbtFloat.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a NBTTagDouble (NMS Type) from our NBTDouble representation
|
||||
* @param nbtDouble target NBTDouble
|
||||
* @return NBTTagDouble copy of our NBTDouble representation
|
||||
*/
|
||||
private NBTTagDouble asNativeNBTDouble(NBTDouble nbtDouble) {
|
||||
return new NBTTagDouble(nbtDouble.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a NBTTagByteArray (NMS Type) from our NBTByteArray representation
|
||||
* @param nbtByteArray target NBTByteArray
|
||||
* @return NBTTagByteArray copy of our NBTByteArray representation
|
||||
*/
|
||||
private NBTTagByteArray asNativeNBTByteArray(NBTByteArray nbtByteArray) {
|
||||
return new NBTTagByteArray(nbtByteArray.getValues());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a NBTTagString (NMS Type) from our NBTString representation
|
||||
* @param nbtString target NBTString
|
||||
* @return NBTTagString copy of our NBTString representation
|
||||
*/
|
||||
private NBTTagString asNativeNBTString(NBTString nbtString) {
|
||||
return new NBTTagString(nbtString.getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a NBTTagList (NMS Type) from our NBTList representation
|
||||
* @param nbtList target NBTList
|
||||
* @return NBTTagList copy of our NBTList representation
|
||||
*/
|
||||
private NBTTagList asNativeNBTList(NBTList nbtList) {
|
||||
NBTTagList nbtTagList = new NBTTagList();
|
||||
nbtList.setValues(nbtList.getValues());
|
||||
return nbtTagList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a NBTTagCompound (NMS Type) from our NBTCompound representation
|
||||
* @param nbtCompound target NBTCompound
|
||||
* @return NBTTagCompound copy of our NBTCompound representation
|
||||
*/
|
||||
private NBTTagCompound asNativeNBTCompound(NBTCompound nbtCompound) {
|
||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||
nbtCompound
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a NBTTagIntArray (NMS Type) from our NBTIntArray representation
|
||||
* @param nbtIntArray target NBTIntArray
|
||||
* @return NBTTagIntArray copy of our NBTIntArray representation
|
||||
*/
|
||||
private NBTTagIntArray asNativeNBTIntArray(NBTIntArray nbtIntArray) {
|
||||
return new NBTTagIntArray(nbtIntArray.getValues());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a NBTTagLongArray (NMS Type) from our NBTLongArray representation
|
||||
* @param nbtLongArray target NBTLongArray
|
||||
* @return NBTTagLongArray copy of our NBTLongArray representation
|
||||
*/
|
||||
private NBTTagLongArray asNativeNBTLongArray(NBTLongArray nbtLongArray) {
|
||||
return new NBTTagLongArray(nbtLongArray.getValues());
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,10 @@ public abstract class PlatformAdapter {
|
||||
this.nbtAdapter = nbtAdapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the NBT Adapter for this platform
|
||||
* @return the platform's NBT adapter
|
||||
*/
|
||||
public NBTAdapter getNbtAdapter() {
|
||||
return nbtAdapter;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.gmail.nossr50.core.nbt;
|
||||
|
||||
public class NBTInteger implements NBTBase {
|
||||
public class NBTInt implements NBTBase {
|
||||
|
||||
private String key;
|
||||
private int value;
|
Loading…
Reference in New Issue
Block a user