Skip to content

Commit

Permalink
Update to MethodScript 3.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
PseudoKnight committed Nov 29, 2018
1 parent 439ff89 commit 8b69ce1
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 59 deletions.
19 changes: 7 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ This event is called when a player's item (like a tool) will take damage. Cancel

#### Prefilters

* **player:** [String Match][1]
* **itemname:** [String Match][2]
* **player:** String Match
* **itemname:** String Match

#### Event Data

Expand All @@ -57,8 +57,8 @@ This event is called when an entity mounts another entity.

#### Prefilters

* **type:** [Macro Match][3]
* **mounttype:** [Macro Match][3]
* **type:** Macro Match
* **mounttype:** Macro Match

#### Event Data

Expand All @@ -73,8 +73,8 @@ This event is called when an entity dismounts another entity. This event cannot

#### Prefilters

* **type:** [Macro Match][3]
* **mounttype:** [Macro Match][3]
* **type:** Macro Match
* **mounttype:** Macro Match

#### Event Data

Expand All @@ -89,16 +89,11 @@ This event is called when a spawner spawns an entity.

#### Prefilters

* **type:** [String Match][1]
* **type:** String Match

#### Event Data

* **type:** The type of entity that is spawning
* **id:** The UUID of the spawning entity
* **location:** The location the entity spawned
* **spawner:** The location of the spawner that spawned the entity


[1]: http://wiki.sk89q.com/wiki/CommandHelper/Events/Prefilters#String_Match
[2]: http://wiki.sk89q.com/wiki/CommandHelper/Events/Prefilters#Item_Match
[3]: http://wiki.sk89q.com/wiki/CommandHelper/Events/Prefilters#Macro_Match
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.pseudoknight</groupId>
<artifactId>chspigot</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<name>CHSpigot</name>
<description>Gives access to methods available in Spigot but not Bukkit</description>

Expand Down Expand Up @@ -99,7 +99,7 @@
<repositories>
<repository>
<id>sk89q-repo</id>
<url>http://mvn2.sk89q.com/repo</url>
<url>http://maven.sk89q.com/repo</url>
</repository>

