Skip to content

Commit

Permalink
Cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jul 28, 2015
1 parent 58c55fe commit d438abd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
Expand Up @@ -175,9 +175,11 @@ else if ((name.equals("damager")) && (damager != null)) {
else if ((name.equals("projectile")) && (projectile != null)) {
return projectile;
}
for (EntityDamageEvent.DamageModifier dm : EntityDamageEvent.DamageModifier.values()) {
if (name.equals("damage_" + dm.name())) {
return new Element(event.getDamage(dm));
if (name.startsWith("damage_")) {
for (EntityDamageEvent.DamageModifier dm : EntityDamageEvent.DamageModifier.values()) {
if (name.equals("damage_" + dm.name())) {
return new Element(event.getDamage(dm));
}
}
}
return super.getContext(name);
Expand Down
Expand Up @@ -127,7 +127,7 @@ public dObject getContext(String name) {
else if (name.equals("reason")) {
return reason;
}
else if (name.equals("cuboids")) {
else if (name.equals("cuboids")) { // DEPRECATED
return cuboids;
}
else if ((name.equals("target")) && (target != null)) {
Expand Down
Expand Up @@ -147,7 +147,7 @@ public dObject getContext(String name) {
else if (name.equals("material")) {
return material;
}
else if (name.equals("cuboids")) {
else if (name.equals("cuboids")) { // DEPRECATED
return cuboids;
}
else if (name.equals("xp")) {
Expand Down
Expand Up @@ -63,6 +63,8 @@ public static String doEvents(List<String> events, dNPC npc, dPlayer player, Map
// @Events
// server start
//
// @Regex ^server start$
//
// @Triggers when the server starts
//
// @Determine
Expand All @@ -84,19 +86,22 @@ public void run() {
String determination = doEvents(Arrays.asList("server start"),
null, null, null);

if (determination.toUpperCase().startsWith("CANCELLED"))
if (determination.toUpperCase().startsWith("CANCELLED")) {
Bukkit.getServer().shutdown(); // TODO: WHY IS THIS AN OPTION?!
}
}

private final Map<String, Integer> current_time = new HashMap<String, Integer>();

// <--[event]
// @Events
// time changes (in <world>)
// <0-23>:00 in <world>
// time <0-23> in <world>
//
// @Regex ^time [^\s]+( in [^\s]+)$
//
// @Triggers when the current time changes in a world (once per mine-hour).
//
// @Context
// <context.time> returns the current time.
// <context.world> returns the world.
Expand All @@ -121,7 +126,7 @@ public void timeEvent() {
doEvents(Arrays.asList
("time changes",
"time changes in " + currentWorld.identifySimple(),
String.valueOf(hour) + ":00 in " + currentWorld.identifySimple(),
String.valueOf(hour) + ":00 in " + currentWorld.identifySimple(), // NOTE: Deprecated
"time " + String.valueOf(hour) + " in " + currentWorld.identifySimple()),
null, null, context, true);

Expand Down

0 comments on commit d438abd

Please sign in to comment.