Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Add alternate event helper options
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 24, 2017
1 parent b4ce1fc commit 8df976d
Showing 1 changed file with 12 additions and 4 deletions.
Expand Up @@ -10,16 +10,24 @@
public class D2SpongeEventHelper {

public static boolean checkBlockType(BlockType btype, ScriptEvent.ScriptEventData data, Action<String> error) {
return checkBlockType(btype, data, error, "type");
}

public static boolean checkBlockType(BlockType btype, ScriptEvent.ScriptEventData data, Action<String> error, String tname) {
// TODO: type_list as well?
return !data.switches.containsKey("type")
|| BlockTypeTag.getFor(error, data.switches.get("type")).getInternal()
return !data.switches.containsKey(tname)
|| BlockTypeTag.getFor(error, data.switches.get(tname)).getInternal()
.equals(btype);
}

public static boolean checkEntityType(EntityType etype, ScriptEvent.ScriptEventData data, Action<String> error) {
return checkEntityType(etype, data, error, "type");
}

public static boolean checkEntityType(EntityType etype, ScriptEvent.ScriptEventData data, Action<String> error, String tname) {
// TODO: type_list as well?
return !data.switches.containsKey("type")
|| EntityTypeTag.getFor(error, data.switches.get("type")).getInternal()
return !data.switches.containsKey(tname)
|| EntityTypeTag.getFor(error, data.switches.get(tname)).getInternal()
.equals(etype);
}
}

0 comments on commit 8df976d

Please sign in to comment.