Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/mcmonkey4eva/Denizen
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Nov 25, 2015
2 parents f0db0a9 + 3f11324 commit fcc5089
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
54 changes: 54 additions & 0 deletions src/main/java/net/aufdemrand/denizen/objects/dChunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,60 @@ public String toString() {

public static void registerTags() {

// <--[tag]
// @attribute <ch@chunk.add[<#>,<#>]>
// @returns dChunk
// @description
// returns the chunk with the specified coordinates added to it.
// -->
registerTag("add", new TagRunnable() {
@Override
public String run(Attribute attribute, dObject object) {
if (!attribute.hasContext(1)) {
dB.echoError("The tag ch@chunk.add[<#>,<#>] must have a value.");
return null;
}
List<String> coords = CoreUtilities.split(attribute.getContext(1), ',');
if (coords.size() < 2) {
dB.echoError("The tag ch@chunk.add[<#>,<#>] requires two values!");
return null;
}
double x = aH.getDoubleFrom(coords.get(0)) * 16;
double z = aH.getDoubleFrom(coords.get(1)) * 16;

return new dChunk(((dChunk) object).getCenter().clone().add(x, 0, z).getChunk())
.getAttribute(attribute.fulfill(1));

}
});

// <--[tag]
// @attribute <ch@chunk.sub[<#>,<#>]>
// @returns dChunk
// @description
// returns the chunk with the specified coordinates subtracted from it.
// -->
registerTag("sub", new TagRunnable() {
@Override
public String run(Attribute attribute, dObject object) {
if (!attribute.hasContext(1)) {
dB.echoError("The tag ch@chunk.add[<#>,<#>] must have a value.");
return null;
}
List<String> coords = CoreUtilities.split(attribute.getContext(1), ',');
if (coords.size() < 2) {
dB.echoError("The tag ch@chunk.sub[<#>,<#>] requires two values!");
return null;
}
double x = aH.getDoubleFrom(coords.get(0)) * 16;
double z = aH.getDoubleFrom(coords.get(1)) * 16;

return new dChunk(((dChunk) object).getCenter().clone().subtract(x, 0, z).getChunk())
.getAttribute(attribute.fulfill(1));

}
});

// <--[tag]
// @attribute <ch@chunk.is_loaded>
// @returns Element(Boolean)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public AbstractListenerPlayIn(NetworkManager networkManager, EntityPlayer entity
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(chatSpamField, chatSpamField.getModifiers() & ~Modifier.FINAL);
chatSpamField.set(null, AtomicIntegerFieldUpdater.newUpdater(AbstractListenerPlayIn.class, "chatThrottle"));
chatSpamField.set(null, AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"));
chatThrottle = PlayerConnection.class.getDeclaredField("chatThrottle");
chatThrottle.setAccessible(true);
}
Expand Down

0 comments on commit fcc5089

Please sign in to comment.