diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index eceba08..9569d2b 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 + 1.3 @@ -70,7 +70,7 @@ org.spigotmc spigot-api - 1.8-R0.1-SNAPSHOT + 1.8.3-R0.1-SNAPSHOT provided @@ -82,19 +82,19 @@ net.citizensnpcs citizensapi - 2.0.14-SNAPSHOT + 2.0.15-SNAPSHOT provided de.slikey effectlib - 2.4 + 3.1 provided org.bukkit bukkit - 1.8-R0.1-SNAPSHOT + 1.8.3-R0.1-SNAPSHOT compile @@ -115,7 +115,7 @@ citizensnpcs 1.0 system - D:\Java Workbench\skRayFall/libs/citizens-2.0.14-SNAPSHOT.jar + D:\Java Workbench\skRayFall/libs/citizens-2.0.15-SNAPSHOT.jar ch.njol @@ -136,7 +136,7 @@ spigot 1.0 system - D:\Java Workbench\skRayFall/libs/spigot-1.8-R0.1-SNAPSHOT.jar + D:\Java Workbench\skRayFall/libs/spigot-1.8.3.jar org.eclipse.jdt diff --git a/pom.xml b/pom.xml index cb277ac..43c6a76 100644 --- a/pom.xml +++ b/pom.xml @@ -73,13 +73,13 @@ org.spigotmc spigot-api - 1.8-R0.1-SNAPSHOT + 1.8.3-R0.1-SNAPSHOT provided net.citizensnpcs citizensapi - 2.0.14-SNAPSHOT + 2.0.15-SNAPSHOT provided @@ -91,13 +91,13 @@ de.slikey effectlib - 2.4 + 3.1 provided org.bukkit bukkit - 1.8-R0.1-SNAPSHOT + 1.8.3-R0.1-SNAPSHOT com.comphenix.protocol @@ -116,7 +116,7 @@ citizensnpcs 1.0 system - ${project.basedir}/libs/citizens-2.0.14-SNAPSHOT.jar + ${project.basedir}/libs/citizens-2.0.15-SNAPSHOT.jar ch.njol @@ -137,7 +137,7 @@ spigot 1.0 system - ${project.basedir}/libs/spigot-1.8-R0.1-SNAPSHOT.jar + ${project.basedir}/libs/spigot-1.8.3.jar org.eclipse.jdt @@ -145,5 +145,5 @@ 1.1.0 - 1.2.1 + 1.3 \ No newline at end of file diff --git a/src/main/java/net/rayfall/eyesniper2/skRayFall/CitizenExpressions/ExprBottomRightSchematic.java b/src/main/java/net/rayfall/eyesniper2/skRayFall/CitizenExpressions/ExprBottomRightSchematic.java new file mode 100644 index 0000000..1acb307 --- /dev/null +++ b/src/main/java/net/rayfall/eyesniper2/skRayFall/CitizenExpressions/ExprBottomRightSchematic.java @@ -0,0 +1,65 @@ +package net.rayfall.eyesniper2.skRayFall.CitizenExpressions; + +import net.citizensnpcs.api.CitizensAPI; +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.api.npc.NPCRegistry; +import net.jrbudda.builder.BuilderTrait; + +import org.bukkit.Location; +import org.bukkit.event.Event; +import org.eclipse.jdt.annotation.Nullable; + +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 ExprBottomRightSchematic extends SimpleExpression{ + + //for builder %number% get the location of the bottom right of schematic centered at %location% + + private Expression id; + private Expression loc; + + @Override + public Class getReturnType() { + return Location.class; + } + + @Override + public boolean isSingle() { + return true; + } + + @SuppressWarnings("unchecked") + @Override + public boolean init(Expression[] e, int arg1, Kleenean arg2, + ParseResult arg3) { + id = (Expression) e[0]; + loc = (Expression) e[1]; + return true; + } + + @Override + public String toString(@Nullable Event evt, boolean arg1) { + return null; + } + + @Override + @Nullable + protected Location[] get(Event evt) { + NPCRegistry registry = CitizensAPI.getNPCRegistry(); + NPC npc = registry.getById(id.getSingle(evt).intValue()); + BuilderTrait bt = npc.getTrait(BuilderTrait.class); + if (bt.schematic != null){ + Location bottomRight = loc.getSingle(evt).add((-1 * Math.floor(bt.schematic.width() / 2)), -1, (-1 * Math.floor(bt.schematic.length() / 2))); + return new Location[] {bottomRight}; + } + else{ + Skript.error("A schematic has yet to be loaded for this Builder"); + return new Location[] {loc.getSingle(evt)}; + } + } + +} diff --git a/src/main/java/net/rayfall/eyesniper2/skRayFall/CitizenExpressions/ExprTopLeftSchematic.java b/src/main/java/net/rayfall/eyesniper2/skRayFall/CitizenExpressions/ExprTopLeftSchematic.java new file mode 100644 index 0000000..cd3fb28 --- /dev/null +++ b/src/main/java/net/rayfall/eyesniper2/skRayFall/CitizenExpressions/ExprTopLeftSchematic.java @@ -0,0 +1,65 @@ +package net.rayfall.eyesniper2.skRayFall.CitizenExpressions; + +import net.citizensnpcs.api.CitizensAPI; +import net.citizensnpcs.api.npc.NPC; +import net.citizensnpcs.api.npc.NPCRegistry; +import net.jrbudda.builder.BuilderTrait; + +import org.bukkit.Location; +import org.bukkit.event.Event; +import org.eclipse.jdt.annotation.Nullable; + +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 ExprTopLeftSchematic extends SimpleExpression{ + + private Expression id; + private Expression loc; + + //for builder %number% get the location of the top left of schematic centered at %location% + + @Override + public Class getReturnType() { + return Location.class; + } + + @Override + public boolean isSingle() { + return true; + } + + @SuppressWarnings("unchecked") + @Override + public boolean init(Expression[] e, int arg1, Kleenean arg2, + ParseResult arg3) { + id = (Expression) e[0]; + loc = (Expression) e[1]; + return true; + } + + @Override + public String toString(@Nullable Event evt, boolean arg1) { + return null; + } + + @Override + @Nullable + protected Location[] get(Event evt) { + NPCRegistry registry = CitizensAPI.getNPCRegistry(); + NPC npc = registry.getById(id.getSingle(evt).intValue()); + BuilderTrait bt = npc.getTrait(BuilderTrait.class); + if (bt.schematic != null){ + Location topLeft = loc.getSingle(evt).add((Math.round(bt.schematic.width() / 2)), bt.schematic.height() - 1, (Math.round(bt.schematic.length() / 2))); + return new Location[] {topLeft}; + } + else{ + Skript.error("A schematic has yet to be loaded for this Builder"); + return new Location[] {loc.getSingle(evt)}; + } + } + +} 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 7b48707..9215360 100644 --- a/src/main/java/net/rayfall/eyesniper2/skRayFall/GeneralEffects/EffParticles.java +++ b/src/main/java/net/rayfall/eyesniper2/skRayFall/GeneralEffects/EffParticles.java @@ -1,9 +1,9 @@ package net.rayfall.eyesniper2.skRayFall.GeneralEffects; -import net.minecraft.server.v1_8_R1.PacketPlayOutWorldParticles; +import net.minecraft.server.v1_8_R2.PacketPlayOutWorldParticles; import net.rayfall.eyesniper2.skRayFall.utli.PacketParticleGetter; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.eclipse.jdt.annotation.Nullable; diff --git a/src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffActionBar.java b/src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffActionBar.java index bf8efee..fd931f3 100644 --- a/src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffActionBar.java +++ b/src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffActionBar.java @@ -1,10 +1,10 @@ package net.rayfall.eyesniper2.skRayFall.Titles; -import net.minecraft.server.v1_8_R1.ChatSerializer; -import net.minecraft.server.v1_8_R1.IChatBaseComponent; -import net.minecraft.server.v1_8_R1.PacketPlayOutChat; +import net.minecraft.server.v1_8_R2.IChatBaseComponent; +import net.minecraft.server.v1_8_R2.IChatBaseComponent.ChatSerializer; +import net.minecraft.server.v1_8_R2.PacketPlayOutChat; -import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.eclipse.jdt.annotation.Nullable; diff --git a/src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffTabTitles.java b/src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffTabTitles.java index 9623266..b5509a3 100644 --- a/src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffTabTitles.java +++ b/src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffTabTitles.java @@ -2,11 +2,11 @@ import java.lang.reflect.Field; -import net.minecraft.server.v1_8_R1.ChatSerializer; -import net.minecraft.server.v1_8_R1.IChatBaseComponent; -import net.minecraft.server.v1_8_R1.PacketPlayOutPlayerListHeaderFooter; +import net.minecraft.server.v1_8_R2.IChatBaseComponent; +import net.minecraft.server.v1_8_R2.IChatBaseComponent.ChatSerializer; +import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerListHeaderFooter; -import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.eclipse.jdt.annotation.Nullable; diff --git a/src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffTitle.java b/src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffTitle.java index 8f5ede8..e68bfaa 100644 --- a/src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffTitle.java +++ b/src/main/java/net/rayfall/eyesniper2/skRayFall/Titles/EffTitle.java @@ -1,12 +1,12 @@ package net.rayfall.eyesniper2.skRayFall.Titles; -import net.minecraft.server.v1_8_R1.ChatSerializer; -import net.minecraft.server.v1_8_R1.EnumTitleAction; -import net.minecraft.server.v1_8_R1.IChatBaseComponent; -import net.minecraft.server.v1_8_R1.PacketPlayOutTitle; -import net.minecraft.server.v1_8_R1.PlayerConnection; +import net.minecraft.server.v1_8_R2.IChatBaseComponent; +import net.minecraft.server.v1_8_R2.IChatBaseComponent.ChatSerializer; +import net.minecraft.server.v1_8_R2.PacketPlayOutTitle; +import net.minecraft.server.v1_8_R2.PacketPlayOutTitle.EnumTitleAction; +import net.minecraft.server.v1_8_R2.PlayerConnection; -import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.eclipse.jdt.annotation.Nullable; diff --git a/src/main/java/net/rayfall/eyesniper2/skRayFall/skRayFall.java b/src/main/java/net/rayfall/eyesniper2/skRayFall/skRayFall.java index 2378e57..d7c6746 100644 --- a/src/main/java/net/rayfall/eyesniper2/skRayFall/skRayFall.java +++ b/src/main/java/net/rayfall/eyesniper2/skRayFall/skRayFall.java @@ -24,14 +24,15 @@ import net.rayfall.eyesniper2.skRayFall.CitizenEffects.EffSetCitizenName; import net.rayfall.eyesniper2.skRayFall.CitizenEffects.EffSpawnCitizen; import net.rayfall.eyesniper2.skRayFall.CitizenEffects.EffStartBuilderBuild; +import net.rayfall.eyesniper2.skRayFall.CitizenExpressions.ExprBottomRightSchematic; import net.rayfall.eyesniper2.skRayFall.CitizenExpressions.ExprGeneralCitizen; import net.rayfall.eyesniper2.skRayFall.CitizenExpressions.ExprLastCitizen; import net.rayfall.eyesniper2.skRayFall.CitizenExpressions.ExprNameOfCitizen; +import net.rayfall.eyesniper2.skRayFall.CitizenExpressions.ExprTopLeftSchematic; import net.rayfall.eyesniper2.skRayFall.Commands.EffectLibCommands; import net.rayfall.eyesniper2.skRayFall.EffectLib.EffBasicEffectLib; import net.rayfall.eyesniper2.skRayFall.EffectLib.EffEffectLibAtom; import net.rayfall.eyesniper2.skRayFall.EffectLib.EffEffectLibBleed; -import net.rayfall.eyesniper2.skRayFall.EffectLib.EffGeneralEffectLib; import net.rayfall.eyesniper2.skRayFall.GeneralEffects.EffMaxHealth; import net.rayfall.eyesniper2.skRayFall.GeneralEffects.EffParticles; import net.rayfall.eyesniper2.skRayFall.GeneralEffects.EffPlaySoundPacket; @@ -53,6 +54,7 @@ import net.rayfall.eyesniper2.skRayFall.utli.ProtocolLibUtli; import org.bukkit.Bukkit; +import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -162,6 +164,8 @@ public NPC get(NPCDeathEvent NPCDeathEvent) { if(getServer().getPluginManager().isPluginEnabled("Builder")){ getLogger().info("Getting bacon sandwiches for builders!"); Skript.registerEffect(EffStartBuilderBuild.class, "make citizen %number% build %string% at %location% [speed %number%] for %player%"); + Skript.registerExpression(ExprTopLeftSchematic.class, Location.class, ExpressionType.SIMPLE, "for builder %number% get the location of the top left of schematic centered at %location%"); + Skript.registerExpression(ExprBottomRightSchematic.class, Location.class, ExpressionType.SIMPLE, "for builder %number% get the location of the bottom right of schematic centered at %location%"); } } else{ @@ -175,8 +179,7 @@ public NPC get(NPCDeathEvent NPCDeathEvent) { getLogger().info("Got bacon for the EffectLib partical ninjas!"); EffectLib lib = EffectLib.instance(); effectManager = new EffectManager(lib); - //to be added in the next update - Skript.registerEffect(EffGeneralEffectLib.class, "(spawn|create|apply) effectlib effect %string% (at|on|to) [the] %entities/location% for %timespan%"); + //more stuff to be added Skript.registerEffect(EffEffectLibAtom.class, "(spawn|create|apply) the atom (formation|effect) (at|on|to) [the] %entities/location% for %timespan%"); Skript.registerEffect(EffEffectLibBleed.class, "(spawn|create|apply) the bleed (formation|effect) (at|on|to) [the] %entities/location% for %timespan%"); Skript.registerEffect(EffBasicEffectLib.class,"spawn formation %string% at %location% for %timespan%"); diff --git a/src/main/java/net/rayfall/eyesniper2/skRayFall/utli/PacketParticleGetter.java b/src/main/java/net/rayfall/eyesniper2/skRayFall/utli/PacketParticleGetter.java index 8e74a22..b8f53af 100644 --- a/src/main/java/net/rayfall/eyesniper2/skRayFall/utli/PacketParticleGetter.java +++ b/src/main/java/net/rayfall/eyesniper2/skRayFall/utli/PacketParticleGetter.java @@ -1,7 +1,7 @@ package net.rayfall.eyesniper2.skRayFall.utli; import ch.njol.skript.Skript; -import net.minecraft.server.v1_8_R1.EnumParticle; +import net.minecraft.server.v1_8_R2.EnumParticle; public class PacketParticleGetter { public static EnumParticle get(String p) { diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 0ee0e26..15e208c 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.1 +version: 1.3 depend: [Skript] softdepend: [Citizens, EffectLib, Votifier, ProtocolLib, Builder] commands: