1.6.3 final commit. Some new effects/expressions.
This commit is contained in:
parent
7d938de291
commit
226d0dc931
@ -7,9 +7,10 @@
|
|||||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/1.8.8.jar"/>
|
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/1.8.8.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/1.8.jar"/>
|
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/1.8.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/Skript.jar"/>
|
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/Skript.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/1.9.jar"/>
|
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/1.9 (2).jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/VanishNoPacket.jar"/>
|
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/VanishNoPacket.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/WorldEdit.jar"/>
|
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/WorldEdit.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/WorldGuard.jar"/>
|
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/WorldGuard.jar"/>
|
||||||
|
<classpathentry kind="lib" path="C:/Users/DELL/AppData/Roaming/.minecraft/workspace/eclipse/Build Path/ProtocolLib.jar"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
1
bin/.gitignore
vendored
1
bin/.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
/me/
|
/me/
|
||||||
|
/protocollib/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: SkStuff
|
name: SkStuff
|
||||||
author: TheBukor
|
author: TheBukor
|
||||||
description: A Skript addon which adds extra functionalities such as NBT and extended WorldEdit support.
|
description: A Skript addon which adds extra functionalities such as NBT and extended WorldEdit support.
|
||||||
version: 1.6.1
|
version: 1.6.3
|
||||||
main: me.TheBukor.SkStuff.SkStuff
|
main: me.TheBukor.SkStuff.SkStuff
|
||||||
softdepend: [Skript, WorldEdit, VanishNoPacket]
|
softdepend: [Skript, WorldEdit, VanishNoPacket]
|
@ -32,7 +32,6 @@ import ch.njol.skript.registrations.EventValues;
|
|||||||
import ch.njol.skript.util.Getter;
|
import ch.njol.skript.util.Getter;
|
||||||
import me.TheBukor.SkStuff.conditions.CondSelectionContains;
|
import me.TheBukor.SkStuff.conditions.CondSelectionContains;
|
||||||
import me.TheBukor.SkStuff.effects.EffClearPathGoals;
|
import me.TheBukor.SkStuff.effects.EffClearPathGoals;
|
||||||
import me.TheBukor.SkStuff.effects.EffClientChat;
|
|
||||||
import me.TheBukor.SkStuff.effects.EffDrainLiquid;
|
import me.TheBukor.SkStuff.effects.EffDrainLiquid;
|
||||||
import me.TheBukor.SkStuff.effects.EffDrawLineWE;
|
import me.TheBukor.SkStuff.effects.EffDrawLineWE;
|
||||||
import me.TheBukor.SkStuff.effects.EffGZipFile;
|
import me.TheBukor.SkStuff.effects.EffGZipFile;
|
||||||
@ -58,7 +57,6 @@ import me.TheBukor.SkStuff.events.WorldEditChangeHandler;
|
|||||||
import me.TheBukor.SkStuff.expressions.ExprChangedBlocksSession;
|
import me.TheBukor.SkStuff.expressions.ExprChangedBlocksSession;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprClickedInventory;
|
import me.TheBukor.SkStuff.expressions.ExprClickedInventory;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprEditSessionLimit;
|
import me.TheBukor.SkStuff.expressions.ExprEditSessionLimit;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprEndermanBlocks;
|
|
||||||
import me.TheBukor.SkStuff.expressions.ExprFileNBT;
|
import me.TheBukor.SkStuff.expressions.ExprFileNBT;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprFireProof;
|
import me.TheBukor.SkStuff.expressions.ExprFireProof;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprFlagOfWGRegion;
|
import me.TheBukor.SkStuff.expressions.ExprFlagOfWGRegion;
|
||||||
@ -66,6 +64,7 @@ import me.TheBukor.SkStuff.expressions.ExprFlagsOfWGRegion;
|
|||||||
import me.TheBukor.SkStuff.expressions.ExprGlideState;
|
import me.TheBukor.SkStuff.expressions.ExprGlideState;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprInventoryOwner;
|
import me.TheBukor.SkStuff.expressions.ExprInventoryOwner;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprItemNBT;
|
import me.TheBukor.SkStuff.expressions.ExprItemNBT;
|
||||||
|
import me.TheBukor.SkStuff.expressions.ExprLastLocation;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprMCIdOf;
|
import me.TheBukor.SkStuff.expressions.ExprMCIdOf;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprMCIdToItem;
|
import me.TheBukor.SkStuff.expressions.ExprMCIdToItem;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprNBTListContents;
|
import me.TheBukor.SkStuff.expressions.ExprNBTListContents;
|
||||||
@ -77,6 +76,7 @@ import me.TheBukor.SkStuff.expressions.ExprSchematicArea;
|
|||||||
import me.TheBukor.SkStuff.expressions.ExprSelectionArea;
|
import me.TheBukor.SkStuff.expressions.ExprSelectionArea;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprSelectionOfPlayer;
|
import me.TheBukor.SkStuff.expressions.ExprSelectionOfPlayer;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprSelectionPos;
|
import me.TheBukor.SkStuff.expressions.ExprSelectionPos;
|
||||||
|
import me.TheBukor.SkStuff.expressions.ExprStepLength;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprTagOf;
|
import me.TheBukor.SkStuff.expressions.ExprTagOf;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprTimespanToNumber;
|
import me.TheBukor.SkStuff.expressions.ExprTimespanToNumber;
|
||||||
import me.TheBukor.SkStuff.expressions.ExprToLowerCase;
|
import me.TheBukor.SkStuff.expressions.ExprToLowerCase;
|
||||||
@ -115,7 +115,7 @@ public class SkStuff extends JavaPlugin {
|
|||||||
exprAmount += 6;
|
exprAmount += 6;
|
||||||
if (Skript.isRunningMinecraft(1, 9)) {
|
if (Skript.isRunningMinecraft(1, 9)) {
|
||||||
getLogger().info("WOW! You're using Minecraft 1.9! Lemme register some cool stuff and fixes right away!");
|
getLogger().info("WOW! You're using Minecraft 1.9! Lemme register some cool stuff and fixes right away!");
|
||||||
Skript.registerEffect(EffResourceSound.class, "play [raw] [([resource[ ]]pack)] sound %string% for %players% at %location% [[with] (0¦volume|1¦pitch) %-number%[[(,| and)] (0¦pitch|1¦volume) %-number%]]");
|
Skript.registerEffect(EffResourceSound.class, "play [raw] [([resource[ ]]pack)] sound %string% (for|to) %players% at %location% [[with] volume %-number%[[(,| and)] pitch %-number%]]", "play [raw] [([resource[ ]]pack)] sound %string% for %players% at %location% [[with] pitch %-number%[[(,| and)] volume %-number%]]");
|
||||||
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))");
|
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))");
|
||||||
Skript.registerExpression(ExprGlideState.class, Boolean.class, ExpressionType.PROPERTY, "elytra (fl(y|ight)|glid(e|ing)) state of %livingentity%", "%livingentity%'s elytra (fl(y|ight)|glid(e|ing)) state");
|
Skript.registerExpression(ExprGlideState.class, Boolean.class, ExpressionType.PROPERTY, "elytra (fl(y|ight)|glid(e|ing)) state of %livingentity%", "%livingentity%'s elytra (fl(y|ight)|glid(e|ing)) state");
|
||||||
EventValues.registerEventValue(EntityToggleGlideEvent.class, Entity.class, new Getter<Entity, EntityToggleGlideEvent>() {
|
EventValues.registerEventValue(EntityToggleGlideEvent.class, Entity.class, new Getter<Entity, EntityToggleGlideEvent>() {
|
||||||
@ -136,7 +136,6 @@ public class SkStuff extends JavaPlugin {
|
|||||||
Skript.registerEffect(EffSetPathGoal.class, "add pathfind[er] goal [[with] priority %-integer%] (0¦(avoid|run away from) %*entitydatas%[, radius %-number%[, speed %-number%[, speed (if|when) (close|near) %-number%]]]|1¦break door[s]|2¦breed[,[move[ment]] speed %-number%]|3¦eat grass|4¦(flee from the sun|seek shad(e|ow))[, [move[ment]] speed %-number%]|5¦(float (in[side]|on) water|swim)|6¦follow (owner|tamer)[, speed %-number%[, min[imum] distance %-number%[, max[imum] distance %-number%]]]|7¦follow (adult|parent)[s][, [move[ment]] speed %-number%]|8¦(fight back|react to|target) (damager|attacker) [[of] type] %*entitydatas%[, call ([for] help|reinforcement) %-boolean%]|9¦o(c|z)elot jump on blocks[, [move[ment]] speed %-number%]|10¦leap at target[, [leap] height %-number%]|11¦look at %*entitydatas%[, (radius|max[imum] distance) %-number%]|12¦melee attack %*entitydatas%[, [move[ment]] speed %-number%[, (memorize|do('nt| not) forget) target [for [a] long[er] time] %-boolean%]]|13¦move to[wards] target[, [move[ment]] speed %-number%[, (radius|max[imum] distance) %-number%]]|14¦target nearest [entity [of] type] %*entitydatas%[, check sight %-boolean%]|15¦o(c|z)elot attack|16¦open door[s]|17¦(panic|flee)[, [move[ment]] speed %-number%]|18¦look around randomly|19¦(walk around randomly|wander)[, [move[ment]] speed %-number%[, min[imum] [of] %-timespan% between mov(e[ment][s]|ing)]]|20¦sit|21¦[creeper] (explode|inflate|swell)|22¦squid (swim around|wander)|23¦shoot fireball[s]|24¦[silverfish] hide (in[side]|on) block[s]|25¦((call|summon|wake) [other] [hidden] silverfish[es])|26¦[enderman] pick[[ ]up] block[s]|27¦[enderman] place block[s]|28¦[enderman] attack player (staring|looking) at [their] eye[s]]|29¦ghast move to[wards] target|30¦ghast (idle move[ment]|wander|random fl(ight|y[ing]))|31¦(tempt to|follow players (holding|with)) %-itemstack%[, [move[ment]] speed %number%[, scared of player movement %-boolean%]]|32¦target [random] %*entitydatas% (if|when) (not |un)tamed|33¦guardian attack [entities]|34¦[z[ombie[ ]]pig[man]] attack [player[s]] (if|when) angry|35¦[z[ombie[ ]]pig[man]] (react to|fight back|target) (attacker|damager) (if|when) angry|36¦[rabbit] eat carrot crops|37¦[killer] rabbit [melee] attack|38¦slime [random] jump|39¦slime change (direction|facing) randomly|40¦slime (idle move[ment]|wander)|41¦follow %*entitydatas%[, radius %-number%[, speed %-number%[, [custom[ ]]name[d] %-string%]]]) to %livingentities%");
|
Skript.registerEffect(EffSetPathGoal.class, "add pathfind[er] goal [[with] priority %-integer%] (0¦(avoid|run away from) %*entitydatas%[, radius %-number%[, speed %-number%[, speed (if|when) (close|near) %-number%]]]|1¦break door[s]|2¦breed[,[move[ment]] speed %-number%]|3¦eat grass|4¦(flee from the sun|seek shad(e|ow))[, [move[ment]] speed %-number%]|5¦(float (in[side]|on) water|swim)|6¦follow (owner|tamer)[, speed %-number%[, min[imum] distance %-number%[, max[imum] distance %-number%]]]|7¦follow (adult|parent)[s][, [move[ment]] speed %-number%]|8¦(fight back|react to|target) (damager|attacker) [[of] type] %*entitydatas%[, call ([for] help|reinforcement) %-boolean%]|9¦o(c|z)elot jump on blocks[, [move[ment]] speed %-number%]|10¦leap at target[, [leap] height %-number%]|11¦look at %*entitydatas%[, (radius|max[imum] distance) %-number%]|12¦melee attack %*entitydatas%[, [move[ment]] speed %-number%[, (memorize|do('nt| not) forget) target [for [a] long[er] time] %-boolean%]]|13¦move to[wards] target[, [move[ment]] speed %-number%[, (radius|max[imum] distance) %-number%]]|14¦target nearest [entity [of] type] %*entitydatas%[, check sight %-boolean%]|15¦o(c|z)elot attack|16¦open door[s]|17¦(panic|flee)[, [move[ment]] speed %-number%]|18¦look around randomly|19¦(walk around randomly|wander)[, [move[ment]] speed %-number%[, min[imum] [of] %-timespan% between mov(e[ment][s]|ing)]]|20¦sit|21¦[creeper] (explode|inflate|swell)|22¦squid (swim around|wander)|23¦shoot fireball[s]|24¦[silverfish] hide (in[side]|on) block[s]|25¦((call|summon|wake) [other] [hidden] silverfish[es])|26¦[enderman] pick[[ ]up] block[s]|27¦[enderman] place block[s]|28¦[enderman] attack player (staring|looking) at [their] eye[s]]|29¦ghast move to[wards] target|30¦ghast (idle move[ment]|wander|random fl(ight|y[ing]))|31¦(tempt to|follow players (holding|with)) %-itemstack%[, [move[ment]] speed %number%[, scared of player movement %-boolean%]]|32¦target [random] %*entitydatas% (if|when) (not |un)tamed|33¦guardian attack [entities]|34¦[z[ombie[ ]]pig[man]] attack [player[s]] (if|when) angry|35¦[z[ombie[ ]]pig[man]] (react to|fight back|target) (attacker|damager) (if|when) angry|36¦[rabbit] eat carrot crops|37¦[killer] rabbit [melee] attack|38¦slime [random] jump|39¦slime change (direction|facing) randomly|40¦slime (idle move[ment]|wander)|41¦follow %*entitydatas%[, radius %-number%[, speed %-number%[, [custom[ ]]name[d] %-string%]]]) to %livingentities%");
|
||||||
Skript.registerEffect(EffMakeJump.class, "make %livingentities% jump", "force %livingentities% to jump");
|
Skript.registerEffect(EffMakeJump.class, "make %livingentities% jump", "force %livingentities% to jump");
|
||||||
Skript.registerEffect(EffGZipFile.class, "create [a] gzip[ped] file [at] [path] %string%");
|
Skript.registerEffect(EffGZipFile.class, "create [a] gzip[ped] file [at] [path] %string%");
|
||||||
Skript.registerEffect(EffClientChat.class, "make %player% (say|chat) %string% client[( |-)]side", "force %player% to (say|chat) %string% client[( |-)]side");
|
|
||||||
Skript.registerExpression(ExprNBTOf.class, Object.class, ExpressionType.PROPERTY, "nbt[[ ]tag[s]] of %~object%", "%~object%'s nbt[[ ]tag[s]]");
|
Skript.registerExpression(ExprNBTOf.class, Object.class, ExpressionType.PROPERTY, "nbt[[ ]tag[s]] of %~object%", "%~object%'s nbt[[ ]tag[s]]");
|
||||||
Skript.registerExpression(ExprItemNBT.class, ItemStack.class, ExpressionType.SIMPLE, "%itemstack% with [custom] nbt[[ ]tag[s]] %string%");
|
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(ExprTagOf.class, Object.class, ExpressionType.PROPERTY, "[nbt[ ]]tag %string% of [[nbt] compound] %compound%");
|
||||||
@ -145,13 +144,16 @@ public class SkStuff extends JavaPlugin {
|
|||||||
Skript.registerExpression(ExprNBTListContents.class, Object.class, ExpressionType.PROPERTY, "[all] contents (of|from) [nbt[ ]list] %nbtlist%", "[nbt[ ]list] %nbtlist% contents");
|
Skript.registerExpression(ExprNBTListContents.class, Object.class, ExpressionType.PROPERTY, "[all] contents (of|from) [nbt[ ]list] %nbtlist%", "[nbt[ ]list] %nbtlist% contents");
|
||||||
Skript.registerExpression(ExprNoClip.class, Boolean.class, ExpressionType.PROPERTY, "no[( |-)]clip (state|mode) of %entities%", "%entities%'s no[( |-)]clip (state|mode)");
|
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(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(ExprEndermanBlocks.class, ItemStack.class, ExpressionType.PROPERTY, "blocks that %entity% can (carry|hold|grab|steal)");
|
||||||
Skript.registerExpression(ExprMCIdOf.class, String.class, ExpressionType.PROPERTY, "(mc|minecraft) [(string|native)] id of %itemtype%", "%itemtype%'s minecraft [(string|native)] id");
|
Skript.registerExpression(ExprMCIdOf.class, String.class, ExpressionType.PROPERTY, "(mc|minecraft) [(string|native)] id of %itemtype%", "%itemtype%'s minecraft [(string|native)] id");
|
||||||
Skript.registerExpression(ExprMCIdToItem.class, ItemStack.class, ExpressionType.SIMPLE, "item[[ ](stack|type)] (of|from) (mc|minecraft) [(string|native)] id %string%");
|
Skript.registerExpression(ExprMCIdToItem.class, ItemStack.class, ExpressionType.SIMPLE, "item[[ ](stack|type)] (of|from) (mc|minecraft) [(string|native)] id %string%");
|
||||||
|
Skript.registerExpression(ExprLastLocation.class, Location.class, ExpressionType.SIMPLE, " ");
|
||||||
|
Skript.registerExpression(ExprStepLength.class, Number.class, ExpressionType.PROPERTY, "[the] step length of %entity%", "%entity%'s step length");
|
||||||
nmsMethods.registerCompoundClassInfo();
|
nmsMethods.registerCompoundClassInfo();
|
||||||
nmsMethods.registerNBTListClassInfo();
|
nmsMethods.registerNBTListClassInfo();
|
||||||
effAmount += 6;
|
effAmount += 5;
|
||||||
exprAmount += 11;
|
exprAmount += 12;
|
||||||
|
// 13 with the ender blocks expression
|
||||||
typeAmount += 2;
|
typeAmount += 2;
|
||||||
}
|
}
|
||||||
if (Bukkit.getPluginManager().getPlugin("WorldEdit") != null) {
|
if (Bukkit.getPluginManager().getPlugin("WorldEdit") != null) {
|
||||||
@ -198,7 +200,7 @@ public class SkStuff extends JavaPlugin {
|
|||||||
}, 0);
|
}, 0);
|
||||||
evtAmount += 1;
|
evtAmount += 1;
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
Skript.error("Unable to register \"On WorldEdit block change\" event! You will need to upgrade to WorldEdit 6.0");
|
Skript.error("Unable to register \"On WorldEdit block change\" event! You will need to upgrade to WorldEdit 6.x if you want to use it!");
|
||||||
}
|
}
|
||||||
condAmount += 1;
|
condAmount += 1;
|
||||||
effAmount += 13;
|
effAmount += 13;
|
||||||
|
57
src/me/TheBukor/SkStuff/effects/EffResourceSound.java
Normal file
57
src/me/TheBukor/SkStuff/effects/EffResourceSound.java
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package me.TheBukor.SkStuff.effects;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
|
import ch.njol.skript.lang.Effect;
|
||||||
|
import ch.njol.skript.lang.Expression;
|
||||||
|
import ch.njol.skript.lang.SkriptParser.ParseResult;
|
||||||
|
import ch.njol.util.Kleenean;
|
||||||
|
|
||||||
|
public class EffResourceSound extends Effect {
|
||||||
|
private Expression<String> sound;
|
||||||
|
private Expression<Player> players;
|
||||||
|
private Expression<Location> location;
|
||||||
|
private Expression<Number> volume;
|
||||||
|
private Expression<Number> pitch;
|
||||||
|
|
||||||
|
private int pattern;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean isDelayed, ParseResult result) {
|
||||||
|
sound = (Expression<String>) expr[0];
|
||||||
|
players = (Expression<Player>) expr[1];
|
||||||
|
location = (Expression<Location>) expr[2];
|
||||||
|
pattern = matchedPattern;
|
||||||
|
if (pattern == 0) {
|
||||||
|
volume = (Expression<Number>) expr[3];
|
||||||
|
pitch = (Expression<Number>) expr[4];
|
||||||
|
} else {
|
||||||
|
pitch = (Expression<Number>) expr[3];
|
||||||
|
volume = (Expression<Number>) expr[4];
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(@Nullable Event e, boolean debug) {
|
||||||
|
return "play raw sound for " + players.toString(e, debug) + " at " + location.toString(e, debug) + " with " + (pattern == 0 ? "volume " + volume.toString(e, debug) : "pitch " + pitch.toString(e, debug)) + " and " + (pattern == 0 ? "pitch " + pitch.toString(e, debug) : "volume " + volume.toString(e, debug));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
protected void execute(Event e) {
|
||||||
|
String s = sound.getSingle(e);
|
||||||
|
Player[] ps = players.getAll(e);
|
||||||
|
Location loc = location.getSingle(e);
|
||||||
|
float vol = (volume == null ? 1.0F : volume.getSingle(e).floatValue());
|
||||||
|
float pitch = (this.pitch == null ? 1.0F : this.pitch.getSingle(e).floatValue());
|
||||||
|
for (Player p : ps) {
|
||||||
|
p.playSound(loc, s, vol, pitch );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -12,7 +12,7 @@ public class EvtWorldEditChange extends Event implements Cancellable {
|
|||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
public EvtWorldEditChange(Player player, Block block) {
|
EvtWorldEditChange(Player player, Block block) {
|
||||||
EvtWorldEditChange.player = player;
|
EvtWorldEditChange.player = player;
|
||||||
EvtWorldEditChange.block = block;
|
EvtWorldEditChange.block = block;
|
||||||
this.cancelled = false;
|
this.cancelled = false;
|
||||||
|
@ -82,7 +82,6 @@ public class ExprEndermanBlocks extends SimpleExpression<ItemStack> {
|
|||||||
items.add(bukkitItem);
|
items.add(bukkitItem);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Arrays.copyOf(items.toArray(), items.size(), ItemStack[].class);
|
return Arrays.copyOf(items.toArray(), items.size(), ItemStack[].class);
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package me.TheBukor.SkStuff.expressions;
|
package me.TheBukor.SkStuff.expressions;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -15,12 +11,11 @@ import ch.njol.skript.lang.SkriptParser.ParseResult;
|
|||||||
import ch.njol.skript.lang.util.SimpleExpression;
|
import ch.njol.skript.lang.util.SimpleExpression;
|
||||||
import ch.njol.util.Kleenean;
|
import ch.njol.util.Kleenean;
|
||||||
import ch.njol.util.coll.CollectionUtils;
|
import ch.njol.util.coll.CollectionUtils;
|
||||||
import me.TheBukor.SkStuff.util.ReflectionUtils;
|
import me.TheBukor.SkStuff.SkStuff;
|
||||||
|
|
||||||
public class ExprFireProof extends SimpleExpression<Boolean> {
|
public class ExprFireProof extends SimpleExpression<Boolean> {
|
||||||
private Expression<Entity> entities;
|
private Expression<Entity> entities;
|
||||||
|
|
||||||
private Class<?> craftEntClass = ReflectionUtils.getOBCClass("entity.CraftEntity");
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends Boolean> getReturnType() {
|
public Class<? extends Boolean> getReturnType() {
|
||||||
return Boolean.class;
|
return Boolean.class;
|
||||||
@ -47,40 +42,30 @@ public class ExprFireProof extends SimpleExpression<Boolean> {
|
|||||||
@Nullable
|
@Nullable
|
||||||
protected Boolean[] get(Event e) {
|
protected Boolean[] get(Event e) {
|
||||||
Entity[] ents = entities.getAll(e);
|
Entity[] ents = entities.getAll(e);
|
||||||
if (ents == null)
|
if (ents.length == 0)
|
||||||
return null;
|
return null;
|
||||||
List<Boolean> fireProofStates = new ArrayList<Boolean>();
|
Boolean[] fireProofStates = new Boolean[ents.length];
|
||||||
|
int i = 0;
|
||||||
for (Entity ent : ents) {
|
for (Entity ent : ents) {
|
||||||
if (ent == null)
|
if (ent == null)
|
||||||
continue;
|
continue;
|
||||||
Object nmsEnt = null;
|
fireProofStates[i] = SkStuff.getNMSMethods().getFireProof(ent);
|
||||||
try {
|
i++;
|
||||||
nmsEnt = craftEntClass.cast(ent).getClass().getMethod("getHandle").invoke(ent); //nmsEnt = ((CraftEntity) ent).getHandle();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
fireProofStates.add((Boolean) ReflectionUtils.getField("fireProof", nmsEnt.getClass(), nmsEnt));
|
|
||||||
}
|
}
|
||||||
return Arrays.copyOf(fireProofStates.toArray(), fireProofStates.size(), Boolean[].class);
|
return fireProofStates;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void change(Event e, @Nullable Object[] delta, ChangeMode mode) {
|
public void change(Event e, @Nullable Object[] delta, ChangeMode mode) {
|
||||||
Entity[] ents = entities.getAll(e);
|
Entity[] ents = entities.getAll(e);
|
||||||
if (ents == null)
|
if (ents.length == 0)
|
||||||
return;
|
return;
|
||||||
if (mode == ChangeMode.SET) {
|
if (mode == ChangeMode.SET) {
|
||||||
Boolean newValue = (Boolean) delta[0];
|
Boolean newValue = (Boolean) delta[0];
|
||||||
for (Entity ent : ents) {
|
for (Entity ent : ents) {
|
||||||
if (ent == null)
|
if (ent == null)
|
||||||
continue;
|
continue;
|
||||||
Object nmsEnt = null;
|
SkStuff.getNMSMethods().setFireProof(ent, newValue);
|
||||||
try {
|
|
||||||
nmsEnt = craftEntClass.cast(ent).getClass().getMethod("getHandle").invoke(ent); //nmsEnt = ((CraftEntity) ent).getHandle();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
ReflectionUtils.setField("fireProof", nmsEnt.getClass(), nmsEnt, newValue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
62
src/me/TheBukor/SkStuff/expressions/ExprInventoryOwner.java
Normal file
62
src/me/TheBukor/SkStuff/expressions/ExprInventoryOwner.java
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
package me.TheBukor.SkStuff.expressions;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
|
|
||||||
|
import ch.njol.skript.Skript;
|
||||||
|
import ch.njol.skript.lang.Expression;
|
||||||
|
import ch.njol.skript.lang.SkriptParser.ParseResult;
|
||||||
|
import ch.njol.skript.lang.util.SimpleExpression;
|
||||||
|
import ch.njol.util.Kleenean;
|
||||||
|
|
||||||
|
public class ExprInventoryOwner extends SimpleExpression<Object> {
|
||||||
|
private Expression<Inventory> inventory;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSingle() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Object> getReturnType() {
|
||||||
|
return Object.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) {
|
||||||
|
inventory = (Expression<Inventory>) expr[0];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(@Nullable Event e, boolean debug) {
|
||||||
|
return "owner of " + inventory.toString(e, debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
protected Object[] get(Event e) {
|
||||||
|
if (inventory.getSingle(e) == null)
|
||||||
|
return null;
|
||||||
|
InventoryHolder holder = inventory.getSingle(e).getHolder();
|
||||||
|
if (holder instanceof Entity) {
|
||||||
|
return new Entity[] { (Entity) holder };
|
||||||
|
} else if (holder instanceof BlockState) {
|
||||||
|
return new Block[] { ((BlockState) holder).getBlock() };
|
||||||
|
} else if (holder instanceof Block) { //Only happens for double chests, I believe
|
||||||
|
return new Block[] { (Block) holder };
|
||||||
|
} else {
|
||||||
|
Skript.error("Something went wrong when trying to get the owner of the specified inventory!");
|
||||||
|
Skript.error("Post the below info on the SkStuff thread in SkUnity:");
|
||||||
|
Skript.error("Class -> " + holder.getClass().getCanonicalName());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
46
src/me/TheBukor/SkStuff/expressions/ExprLastLocation.java
Normal file
46
src/me/TheBukor/SkStuff/expressions/ExprLastLocation.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package me.TheBukor.SkStuff.expressions;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
|
import ch.njol.skript.lang.Expression;
|
||||||
|
import ch.njol.skript.lang.SkriptParser.ParseResult;
|
||||||
|
import ch.njol.skript.lang.util.SimpleExpression;
|
||||||
|
import ch.njol.util.Kleenean;
|
||||||
|
import me.TheBukor.SkStuff.SkStuff;
|
||||||
|
|
||||||
|
public class ExprLastLocation extends SimpleExpression<Location> {
|
||||||
|
private Expression<Entity> entity;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSingle() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Location> getReturnType() {
|
||||||
|
return Location.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) {
|
||||||
|
entity = (Expression<Entity>) expr[0];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(@Nullable Event e, boolean debug) {
|
||||||
|
return "last location of " + entity.toString(e, debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
protected Location[] get(Event e) {
|
||||||
|
Entity ent = entity.getSingle(e);
|
||||||
|
return new Location[] { SkStuff.getNMSMethods().getLastLocation(ent) };
|
||||||
|
}
|
||||||
|
}
|
@ -51,6 +51,7 @@ public class ExprNBTListIndex extends SimpleExpression<Object> {
|
|||||||
@Nullable
|
@Nullable
|
||||||
protected Object[] get(Event e) {
|
protected Object[] get(Event e) {
|
||||||
int i = index.getSingle(e).intValue();
|
int i = index.getSingle(e).intValue();
|
||||||
|
i--;
|
||||||
Object list = nbtList.getSingle(e);
|
Object list = nbtList.getSingle(e);
|
||||||
return new Object[] { SkStuff.getNMSMethods().getIndex(list, i) };
|
return new Object[] { SkStuff.getNMSMethods().getIndex(list, i) };
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package me.TheBukor.SkStuff.expressions;
|
package me.TheBukor.SkStuff.expressions;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -15,13 +11,11 @@ import ch.njol.skript.lang.SkriptParser.ParseResult;
|
|||||||
import ch.njol.skript.lang.util.SimpleExpression;
|
import ch.njol.skript.lang.util.SimpleExpression;
|
||||||
import ch.njol.util.Kleenean;
|
import ch.njol.util.Kleenean;
|
||||||
import ch.njol.util.coll.CollectionUtils;
|
import ch.njol.util.coll.CollectionUtils;
|
||||||
import me.TheBukor.SkStuff.util.ReflectionUtils;
|
import me.TheBukor.SkStuff.SkStuff;
|
||||||
|
|
||||||
public class ExprNoClip extends SimpleExpression<Boolean> {
|
public class ExprNoClip extends SimpleExpression<Boolean> {
|
||||||
private Expression<Entity> entities;
|
private Expression<Entity> entities;
|
||||||
|
|
||||||
private Class<?> craftEntClass = ReflectionUtils.getOBCClass("entity.CraftEntity");
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends Boolean> getReturnType() {
|
public Class<? extends Boolean> getReturnType() {
|
||||||
return Boolean.class;
|
return Boolean.class;
|
||||||
@ -48,40 +42,30 @@ public class ExprNoClip extends SimpleExpression<Boolean> {
|
|||||||
@Nullable
|
@Nullable
|
||||||
protected Boolean[] get(Event e) {
|
protected Boolean[] get(Event e) {
|
||||||
Entity[] ents = entities.getAll(e);
|
Entity[] ents = entities.getAll(e);
|
||||||
if (ents == null)
|
if (ents.length == 0)
|
||||||
return null;
|
return null;
|
||||||
List<Boolean> noClipStates = new ArrayList<Boolean>();
|
Boolean[] noClipStates = new Boolean[ents.length];
|
||||||
|
int i = 0;
|
||||||
for (Entity ent : ents) {
|
for (Entity ent : ents) {
|
||||||
if (ent == null)
|
if (ent == null)
|
||||||
continue;
|
continue;
|
||||||
Object nmsEnt = null;
|
noClipStates[i] = SkStuff.getNMSMethods().getNoClip(ent);
|
||||||
try {
|
i++;
|
||||||
nmsEnt = craftEntClass.cast(ent).getClass().getMethod("getHandle").invoke(ent); //nmsEnt = ((CraftEntity) ent).getHandle();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
noClipStates.add((Boolean) ReflectionUtils.getField("noclip", nmsEnt.getClass(), nmsEnt));
|
|
||||||
}
|
}
|
||||||
return Arrays.copyOf(noClipStates.toArray(), noClipStates.size(), Boolean[].class);
|
return noClipStates;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void change(Event e, @Nullable Object[] delta, ChangeMode mode) {
|
public void change(Event e, @Nullable Object[] delta, ChangeMode mode) {
|
||||||
Entity[] ents = entities.getAll(e);
|
Entity[] ents = entities.getAll(e);
|
||||||
if (ents == null)
|
if (ents.length == 0)
|
||||||
return;
|
return;
|
||||||
if (mode == ChangeMode.SET) {
|
if (mode == ChangeMode.SET) {
|
||||||
Boolean newValue = (Boolean) delta[0];
|
Boolean newValue = (Boolean) delta[0];
|
||||||
for (Entity ent : ents) {
|
for (Entity ent : ents) {
|
||||||
if (ent == null)
|
if (ent == null)
|
||||||
continue;
|
continue;
|
||||||
Object nmsEnt = null;
|
SkStuff.getNMSMethods().setNoClip(ent, newValue);
|
||||||
try {
|
|
||||||
nmsEnt = craftEntClass.cast(ent).getClass().getMethod("getHandle").invoke(ent); //nmsEnt = ((CraftEntity) ent).getHandle();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
ReflectionUtils.setField("noclip", nmsEnt.getClass(), nmsEnt, newValue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
78
src/me/TheBukor/SkStuff/expressions/ExprStepLength.java
Normal file
78
src/me/TheBukor/SkStuff/expressions/ExprStepLength.java
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
package me.TheBukor.SkStuff.expressions;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
|
||||||
|
import ch.njol.skript.classes.Changer.ChangeMode;
|
||||||
|
import ch.njol.skript.lang.Expression;
|
||||||
|
import ch.njol.skript.lang.SkriptParser.ParseResult;
|
||||||
|
import ch.njol.skript.lang.util.SimpleExpression;
|
||||||
|
import ch.njol.util.Kleenean;
|
||||||
|
import ch.njol.util.coll.CollectionUtils;
|
||||||
|
import me.TheBukor.SkStuff.SkStuff;
|
||||||
|
|
||||||
|
public class ExprStepLength extends SimpleExpression<Number> {
|
||||||
|
private Expression<Entity> entity;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSingle() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends Number> getReturnType() {
|
||||||
|
return Number.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean isDelayed, ParseResult parseResult) {
|
||||||
|
entity = (Expression<Entity>) expr[0];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(@Nullable Event e, boolean debug) {
|
||||||
|
return "step length of " + entity.toString(e, debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
protected Number[] get(Event e) {
|
||||||
|
Entity ent = entity.getSingle(e);
|
||||||
|
if (ent == null)
|
||||||
|
return null;
|
||||||
|
return new Number[] { SkStuff.getNMSMethods().getEntityStepLength(ent) };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void change(Event e, @Nullable Object[] delta, ChangeMode mode) {
|
||||||
|
Entity ent = entity.getSingle(e);
|
||||||
|
if (ent == null)
|
||||||
|
return;
|
||||||
|
if (mode == ChangeMode.ADD) {
|
||||||
|
float toAdd = ((Number) delta[0]).floatValue();
|
||||||
|
float currentLength = SkStuff.getNMSMethods().getEntityStepLength(ent);
|
||||||
|
SkStuff.getNMSMethods().setEntityStepLength(ent, (currentLength + toAdd));
|
||||||
|
} else if (mode == ChangeMode.REMOVE) {
|
||||||
|
float toRemove = ((Number) delta[0]).floatValue();
|
||||||
|
float currentLength = SkStuff.getNMSMethods().getEntityStepLength(ent);
|
||||||
|
SkStuff.getNMSMethods().setEntityStepLength(ent, (currentLength - toRemove));
|
||||||
|
} else if (mode == ChangeMode.SET) {
|
||||||
|
float toSet = ((Number) delta[0]).floatValue();
|
||||||
|
SkStuff.getNMSMethods().setEntityStepLength(ent, toSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public Class<?>[] acceptChange(ChangeMode mode) {
|
||||||
|
if (mode == ChangeMode.ADD || mode == ChangeMode.REMOVE || mode == ChangeMode.SET) {
|
||||||
|
return CollectionUtils.array(Number.class);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
@ -10,13 +10,13 @@ import ch.njol.skript.lang.SkriptParser.ParseResult;
|
|||||||
import ch.njol.skript.lang.util.SimpleExpression;
|
import ch.njol.skript.lang.util.SimpleExpression;
|
||||||
import ch.njol.util.Kleenean;
|
import ch.njol.util.Kleenean;
|
||||||
import ch.njol.util.coll.CollectionUtils;
|
import ch.njol.util.coll.CollectionUtils;
|
||||||
|
import me.TheBukor.SkStuff.SkStuff;
|
||||||
import me.TheBukor.SkStuff.util.ReflectionUtils;
|
import me.TheBukor.SkStuff.util.ReflectionUtils;
|
||||||
|
|
||||||
public class ExprTagOf extends SimpleExpression<Object> {
|
public class ExprTagOf extends SimpleExpression<Object> {
|
||||||
private Expression<String> string;
|
private Expression<String> string;
|
||||||
private Expression<Object> compound;
|
private Expression<Object> compound;
|
||||||
|
|
||||||
private Class<?> nbtClass = ReflectionUtils.getNMSClass("NBTTagCompound");
|
|
||||||
private Class<?> nbtBaseClass = ReflectionUtils.getNMSClass("NBTBase");
|
private Class<?> nbtBaseClass = ReflectionUtils.getNMSClass("NBTBase");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -36,149 +36,37 @@ public class ExprTagOf extends SimpleExpression<Object> {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public String toString(@Nullable Event e, boolean debug) {
|
public String toString(@Nullable Event e, boolean debug) {
|
||||||
return "the tag " + string.toString(e, debug) + " of compound";
|
return "the tag " + string.toString(e, debug) + " of " + compound.toString(e, debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
protected Object[] get(Event e) {
|
protected Object[] get(Event e) {
|
||||||
Object NBT = compound.getSingle(e);
|
Object NBT = compound.getSingle(e);
|
||||||
if (NBT == null || NBT.toString().equals("{}")) return null; //The NBT can be empty/inexistant for items ("{}" is an empty compound).
|
if (NBT == null || NBT.toString().equals("{}")) { // "{}" is an empty compound.
|
||||||
|
return null; //The NBT can be empty/inexistant for items
|
||||||
|
}
|
||||||
String stringTag = string.getSingle(e);
|
String stringTag = string.getSingle(e);
|
||||||
Object tag = null;
|
Object tag = SkStuff.getNMSMethods().getNBTTag(NBT, stringTag);
|
||||||
try {
|
if (tag == null) {
|
||||||
tag = nbtClass.getMethod("get", String.class).invoke(NBT, stringTag);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
if (tag == null)
|
|
||||||
return null; //The tag doesn't exist? Return <none>.
|
return null; //The tag doesn't exist? Return <none>.
|
||||||
Byte id = null;
|
|
||||||
try {
|
|
||||||
id = (Byte) tag.getClass().getMethod("getTypeId").invoke(tag);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
}
|
||||||
try {
|
byte id = SkStuff.getNMSMethods().getTypeId(tag);
|
||||||
switch (id) {
|
return new Object[] { SkStuff.getNMSMethods().getNBTTagValue(NBT, stringTag, id) };
|
||||||
case 1:
|
|
||||||
return new Byte[] { Byte.valueOf(nbtClass.getMethod("getByte", String.class).invoke(NBT, stringTag).toString()) };
|
|
||||||
case 2:
|
|
||||||
return new Short[] { Short.valueOf(nbtClass.getMethod("getShort", String.class).invoke(NBT, stringTag).toString()) };
|
|
||||||
case 3:
|
|
||||||
return new Integer[] { Integer.valueOf(nbtClass.getMethod("getInt", String.class).invoke(NBT, stringTag).toString()) };
|
|
||||||
case 4:
|
|
||||||
return new Long[] { Long.valueOf(nbtClass.getMethod("getLong", String.class).invoke(NBT, stringTag).toString()) };
|
|
||||||
case 5:
|
|
||||||
return new Float[] { Float.valueOf(nbtClass.getMethod("getFloat", String.class).invoke(NBT, stringTag).toString()) };
|
|
||||||
case 6:
|
|
||||||
return new Double[] { Double.valueOf(nbtClass.getMethod("getDouble", String.class).invoke(NBT, stringTag).toString()) };
|
|
||||||
case 7: //Byte array, only used in chunk files. Also doesn't have support for the MojangsonParser.
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
return new String[] { nbtClass.getMethod("getString", String.class).invoke(NBT, stringTag).toString() };
|
|
||||||
case 9:
|
|
||||||
int i;
|
|
||||||
Object[] list = new Object[] { new Object() };
|
|
||||||
for (i = 1; i <= 11; i++) { //To get a list I need to know the type of the tags it contains inside,
|
|
||||||
//since I can't predict what type the list will have, I just loop all of the IDs until I find a non-empty list.
|
|
||||||
list[0] = nbtClass.getMethod("getList", String.class, int.class).invoke(NBT, stringTag, i); //Try to get the list with the ID "loop-number".
|
|
||||||
if (!list[0].toString().equals("[]")) { //If list is not empty.
|
|
||||||
break; //Stop loop.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
/*
|
|
||||||
REMOVED TEMPORARILY, HOPEFULLY THE NEW IMPLEMENTATION SHOULD WORK BETTER
|
|
||||||
int i;
|
|
||||||
Object list = null;
|
|
||||||
for (i = 1; i <= 11; i++) { //To get a list I need to know the type of the tags it contains inside,
|
|
||||||
//since I can't predict what type the list will have, I just loop all of the IDs until I find a non-empty list.
|
|
||||||
list = nbtClass.getMethod("getList", String.class, int.class).invoke(NBT, stringTag, i); //Try to get the list with the ID "loop-number".
|
|
||||||
if (!list.toString().equals("[]")) { //If list is not empty.
|
|
||||||
break; //Stop loop.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String methodName = null;
|
|
||||||
switch (NBTUtil.getContentsId(list)) {
|
|
||||||
case 5: //Float
|
|
||||||
methodName = "e"; //list.e(int) = get float from the specified index.
|
|
||||||
break;
|
|
||||||
case 6: //Double
|
|
||||||
methodName = "d"; //list.d(int) = get double from the specified index.
|
|
||||||
break;
|
|
||||||
case 8: //String
|
|
||||||
methodName = "getString"; //Self-explanatory, I guess.
|
|
||||||
break;
|
|
||||||
case 10: //Compound
|
|
||||||
methodName = "get"; //list.get(int) = get compound at the specified index.
|
|
||||||
break;
|
|
||||||
case 11: //Integer array
|
|
||||||
methodName = "c"; //Not sure if ever used, but meh.
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
int listSize = (int) list.getClass().getMethod("size").invoke(list);
|
|
||||||
Object[] tags = new Object[listSize];
|
|
||||||
for (i = 0; i < listSize; i++) {
|
|
||||||
Object gottenTag = list.getClass().getMethod(methodName, int.class).invoke(list, i);
|
|
||||||
tags[i] = gottenTag;
|
|
||||||
}
|
|
||||||
return tags;
|
|
||||||
*/
|
|
||||||
case 10:
|
|
||||||
return new Object[] { nbtClass.getMethod("getCompound", String.class).invoke(NBT, stringTag) };
|
|
||||||
case 11: //Integer array, this one is only used on the chunk files (and maybe schematic files?).
|
|
||||||
return new Object[] { nbtClass.getMethod("getIntArray", String.class).invoke(NBT, stringTag).toString() };
|
|
||||||
default: //This shouldn't happen, but it's better to have this just in case it spills errors everywhere.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void change(Event e, @Nullable Object[] delta, ChangeMode mode) {
|
public void change(Event e, @Nullable Object[] delta, ChangeMode mode) {
|
||||||
Object NBT = compound.getSingle(e);
|
Object NBT = compound.getSingle(e);
|
||||||
if (NBT == null)
|
if (NBT == null) {
|
||||||
try {
|
return;
|
||||||
NBT = nbtClass.newInstance(); //If the NBT isn't set, create an empty one
|
}
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
String stringTag = string.getSingle(e);
|
String stringTag = string.getSingle(e);
|
||||||
if (mode == ChangeMode.SET) {
|
if (mode == ChangeMode.SET) {
|
||||||
Object newValue = delta[0];
|
Object newValue = delta[0];
|
||||||
try {
|
SkStuff.getNMSMethods().setNBTTag(NBT, stringTag, newValue);
|
||||||
if (newValue instanceof Byte) {
|
|
||||||
nbtClass.getMethod("setByte", String.class, byte.class).invoke(NBT, stringTag, ((Byte) newValue).byteValue());
|
|
||||||
} else if (newValue instanceof Short) {
|
|
||||||
nbtClass.getMethod("setShort", String.class, short.class).invoke(NBT, stringTag, ((Short) newValue).shortValue());
|
|
||||||
} else if (newValue instanceof Integer) {
|
|
||||||
nbtClass.getMethod("setInt", String.class, int.class).invoke(NBT, stringTag, ((Integer) newValue).intValue());
|
|
||||||
} else if (newValue instanceof Long) {
|
|
||||||
nbtClass.getMethod("setLong", String.class, long.class).invoke(NBT, stringTag, ((Long) newValue).longValue());
|
|
||||||
} else if (newValue instanceof Float) {
|
|
||||||
nbtClass.getMethod("setFloat", String.class, float.class).invoke(NBT, stringTag, ((Float) newValue).floatValue());
|
|
||||||
} else if (newValue instanceof Double) {
|
|
||||||
nbtClass.getMethod("setDouble", String.class, double.class).invoke(NBT, stringTag, ((Double) newValue).doubleValue());
|
|
||||||
} else if (newValue instanceof String) {
|
|
||||||
nbtClass.getMethod("setString", String.class, String.class).invoke(NBT, stringTag, String.valueOf(newValue));
|
|
||||||
} else {
|
|
||||||
return; //Something else like a list or entire compound.
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
} else if (mode == ChangeMode.RESET || mode == ChangeMode.DELETE) {
|
} else if (mode == ChangeMode.RESET || mode == ChangeMode.DELETE) {
|
||||||
try {
|
SkStuff.getNMSMethods().removeNBTTag(NBT, stringTag);
|
||||||
nbtClass.getMethod("set", String.class, nbtBaseClass).invoke(NBT, stringTag, nbtBaseClass.newInstance());
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +75,7 @@ public class ExprTagOf extends SimpleExpression<Object> {
|
|||||||
@Nullable
|
@Nullable
|
||||||
public Class<?>[] acceptChange(ChangeMode mode) {
|
public Class<?>[] acceptChange(ChangeMode mode) {
|
||||||
if (mode == ChangeMode.SET || mode == ChangeMode.DELETE || mode == ChangeMode.RESET) {
|
if (mode == ChangeMode.SET || mode == ChangeMode.DELETE || mode == ChangeMode.RESET) {
|
||||||
return CollectionUtils.array(Object.class);
|
return CollectionUtils.array(Number.class, String.class, nbtBaseClass);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ public class PathfinderGoalFollow_v1_8_R3 extends PathfinderGoal {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !follower.getNavigation().m(); // m() means hasNoPath()
|
return follower.getNavigation().m(); // m() means hasNoPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
// c() is execute()
|
// c() is execute()
|
||||||
|
@ -64,7 +64,7 @@ public class PathfinderGoalFollow_v1_9_R1 extends PathfinderGoal {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return !follower.getNavigation().n(); // n() means hasNoPath()
|
return follower.getNavigation().n(); // n() means hasNoPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
// c() is execute()
|
// c() is execute()
|
||||||
@ -72,4 +72,6 @@ public class PathfinderGoalFollow_v1_9_R1 extends PathfinderGoal {
|
|||||||
public void c() {
|
public void c() {
|
||||||
follower.getNavigation().a(followed, speed); // a() means moveTo()
|
follower.getNavigation().a(followed, speed); // a() means moveTo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,63 +1,92 @@
|
|||||||
package me.TheBukor.SkStuff.util;
|
package me.TheBukor.SkStuff.util;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public interface NMSInterface {
|
public interface NMSInterface {
|
||||||
|
|
||||||
public void addToCompound(Object compound, Object toAdd);
|
public Object getNBTTag(Object compound, String tag);
|
||||||
|
|
||||||
public void removeFromCompound(Object compound, String ... toRemove);
|
public void setNBTTag(Object compound, String tag, Object toSet);
|
||||||
|
|
||||||
public Object parseRawNBT(String rawNBT);
|
public void removeNBTTag(Object compound, String tag);
|
||||||
|
|
||||||
public Object[] getContents(Object nbtList);
|
public byte getTypeId(Object nbtBase);
|
||||||
|
|
||||||
public void addToList(Object nbtList, Object toAdd);
|
public Object getNBTTagValue(Object compound, String tag, byte typeId);
|
||||||
|
|
||||||
public void removeFromList(Object nbtList, int index);
|
public void addToCompound(Object compound, Object toAdd);
|
||||||
|
|
||||||
public void setIndex(Object nbtList, int index, Object toSet);
|
public void removeFromCompound(Object compound, String ... toRemove);
|
||||||
|
|
||||||
public Object getIndex(Object nbtList, int index);
|
public Object parseRawNBT(String rawNBT);
|
||||||
|
|
||||||
public void clearPathfinderGoals(Entity entity);
|
public Object[] getContents(Object nbtList);
|
||||||
|
|
||||||
public void removePathfinderGoal(Object entity, Class<?> goalClass, boolean isTargetSelector);
|
public void addToList(Object nbtList, Object toAdd);
|
||||||
|
|
||||||
public void addPathfinderGoal(Object entity, int priority, Object goal, boolean isTargetSelector);
|
public void removeFromList(Object nbtList, int index);
|
||||||
|
|
||||||
public void registerCompoundClassInfo();
|
public void setIndex(Object nbtList, int index, Object toSet);
|
||||||
|
|
||||||
public void registerNBTListClassInfo();
|
public Object getIndex(Object nbtList, int index);
|
||||||
|
|
||||||
public Object getEntityNBT(Entity entity);
|
public void clearPathfinderGoals(Entity entity);
|
||||||
|
|
||||||
public Object getTileNBT(Block block);
|
public void removePathfinderGoal(Object entity, Class<?> goalClass, boolean isTargetSelector);
|
||||||
|
|
||||||
public Object getItemNBT(ItemStack itemStack);
|
public void addPathfinderGoal(Object entity, int priority, Object goal, boolean isTargetSelector);
|
||||||
|
|
||||||
public void setEntityNBT(Entity entity, Object newCompound);
|
public void registerCompoundClassInfo();
|
||||||
|
|
||||||
public void setTileNBT(Block block, Object newCompound);
|
public void registerNBTListClassInfo();
|
||||||
|
|
||||||
public ItemStack getItemWithNBT(ItemStack itemStack, Object compound);
|
public Object getEntityNBT(Entity entity);
|
||||||
|
|
||||||
public Object getFileNBT(File file);
|
public Object getTileNBT(Block block);
|
||||||
|
|
||||||
public void setFileNBT(File file, Object newCompound);
|
public Object getItemNBT(ItemStack itemStack);
|
||||||
|
|
||||||
public Object convertToNBT(Number number);
|
public void setEntityNBT(Entity entity, Object newCompound);
|
||||||
|
|
||||||
public Object convertToNBT(String string);
|
public void setTileNBT(Block block, Object newCompound);
|
||||||
|
|
||||||
public String getMCId(ItemStack itemStack);
|
public ItemStack getItemWithNBT(ItemStack itemStack, Object compound);
|
||||||
|
|
||||||
public ItemStack getItemFromMcId(String mcId);
|
public Object getFileNBT(File file);
|
||||||
|
|
||||||
void makeClientSay(String msg, Player p);
|
public void setFileNBT(File file, Object newCompound);
|
||||||
}
|
|
||||||
|
public Object convertToNBT(Number number);
|
||||||
|
|
||||||
|
public Object convertToNBT(String string);
|
||||||
|
|
||||||
|
public String getMCId(ItemStack itemStack);
|
||||||
|
|
||||||
|
public ItemStack getItemFromMcId(String mcId);
|
||||||
|
|
||||||
|
public boolean getNoClip(Entity entity);
|
||||||
|
|
||||||
|
public void setNoClip(Entity entity, boolean noclip);
|
||||||
|
|
||||||
|
public boolean getFireProof(Entity entity);
|
||||||
|
|
||||||
|
public void setFireProof(Entity entity, boolean fireProof);
|
||||||
|
|
||||||
|
/*
|
||||||
|
public ItemStack[] getEndermanBlocks(Entity enderman);
|
||||||
|
|
||||||
|
public void setEndermanBlocks(Entity enderman, ItemStack... blocks);
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Location getLastLocation(Entity entity);
|
||||||
|
|
||||||
|
public float getEntityStepLength(Entity entity);
|
||||||
|
|
||||||
|
public void setEntityStepLength(Entity entity, float length);
|
||||||
|
|
||||||
|
}
|
@ -17,14 +17,13 @@ import java.util.Set;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
|
||||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import ch.njol.skript.Skript;
|
import ch.njol.skript.Skript;
|
||||||
@ -51,10 +50,89 @@ import net.minecraft.server.v1_7_R4.NBTTagShort;
|
|||||||
import net.minecraft.server.v1_7_R4.NBTTagString;
|
import net.minecraft.server.v1_7_R4.NBTTagString;
|
||||||
import net.minecraft.server.v1_7_R4.TileEntity;
|
import net.minecraft.server.v1_7_R4.TileEntity;
|
||||||
import net.minecraft.server.v1_7_R4.World;
|
import net.minecraft.server.v1_7_R4.World;
|
||||||
import net.minecraft.server.v1_7_R4.PacketPlayInChat;
|
|
||||||
|
|
||||||
public class NMS_v1_7_R4 implements NMSInterface {
|
public class NMS_v1_7_R4 implements NMSInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getNBTTag(Object compound, String tag) {
|
||||||
|
if (compound instanceof NBTTagCompound) {
|
||||||
|
return ((NBTTagCompound) compound).get(tag);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setNBTTag(Object compound, String tag, Object toSet) {
|
||||||
|
if (compound instanceof NBTTagCompound && (toSet instanceof NBTBase || toSet instanceof Number || toSet instanceof String)) {
|
||||||
|
NBTBase converted = null;
|
||||||
|
if (toSet instanceof Number) {
|
||||||
|
converted = convertToNBT((Number) toSet);
|
||||||
|
} else if (toSet instanceof String) {
|
||||||
|
converted = convertToNBT((String) toSet);
|
||||||
|
} else { //Already an NBTBase
|
||||||
|
converted = (NBTBase) toSet; //No need to convert anything
|
||||||
|
}
|
||||||
|
((NBTTagCompound) compound).set(tag, converted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeNBTTag(Object compound, String tag) {
|
||||||
|
if (compound instanceof NBTTagCompound) {
|
||||||
|
((NBTTagCompound) compound).remove(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte getTypeId(Object nbtBase) {
|
||||||
|
if (nbtBase instanceof NBTBase) {
|
||||||
|
return ((NBTBase) nbtBase).getTypeId();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getNBTTagValue(Object compound, String tag, byte typeId) {
|
||||||
|
if (compound instanceof NBTTagCompound) {
|
||||||
|
switch (typeId) {
|
||||||
|
case 1:
|
||||||
|
return ((NBTTagCompound) compound).getByte(tag);
|
||||||
|
case 2:
|
||||||
|
return ((NBTTagCompound) compound).getShort(tag);
|
||||||
|
case 3:
|
||||||
|
return ((NBTTagCompound) compound).getInt(tag);
|
||||||
|
case 4:
|
||||||
|
return ((NBTTagCompound) compound).getLong(tag);
|
||||||
|
case 5:
|
||||||
|
return ((NBTTagCompound) compound).getFloat(tag);
|
||||||
|
case 6:
|
||||||
|
return ((NBTTagCompound) compound).getDouble(tag);
|
||||||
|
case 7: //Byte array, only used in chunk files. Also doesn't have support for the MojangsonParser.
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
return ((NBTTagCompound) compound).getString(tag);
|
||||||
|
case 9:
|
||||||
|
int i;
|
||||||
|
NBTTagList list = null;
|
||||||
|
for (i = 1; i <= 11; i++) { //To get a list I need to know the type of the tags it contains inside,
|
||||||
|
//since I can't predict what type the list will have, I just loop all of the IDs until I find a non-empty list.
|
||||||
|
list = ((NBTTagCompound) compound).getList(tag, i); //Try to get the list with the ID "loop-number".
|
||||||
|
if (!list.toString().equals("[]")) { //If list is not empty.
|
||||||
|
break; //Stop loop.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list; //May be null
|
||||||
|
case 10:
|
||||||
|
return ((NBTTagCompound) compound).getCompound(tag);
|
||||||
|
case 11: //Integer array, this one is only used on the chunk files (and maybe schematic files?).
|
||||||
|
return ((NBTTagCompound) compound).getIntArray(tag);
|
||||||
|
default: //This should never happen, but it's better to have this just in case it spills errors everywhere.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void addToCompound(Object compound, Object toAdd) {
|
public void addToCompound(Object compound, Object toAdd) {
|
||||||
@ -496,8 +574,44 @@ public class NMS_v1_7_R4 implements NMSInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void makeClientSay(String msg, Player p) {
|
public boolean getNoClip(Entity entity) {
|
||||||
PacketPlayInChat chatPacket = new PacketPlayInChat(msg);
|
return false; //Not supported in 1.7
|
||||||
((CraftPlayer) p).getHandle().playerConnection.a(chatPacket);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setNoClip(Entity entity, boolean noclip) {
|
||||||
|
return; //Not supported in 1.7
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getFireProof(Entity entity) {
|
||||||
|
net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
return (boolean) ReflectionUtils.getField("fireProof", nmsEntity.getClass(), nmsEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFireProof(Entity entity, boolean fireProof) {
|
||||||
|
net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
ReflectionUtils.setField("fireProof", nmsEntity.getClass(), nmsEntity, fireProof);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLastLocation(Entity entity) {
|
||||||
|
net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
org.bukkit.World world = nmsEntity.world.getWorld();
|
||||||
|
Location lastEntLoc = new Location(world, nmsEntity.S, nmsEntity.T, nmsEntity.U);
|
||||||
|
return lastEntLoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getEntityStepLength(Entity entity) {
|
||||||
|
net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
return nmsEntity.V;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEntityStepLength(Entity entity, float length) {
|
||||||
|
net.minecraft.server.v1_7_R4.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.V = length;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,14 +14,13 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import ch.njol.skript.Skript;
|
import ch.njol.skript.Skript;
|
||||||
@ -54,10 +53,89 @@ import net.minecraft.server.v1_8_R3.PathfinderGoal;
|
|||||||
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
|
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.v1_8_R3.TileEntity;
|
import net.minecraft.server.v1_8_R3.TileEntity;
|
||||||
import net.minecraft.server.v1_8_R3.World;
|
import net.minecraft.server.v1_8_R3.World;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayInChat;
|
|
||||||
|
|
||||||
public class NMS_v1_8_R3 implements NMSInterface {
|
public class NMS_v1_8_R3 implements NMSInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getNBTTag(Object compound, String tag) {
|
||||||
|
if (compound instanceof NBTTagCompound) {
|
||||||
|
return ((NBTTagCompound) compound).get(tag);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setNBTTag(Object compound, String tag, Object toSet) {
|
||||||
|
if (compound instanceof NBTTagCompound && (toSet instanceof NBTBase || toSet instanceof Number || toSet instanceof String)) {
|
||||||
|
NBTBase converted = null;
|
||||||
|
if (toSet instanceof Number) {
|
||||||
|
converted = convertToNBT((Number) toSet);
|
||||||
|
} else if (toSet instanceof String) {
|
||||||
|
converted = convertToNBT((String) toSet);
|
||||||
|
} else { //Already an NBTBase
|
||||||
|
converted = (NBTBase) toSet; //No need to convert anything
|
||||||
|
}
|
||||||
|
((NBTTagCompound) compound).set(tag, converted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeNBTTag(Object compound, String tag) {
|
||||||
|
if (compound instanceof NBTTagCompound) {
|
||||||
|
((NBTTagCompound) compound).remove(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte getTypeId(Object nbtBase) {
|
||||||
|
if (nbtBase instanceof NBTBase) {
|
||||||
|
return ((NBTBase) nbtBase).getTypeId();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getNBTTagValue(Object compound, String tag, byte typeId) {
|
||||||
|
if (compound instanceof NBTTagCompound) {
|
||||||
|
switch (typeId) {
|
||||||
|
case 1:
|
||||||
|
return ((NBTTagCompound) compound).getByte(tag);
|
||||||
|
case 2:
|
||||||
|
return ((NBTTagCompound) compound).getShort(tag);
|
||||||
|
case 3:
|
||||||
|
return ((NBTTagCompound) compound).getInt(tag);
|
||||||
|
case 4:
|
||||||
|
return ((NBTTagCompound) compound).getLong(tag);
|
||||||
|
case 5:
|
||||||
|
return ((NBTTagCompound) compound).getFloat(tag);
|
||||||
|
case 6:
|
||||||
|
return ((NBTTagCompound) compound).getDouble(tag);
|
||||||
|
case 7: //Byte array, only used in chunk files. Also doesn't have support for the MojangsonParser.
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
return ((NBTTagCompound) compound).getString(tag);
|
||||||
|
case 9:
|
||||||
|
int i;
|
||||||
|
NBTTagList list = null;
|
||||||
|
for (i = 1; i <= 11; i++) { //To get a list I need to know the type of the tags it contains inside,
|
||||||
|
//since I can't predict what type the list will have, I just loop all of the IDs until I find a non-empty list.
|
||||||
|
list = ((NBTTagCompound) compound).getList(tag, i); //Try to get the list with the ID "loop-number".
|
||||||
|
if (!list.isEmpty()) { //If list is not empty.
|
||||||
|
break; //Stop loop.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list; //May be null
|
||||||
|
case 10:
|
||||||
|
return ((NBTTagCompound) compound).getCompound(tag);
|
||||||
|
case 11: //Integer array, this one is only used on the chunk files (and maybe schematic files?).
|
||||||
|
return ((NBTTagCompound) compound).getIntArray(tag);
|
||||||
|
default: //This should never happen, but it's better to have this just in case it spills errors everywhere.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addToCompound(Object compound, Object toAdd) {
|
public void addToCompound(Object compound, Object toAdd) {
|
||||||
if (compound instanceof NBTTagCompound && toAdd instanceof NBTTagCompound) {
|
if (compound instanceof NBTTagCompound && toAdd instanceof NBTTagCompound) {
|
||||||
@ -538,8 +616,46 @@ public class NMS_v1_8_R3 implements NMSInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void makeClientSay(String msg, Player p) {
|
public boolean getNoClip(Entity entity) {
|
||||||
PacketPlayInChat chatPacket = new PacketPlayInChat(msg);
|
net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
((CraftPlayer) p).getHandle().playerConnection.a(chatPacket);
|
return nmsEntity.noclip;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setNoClip(Entity entity, boolean noclip) {
|
||||||
|
net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.noclip = noclip;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getFireProof(Entity entity) {
|
||||||
|
net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
return nmsEntity.isFireProof();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFireProof(Entity entity, boolean fireProof) {
|
||||||
|
net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
ReflectionUtils.setField("fireProof", nmsEntity.getClass(), nmsEntity, fireProof);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLastLocation(Entity entity) {
|
||||||
|
net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
org.bukkit.World world = nmsEntity.world.getWorld();
|
||||||
|
Location lastEntLoc = new Location(world, nmsEntity.P, nmsEntity.Q, nmsEntity.R);
|
||||||
|
return lastEntLoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getEntityStepLength(Entity entity) {
|
||||||
|
net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
return nmsEntity.S;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEntityStepLength(Entity entity, float length) {
|
||||||
|
net.minecraft.server.v1_8_R3.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.S = length;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,14 +14,13 @@ import java.util.LinkedHashSet;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftEntity;
|
||||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import ch.njol.skript.Skript;
|
import ch.njol.skript.Skript;
|
||||||
@ -51,7 +50,6 @@ import net.minecraft.server.v1_9_R1.NBTTagList;
|
|||||||
import net.minecraft.server.v1_9_R1.NBTTagLong;
|
import net.minecraft.server.v1_9_R1.NBTTagLong;
|
||||||
import net.minecraft.server.v1_9_R1.NBTTagShort;
|
import net.minecraft.server.v1_9_R1.NBTTagShort;
|
||||||
import net.minecraft.server.v1_9_R1.NBTTagString;
|
import net.minecraft.server.v1_9_R1.NBTTagString;
|
||||||
import net.minecraft.server.v1_9_R1.PacketPlayInChat;
|
|
||||||
import net.minecraft.server.v1_9_R1.PathfinderGoal;
|
import net.minecraft.server.v1_9_R1.PathfinderGoal;
|
||||||
import net.minecraft.server.v1_9_R1.PathfinderGoalSelector;
|
import net.minecraft.server.v1_9_R1.PathfinderGoalSelector;
|
||||||
import net.minecraft.server.v1_9_R1.TileEntity;
|
import net.minecraft.server.v1_9_R1.TileEntity;
|
||||||
@ -59,6 +57,86 @@ import net.minecraft.server.v1_9_R1.World;
|
|||||||
|
|
||||||
public class NMS_v1_9_R1 implements NMSInterface {
|
public class NMS_v1_9_R1 implements NMSInterface {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getNBTTag(Object compound, String tag) {
|
||||||
|
if (compound instanceof NBTTagCompound) {
|
||||||
|
return ((NBTTagCompound) compound).get(tag);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setNBTTag(Object compound, String tag, Object toSet) {
|
||||||
|
if (compound instanceof NBTTagCompound && (toSet instanceof NBTBase || toSet instanceof Number || toSet instanceof String)) {
|
||||||
|
NBTBase converted = null;
|
||||||
|
if (toSet instanceof Number) {
|
||||||
|
converted = convertToNBT((Number) toSet);
|
||||||
|
} else if (toSet instanceof String) {
|
||||||
|
converted = convertToNBT((String) toSet);
|
||||||
|
} else { //Already an NBTBase
|
||||||
|
converted = (NBTBase) toSet; //No need to convert anything
|
||||||
|
}
|
||||||
|
((NBTTagCompound) compound).set(tag, converted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeNBTTag(Object compound, String tag) {
|
||||||
|
if (compound instanceof NBTTagCompound) {
|
||||||
|
((NBTTagCompound) compound).remove(tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte getTypeId(Object nbtBase) {
|
||||||
|
if (nbtBase instanceof NBTBase) {
|
||||||
|
return ((NBTBase) nbtBase).getTypeId();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getNBTTagValue(Object compound, String tag, byte typeId) {
|
||||||
|
if (compound instanceof NBTTagCompound) {
|
||||||
|
switch (typeId) {
|
||||||
|
case 1:
|
||||||
|
return ((NBTTagCompound) compound).getByte(tag);
|
||||||
|
case 2:
|
||||||
|
return ((NBTTagCompound) compound).getShort(tag);
|
||||||
|
case 3:
|
||||||
|
return ((NBTTagCompound) compound).getInt(tag);
|
||||||
|
case 4:
|
||||||
|
return ((NBTTagCompound) compound).getLong(tag);
|
||||||
|
case 5:
|
||||||
|
return ((NBTTagCompound) compound).getFloat(tag);
|
||||||
|
case 6:
|
||||||
|
return ((NBTTagCompound) compound).getDouble(tag);
|
||||||
|
case 7: //Byte array, only used in chunk files. Also doesn't have support for the MojangsonParser.
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
return ((NBTTagCompound) compound).getString(tag);
|
||||||
|
case 9:
|
||||||
|
int i;
|
||||||
|
NBTTagList list = null;
|
||||||
|
for (i = 1; i <= 11; i++) { //To get a list I need to know the type of the tags it contains inside,
|
||||||
|
//since I can't predict what type the list will have, I just loop all of the IDs until I find a non-empty list.
|
||||||
|
list = ((NBTTagCompound) compound).getList(tag, i); //Try to get the list with the ID "loop-number".
|
||||||
|
if (!list.isEmpty()) { //If list is not empty.
|
||||||
|
break; //Stop loop.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list; //May be null
|
||||||
|
case 10:
|
||||||
|
return ((NBTTagCompound) compound).getCompound(tag);
|
||||||
|
case 11: //Integer array, this one is only used on the chunk files (and maybe schematic files?).
|
||||||
|
return ((NBTTagCompound) compound).getIntArray(tag);
|
||||||
|
default: //This should never happen, but it's better to have this just in case it spills errors everywhere.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addToCompound(Object compound, Object toAdd) {
|
public void addToCompound(Object compound, Object toAdd) {
|
||||||
if (compound instanceof NBTTagCompound && toAdd instanceof NBTTagCompound) {
|
if (compound instanceof NBTTagCompound && toAdd instanceof NBTTagCompound) {
|
||||||
@ -541,8 +619,79 @@ public class NMS_v1_9_R1 implements NMSInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void makeClientSay(String msg, Player p) {
|
public boolean getNoClip(Entity entity) {
|
||||||
PacketPlayInChat chatPacket = new PacketPlayInChat(msg);
|
net.minecraft.server.v1_9_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
((CraftPlayer) p).getHandle().playerConnection.a(chatPacket);
|
return nmsEntity.noclip;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setNoClip(Entity entity, boolean noclip) {
|
||||||
|
net.minecraft.server.v1_9_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.noclip = noclip;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getFireProof(Entity entity) {
|
||||||
|
net.minecraft.server.v1_9_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
return nmsEntity.isFireProof();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFireProof(Entity entity, boolean fireProof) {
|
||||||
|
net.minecraft.server.v1_9_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
ReflectionUtils.setField("fireProof", nmsEntity.getClass(), nmsEntity, fireProof);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public ItemStack[] getEndermanBlocks(Entity enderman) {
|
||||||
|
EntityEnderman nmsEnder = ((CraftEnderman) enderman).getHandle();
|
||||||
|
Set<net.minecraft.server.v1_9_R1.Block> nmsBlocks = (Set<net.minecraft.server.v1_9_R1.Block>) ReflectionUtils.getField("c", EntityEnderman.class, nmsEnder);
|
||||||
|
ItemStack[] items = new ItemStack[nmsBlocks.size()];
|
||||||
|
int i = 0;
|
||||||
|
for (net.minecraft.server.v1_9_R1.Block nmsBlock : nmsBlocks) {
|
||||||
|
IBlockData nmsBlockData = nmsBlock.getBlockData();
|
||||||
|
int dataValue = nmsBlock.toLegacyData(nmsBlockData);
|
||||||
|
net.minecraft.server.v1_9_R1.ItemStack nmsItem = new net.minecraft.server.v1_9_R1.ItemStack(nmsBlock, 1, dataValue);
|
||||||
|
ItemStack bukkitItem = CraftItemStack.asCraftMirror(nmsItem);
|
||||||
|
items[i] = bukkitItem;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void setEndermanBlocks(Entity enderman, ItemStack... blocks) {
|
||||||
|
EntityEnderman nmsEnder = ((CraftEnderman) enderman).getHandle();
|
||||||
|
Set<net.minecraft.server.v1_9_R1.Block> nmsBlocks = (Set<net.minecraft.server.v1_9_R1.Block>) ReflectionUtils.getField("c", EntityEnderman.class, nmsEnder);
|
||||||
|
for (ItemStack block : blocks) {
|
||||||
|
if (!block.getType().isBlock())
|
||||||
|
return;
|
||||||
|
// TODO Figure out how to get a Blocks from a Bukkit ItemStack
|
||||||
|
// Blocks.class has a PRIVATE method to get from a MC id.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLastLocation(Entity entity) {
|
||||||
|
net.minecraft.server.v1_9_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
org.bukkit.World world = nmsEntity.world.getWorld();
|
||||||
|
Location lastEntLoc = new Location(world, nmsEntity.M, nmsEntity.N, nmsEntity.O);
|
||||||
|
return lastEntLoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getEntityStepLength(Entity entity) {
|
||||||
|
net.minecraft.server.v1_9_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
return nmsEntity.P;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEntityStepLength(Entity entity, float length) {
|
||||||
|
net.minecraft.server.v1_9_R1.Entity nmsEntity = ((CraftEntity) entity).getHandle();
|
||||||
|
nmsEntity.P = length;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user