diff --git a/.classpath b/.classpath
index d86587e..e87c63b 100644
--- a/.classpath
+++ b/.classpath
@@ -2,7 +2,6 @@
-
@@ -11,5 +10,6 @@
+
diff --git a/plugin.yml b/plugin.yml
index 2a72415..9cc7c29 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -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.4
+version: 1.4.2
main: me.TheBukor.SkStuff.SkStuff
softdepend: [Skript, WorldEdit]
\ No newline at end of file
diff --git a/src/me/TheBukor/SkStuff/SkStuff.java b/src/me/TheBukor/SkStuff/SkStuff.java
index 327c0a7..5bef2a3 100644
--- a/src/me/TheBukor/SkStuff/SkStuff.java
+++ b/src/me/TheBukor/SkStuff/SkStuff.java
@@ -1,5 +1,7 @@
package me.TheBukor.SkStuff;
+import java.lang.reflect.InvocationTargetException;
+
import javax.annotation.Nullable;
import org.bukkit.Bukkit;
@@ -35,49 +37,20 @@ import me.TheBukor.SkStuff.effects.EffSimulateSnow;
import me.TheBukor.SkStuff.effects.EffUndoRedoSession;
import me.TheBukor.SkStuff.events.EvtWorldEditChange;
import me.TheBukor.SkStuff.events.WorldEditChangeHandler;
-import me.TheBukor.SkStuff.expressions.ExprAreaOfSchematic;
-import me.TheBukor.SkStuff.expressions.ExprAreaOfSelection;
import me.TheBukor.SkStuff.expressions.ExprChangedBlocksSession;
import me.TheBukor.SkStuff.expressions.ExprEditSessionLimit;
-import me.TheBukor.SkStuff.expressions.ExprFileNBTv1_8_R1;
-import me.TheBukor.SkStuff.expressions.ExprFileNBTv1_8_R2;
-import me.TheBukor.SkStuff.expressions.ExprFileNBTv1_8_R3;
-import me.TheBukor.SkStuff.expressions.ExprHeightOfSchematic;
-import me.TheBukor.SkStuff.expressions.ExprHeightOfSelection;
-import me.TheBukor.SkStuff.expressions.ExprItemNBTv1_7_R1;
-import me.TheBukor.SkStuff.expressions.ExprItemNBTv1_7_R2;
-import me.TheBukor.SkStuff.expressions.ExprItemNBTv1_7_R3;
-import me.TheBukor.SkStuff.expressions.ExprItemNBTv1_7_R4;
-import me.TheBukor.SkStuff.expressions.ExprItemNBTv1_8_R1;
-import me.TheBukor.SkStuff.expressions.ExprItemNBTv1_8_R2;
-import me.TheBukor.SkStuff.expressions.ExprItemNBTv1_8_R3;
-import me.TheBukor.SkStuff.expressions.ExprLengthOfSchematic;
-import me.TheBukor.SkStuff.expressions.ExprLengthOfSelection;
-import me.TheBukor.SkStuff.expressions.ExprNBTv1_7_R1;
-import me.TheBukor.SkStuff.expressions.ExprNBTv1_7_R2;
-import me.TheBukor.SkStuff.expressions.ExprNBTv1_7_R3;
-import me.TheBukor.SkStuff.expressions.ExprNBTv1_7_R4;
-import me.TheBukor.SkStuff.expressions.ExprNBTv1_8_R1;
-import me.TheBukor.SkStuff.expressions.ExprNBTv1_8_R2;
-import me.TheBukor.SkStuff.expressions.ExprNBTv1_8_R3;
+import me.TheBukor.SkStuff.expressions.ExprFileNBT;
+import me.TheBukor.SkStuff.expressions.ExprFireProof;
+import me.TheBukor.SkStuff.expressions.ExprItemNBT;
+import me.TheBukor.SkStuff.expressions.ExprNBTOf;
import me.TheBukor.SkStuff.expressions.ExprNewEditSession;
+import me.TheBukor.SkStuff.expressions.ExprNoClip;
+import me.TheBukor.SkStuff.expressions.ExprSchematicArea;
+import me.TheBukor.SkStuff.expressions.ExprSelectionArea;
import me.TheBukor.SkStuff.expressions.ExprSelectionOfPlayer;
-import me.TheBukor.SkStuff.expressions.ExprSelectionPos1;
-import me.TheBukor.SkStuff.expressions.ExprSelectionPos2;
-import me.TheBukor.SkStuff.expressions.ExprTagOfv1_7_R1;
-import me.TheBukor.SkStuff.expressions.ExprTagOfv1_7_R2;
-import me.TheBukor.SkStuff.expressions.ExprTagOfv1_7_R3;
-import me.TheBukor.SkStuff.expressions.ExprTagOfv1_7_R4;
-import me.TheBukor.SkStuff.expressions.ExprTagOfv1_8_R1;
-import me.TheBukor.SkStuff.expressions.ExprTagOfv1_8_R2;
-import me.TheBukor.SkStuff.expressions.ExprTagOfv1_8_R3;
-import me.TheBukor.SkStuff.expressions.ExprVolumeOfSchematic;
-import me.TheBukor.SkStuff.expressions.ExprVolumeOfSelection;
-import me.TheBukor.SkStuff.expressions.ExprWidthOfSchematic;
-import me.TheBukor.SkStuff.expressions.ExprWidthOfSelection;
-import net.minecraft.server.v1_8_R1.MojangsonParser;
-import net.minecraft.server.v1_8_R1.NBTTagCompound;
-import net.minecraft.server.v1_8_R2.MojangsonParseException;
+import me.TheBukor.SkStuff.expressions.ExprSelectionPos;
+import me.TheBukor.SkStuff.expressions.ExprTagOf;
+import me.TheBukor.SkStuff.util.ReflectionUtils;
public class SkStuff extends JavaPlugin {
private int condAmount = 0;
@@ -86,315 +59,78 @@ public class SkStuff extends JavaPlugin {
private int effAmount = 0;
private boolean evtWE = false;
+ private Class> nbtClass = ReflectionUtils.getNMSClass("NBTTagCompound");
+ private Class> nbtParserClass = ReflectionUtils.getNMSClass("MojangsonParser");
+ private Class> nbtParseExClass = ReflectionUtils.getNMSClass("MojangsonParseException");
+
+ @SuppressWarnings("unchecked")
public void onEnable() {
- if (Bukkit.getPluginManager().getPlugin("Skript") != null) {
+ if (Bukkit.getPluginManager().getPlugin("Skript") != null && Skript.isAcceptRegistrations()) {
Skript.registerAddon(this);
getLogger().info("SkStuff " + this.getDescription().getVersion() + " has been successfully enabled!");
- if (Bukkit.getVersion().contains("(MC: 1.7.2)")) {
- getLogger().info("Successfully found 1.7.2! Registering version specific expressions...");
- exprAmount += 3;
- typeAmount += 1;
- Skript.registerExpression(ExprNBTv1_7_R1.class, net.minecraft.server.v1_7_R1.NBTTagCompound.class, ExpressionType.PROPERTY, "nbt[[ ]tag[s]] of %entity/block/itemstack%", "%entity/block/itemstack%'s nbt[[ ]tag[s]]");
- Skript.registerExpression(ExprItemNBTv1_7_R1.class, ItemStack.class, ExpressionType.SIMPLE, "%itemstack% with [custom] nbt[[ ]tag[s]] %string%");
- Skript.registerExpression(ExprTagOfv1_7_R1.class, Object.class, ExpressionType.SIMPLE, "[nbt[ ]]tag %string% of [nbt [compound]] %compound%");
- //WARNING! HIGHLY EXPERIMENTAL, IT CAN CORRUPT WORLDS AT CURRENT VERSION, USE AT YOUR OWN RISK!
- //Skript.registerExpression(ExprFileNBTv1_7_R1.class, net.minecraft.server.v1_7_R1.NBTTagCompound.class, ExpressionType.PROPERTY, "nbt[[ ]tag[s]] from [file] %string%");
- Classes.registerClass(new ClassInfo(net.minecraft.server.v1_7_R1.NBTTagCompound.class, "compound").name("NBT Tag Compound").user("((nbt)?( ?tag)?) ?compounds?").parser(new Parser() {
- @Override
- public String getVariableNamePattern() {
- return "{.+:.+}";
- }
+ getLogger().info("Trying to register version specific stuff...");
+ typeAmount += 1;
+ exprAmount += 6;
+ Skript.registerExpression(ExprNBTOf.class, Object.class, ExpressionType.PROPERTY, "nbt[[ ]tag[s]] of %entity/block/itemstack%", "%entity/block/itemstack%'s nbt[[ ]tag[s]]");
+ Skript.registerExpression(ExprItemNBT.class, ItemStack.class, ExpressionType.SIMPLE, "%itemstack% with [custom] nbt[[ ]tag[s]] %string%");
+ Skript.registerExpression(ExprTagOf.class, Object.class, ExpressionType.PROPERTY, "[nbt[ ]]tag %string% of [[nbt] compound] %compound%");
+ Skript.registerExpression(ExprFileNBT.class, Object.class, ExpressionType.PROPERTY, "nbt[[ ]tag[s]] from [file] %string%");
+ Skript.registerExpression(ExprNoClip.class, Boolean.class, ExpressionType.PROPERTY, "no[( |-)]clip (state|mode) of %entity%", "%entity%'s no[( |-)]clip (state|mode)");
+ Skript.registerExpression(ExprFireProof.class, Boolean.class, ExpressionType.PROPERTY, "fire[ ]proof (state|mode) of %entity%", "%entity%'s fire[ ]proof (state|mode)");
+
+ Classes.registerClass(new ClassInfo