Skip to content

Commit

Permalink
mm & shopkeeper cleanup
Browse files Browse the repository at this point in the history
relates to #331
  • Loading branch information
mcmonkey4eva committed Jul 31, 2020
1 parent 03e5fde commit fd0bc1b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Expand Up @@ -63,25 +63,26 @@ public MythicMobsDeathEvent() {

@Override
public boolean couldMatch(ScriptPath path) {
if (!path.eventLower.startsWith("mythicmob")) {
return false;
}
String cmd = path.eventArgLowerAt(2);
return path.eventLower.startsWith("mythicmob")
&& (cmd.equals("death") || cmd.equals("dies") || cmd.equals("killed"));
if (!cmd.equals("death") && !cmd.equals("die") && !cmd.equals("killed")) {
return false;
}
return true;
}

@Override
public boolean matches(ScriptPath path) {
String mob = path.eventArgLowerAt(1);

if (!mob.equals("mob")
&& runGenericCheck(mob, mythicmob.getMobType().getInternalName())) {
if (!mob.equals("mob") && runGenericCheck(mob, mythicmob.getMobType().getInternalName())) {
return false;
}
if ((path.eventArgLowerAt(3).equals("by"))
&& !tryEntity(killer, path.eventArgLowerAt(4))) {
if ((path.eventArgLowerAt(3).equals("by")) && !tryEntity(killer, path.eventArgLowerAt(4))) {
return false;
}
if (!runInCheck(path, entity.getLocation())
&& !runInCheck(path, killer.getLocation())) {
if (!runInCheck(path, entity.getLocation()) && !runInCheck(path, killer.getLocation())) {
return false;
}
return super.matches(path);
Expand Down
Expand Up @@ -168,7 +168,7 @@ public String getAttribute(Attribute attribute) {
// @returns ElementTag(Boolean)
// @plugin Depenizen, ShopKeepers
// @description
// Returns whether the Shopkeeper is currently in a trade.
// Returns whether the Shopkeeper UI is currently active (may be false when the UI is about to be closed).
// -->
else if (attribute.startsWith("is_ui_active")) {
return new ElementTag(shopkeeper.isUIActive()).getAttribute(attribute.fulfill(1));
Expand All @@ -179,14 +179,14 @@ else if (attribute.startsWith("is_ui_active")) {
// @returns ListTag
// @plugin Depenizen, ShopKeepers
// @description
// Returns a ListTag of the Shopkeeper's trades (as escaped sub-lists).
// Returns a ListTag of the Shopkeeper's trades (as sub-lists).
// NOTE: see '!language Property Escaping'.
// -->
else if (attribute.startsWith("trades") || attribute.startsWith("recipes")) {
ListTag trades = new ListTag();
for (TradingRecipe trade : shopkeeper.getTradingRecipes(null)) {
ListTag recipe = wrapTradingRecipe(trade);
trades.add(EscapeTagBase.escape(recipe.identify()));
trades.addObject(recipe);
}
return trades.getAttribute(attribute.fulfill(1));
}
Expand Down

0 comments on commit fd0bc1b

Please sign in to comment.