Forgot 1.6.3.1 commit. Whoops!
Added compound serializer to 1.7.10 Fixed a bug that would cause ALL variables to be unused if a single compound variable was invalid
This commit is contained in:
		
							parent
							
								
									226d0dc931
								
							
						
					
					
						commit
						7140ed1cff
					
				@ -1,6 +1,6 @@
 | 
			
		||||
name: SkStuff
 | 
			
		||||
author: TheBukor
 | 
			
		||||
description: A Skript addon which adds extra functionalities such as NBT and extended WorldEdit support.
 | 
			
		||||
version: 1.6.3
 | 
			
		||||
version: 1.6.3.1
 | 
			
		||||
main: me.TheBukor.SkStuff.SkStuff
 | 
			
		||||
softdepend: [Skript, WorldEdit, VanishNoPacket]
 | 
			
		||||
@ -316,6 +316,46 @@ public class NMS_v1_7_R4 implements NMSInterface {
 | 
			
		||||
			public String toVariableNameString(NBTTagCompound compound) {
 | 
			
		||||
				return compound.toString();
 | 
			
		||||
			}
 | 
			
		||||
		}).serializer(new Serializer<NBTTagCompound>() {
 | 
			
		||||
 | 
			
		||||
				@Override
 | 
			
		||||
				public Fields serialize(NBTTagCompound compound) throws NotSerializableException {
 | 
			
		||||
					Fields f = new Fields();
 | 
			
		||||
					f.putObject("asString", compound.toString());
 | 
			
		||||
					return f;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				@Override
 | 
			
		||||
				public void deserialize(NBTTagCompound compound, Fields f) throws StreamCorruptedException, NotSerializableException {
 | 
			
		||||
					assert false;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				@Override
 | 
			
		||||
				protected boolean canBeInstantiated() {
 | 
			
		||||
					return false;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				@Override
 | 
			
		||||
				protected NBTTagCompound deserialize(Fields fields) throws StreamCorruptedException, NotSerializableException {
 | 
			
		||||
					String raw = fields.getObject("asString", String.class);
 | 
			
		||||
					NBTTagCompound compound =  parseRawNBT(raw);
 | 
			
		||||
					if (compound == null) {
 | 
			
		||||
						throw new StreamCorruptedException("Unable to parse NBT compound from a variable: " + raw);
 | 
			
		||||
					}
 | 
			
		||||
					return compound;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				@Override
 | 
			
		||||
				@Nullable
 | 
			
		||||
				public NBTTagCompound deserialize(String s) {
 | 
			
		||||
					NBTTagCompound compound =  parseRawNBT(s);
 | 
			
		||||
					return compound;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				@Override
 | 
			
		||||
				public boolean mustSyncDeserialization() {
 | 
			
		||||
					return true;
 | 
			
		||||
				}
 | 
			
		||||
			}));
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
@ -397,6 +437,9 @@ public class NMS_v1_7_R4 implements NMSInterface {
 | 
			
		||||
				String s = fields.getObject("asString", String.class);
 | 
			
		||||
				NBTTagCompound tempNBT =  parseRawNBT("{SkStuffIsCool:" + s + "}");
 | 
			
		||||
				NBTTagList nbtList = (NBTTagList) tempNBT.get("SkStuffIsCool");
 | 
			
		||||
				if (tempNBT == null || nbtList == null) {
 | 
			
		||||
					throw new StreamCorruptedException("Unable to parse NBT list from a variable: " + s);
 | 
			
		||||
				}
 | 
			
		||||
				return nbtList;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -351,8 +351,11 @@ public class NMS_v1_8_R3 implements NMSInterface {
 | 
			
		||||
 | 
			
		||||
			@Override
 | 
			
		||||
			protected NBTTagCompound deserialize(Fields fields) throws StreamCorruptedException, NotSerializableException {
 | 
			
		||||
				String s = fields.getObject("asString", String.class);
 | 
			
		||||
				NBTTagCompound compound =  parseRawNBT(s);
 | 
			
		||||
				String raw = fields.getObject("asString", String.class);
 | 
			
		||||
				NBTTagCompound compound =  parseRawNBT(raw);
 | 
			
		||||
				if (compound == null) {
 | 
			
		||||
					throw new StreamCorruptedException("Unable to parse NBT from a variable: " + raw);
 | 
			
		||||
				}
 | 
			
		||||
				return compound;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@ -448,6 +451,9 @@ public class NMS_v1_8_R3 implements NMSInterface {
 | 
			
		||||
				String s = fields.getObject("asString", String.class);
 | 
			
		||||
				NBTTagCompound tempNBT =  parseRawNBT("{SkStuffIsCool:" + s + "}");
 | 
			
		||||
				NBTTagList nbtList = (NBTTagList) tempNBT.get("SkStuffIsCool");
 | 
			
		||||
				if (tempNBT == null || nbtList == null) {
 | 
			
		||||
					throw new StreamCorruptedException("Unable to parse NBT list from a variable: " + s);
 | 
			
		||||
				}
 | 
			
		||||
				return nbtList;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -352,8 +352,11 @@ public class NMS_v1_9_R1 implements NMSInterface {
 | 
			
		||||
 | 
			
		||||
			@Override
 | 
			
		||||
			protected NBTTagCompound deserialize(Fields fields) throws StreamCorruptedException, NotSerializableException {
 | 
			
		||||
				String s = fields.getObject("asString", String.class);
 | 
			
		||||
				NBTTagCompound compound =  parseRawNBT(s);
 | 
			
		||||
				String raw = fields.getObject("asString", String.class);
 | 
			
		||||
				NBTTagCompound compound =  parseRawNBT(raw);
 | 
			
		||||
				if (compound == null) {
 | 
			
		||||
					throw new StreamCorruptedException("Unable to parse NBT from a variable: " + raw);
 | 
			
		||||
				}
 | 
			
		||||
				return compound;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@ -449,6 +452,9 @@ public class NMS_v1_9_R1 implements NMSInterface {
 | 
			
		||||
				String s = fields.getObject("asString", String.class);
 | 
			
		||||
				NBTTagCompound tempNBT =  parseRawNBT("{SkStuffIsCool:" + s + "}");
 | 
			
		||||
				NBTTagList nbtList = (NBTTagList) tempNBT.get("SkStuffIsCool");
 | 
			
		||||
				if (tempNBT == null || nbtList == null) {
 | 
			
		||||
					throw new StreamCorruptedException("Unable to parse NBT list from a variable: " + s);
 | 
			
		||||
				}
 | 
			
		||||
				return nbtList;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user