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 Oct 3, 2017
2 parents 1d340f6 + ab512b2 commit 1c2bf0e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
26 changes: 26 additions & 0 deletions plugin/src/main/java/net/aufdemrand/denizen/objects/dEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2160,6 +2160,18 @@ else if (!getLivingEntity().getActivePotionEffects().isEmpty()) {
}
}

// <--[tag]
// @attribute <e@entity.is_sheared>
// @returns Element(Boolean)
// @group attributes
// @description
// Returns whether a sheep is sheared.
// -->
if (attribute.startsWith("is_sheared") && getBukkitEntity() instanceof Sheep) {
return new Element(((Sheep) getBukkitEntity()).isSheared())
.getAttribute(attribute.fulfill(1));
}

// <--[tag]
// @attribute <e@entity.is_on_ground>
// @returns Element(Boolean)
Expand Down Expand Up @@ -2861,6 +2873,20 @@ public void adjust(Mechanism mechanism) {
getLivingEntity().setRemoveWhenFarAway(value.asBoolean());
}

// <--[mechanism]
// @object dEntity
// @name sheared
// @input Element(Boolean)
// @description
// Sets whether the sheep is sheared.
// @tags
// <e@entity.is_sheared>
// -->
if (mechanism.matches("sheared") && mechanism.requireBoolean()
&& getBukkitEntity() instanceof Sheep) {
((Sheep) getBukkitEntity()).setSheared(value.asBoolean());
}

// <--[mechanism]
// @object dEntity
// @name velocity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public void run() {
@TagManager.TagEvents
public void schematicTags(ReplaceableTagEvent event) {

if (!event.matches("schematic, schem")) {
if (!event.matches("schematic", "schem")) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ else if (event.getName().equals("&Uuml")) {
}


// Thanks geckon :)
final String[] code = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
, "a", "b", "c", "d", "e", "f", "k", "l", "m", "n", "o", "r"};
final String[] code2 = {"&0", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9"
, "&a", "&b", "&c", "&d", "&e", "&f", "&k", "&l", "&m", "&n", "&o", "&r"};

// <--[tag]
// @attribute <&0>
Expand Down Expand Up @@ -378,7 +379,7 @@ public void colorTags(ReplaceableTagEvent event) {
if (event.matches(color.name())) {
event.setReplaced(new Element(color.toString()).getAttribute(attribute.fulfill(1)));
}
else if (event.matches("&" + code[i])) {
else if (event.matches(code2[i])) {
event.setReplaced(new Element(ChatColor.getByChar(code[i]).toString()).getAttribute(attribute.fulfill(1)));
}
i++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public int getX(dPlayer player, UUID uuid) {
int tx = x;
if (worldCoordinates && lastMap != null) {
float f = (float) (tx - lastMap.getCenterX()) / (1 << (lastMap.getScale().getValue()));
byte bx = (byte) ((int) ((f * 2.0F) + 0.5D));
return bx;
int bx = ((int) ((f * 2.0F) + 0.5D));
return (bx < -127 ? -127 : (bx > 127 ? 127 : bx));
}
return tx;
}
Expand All @@ -60,8 +60,8 @@ public int getY(dPlayer player, UUID uuid) {
int ty = y;
if (worldCoordinates && lastMap != null) {
float f1 = (float) (ty - lastMap.getCenterZ()) / (1 << (lastMap.getScale().getValue()));
byte by = (byte) ((int) ((f1 * 2.0F) + 0.5D));
return by;
int by = ((int) ((f1 * 2.0F) + 0.5D));
return (by < -127 ? -127 : (by > 127 ? 127 : by));
}
return ty;
}
Expand Down

0 comments on commit 1c2bf0e

Please sign in to comment.