From e3a902c7737a40aa531ad6484081fb3e61e7a64a Mon Sep 17 00:00:00 2001 From: TheBukor Date: Sun, 13 Mar 2016 22:38:17 -0300 Subject: [PATCH] Minecraft ID of is actually version based; Made NBTListIndex be 1-indexed instead of zero-indexed (1 is the first value, instead of 0) --- src/me/TheBukor/SkStuff/SkStuff.java | 6 +++--- src/me/TheBukor/SkStuff/expressions/ExprNBTListIndex.java | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/me/TheBukor/SkStuff/SkStuff.java b/src/me/TheBukor/SkStuff/SkStuff.java index 584926d..0094cb5 100644 --- a/src/me/TheBukor/SkStuff/SkStuff.java +++ b/src/me/TheBukor/SkStuff/SkStuff.java @@ -112,9 +112,8 @@ public class SkStuff extends JavaPlugin { Skript.registerExpression(ExprTimespanToNumber.class, Number.class, ExpressionType.SIMPLE, "%timespan% [converted] [in]to (0¦ticks|1¦sec[ond]s|2¦min[ute]s|3¦hours|4¦days)"); Skript.registerExpression(ExprClickedInventory.class, Inventory.class, ExpressionType.SIMPLE, "[skstuff] clicked inventory"); Skript.registerExpression(ExprSerializedInv.class, String.class, ExpressionType.PROPERTY, "[(skstuff|1.9)] serialized [contents of] %inventory%"); - Skript.registerExpression(ExprMCIdOf.class, String.class, ExpressionType.PROPERTY, "minecraft [(string|native)] id of %itemtype%", "%itemtype%'s minecraft [(string|native)] id"); effAmount += 2; - exprAmount += 7; + exprAmount += 6; if (Skript.isRunningMinecraft(1, 9)) { getLogger().info("WOW! You're using Minecraft 1.9! Lemme register some cool stuff right away!"); Skript.registerEvent("Elytra glide toggle", SimpleEvent.class, EntityToggleGlideEvent.class, "[entity] elytra (fl(y|ight)|glid(e|ing)) toggl(e|ing)", "[entity] toggle elytra (fl(y|ight)|glid(e|ing))"); @@ -147,10 +146,11 @@ public class SkStuff extends JavaPlugin { Skript.registerExpression(ExprNoClip.class, Boolean.class, ExpressionType.PROPERTY, "no[( |-)]clip (state|mode) of %entities%", "%entities%'s no[( |-)]clip (state|mode)"); Skript.registerExpression(ExprFireProof.class, Boolean.class, ExpressionType.PROPERTY, "fire[ ]proof (state|mode) of %entities%", "%entities%'s fire[ ]proof (state|mode)"); Skript.registerExpression(ExprEndermanBlocks.class, ItemStack.class, ExpressionType.PROPERTY, "blocks that %entity% can (carry|hold|grab|steal)"); + Skript.registerExpression(ExprMCIdOf.class, String.class, ExpressionType.PROPERTY, "minecraft [(string|native)] id of %itemtype%", "%itemtype%'s minecraft [(string|native)] id"); nmsMethods.registerCompoundClassInfo(); nmsMethods.registerNBTListClassInfo(); effAmount += 5; - exprAmount += 9; + exprAmount += 10; typeAmount += 2; } if (Bukkit.getPluginManager().getPlugin("WorldEdit") != null) { diff --git a/src/me/TheBukor/SkStuff/expressions/ExprNBTListIndex.java b/src/me/TheBukor/SkStuff/expressions/ExprNBTListIndex.java index cadc3d3..3afdd3d 100644 --- a/src/me/TheBukor/SkStuff/expressions/ExprNBTListIndex.java +++ b/src/me/TheBukor/SkStuff/expressions/ExprNBTListIndex.java @@ -53,6 +53,7 @@ public class ExprNBTListIndex extends SimpleExpression { @Override public void change(Event e, @Nullable Object[] delta, ChangeMode mode) { int i = index.getSingle(e).intValue(); + i--; Object list = nbtList.getSingle(e); if (mode == ChangeMode.SET) { if (!(delta[0] instanceof Number || delta[0] instanceof String || nbtBaseClass.isAssignableFrom(delta[0].getClass())))