<repository>
Expand All @@ -117,7 +117,7 @@
<dependency>
<groupId>com.sk89q</groupId>
<artifactId>commandhelper</artifactId>
<version>3.3.3-SNAPSHOT</version>
<version>3.3.4-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>bukkit</artifactId>
Expand All @@ -132,7 +132,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13-R0.1-SNAPSHOT</version>
<version>1.13.2-R0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
46 changes: 23 additions & 23 deletions src/main/java/me/pseudoknight/chspigot/Events.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
import com.laytonsmith.abstraction.MCEntity;
import com.laytonsmith.annotations.api;
import com.laytonsmith.core.CHLog;
import com.laytonsmith.core.CHVersion;
import com.laytonsmith.core.MSVersion;
import com.laytonsmith.core.ObjectGenerator;
import com.laytonsmith.core.Static;
import com.laytonsmith.core.constructs.CArray;
import com.laytonsmith.core.constructs.CInt;
import com.laytonsmith.core.constructs.CString;
import com.laytonsmith.core.constructs.Construct;
import com.laytonsmith.core.constructs.Target;
import com.laytonsmith.core.environments.Environment;
import com.laytonsmith.core.events.AbstractEvent;
Expand All @@ -20,6 +19,7 @@
import com.laytonsmith.core.events.Prefilters;
import com.laytonsmith.core.exceptions.EventException;
import com.laytonsmith.core.exceptions.PrefilterNonMatchException;
import com.laytonsmith.core.natives.interfaces.Mixed;
import me.pseudoknight.chspigot.abstraction.MCEntityDismountEvent;
import me.pseudoknight.chspigot.abstraction.MCEntityMountEvent;
import me.pseudoknight.chspigot.abstraction.MCPlayerItemDamageEvent;
Expand Down Expand Up @@ -64,20 +64,20 @@ public BindableEvent convert(CArray manualObject, Target t) {

@Override
public Version since() {
return CHVersion.V3_3_1;
return MSVersion.V3_3_1;
}

@Override
public void bind(BoundEvent event) {
Map<String, Construct> prefilters = event.getPrefilter();
Map<String, Mixed> prefilters = event.getPrefilter();
if(prefilters.containsKey("item")) {
CHLog.GetLogger().w(CHLog.Tags.DEPRECATION, "The \"item\" prefilter here is no longer supported."
+ " Use \"itemname\" instead.", event.getTarget());
}
}

@Override
public boolean matches(Map<String, Construct> prefilter, BindableEvent e) throws PrefilterNonMatchException {
public boolean matches(Map<String, Mixed> prefilter, BindableEvent e) throws PrefilterNonMatchException {
if (e instanceof MCPlayerItemDamageEvent) {
MCPlayerItemDamageEvent event = (MCPlayerItemDamageEvent)e;

Expand All @@ -91,10 +91,10 @@ public boolean matches(Map<String, Construct> prefilter, BindableEvent e) throws
}

@Override
public Map<String, Construct> evaluate(BindableEvent e) throws EventException {
public Map<String, Mixed> evaluate(BindableEvent e) throws EventException {
if (e instanceof MCPlayerItemDamageEvent) {
MCPlayerItemDamageEvent event = (MCPlayerItemDamageEvent) e;
Map<String, Construct> map = evaluate_helper(e);
Map<String, Mixed> map = evaluate_helper(e);

map.put("player", new CString(event.getPlayer().getName(), Target.UNKNOWN));
map.put("item", ObjectGenerator.GetGenerator().item(event.getItem(), Target.UNKNOWN));
Expand All @@ -106,7 +106,7 @@ public Map<String, Construct> evaluate(BindableEvent e) throws EventException {
}

@Override
public boolean modifyEvent(String key, Construct value, BindableEvent e) {
public boolean modifyEvent(String key, Mixed value, BindableEvent e) {
MCPlayerItemDamageEvent event = (MCPlayerItemDamageEvent)e;

if (key.equalsIgnoreCase("damage") && value instanceof CInt) {
Expand Down Expand Up @@ -157,11 +157,11 @@ public BindableEvent convert(CArray manualObject, Target t) {

@Override
public Version since() {
return CHVersion.V3_3_2;
return MSVersion.V3_3_2;
}

@Override
public boolean matches(Map<String, Construct> prefilter, BindableEvent e) throws PrefilterNonMatchException {
public boolean matches(Map<String, Mixed> prefilter, BindableEvent e) throws PrefilterNonMatchException {
if (e instanceof MCEntityMountEvent) {
MCEntityMountEvent event = (MCEntityMountEvent)e;

Expand All @@ -175,10 +175,10 @@ public boolean matches(Map<String, Construct> prefilter, BindableEvent e) throws
}

@Override
public Map<String, Construct> evaluate(BindableEvent e) throws EventException {
public Map<String, Mixed> evaluate(BindableEvent e) throws EventException {
if (e instanceof MCEntityMountEvent) {
MCEntityMountEvent event = (MCEntityMountEvent) e;
Map<String, Construct> map = new HashMap<>();
Map<String, Mixed> map = new HashMap<>();

map.put("type", new CString(event.getEntity().getType().name(), Target.UNKNOWN));
map.put("id", new CString(event.getEntity().getUniqueId().toString(), Target.UNKNOWN));
Expand All @@ -191,7 +191,7 @@ public Map<String, Construct> evaluate(BindableEvent e) throws EventException {
}

@Override
public boolean modifyEvent(String key, Construct value, BindableEvent e) {
public boolean modifyEvent(String key, Mixed value, BindableEvent e) {
return false;
}
}
Expand Down Expand Up @@ -226,11 +226,11 @@ public BindableEvent convert(CArray manualObject, Target t) {

@Override
public Version since() {
return CHVersion.V3_3_2;
return MSVersion.V3_3_2;
}

@Override
public boolean matches(Map<String, Construct> prefilter, BindableEvent e) throws PrefilterNonMatchException {
public boolean matches(Map<String, Mixed> prefilter, BindableEvent e) throws PrefilterNonMatchException {
if (e instanceof MCEntityDismountEvent) {
MCEntityDismountEvent event = (MCEntityDismountEvent)e;

Expand All @@ -244,10 +244,10 @@ public boolean matches(Map<String, Construct> prefilter, BindableEvent e) throws
}

@Override
public Map<String, Construct> evaluate(BindableEvent e) throws EventException {
public Map<String, Mixed> evaluate(BindableEvent e) throws EventException {
if (e instanceof MCEntityDismountEvent) {
MCEntityDismountEvent event = (MCEntityDismountEvent) e;
Map<String, Construct> map = new HashMap<>();
Map<String, Mixed> map = new HashMap<>();

map.put("type", new CString(event.getEntity().getType().name(), Target.UNKNOWN));
map.put("id", new CString(event.getEntity().getUniqueId().toString(), Target.UNKNOWN));
Expand All @@ -260,7 +260,7 @@ public Map<String, Construct> evaluate(BindableEvent e) throws EventException {
}

@Override
public boolean modifyEvent(String key, Construct value, BindableEvent e) {
public boolean modifyEvent(String key, Mixed value, BindableEvent e) {
return false;
}
}
Expand All @@ -285,7 +285,7 @@ public String docs() {
}

@Override
public boolean matches(Map<String, Construct> prefilter, BindableEvent e) throws PrefilterNonMatchException {
public boolean matches(Map<String, Mixed> prefilter, BindableEvent e) throws PrefilterNonMatchException {
if (e instanceof MCSpawnerSpawnEvent) {
MCSpawnerSpawnEvent event = (MCSpawnerSpawnEvent)e;
if(prefilter.containsKey("type")) {
Expand All @@ -299,10 +299,10 @@ public boolean matches(Map<String, Construct> prefilter, BindableEvent e) throws
}

@Override
public Map<String, Construct> evaluate(BindableEvent e) throws EventException {
public Map<String, Mixed> evaluate(BindableEvent e) throws EventException {
if (e instanceof MCSpawnerSpawnEvent) {
MCSpawnerSpawnEvent event = (MCSpawnerSpawnEvent) e;
Map<String, Construct> map = new HashMap<>();
Map<String, Mixed> map = new HashMap<>();
Target t = Target.UNKNOWN;

map.put("type", new CString(event.getEntity().getType().name(),t));
Expand All @@ -327,11 +327,11 @@ public BindableEvent convert(CArray manualObject, Target t) {

@Override
public Version since() {
return CHVersion.V3_3_2;
return MSVersion.V3_3_2;
}

@Override
public boolean modifyEvent(String key, Construct value, BindableEvent e) {
public boolean modifyEvent(String key, Mixed value, BindableEvent e) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/me/pseudoknight/chspigot/Extension.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public class Extension extends AbstractExtension {

public Version getVersion() {
return new SimpleVersion(2,0,0);
return new SimpleVersion(2,0,1);
}

@Override
Expand Down
Loading

0 comments on commit 8b69ce1

Please sign in to comment.