Skip to content

Commit

Permalink
implement new script event autosystem
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 12, 2019
1 parent 75f9a93 commit 1224bc5
Show file tree
Hide file tree
Showing 59 changed files with 94 additions and 112 deletions.
Expand Up @@ -47,11 +47,10 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String shopName = path.eventArgLowerAt(2).replace("areashop@", "");
if (shopName.equals("shop")) {
return true;
if (!shopName.equals("shop") && !areaShop.equals(AreaShopTag.valueOf(shopName))) {
return false;
}
AreaShopTag shop = AreaShopTag.valueOf(shopName);
return shop != null && shop.equals(areaShop);
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -53,7 +53,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {

@Override
public boolean matches(ScriptPath path) {
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -48,7 +48,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {

@Override
public boolean matches(ScriptPath path) {
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -48,7 +48,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {

@Override
public boolean matches(ScriptPath path) {
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -49,7 +49,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {

@Override
public boolean matches(ScriptPath path) {
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -46,7 +46,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {

@Override
public boolean matches(ScriptPath path) {
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -46,7 +46,7 @@ public boolean couldMatch(ScriptPath path) {

@Override
public boolean matches(ScriptPath path) {
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -46,7 +46,7 @@ public boolean couldMatch(ScriptPath path) {

@Override
public boolean matches(ScriptPath path) {
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -53,7 +53,7 @@ public boolean matches(ScriptPath path) {
if (!serverName.equals("server") && !serverName.equalsIgnoreCase(newServer)) {
return false;
}
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -62,7 +62,7 @@ public boolean matches(ScriptPath path) {
if (!path.eventArgLowerAt(2).equals("command") && !path.eventArgLowerAt(2).equals(commandName())) {
return false;
}
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -64,7 +64,7 @@ public boolean couldMatch(ScriptPath path) {

@Override
public boolean matches(ScriptPath path) {
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -38,7 +38,7 @@ public boolean couldMatch(ScriptPath path) {

@Override
public boolean matches(ScriptPath path) {
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -38,7 +38,7 @@ public boolean couldMatch(ScriptPath path) {

@Override
public boolean matches(ScriptPath path) {
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -56,7 +56,7 @@ else if (path.eventArgLowerAt(1).equals("returns") && event.getValue()) {
else if (!path.eventArgLowerAt(1).equals("afk")) {
return false;
}
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -48,7 +48,7 @@ public boolean matches(ScriptPath path) {
if (!runInCheck(path, event.getPlayer().getLocation())) {
return false;
}
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -55,7 +55,7 @@ public boolean matches(ScriptPath path) {
if (!status.equals("status")) {
return false;
}
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -58,7 +58,7 @@ public boolean matches(ScriptPath path) {
if (!status.equals("status")) {
return false;
}
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -58,7 +58,7 @@ public boolean matches(ScriptPath path) {
if (!status.equals("status")) {
return false;
}
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -66,11 +66,18 @@ public boolean matches(ScriptPath path) {
String direction = path.eventArgAt(2);
String claim_test = path.eventArgLowerAt(3);

// TODO: Wtf
if (direction.equals("enters") && new_claim != null) {
return claim_test.equals("gpclaim") || claim_test.equals(CoreUtilities.toLowerCase(new_claim.simple()));
if (!(claim_test.equals("gpclaim") || claim_test.equals(CoreUtilities.toLowerCase(new_claim.simple())))) {
return false;
}
return super.matches(path);
}
else if (direction.equals("exits") && old_claim != null) {
return claim_test.equals("gpclaim") || claim_test.equals(CoreUtilities.toLowerCase(old_claim.simple()));
if (!(claim_test.equals("gpclaim") || claim_test.equals(CoreUtilities.toLowerCase(old_claim.simple())))) {
return false;
}
return super.matches(path);
}
return false;
}
Expand Down
Expand Up @@ -55,12 +55,11 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String disguiseName = path.eventArgLowerAt(2);

if (disguiseName.equals("disguise")) {
return true;
if (!disguiseName.equals("disguise") && !disguise.equals(LibsDisguiseTag.valueOf(disguiseName))) {
return false;
}

LibsDisguiseTag dDisguise = LibsDisguiseTag.valueOf(disguiseName);
return dDisguise != null && dDisguise.equals(disguise);
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -54,13 +54,11 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String disguiseName = path.eventArgLowerAt(2);

if (disguiseName.equals("disguise")) {
return true;
if (!disguiseName.equals("disguise") && !disguise.equals(LibsDisguiseTag.valueOf(disguiseName))) {
return false;
}

LibsDisguiseTag dDisguise = LibsDisguiseTag.valueOf(disguiseName);
return dDisguise != null && dDisguise.equals(disguise);
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -57,8 +57,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {

@Override
public boolean matches(ScriptPath path) {
String lower = path.eventArgLowerAt(3);
return lower.startsWith("magicspells player mana change");
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -79,7 +79,7 @@ public boolean matches(ScriptPath path) {
if (spellName.equals("spell") || spellName.equalsIgnoreCase(spell.asString())) {
return true;
}
return false;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -51,8 +51,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {

@Override
public boolean matches(ScriptPath path) {
String lower = path.eventArgLowerAt(3);
return lower.startsWith("magicspells player completes spell");
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -51,8 +51,7 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {

@Override
public boolean matches(ScriptPath path) {
String lower = path.eventArgLowerAt(3);
return lower.startsWith("magicspells player learns spell");
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -70,7 +70,7 @@ public boolean matches(ScriptPath path) {
return false;
}

return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -68,7 +68,7 @@ public boolean matches(ScriptPath path) {
return false;
}

return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -65,7 +65,7 @@ public boolean matches(ScriptPath path) {
return false;
}

return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -64,7 +64,7 @@ public boolean matches(ScriptPath path) {
return false;
}

return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -68,7 +68,7 @@ public boolean matches(ScriptPath path) {
return false;
}

return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -69,7 +69,7 @@ public boolean matches(ScriptPath path) {
return false;
}

return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -51,7 +51,7 @@ public boolean matches(ScriptPath path) {
if (!arenaname.equals("arena") && (a == null || !CoreUtilities.toLowerCase(a.getArena().arenaName()).equals(arenaname))) {
return false;
}
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -50,7 +50,7 @@ public boolean matches(ScriptPath path) {
if (!arenaname.equals("arena") && (a == null || !CoreUtilities.toLowerCase(a.getArena().arenaName()).equals(arenaname))) {
return false;
}
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -52,8 +52,10 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
public boolean matches(ScriptPath path) {
String arenaname = path.eventArgLowerAt(2).replace("mobarena@", "");
MobArenaArenaTag a = MobArenaArenaTag.valueOf(arenaname);
return (arenaname.equals("arena") || (a != null && a.getArena() == event.getArena()))
&& event.getWave() != null;
if (!((arenaname.equals("arena") || (a != null && a.getArena() == event.getArena())) && event.getWave() != null)) {
return false;
}
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -96,7 +96,7 @@ public boolean matches(ScriptPath path) {
return false;
}

return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -50,7 +50,7 @@ public boolean couldMatch(ScriptPath path) {
if (!path.eventArgLowerAt(2).equals("ends") && !path.eventArgLowerAt(3).equals("ends")) {
return false;
}
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -54,14 +54,10 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String plotName = path.eventArgLowerAt(3);
if (plotName.equals("plotsquaredplot")) {
return true;
}
PlotSquaredPlotTag dplot = PlotSquaredPlotTag.valueOf(plotName);
if (dplot == null || !dplot.equals(plot)) {
if (!plotName.equals("plotsquaredplot") && !plot.equals(PlotSquaredPlotTag.valueOf(plotName))) {
return false;
}
return true;
return super.matches(path);
}

@Override
Expand Down
Expand Up @@ -49,11 +49,10 @@ public boolean couldMatch(ScriptContainer scriptContainer, String s) {
@Override
public boolean matches(ScriptPath path) {
String plotName = path.eventArgLowerAt(3);
if (plotName.equals("plotsquaredplot")) {
return true;
if (!plotName.equals("plotsquaredplot") && !plot.equals(PlotSquaredPlotTag.valueOf(plotName))) {
return false;
}
PlotSquaredPlotTag dplot = PlotSquaredPlotTag.valueOf(plotName);
return dplot != null && dplot.equals(plot);
return super.matches(path);
}

@Override
Expand Down

0 comments on commit 1224bc5

Please sign in to comment.