Skip to content

Commit

Permalink
change in area to be a switch by default
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Mar 9, 2019
1 parent 137452e commit 085ff94
Show file tree
Hide file tree
Showing 113 changed files with 519 additions and 399 deletions.
Expand Up @@ -177,31 +177,39 @@ public boolean runInCheck(ScriptPath path, Location location) {
}

public boolean runInCheck(ScriptPath path, Location location, String innote) {
int index;
for (index = 0; index < path.eventArgsLower.length; index++) {
if (path.eventArgsLower[index].equals(innote)) {
break;
}
}
if (index >= path.eventArgsLower.length) {
// No 'in ...' specified
return true;
}

String it = path.eventArgLowerAt(index + 1);
if (it.equals("notable")) {
String subit = path.eventArgLowerAt(index + 2);
if (subit.equals("cuboid")) {
return dCuboid.getNotableCuboidsContaining(location).size() > 0;
String it = path.switches.get(innote);
if (it == null) {
int index;
for (index = 0; index < path.eventArgsLower.length; index++) {
if (path.eventArgsLower[index].equals(innote)) {
break;
}
}
else if (subit.equals("ellipsoid")) {
return dEllipsoid.getNotableEllipsoidsContaining(location).size() > 0;
if (index >= path.eventArgsLower.length) {
// No 'in ...' specified
return true;
}
else {
dB.echoError("Invalid event 'IN ...' check [" + getName() + "] ('in notable ???'): '" + path.event + "' for " + path.container.getName());
return false;
it = path.eventArgLowerAt(index + 1);
if (it.equals("notable")) {
String subit = path.eventArgLowerAt(index + 2);
if (subit.equals("cuboid")) {
return dCuboid.getNotableCuboidsContaining(location).size() > 0;
}
else if (subit.equals("ellipsoid")) {
return dEllipsoid.getNotableEllipsoidsContaining(location).size() > 0;
}
else {
dB.echoError("Invalid event 'IN ...' check [" + getName() + "] ('in notable ???'): '" + path.event + "' for " + path.container.getName());
return false;
}
}
}
if (it.equals("cuboid")) {
return dCuboid.getNotableCuboidsContaining(location).size() > 0;
}
else if (it.equals("ellipsoid")) {
return dEllipsoid.getNotableEllipsoidsContaining(location).size() > 0;
}
else if (dWorld.matches(it)) {
return CoreUtilities.toLowerCase(location.getWorld().getName()).equals(it);
}
Expand Down
Expand Up @@ -14,10 +14,11 @@ public class BlockBuiltScriptEvent extends BukkitScriptEvent implements Listener

// <--[event]
// @Events
// block being built (on <material>) (in <area>)
// <material> being built (on <material>) (in <area>)
// block being built (on <material>)
// <material> being built (on <material>)
//
// @Regex ^on [^\s]+ being built( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ being built$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -14,10 +14,11 @@ public class BlockBurnsScriptEvent extends BukkitScriptEvent implements Listener

// <--[event]
// @Events
// block burns (in <area>)
// <block> burns (in <area>)
// block burns
// <block> burns
//
// @Regex ^on [^\s]+ burns( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ burns$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -18,12 +18,13 @@ public class BlockDispensesScriptEvent extends BukkitScriptEvent implements List

// <--[event]
// @Events
// block dispenses item (in <area>)
// block dispenses <item> (in <area>)
// <block> dispenses item (in <area>)
// <block> dispenses <item> (in <area>)
// block dispenses item
// block dispenses <item>
// <block> dispenses item
// <block> dispenses <item>
//
// @Regex ^on [^\s]+ dispense [^\s]+ ( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ dispense [^\s]+ $
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -14,10 +14,11 @@ public class BlockFadesScriptEvent extends BukkitScriptEvent implements Listener

// <--[event]
// @Events
// block fades (in <area>)
// <block> fades (in <area>)
// block fades
// <block> fades
//
// @Regex ^on [^\s]+ fades( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ fades$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -15,10 +15,11 @@ public class BlockFallsScriptEvent extends BukkitScriptEvent implements Listener

// <--[event]
// @Events
// block falls (in <area>)
// <material> falls (in <area>)
// block falls
// <material> falls
//
// @Regex ^on [^\s]+ falls( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ falls$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -14,10 +14,11 @@ public class BlockFormsScriptEvent extends BukkitScriptEvent implements Listener

// <--[event]
// @Events
// block forms (in <area>)
// <block> forms (in <area>)
// block forms
// <block> forms
//
// @Regex ^on [^\s]+ forms( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ forms$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -14,10 +14,11 @@ public class BlockGrowsScriptEvent extends BukkitScriptEvent implements Listener

// <--[event]
// @Events
// block grows (in <area>)
// <block> grows (in <area>)
// block grows
// <block> grows
//
// @Regex ^on [^\s]+ grows( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ grows$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -16,10 +16,11 @@ public class BlockIgnitesScriptEvent extends BukkitScriptEvent implements Listen

// <--[event]
// @Events
// block ignites (in <area>)
// <material> ignites (in <area>)
// block ignites
// <material> ignites
//
// @Regex ^on [^\s]+ ignites( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ ignites$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -16,10 +16,11 @@ public class BlockPhysicsScriptEvent extends BukkitScriptEvent implements Listen

// <--[event]
// @Events
// block physics (in <area>)
// <material> physics (in <area>)
// block physics
// <material> physics
//
// @Regex ^on [^\s]+ physics( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ physics$
// @Switch in <area>
//
// @Warning This event may fire very rapidly.
//
Expand Down
Expand Up @@ -14,10 +14,11 @@ public class BlockSpreadsScriptEvent extends BukkitScriptEvent implements Listen

// <--[event]
// @Events
// block spreads (in <area>)
// <material> spreads (in <area>)
// block spreads
// <material> spreads
//
// @Regex ^on [^\s]+ spreads( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ spreads$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -109,9 +109,10 @@ private List<String> getAll(String cmd) {
// <--[event]
// @Events
// command
// <command_name>|... command (in <area>)
// <command_name>|... command
//
// @Regex ^on( [^\s]+)? command( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on( [^\s]+)? command$
// @Switch in <area>
//
// @Triggers when a player, console, or command block/minecart runs a Bukkit command. This happens before
// any code of established commands allowing scripters to 'override' existing commands.
Expand Down
Expand Up @@ -14,9 +14,10 @@ public class CreeperPoweredScriptEvent extends BukkitScriptEvent implements List

// <--[event]
// @Events
// creeper powered (because <cause>) (in <area>)
// creeper powered (because <cause>)
//
// @Regex ^on creeper powered( because [^\s]+)?( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on creeper powered( because [^\s]+)?$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -19,12 +19,13 @@ public class EntityBreaksHangingScriptEvent extends BukkitScriptEvent implements

// <--[event]
// @Events
// entity breaks hanging (because <cause>) (in <area>)
// entity breaks <hanging> (because <cause>) (in <area>)
// <entity> breaks hanging (because <cause>) (in <area>)
// <entity> breaks <hanging> (because <cause>) (in <area>)
// entity breaks hanging (because <cause>)
// entity breaks <hanging> (because <cause>)
// <entity> breaks hanging (because <cause>)
// <entity> breaks <hanging> (because <cause>)
//
// @Regex ^on [^\s]+ breaks [^\s]+( because [^\s]+)?( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ breaks [^\s]+( because [^\s]+)?$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -21,10 +21,11 @@ public class EntityBreedScriptEvent extends BukkitScriptEvent implements Listene

// <--[event]
// @Events
// entity breeds (in <area>)
// <entity> breeds (in <area>)
// entity breeds
// <entity> breeds
//
// @Regex ^on [^\s]+ breeds( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ breeds$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -21,12 +21,13 @@ public class EntityChangesBlockScriptEvent extends BukkitScriptEvent implements
// <--[event]
// @Events
// entity changes block
// entity changes block (into <material>) (in <area>)
// entity changes <material> (into <material>) (in <area>)
// <entity> changes block (into <material>) (in <area>)
// <entity> changes <material> (into <material>) (in <area>)
// entity changes block (into <material>)
// entity changes <material> (into <material>)
// <entity> changes block (into <material>)
// <entity> changes <material> (into <material>)
//
// @Regex ^on [^\s]+ changes [^\s]+( into [^\s]+)?( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ changes [^\s]+( into [^\s]+)?$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -22,10 +22,11 @@ public class EntityCombustsScriptEvent extends BukkitScriptEvent implements List

// <--[event]
// @Events
// entity combusts (in <area>)
// <entity> combusts (in <area>)
// entity combusts
// <entity> combusts
//
// @Regex ^on [^\s]+ combusts( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ combusts$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -16,10 +16,11 @@ public class EntityCreatePortalScriptEvent extends BukkitScriptEvent implements

// <--[event]
// @Events
// entity creates portal (in <area>)
// <entity> creates portal (in <area>)
// entity creates portal
// <entity> creates portal
//
// @Regex ^on [^\s]+ creates portal( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ creates portal$
// @Switch in <area>
//
// @Cancellable true
//
Expand Down
Expand Up @@ -27,18 +27,19 @@ public class EntityDamagedScriptEvent extends BukkitScriptEvent implements Liste

// <--[event]
// @Events
// entity damaged (by <cause>) (in <area>)
// <entity> damaged (by <cause>) (in <area>)
// entity damages entity (in <area>)
// entity damages <entity> (in <area>)
// entity damaged by entity (in <area>)
// entity damaged by <entity> (in <area>)
// <entity> damages entity (in <area>)
// <entity> damaged by entity (in <area>)
// <entity> damaged by <entity> (in <area>)
// <entity> damages <entity> (in <area>)
// entity damaged (by <cause>)
// <entity> damaged (by <cause>)
// entity damages entity
// entity damages <entity>
// entity damaged by entity
// entity damaged by <entity>
// <entity> damages entity
// <entity> damaged by entity
// <entity> damaged by <entity>
// <entity> damages <entity>
//
// @Regex ^on [^\s]+ ((damages [^\s]+)|damaged( by [^\s]+)?)( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ ((damages [^\s]+)|damaged( by [^\s]+)?)$
// @Switch in <area>
//
// @Switch with <item>
//
Expand Down
Expand Up @@ -30,14 +30,15 @@ public class EntityDeathScriptEvent extends BukkitScriptEvent implements Listene

// <--[event]
// @Events
// entity death (in <area>)
// entity dies (in <area>)
// <entity> dies (in <area>)
// <entity> death (in <area>)
// entity death
// entity dies
// <entity> dies
// <entity> death
//
// @Cancellable true
//
// @Regex ^on [^\s]+ (death|dies)( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ (death|dies)$
// @Switch in <area>
//
// @Triggers when an entity dies.
//
Expand Down
Expand Up @@ -13,10 +13,11 @@ public class EntityDespawnScriptEvent extends BukkitScriptEvent {

// <--[event]
// @Events
// entity despawns (in <area>)
// <entity> despawns (in <area>)
// entity despawns
// <entity> despawns
//
// @Regex ^on [^\s]+ despawns( in ((notable (cuboid|ellipsoid))|([^\s]+)))?$
// @Regex ^on [^\s]+ despawns$
// @Switch in <area>
//
// @Warning this event fires very rapidly.
//
Expand Down

0 comments on commit 085ff94

Please sign in to comment.