Skip to content

Commit

Permalink
Update all old block event getContext's
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jul 20, 2015
1 parent 95c17f4 commit 772ff4a
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 53 deletions.
Expand Up @@ -96,12 +96,17 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public HashMap<String, dObject> getContext() {
HashMap<String, dObject> context = super.getContext();
context.put("location", location);
context.put("new_material", new_material); // Deprecated because it doesn't have proper data
context.put("old_material", old_material);
return context;
public dObject getContext(String name) {
if (name.equals("location")) {
return location;
}
else if (name.equals("new_material")) {
return new_material;
}
else if (name.equals("old_material")) {
return old_material;
}
return super.getContext(name);
}

@EventHandler
Expand Down
Expand Up @@ -82,11 +82,14 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public HashMap<String, dObject> getContext() {
HashMap<String, dObject> context = super.getContext();
context.put("location", location);
context.put("material", material);
return context;
public dObject getContext(String name) {
if (name.equals("location")) {
return location;
}
else if (name.equals("material")) {
return material;
}
return super.getContext(name);
}

@EventHandler
Expand Down
Expand Up @@ -79,11 +79,14 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public HashMap<String, dObject> getContext() {
HashMap<String, dObject> context = super.getContext();
context.put("location", location);
context.put("material", material);
return context;
public dObject getContext(String name) {
if (name.equals("location")) {
return location;
}
else if (name.equals("material")) {
return material;
}
return super.getContext(name);
}

@EventHandler
Expand Down
Expand Up @@ -79,10 +79,11 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public HashMap<String, dObject> getContext() {
HashMap<String, dObject> context = super.getContext();
context.put("location", location);
return context;
public dObject getContext(String name) {
if (name.equals("location")) {
return location;
}
return super.getContext(name);
}

@EventHandler
Expand Down
Expand Up @@ -79,11 +79,14 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public HashMap<String, dObject> getContext() {
HashMap<String, dObject> context = super.getContext();
context.put("location", location);
context.put("material", material);
return context;
public dObject getContext(String name) {
if (name.equals("location")) {
return location;
}
else if (name.equals("material")) {
return material;
}
return super.getContext(name);
}

@EventHandler
Expand Down
Expand Up @@ -83,11 +83,14 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public HashMap<String, dObject> getContext() {
HashMap<String, dObject> context = super.getContext();
context.put("location", location);
context.put("material", material);
return context;
public dObject getContext(String name) {
if (name.equals("location")) {
return location;
}
else if (name.equals("material")) {
return material;
}
return super.getContext(name);
}

@EventHandler
Expand Down
Expand Up @@ -87,18 +87,23 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public HashMap<String, dObject> getContext() {
HashMap<String, dObject> context = super.getContext();
context.put("location", location);
context.put("material", material);
if (entity != null) {
context.put("entity", entity);
public dObject getContext(String name) {
if (name.equals("location")) {
return location;
}
if (origin_location != null) {
context.put("origin_location", origin_location);
else if (name.equals("material")) {
return material;
}
context.put("cause", cause);
return context;
else if (name.equals("entity") && entity != null) {
return entity;
}
else if (name.equals("origin_location") && origin_location != null) {
return origin_location;
}
else if (name.equals("cause")) {
return cause;
}
return super.getContext(name);
}

@EventHandler
Expand Down
Expand Up @@ -85,11 +85,14 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
}

@Override
public HashMap<String, dObject> getContext() {
HashMap<String, dObject> context = super.getContext();
context.put("location", location);
context.put("new_material", new_material);
return context;
public dObject getContext(String name) {
if (name.equals("location")) {
return location;
}
else if (name.equals("new_material")) {
return new_material;
}
return super.getContext(name);
}

@EventHandler
Expand Down
Expand Up @@ -82,14 +82,6 @@ public boolean applyDetermination(ScriptContainer container, String determinatio
return super.applyDetermination(container, determination);
}

@Override
public HashMap<String, dObject> getContext() {
HashMap<String, dObject> context = super.getContext();
context.put("location", location);
context.put("material", material);
return context;
}

@Override
public dObject getContext(String name) {
if (name.equals("location")) {
Expand Down

0 comments on commit 772ff4a

Please sign in to comment.