Fixes, two new features.
Fixed the new Follow pathfinder goals. Added new optional syntax to NBTListIndex. Removed unused code in NBTOf. Added new NMS Method: makeClientSay. Added ClientChat effect. Added ResourcePackSound effect (1.9).
This commit is contained in:
parent
b9ccb09eed
commit
7d938de291
@ -1,5 +1,6 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
|
@ -32,6 +32,7 @@ import ch.njol.skript.registrations.EventValues;
|
||||
import ch.njol.skript.util.Getter;
|
||||
import me.TheBukor.SkStuff.conditions.CondSelectionContains;
|
||||
import me.TheBukor.SkStuff.effects.EffClearPathGoals;
|
||||
import me.TheBukor.SkStuff.effects.EffClientChat;
|
||||
import me.TheBukor.SkStuff.effects.EffDrainLiquid;
|
||||
import me.TheBukor.SkStuff.effects.EffDrawLineWE;
|
||||
import me.TheBukor.SkStuff.effects.EffGZipFile;
|
||||
@ -45,7 +46,7 @@ import me.TheBukor.SkStuff.effects.EffPasteSchematic;
|
||||
import me.TheBukor.SkStuff.effects.EffRememberChanges;
|
||||
import me.TheBukor.SkStuff.effects.EffRemovePathGoal;
|
||||
import me.TheBukor.SkStuff.effects.EffReplaceBlocksWE;
|
||||
import me.TheBukor.SkStuff.effects.EffRestoreInv;
|
||||
import me.TheBukor.SkStuff.effects.EffResourceSound;
|
||||
import me.TheBukor.SkStuff.effects.EffSetBlocksWE;
|
||||
import me.TheBukor.SkStuff.effects.EffSetPathGoal;
|
||||
import me.TheBukor.SkStuff.effects.EffShowEntityEffect;
|
||||
@ -63,6 +64,7 @@ import me.TheBukor.SkStuff.expressions.ExprFireProof;
|
||||
import me.TheBukor.SkStuff.expressions.ExprFlagOfWGRegion;
|
||||
import me.TheBukor.SkStuff.expressions.ExprFlagsOfWGRegion;
|
||||
import me.TheBukor.SkStuff.expressions.ExprGlideState;
|
||||
import me.TheBukor.SkStuff.expressions.ExprInventoryOwner;
|
||||
import me.TheBukor.SkStuff.expressions.ExprItemNBT;
|
||||
import me.TheBukor.SkStuff.expressions.ExprMCIdOf;
|
||||
import me.TheBukor.SkStuff.expressions.ExprMCIdToItem;
|
||||
@ -75,7 +77,6 @@ import me.TheBukor.SkStuff.expressions.ExprSchematicArea;
|
||||
import me.TheBukor.SkStuff.expressions.ExprSelectionArea;
|
||||
import me.TheBukor.SkStuff.expressions.ExprSelectionOfPlayer;
|
||||
import me.TheBukor.SkStuff.expressions.ExprSelectionPos;
|
||||
import me.TheBukor.SkStuff.expressions.ExprSerializedInv;
|
||||
import me.TheBukor.SkStuff.expressions.ExprTagOf;
|
||||
import me.TheBukor.SkStuff.expressions.ExprTimespanToNumber;
|
||||
import me.TheBukor.SkStuff.expressions.ExprToLowerCase;
|
||||
@ -104,20 +105,19 @@ public class SkStuff extends JavaPlugin {
|
||||
getLogger().info("SkStuff " + this.getDescription().getVersion() + " has been successfully enabled!");
|
||||
getLogger().info("Registering general non version specific stuff...");
|
||||
Skript.registerEffect(EffShowEntityEffect.class, "(display|play|show) entity effect (0¦firework[s] explo(de|sion)|1¦hurt|2¦[[iron] golem] (give|offer) (rose|poppy)|3¦[sheep] eat grass|4¦wolf shake) at %entity%");
|
||||
Skript.registerEffect(EffRestoreInv.class, "[(skstuff|1.9)] restore %inventory% (to|from) [serialized [inventory [conents]]] %string%");
|
||||
Skript.registerExpression(ExprToUpperCase.class, String.class, ExpressionType.SIMPLE, "%string% [converted] to [all] (cap[ital]s|upper[ ]case)", "convert %string% to [all] (cap[ital]s|upper[ ]case)", "capitalize [all] [char[acter]s (of|in)] %string%");
|
||||
Skript.registerExpression(ExprToLowerCase.class, String.class, ExpressionType.SIMPLE, "%string% [converted] to [all] lower[ ]case", "convert %string% to [all] lower[ ]case", "un[( |-)]capitalize [all] [char[acter]s (of|in)] %string%");
|
||||
Skript.registerExpression(ExprWordsToUpperCase.class, String.class, ExpressionType.SIMPLE, "(first|1st) (letter|char[acter]) (of|in) (each word|[all] words) (of|in) %string% [converted] to (cap[ital]s|upper[ ]case) (0¦|1¦ignoring [other] upper[ ]case [(char[acter]s|letters)])", "convert (first|1st) (letter|char[acter]) (of|in) (each word|[all] words) (of|in) %string% to (cap[ital]s|upper[ ]case) (0¦|1¦ignoring [other] upper[ ]case [(char[acter]s|letters)])", "capitalize (first|1st) (letter|char[acter]) (of|in) (each word|[all] words) (of|in) %string% (0¦|1¦ignoring [other] upper[ ]case [(char[acter]s|letters)])");
|
||||
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%");
|
||||
effAmount += 2;
|
||||
Skript.registerExpression(ExprInventoryOwner.class, Object.class, ExpressionType.PROPERTY, "[inventory] (owner|holder) of %inventory%", "%inventory%'s [inventory] (owner|holder)");
|
||||
effAmount += 1;
|
||||
exprAmount += 6;
|
||||
if (Skript.isRunningMinecraft(1, 9)) {
|
||||
getLogger().info("WOW! You're using Minecraft 1.9! Lemme register some cool elytra stuff 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.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");
|
||||
|
||||
EventValues.registerEventValue(EntityToggleGlideEvent.class, Entity.class, new Getter<Entity, EntityToggleGlideEvent>() {
|
||||
@Override
|
||||
@Nullable
|
||||
@ -125,7 +125,7 @@ public class SkStuff extends JavaPlugin {
|
||||
return e.getEntity();
|
||||
}
|
||||
}, 0);
|
||||
|
||||
effAmount += 1;
|
||||
evtAmount += 1;
|
||||
exprAmount += 1;
|
||||
}
|
||||
@ -136,6 +136,7 @@ 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(EffMakeJump.class, "make %livingentities% jump", "force %livingentities% to jump");
|
||||
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(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%");
|
||||
@ -149,7 +150,7 @@ public class SkStuff extends JavaPlugin {
|
||||
Skript.registerExpression(ExprMCIdToItem.class, ItemStack.class, ExpressionType.SIMPLE, "item[[ ](stack|type)] (of|from) (mc|minecraft) [(string|native)] id %string%");
|
||||
nmsMethods.registerCompoundClassInfo();
|
||||
nmsMethods.registerNBTListClassInfo();
|
||||
effAmount += 5;
|
||||
effAmount += 6;
|
||||
exprAmount += 11;
|
||||
typeAmount += 2;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class ExprGlideState extends SimpleExpression<Boolean> {
|
||||
protected Boolean[] get(Event e) {
|
||||
LivingEntity ent = entity.getSingle(e);
|
||||
EntityLiving nmsEntity = ((CraftLivingEntity) ent).getHandle();
|
||||
return new Boolean[] { nmsEntity.cB() };
|
||||
return new Boolean[] { nmsEntity.getFlag(7) };
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -32,14 +32,19 @@ public class ExprNBTListIndex extends SimpleExpression<Object> {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public boolean init(Expression<?>[] expr, int matchedPattern, Kleenean arg2, ParseResult result) {
|
||||
if (matchedPattern == 0) {
|
||||
nbtList = (Expression<Object>) expr[0];
|
||||
index = (Expression<Number>) expr[1];
|
||||
} else {
|
||||
index = (Expression<Number>) expr[0];
|
||||
nbtList = (Expression<Object>) expr[1];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(@Nullable Event e, boolean debug) {
|
||||
return "NBT list" + nbtList.toString(e, debug) + " index " + index.toString(e, debug);
|
||||
return "index " + index.toString(e, debug) + " from nbt list " + nbtList.toString(e, debug);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -104,28 +104,8 @@ public class ExprNBTOf extends SimpleExpression<Object> {
|
||||
SkStuff.getNMSMethods().setTileNBT((Block) tar, blockNBT);
|
||||
}
|
||||
} else if (tar instanceof ItemStack) {
|
||||
Object itemNBT = SkStuff.getNMSMethods().getItemNBT((ItemStack) tar);
|
||||
if (mode == ChangeMode.ADD) {
|
||||
SkStuff.getNMSMethods().addToCompound(itemNBT, parsedNBT);
|
||||
ItemStack newItem = SkStuff.getNMSMethods().getItemWithNBT((ItemStack) tar, itemNBT);
|
||||
Object slot = target.getSource().getSingle(e);
|
||||
if (slot instanceof Slot) {
|
||||
((Slot) slot).setItem(newItem);
|
||||
}
|
||||
} else if (mode == ChangeMode.REMOVE) {
|
||||
String[] toRemove = Arrays.copyOf(delta, delta.length, String[].class);
|
||||
SkStuff.getNMSMethods().removeFromCompound(itemNBT, toRemove);
|
||||
ItemStack newItem = SkStuff.getNMSMethods().getItemWithNBT((ItemStack) tar, itemNBT);
|
||||
Object slot = target.getSource().getSingle(e);
|
||||
if (slot instanceof Slot) {
|
||||
((Slot) slot).setItem(newItem);
|
||||
}
|
||||
} else if (mode == ChangeMode.DELETE || mode == ChangeMode.RESET) {
|
||||
ItemStack newItem = SkStuff.getNMSMethods().getItemWithNBT((ItemStack) tar, null);
|
||||
Object slot = target.getSource().getSingle(e);
|
||||
if (slot instanceof Slot) {
|
||||
((Slot) slot).setItem(newItem);
|
||||
}
|
||||
if (mode == ChangeMode.ADD || mode == ChangeMode.REMOVE || mode == ChangeMode.DELETE || mode == ChangeMode.RESET) {
|
||||
Skript.warning("Failed to change the NBT of an item: Itemstack didn't have any slot attached to it.");
|
||||
}
|
||||
} else if (tar instanceof Slot) {
|
||||
ItemStack slotItem = ((Slot) tar).getItem();
|
||||
|
@ -53,9 +53,14 @@ public class PathfinderGoalFollow_v1_8_R3 extends PathfinderGoal {
|
||||
@Override
|
||||
public boolean b() {
|
||||
if (followed.dead) {
|
||||
followed = null;
|
||||
return false;
|
||||
} else if (followed.h(follower) < 9.0D || followed.h(follower) > Math.pow(radius, 2)) { // h() = distanceSquaredFrom()
|
||||
return false; // if 3 blocks away or not in radius, stop moving.
|
||||
//Maybe I'll add a teleport feature later.
|
||||
} else if (isByName) {
|
||||
if (!followed.getCustomName().equals(customName)) {
|
||||
followed = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -65,6 +70,6 @@ public class PathfinderGoalFollow_v1_8_R3 extends PathfinderGoal {
|
||||
// c() is execute()
|
||||
@Override
|
||||
public void c() {
|
||||
follower.getNavigation().a(followed, speed);
|
||||
follower.getNavigation().a(followed, speed); // a() means moveTo()
|
||||
}
|
||||
}
|
@ -53,9 +53,14 @@ public class PathfinderGoalFollow_v1_9_R1 extends PathfinderGoal {
|
||||
@Override
|
||||
public boolean b() {
|
||||
if (followed.dead) {
|
||||
followed = null;
|
||||
return false;
|
||||
} else if (followed.h(follower) < 9.0D || followed.h(follower) > Math.pow(radius, 2)) { // h() = distanceSquaredFrom()
|
||||
return false; // if 3 blocks away or not in radius, stop moving.
|
||||
//Maybe I'll add a teleport feature later.
|
||||
} else if (isByName) {
|
||||
if (!followed.getCustomName().equals(customName)) {
|
||||
followed = null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -65,6 +70,6 @@ public class PathfinderGoalFollow_v1_9_R1 extends PathfinderGoal {
|
||||
// c() is execute()
|
||||
@Override
|
||||
public void c() {
|
||||
follower.getNavigation().a(followed, speed);
|
||||
follower.getNavigation().a(followed, speed); // a() means moveTo()
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ import java.io.File;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public interface NMSInterface {
|
||||
@ -57,4 +58,6 @@ public interface NMSInterface {
|
||||
public String getMCId(ItemStack itemStack);
|
||||
|
||||
public ItemStack getItemFromMcId(String mcId);
|
||||
|
||||
void makeClientSay(String msg, Player p);
|
||||
}
|
||||
|
@ -22,7 +22,9 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
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.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import ch.njol.skript.Skript;
|
||||
@ -49,7 +51,7 @@ import net.minecraft.server.v1_7_R4.NBTTagShort;
|
||||
import net.minecraft.server.v1_7_R4.NBTTagString;
|
||||
import net.minecraft.server.v1_7_R4.TileEntity;
|
||||
import net.minecraft.server.v1_7_R4.World;
|
||||
import net.minecraft.server.v1_9_R1.MinecraftKey;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayInChat;
|
||||
|
||||
public class NMS_v1_7_R4 implements NMSInterface {
|
||||
|
||||
@ -358,8 +360,10 @@ public class NMS_v1_7_R4 implements NMSInterface {
|
||||
public NBTTagCompound getItemNBT(ItemStack itemStack) {
|
||||
if (itemStack == null || itemStack.getType() == Material.AIR)
|
||||
return null;
|
||||
NBTTagCompound NBT = CraftItemStack.asNMSCopy(itemStack).getTag();
|
||||
return NBT;
|
||||
NBTTagCompound itemNBT = CraftItemStack.asNMSCopy(itemStack).getTag();
|
||||
if (itemNBT == null || itemNBT.isEmpty())
|
||||
itemNBT = null;
|
||||
return itemNBT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -488,8 +492,12 @@ public class NMS_v1_7_R4 implements NMSInterface {
|
||||
|
||||
@Override
|
||||
public ItemStack getItemFromMcId(String mcId) {
|
||||
MinecraftKey mcKey = new MinecraftKey(mcId);
|
||||
Item nmsItem = (Item) Item.REGISTRY.get(mcKey);
|
||||
return CraftItemStack.asNewCraftStack(nmsItem);
|
||||
return null; //Not supported in 1.7
|
||||
}
|
||||
|
||||
@Override
|
||||
public void makeClientSay(String msg, Player p) {
|
||||
PacketPlayInChat chatPacket = new PacketPlayInChat(msg);
|
||||
((CraftPlayer) p).getHandle().playerConnection.a(chatPacket);
|
||||
}
|
||||
}
|
@ -19,7 +19,9 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
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.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import ch.njol.skript.Skript;
|
||||
@ -52,6 +54,7 @@ import net.minecraft.server.v1_8_R3.PathfinderGoal;
|
||||
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
|
||||
import net.minecraft.server.v1_8_R3.TileEntity;
|
||||
import net.minecraft.server.v1_8_R3.World;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInChat;
|
||||
|
||||
public class NMS_v1_8_R3 implements NMSInterface {
|
||||
|
||||
@ -409,6 +412,8 @@ public class NMS_v1_8_R3 implements NMSInterface {
|
||||
if (itemStack == null || itemStack.getType() == Material.AIR)
|
||||
return null;
|
||||
NBTTagCompound itemNBT = CraftItemStack.asNMSCopy(itemStack).getTag();
|
||||
if (itemNBT == null || itemNBT.isEmpty())
|
||||
itemNBT = null;
|
||||
return itemNBT;
|
||||
}
|
||||
|
||||
@ -531,4 +536,10 @@ public class NMS_v1_8_R3 implements NMSInterface {
|
||||
Item nmsItem = (Item) Item.REGISTRY.get(mcKey);
|
||||
return CraftItemStack.asNewCraftStack(nmsItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void makeClientSay(String msg, Player p) {
|
||||
PacketPlayInChat chatPacket = new PacketPlayInChat(msg);
|
||||
((CraftPlayer) p).getHandle().playerConnection.a(chatPacket);
|
||||
}
|
||||
}
|
@ -18,8 +18,10 @@ import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
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.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import ch.njol.skript.Skript;
|
||||
@ -49,6 +51,7 @@ import net.minecraft.server.v1_9_R1.NBTTagList;
|
||||
import net.minecraft.server.v1_9_R1.NBTTagLong;
|
||||
import net.minecraft.server.v1_9_R1.NBTTagShort;
|
||||
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.PathfinderGoalSelector;
|
||||
import net.minecraft.server.v1_9_R1.TileEntity;
|
||||
@ -410,7 +413,7 @@ public class NMS_v1_9_R1 implements NMSInterface {
|
||||
if (itemStack == null || itemStack.getType() == Material.AIR)
|
||||
return null;
|
||||
NBTTagCompound itemNBT = CraftItemStack.asNMSCopy(itemStack).getTag();
|
||||
if (itemNBT.isEmpty())
|
||||
if (itemNBT == null || itemNBT.isEmpty())
|
||||
itemNBT = null;
|
||||
return itemNBT;
|
||||
}
|
||||
@ -536,4 +539,10 @@ public class NMS_v1_9_R1 implements NMSInterface {
|
||||
Item nmsItem = (Item) Item.REGISTRY.get(mcKey);
|
||||
return CraftItemStack.asNewCraftStack(nmsItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void makeClientSay(String msg, Player p) {
|
||||
PacketPlayInChat chatPacket = new PacketPlayInChat(msg);
|
||||
((CraftPlayer) p).getHandle().playerConnection.a(chatPacket);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user