Skip to content

Commit

Permalink
Fix attached_to, fixes #1383
Browse files Browse the repository at this point in the history
weee interfaces
  • Loading branch information
mcmonkey4eva committed Apr 7, 2016
1 parent 66434c0 commit 4719b98
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/main/java/net/aufdemrand/denizen/objects/dLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,24 @@
import net.aufdemrand.denizencore.tags.core.EscapeTags;
import net.aufdemrand.denizencore.utilities.CoreUtilities;
import net.minecraft.server.v1_9_R1.TileEntitySkull;
import org.apache.commons.lang.StringUtils;
import org.bukkit.*;
import org.bukkit.block.*;
import org.bukkit.block.Banner;
import org.bukkit.block.Furnace;
import org.bukkit.block.Sign;
import org.bukkit.block.Skull;
import org.bukkit.block.banner.PatternType;
import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.material.Button;
import org.bukkit.material.Lever;
import org.bukkit.material.MaterialData;
import org.bukkit.material.*;
import org.bukkit.util.BlockIterator;

import java.util.*;
import java.util.Comparator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand Down Expand Up @@ -1991,11 +1993,8 @@ && getBlock().getType() == Material.COMMAND) {
if (attribute.startsWith("attached_to")) {
BlockFace face = BlockFace.SELF;
MaterialData data = getBlock().getState().getData();
if (data instanceof Lever) {
face = ((Lever) data).getAttachedFace();
}
else if (data instanceof Button) {
face = ((Button) data).getAttachedFace();
if (data instanceof Attachable) {
face = ((Attachable) data).getAttachedFace();
}
if (face != BlockFace.SELF) {
return new dLocation(getBlock().getRelative(face).getLocation()).getAttribute(attribute.fulfill(1));
Expand Down

0 comments on commit 4719b98

Please sign in to comment.