diff --git a/pom.xml b/pom.xml
index b4d88de..7a04b0d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
me.pseudoknight
chspigot
- 2.0.3
+ 2.0.4
CHSpigot
Gives access to methods available in Spigot but not Bukkit
@@ -101,16 +101,6 @@
enginehub-maven
https://maven.enginehub.org/repo/
-
-
- spigot-repo
- https://hub.spigotmc.org/nexus/content/repositories/snapshots/
-
-
-
- maven-central
- https://repo.maven.apache.org/maven2/
-
@@ -118,21 +108,6 @@
com.sk89q
commandhelper
3.3.4-SNAPSHOT
-
-
- bukkit
- org.bukkit
-
-
- bukkit
- com.sk89q.spigot
-
-
-
-
- org.spigotmc
- spigot-api
- 1.15.2-R0.1-SNAPSHOT
diff --git a/src/main/java/me/pseudoknight/chspigot/Events.java b/src/main/java/me/pseudoknight/chspigot/Events.java
index a68810e..c3cc8b5 100644
--- a/src/main/java/me/pseudoknight/chspigot/Events.java
+++ b/src/main/java/me/pseudoknight/chspigot/Events.java
@@ -3,7 +3,6 @@
import com.laytonsmith.PureUtilities.Version;
import com.laytonsmith.abstraction.MCEntity;
import com.laytonsmith.annotations.api;
-import com.laytonsmith.core.MSLog;
import com.laytonsmith.core.MSVersion;
import com.laytonsmith.core.ObjectGenerator;
import com.laytonsmith.core.Static;
@@ -67,15 +66,6 @@ public Version since() {
return MSVersion.V3_3_1;
}
- @Override
- public void bind(BoundEvent event) {
- Map prefilters = event.getPrefilter();
- if(prefilters.containsKey("item")) {
- MSLog.GetLogger().w(MSLog.Tags.DEPRECATION, "The \"item\" prefilter here is no longer supported."
- + " Use \"itemname\" instead.", event.getTarget());
- }
- }
-
@Override
public boolean matches(Map prefilter, BindableEvent e) throws PrefilterNonMatchException {
if (e instanceof MCPlayerItemDamageEvent) {
@@ -117,14 +107,6 @@ public boolean modifyEvent(String key, Mixed value, BindableEvent e) {
return false;
}
-
- @Override
- public void cancel(BindableEvent o, boolean state) {
- super.cancel(o, state);
- MCPlayerItemDamageEvent e = (MCPlayerItemDamageEvent)o;
- e.getPlayer().updateInventory();
- }
-
}
@api
diff --git a/src/main/java/me/pseudoknight/chspigot/Extension.java b/src/main/java/me/pseudoknight/chspigot/Extension.java
index 248f31e..a97c568 100644
--- a/src/main/java/me/pseudoknight/chspigot/Extension.java
+++ b/src/main/java/me/pseudoknight/chspigot/Extension.java
@@ -9,19 +9,22 @@
@MSExtension("CHSpigot")
public class Extension extends AbstractExtension {
+ private final SimpleVersion VERSION = new SimpleVersion(2,0,4);
+
+ @Override
public Version getVersion() {
- return new SimpleVersion(2,0,3);
+ return VERSION;
}
@Override
public void onStartup() {
SpigotListeners.register();
- System.out.println("CHSpigot " + getVersion() + " loaded.");
+ System.out.println("CHSpigot " + VERSION + " loaded.");
}
@Override
public void onShutdown() {
SpigotListeners.unregister();
- System.out.println("CHSpigot " + getVersion() + " unloaded.");
+ System.out.println("CHSpigot " + VERSION + " unloaded.");
}
}
diff --git a/src/main/java/me/pseudoknight/chspigot/Functions.java b/src/main/java/me/pseudoknight/chspigot/Functions.java
index 5d8a6d4..7f63093 100644
--- a/src/main/java/me/pseudoknight/chspigot/Functions.java
+++ b/src/main/java/me/pseudoknight/chspigot/Functions.java
@@ -1,37 +1,21 @@
package me.pseudoknight.chspigot;
import com.laytonsmith.PureUtilities.Version;
-import com.laytonsmith.abstraction.MCEntity;
-import com.laytonsmith.abstraction.MCLocation;
-import com.laytonsmith.abstraction.entities.MCArrow;
import com.laytonsmith.annotations.api;
import com.laytonsmith.core.*;
-import com.laytonsmith.core.compiler.FileOptions;
import com.laytonsmith.core.constructs.CArray;
-import com.laytonsmith.core.constructs.CDouble;
import com.laytonsmith.core.constructs.CString;
import com.laytonsmith.core.constructs.CVoid;
import com.laytonsmith.core.constructs.Target;
import com.laytonsmith.core.environments.CommandHelperEnvironment;
import com.laytonsmith.core.environments.Environment;
-import com.laytonsmith.core.exceptions.CRE.CREBadEntityException;
-import com.laytonsmith.core.exceptions.CRE.CRECastException;
-import com.laytonsmith.core.exceptions.CRE.CREFormatException;
-import com.laytonsmith.core.exceptions.CRE.CREInvalidWorldException;
import com.laytonsmith.core.exceptions.CRE.CREPlayerOfflineException;
import com.laytonsmith.core.exceptions.CRE.CREThrowable;
-import com.laytonsmith.core.exceptions.ConfigCompileException;
import com.laytonsmith.core.exceptions.ConfigRuntimeException;
import com.laytonsmith.core.functions.AbstractFunction;
import com.laytonsmith.core.natives.interfaces.Mixed;
-import org.bukkit.Location;
-import org.bukkit.Particle;
-import org.bukkit.World;
-import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
-import java.util.EnumSet;
-import java.util.List;
import java.util.Set;
/**
@@ -43,294 +27,6 @@ public static String docs() {
return "These functions provide a methodscript interface for Spigot specific methods.";
}
- @api
- public static class get_arrow_damage extends AbstractFunction implements Optimizable {
-
- public Class extends CREThrowable>[] thrown() {
- return new Class[]{CREBadEntityException.class, CRECastException.class};
- }
-
- public boolean isRestricted() {
- return true;
- }
-
- public Boolean runAsync() {
- return false;
- }
-
- public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException {
- MCEntity ent = Static.getEntity(args[0], t);
- if(ent instanceof MCArrow) {
- return new CDouble(((Arrow) ent.getHandle()).getDamage(), t);
- }
-
- throw new CREBadEntityException("The specified entity ID must be an arrow", t);
- }
-
- public String getName() {
- return "get_arrow_damage";
- }
-
- public Integer[] numArgs() {
- return new Integer[]{1};
- }
-
- public String docs() {
- return "double {entityID} Gets the damage for the specified arrow entityID.";
- }
-
- public Version since() {
- return MSVersion.V3_3_1;
- }
-
- @Override
- public ParseTree optimizeDynamic(Target t, Environment env, Set> envs,
- List children, FileOptions fileOptions) throws ConfigCompileException, ConfigRuntimeException {
- MSLog.GetLogger().w(MSLog.Tags.DEPRECATION, "get_arrow_damage() in CHSpigot is deprecated for entity_spec() for arrows in in CH", t);
- return null;
- }
-
- @Override
- public Set optimizationOptions() {
- return EnumSet.of(Optimizable.OptimizationOption.OPTIMIZE_DYNAMIC);
- }
- }
-
- @api
- public static class set_arrow_damage extends AbstractFunction implements Optimizable {
-
- public Class extends CREThrowable>[] thrown() {
- return new Class[]{CREBadEntityException.class, CRECastException.class};
- }
-
- public boolean isRestricted() {
- return true;
- }
-
- public Boolean runAsync() {
- return false;
- }
-
- public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException {
- MCEntity ent = Static.getEntity(args[0], t);
- if(ent instanceof MCArrow) {
- ((Arrow) ent.getHandle()).setDamage(Static.getDouble(args[1], t));
- return CVoid.VOID;
- }
-
- throw new CREBadEntityException("The specified entity ID must be an arrow", t);
- }
-
- public String getName() {
- return "set_arrow_damage";
- }
-
- public Integer[] numArgs() {
- return new Integer[]{2};
- }
-
- public String docs() {
- return "void {entityID, double} Sets the damage the specified arrow entity will do.";
- }
-
- public Version since() {
- return MSVersion.V3_3_1;
- }
-
- @Override
- public ParseTree optimizeDynamic(Target t, Environment env, Set> envs,
- List children, FileOptions fileOptions) throws ConfigCompileException, ConfigRuntimeException {
- MSLog.GetLogger().w(MSLog.Tags.DEPRECATION, "set_arrow_damage() in CHSpigot is deprecated for set_entity_spec() for arrows in in CH", t);
- return null;
- }
-
- @Override
- public Set optimizationOptions() {
- return EnumSet.of(Optimizable.OptimizationOption.OPTIMIZE_DYNAMIC);
- }
-
- }
-
- @api
- public static class play_effect extends AbstractFunction implements Optimizable {
-
- // convert old mismatched particle effect names to particle types
- public enum OldEffect {
- MAGIC_CRIT(Particle.CRIT_MAGIC),
- POTION_SWIRL(Particle.SPELL_MOB),
- POTION_SWIRL_TRANSPARENT(Particle.SPELL_MOB_AMBIENT),
- INSTANT_SPELL(Particle.SPELL_INSTANT),
- WITCH_MAGIC(Particle.SPELL_WITCH),
- FLYING_GLYPH(Particle.ENCHANTMENT_TABLE),
- LAVA_POP(Particle.LAVA),
- SPLASH(Particle.WATER_SPLASH),
- PARTICLE_SMOKE(Particle.SMOKE_NORMAL),
- EXPLOSION(Particle.EXPLOSION_NORMAL),
- VOID_FOG(Particle.SUSPENDED_DEPTH),
- SMALL_SMOKE(Particle.SUSPENDED_DEPTH),
- COLOURED_DUST(Particle.FALLING_DUST),
- SNOWBALL_BREAK(Particle.SNOWBALL),
- WATERDRIP(Particle.DRIP_WATER),
- LAVADRIP(Particle.DRIP_LAVA),
- VILLAGER_THUNDERCLOUD(Particle.VILLAGER_ANGRY),
- HAPPY_VILLAGER(Particle.VILLAGER_HAPPY),
- LARGE_SMOKE(Particle.SMOKE_LARGE),
- TILE_BREAK(Particle.BLOCK_CRACK),
- TILE_DUST(Particle.BLOCK_DUST);
-
- private final Particle particle;
-
- OldEffect(Particle type) {
- particle = type;
- }
-
- Particle getParticle() {
- return particle;
- }
- }
-
- public Class extends CREThrowable>[] thrown() {
- return new Class[]{CREFormatException.class, CRECastException.class, CREInvalidWorldException.class};
- }
-
- public boolean isRestricted() {
- return true;
- }
-
- public Boolean runAsync() {
- return false;
- }
-
- public Mixed exec(Target t, Environment environment, Mixed... args) throws ConfigRuntimeException {
- MCLocation l;
- Particle particle;
- CArray options = null;
- Player p = null;
-
- if(args[0] instanceof CArray) {
- l = ObjectGenerator.GetGenerator().location(args[0], null, t);
- try {
- particle = Particle.valueOf(args[1].val().toUpperCase());
- } catch(IllegalArgumentException ex) {
- try {
- particle = OldEffect.valueOf(args[1].val().toUpperCase()).getParticle();
- } catch(IllegalArgumentException ex2) {
- MSLog.GetLogger().e(MSLog.Tags.GENERAL, "Invalid particle: " + args[1].val(), t);
- return CVoid.VOID;
- }
- }
- if(args.length == 3) {
- options = Static.getArray(args[2], t);
- }
- } else {
- p = (Player) Static.GetPlayer(args[0], t).getHandle();
- l = ObjectGenerator.GetGenerator().location(args[1], null, t);
- try {
- particle = Particle.valueOf(args[2].val().toUpperCase());
- } catch(IllegalArgumentException ex) {
- try {
- particle = OldEffect.valueOf(args[2].val().toUpperCase()).getParticle();
- } catch(IllegalArgumentException ex2) {
- MSLog.GetLogger().e(MSLog.Tags.GENERAL, "Invalid particle: " + args[2].val(), t);
- return CVoid.VOID;
- }
- }
- if(args.length == 4) {
- options = Static.getArray(args[3], t);
- }
- }
-
- World w = (World) l.getWorld().getHandle();
- Location loc = new Location(w, l.getX(), l.getY(), l.getZ());
-
- if(options != null) {
- float offsetX = 0;
- float offsetY = 0;
- float offsetZ = 0;
- float speed = 1;
- int particleCount = 1;
- int radius = 0;
- if(options.containsKey("offsetX")){
- offsetX = Static.getDouble32(options.get("offsetX", t), t);
- }
- if(options.containsKey("offsetY")){
- offsetY = Static.getDouble32(options.get("offsetY", t), t);
- }
- if(options.containsKey("offsetZ")){
- offsetZ = Static.getDouble32(options.get("offsetZ", t), t);
- }
- if(options.containsKey("speed")){
- speed = Static.getDouble32(options.get("speed", t), t);
- }
- if(options.containsKey("particleCount")){
- particleCount = Static.getInt32(options.get("particleCount", t), t);
- }
- if(options.containsKey("radius")) {
- radius = Static.getInt32(options.get("radius", t), t);
- }
- if(options.containsKey("id") || options.containsKey("data")) {
- MSLog.GetLogger().w(MSLog.Tags.DEPRECATION, "Particle id and data is deprecated in play_effect()."
- + " Consider using spawn_particle().", t);
- }
-
- if(p == null) {
- if(radius > 0) {
- World world = loc.getWorld();
- for(Player player : world.getPlayers()) {
- if(player.isOnline() && player.getLocation().distance(loc) < radius) {
- player.spawnParticle(particle, loc, particleCount, offsetX, offsetY, offsetZ, speed);
- }
- }
- } else {
- w.spawnParticle(particle, loc, particleCount, offsetX, offsetY, offsetZ, speed);
- }
- } else {
- p.spawnParticle(particle, loc, particleCount, offsetX, offsetY, offsetZ, speed);
- }
-
- return CVoid.VOID;
- }
-
- if(p == null) {
- w.spawnParticle(particle, loc, 1);
- } else {
- p.spawnParticle(particle, loc, 1);
- }
- return CVoid.VOID;
- }
-
- public String getName() {
- return "play_effect";
- }
-
- public Integer[] numArgs() {
- return new Integer[]{2, 3, 4};
- }
-
- public String docs() {
- return "void {[player], locationArray, particle, [particleArray]} (deprecated) Plays the specified particle effect to any"
- + " nearby players or specified player. Particle array may contain one or more of the following indexes: "
- + "float offsetX, float offsetY, float offsetZ, float speed, int particleCount";
- }
-
- public Version since() {
- return MSVersion.V3_3_1;
- }
-
- @Override
- public ParseTree optimizeDynamic(Target t, Environment env, Set> envs,
- List children, FileOptions fileOptions) throws ConfigCompileException, ConfigRuntimeException {
- MSLog.GetLogger().w(MSLog.Tags.DEPRECATION, "play_effect() in CHSpigot is deprecated for spawn_particle() in CH", t);
- return null;
- }
-
- @Override
- public Set optimizationOptions() {
- return EnumSet.of(OptimizationOption.OPTIMIZE_DYNAMIC);
- }
-
- }
-
@api
public static class respawn extends AbstractFunction {