From 66ceb871f3e9a42e999ee8c408246e446abb645a Mon Sep 17 00:00:00 2001 From: eyesniper2 Date: Thu, 19 Feb 2015 11:18:22 -0700 Subject: [PATCH] 1.2.1 Update Fixed several bugs. --- dependency-reduced-pom.xml | 2 +- pom.xml | 2 +- .../GeneralEffects/EffParticles.java | 16 +++---- .../eyesniper2/skRayFall/skRayFall.java | 37 ++------------- .../skRayFall/utli/ProtocolLibUtli.java | 46 +++++++++++++++++++ src/main/resources/plugin.yml | 2 +- 6 files changed, 59 insertions(+), 46 deletions(-) create mode 100644 src/main/java/net/rayfall/eyesniper2/skRayFall/utli/ProtocolLibUtli.java diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index ebe7fd1..eceba08 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.rayfall.eyesniper2 skRayFall - 1.2 + 1.2.1 diff --git a/pom.xml b/pom.xml index cb4bf3f..cb277ac 100644 --- a/pom.xml +++ b/pom.xml @@ -145,5 +145,5 @@ 1.1.0 - 1.2 + 1.2.1 \ No newline at end of file diff --git a/src/main/java/net/rayfall/eyesniper2/skRayFall/GeneralEffects/EffParticles.java b/src/main/java/net/rayfall/eyesniper2/skRayFall/GeneralEffects/EffParticles.java index 316b7fd..7b48707 100644 --- a/src/main/java/net/rayfall/eyesniper2/skRayFall/GeneralEffects/EffParticles.java +++ b/src/main/java/net/rayfall/eyesniper2/skRayFall/GeneralEffects/EffParticles.java @@ -14,7 +14,7 @@ import ch.njol.util.Kleenean; public class EffParticles extends Effect{ - //show [%number%] %string% particle[s] at %location% [offset with %number%, %number% (and|,) %number%] for %player% + //show %number% of %string% particle[s] at %location% for %player% [offset with %number%, %number% (and|,) %number%] private Expression partNum; private Expression player; private Expression location; @@ -32,10 +32,10 @@ public boolean init(Expression[] e, int arg1, Kleenean arg2, partNum = (Expression) e[0]; type = (Expression) e[1]; location = (Expression) e[2]; - x = (Expression) e[3]; - y = (Expression) e[4]; - z = (Expression) e[5]; - player = (Expression) e[6]; + x = (Expression) e[4]; + y = (Expression) e[5]; + z = (Expression) e[6]; + player = (Expression) e[3]; return true; } @@ -46,13 +46,9 @@ public String toString(@Nullable Event arg0, boolean arg1) { @Override protected void execute(Event evt) { - int num = 5; float hx = 0f; float hy = 0f; float hz = 0f; - if (partNum != null){ - num = partNum.getSingle(evt).intValue(); - } if (x != null){ hx = x.getSingle(evt).floatValue(); } @@ -63,7 +59,7 @@ protected void execute(Event evt) { hz = z.getSingle(evt).floatValue(); } - PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(PacketParticleGetter.get(type.getSingle(evt)), false, (float) location.getSingle(evt).getX(), (float) location.getSingle(evt).getY(), (float) location.getSingle(evt).getZ(), hx, hy, hz, 0f, num, new int[0]); + PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(PacketParticleGetter.get(type.getSingle(evt)), false, (float) location.getSingle(evt).getX(), (float) location.getSingle(evt).getY(), (float) location.getSingle(evt).getZ(), hx, hy, hz, 0f, partNum.getSingle(evt).intValue(), new int[0]); ((CraftPlayer) player.getSingle(evt)).getHandle().playerConnection.sendPacket(packet); } diff --git a/src/main/java/net/rayfall/eyesniper2/skRayFall/skRayFall.java b/src/main/java/net/rayfall/eyesniper2/skRayFall/skRayFall.java index 7a6349c..2378e57 100644 --- a/src/main/java/net/rayfall/eyesniper2/skRayFall/skRayFall.java +++ b/src/main/java/net/rayfall/eyesniper2/skRayFall/skRayFall.java @@ -50,9 +50,9 @@ import net.rayfall.eyesniper2.skRayFall.Titles.EffActionBar; import net.rayfall.eyesniper2.skRayFall.Titles.EffTabTitles; import net.rayfall.eyesniper2.skRayFall.Titles.EffTitle; +import net.rayfall.eyesniper2.skRayFall.utli.ProtocolLibUtli; import org.bukkit.Bukkit; -import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -67,14 +67,6 @@ import org.eclipse.jdt.annotation.Nullable; import org.mcstats.Metrics; -import com.comphenix.protocol.Packets; -import com.comphenix.protocol.ProtocolLibrary; -import com.comphenix.protocol.events.ConnectionSide; -import com.comphenix.protocol.events.ListenerPriority; -import com.comphenix.protocol.events.PacketAdapter; -import com.comphenix.protocol.events.PacketEvent; -import com.comphenix.protocol.wrappers.nbt.NbtCompound; -import com.comphenix.protocol.wrappers.nbt.NbtFactory; import com.vexsoftware.votifier.model.VotifierEvent; import ch.njol.skript.Skript; @@ -214,7 +206,7 @@ public Player get(VotifierEvent VotifierEvent) { //Cool 1.8 Stuff! Skript.registerEffect(EffTitle.class,"send %player% title %string% [with subtitle %-string%] [for %-timespan%] [with %-timespan% fade in and %-timespan% fade out]"); Skript.registerEffect(EffPlaySoundPacket.class,"play %string% to %player% [at volume %number%]"); - Skript.registerEffect(EffParticles.class, "show [%number%] %string% particle[s] at %location% [offset with %number%, %number% (and|,) %number%] for %player%"); + Skript.registerEffect(EffParticles.class, "show %number% %string% particle[s] at %location% for %player% [offset by %number%, %number% (and|,) %number%]"); Skript.registerEffect(EffActionBar.class, "set action bar of %player% to %string%"); Skript.registerEffect(EffTabTitles.class, "set tab header to %string% and footer to %string% for %player%"); Skript.registerEvent("Crafting Click", EvtCraftClick.class, InventoryClickEvent.class,"crafting click in slot %number%"); @@ -234,19 +226,9 @@ public Player get(VotifierEvent VotifierEvent) { Skript.registerCondition(CondisScoreboardSet.class, "side bar is set for %player%"); if (getServer().getPluginManager().isPluginEnabled("ProtocolLib")){ getLogger().info("Enabling ProtocolLib content! *High-five*"); - ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter( - this, ConnectionSide.SERVER_SIDE, ListenerPriority.HIGH, - Packets.Server.SET_SLOT, Packets.Server.WINDOW_ITEMS) { - @Override - public void onPacketSending(PacketEvent event) { - if (event.getPacketID() == Packets.Server.SET_SLOT) { - addGlow(new ItemStack[] { event.getPacket().getItemModifier().read(0) }); - } else { - addGlow(event.getPacket().getItemArrayModifier().read(0)); - } - } - }); + Skript.registerExpression(ExprShinyItem.class, ItemStack.class, ExpressionType.PROPERTY, "shiny %itemstacks%"); + ProtocolLibUtli.run(); } else{ getLogger().info("No ProtocolLib Found! *eats some bacon*"); @@ -268,16 +250,5 @@ public void onJoin(PlayerJoinEvent evt){ } - private void addGlow(ItemStack[] stacks) { - for (ItemStack stack : stacks) { - if (stack != null) { - if (stack.getEnchantmentLevel(Enchantment.ARROW_INFINITE) == 70 || stack.getEnchantmentLevel(Enchantment.WATER_WORKER) == 70) { - NbtCompound compound = (NbtCompound) NbtFactory.fromItemTag(stack); - compound.put(NbtFactory.of("HideFlags", 1)); - } - } - } - } - } diff --git a/src/main/java/net/rayfall/eyesniper2/skRayFall/utli/ProtocolLibUtli.java b/src/main/java/net/rayfall/eyesniper2/skRayFall/utli/ProtocolLibUtli.java new file mode 100644 index 0000000..107919f --- /dev/null +++ b/src/main/java/net/rayfall/eyesniper2/skRayFall/utli/ProtocolLibUtli.java @@ -0,0 +1,46 @@ +package net.rayfall.eyesniper2.skRayFall.utli; + +import net.rayfall.eyesniper2.skRayFall.skRayFall; + +import org.bukkit.enchantments.Enchantment; +import org.bukkit.event.Listener; +import org.bukkit.inventory.ItemStack; + +import com.comphenix.protocol.PacketType; +import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.events.ListenerPriority; +import com.comphenix.protocol.events.PacketAdapter; +import com.comphenix.protocol.events.PacketEvent; +import com.comphenix.protocol.wrappers.nbt.NbtCompound; +import com.comphenix.protocol.wrappers.nbt.NbtFactory; + +public class ProtocolLibUtli implements Listener{ + public static void addGlow(ItemStack[] stacks) { + for (ItemStack stack : stacks) { + if (stack != null) { + if (stack.getEnchantmentLevel(Enchantment.ARROW_INFINITE) == 70 || stack.getEnchantmentLevel(Enchantment.WATER_WORKER) == 70) { + NbtCompound compound = (NbtCompound) NbtFactory.fromItemTag(stack); + compound.put(NbtFactory.of("HideFlags", 1)); + } + } + } + } + + public static void run() { + + ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(new PacketAdapter.AdapterParameteters().plugin(skRayFall.plugin).serverSide().listenerPriority(ListenerPriority.HIGH).types(PacketType.Play.Server.SET_SLOT, PacketType.Play.Server.WINDOW_ITEMS)) { + @Override + public void onPacketSending(PacketEvent event) { + if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) { + addGlow(new ItemStack[] { event.getPacket().getItemModifier().read(0) }); + } else { + addGlow(event.getPacket().getItemArrayModifier().read(0)); + } + } + }); + + } + +} + + diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index f635fe4..0ee0e26 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -3,7 +3,7 @@ description: An addon for skript that adds Citizens support, EffectLib support a author: eyesniper2 website: http://rayfall.net/ main: net.rayfall.eyesniper2.skRayFall.skRayFall -version: 1.2 +version: 1.2.1 depend: [Skript] softdepend: [Citizens, EffectLib, Votifier, ProtocolLib, Builder] commands: