Skip to content

Commit

Permalink
1.2.1 Update
Browse files Browse the repository at this point in the history
Fixed several bugs.
  • Loading branch information
eyesniper2 committed Feb 19, 2015
1 parent 0eb3b38 commit 66ceb87
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 46 deletions.
2 changes: 1 addition & 1 deletion dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.rayfall.eyesniper2</groupId>
<artifactId>skRayFall</artifactId>
<version>1.2</version>
<version>1.2.1</version>
<build>
<plugins>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,5 @@
<version>1.1.0</version>
</dependency>
</dependencies>
<version>1.2</version>
<version>1.2.1</version>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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<Number> partNum;
private Expression<Player> player;
private Expression<Location> location;
Expand All @@ -32,10 +32,10 @@ public boolean init(Expression<?>[] e, int arg1, Kleenean arg2,
partNum = (Expression<Number>) e[0];
type = (Expression<String>) e[1];
location = (Expression<Location>) e[2];
x = (Expression<Number>) e[3];
y = (Expression<Number>) e[4];
z = (Expression<Number>) e[5];
player = (Expression<Player>) e[6];
x = (Expression<Number>) e[4];
y = (Expression<Number>) e[5];
z = (Expression<Number>) e[6];
player = (Expression<Player>) e[3];
return true;
}

Expand All @@ -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();
}
Expand All @@ -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);
}

Expand Down
37 changes: 4 additions & 33 deletions src/main/java/net/rayfall/eyesniper2/skRayFall/skRayFall.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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%");
Expand All @@ -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*");
Expand All @@ -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));
}
}
}
}

}

Original file line number Diff line number Diff line change
@@ -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));
}
}
});

}

}


2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 66ceb87

Please sign in to comment.