Improvements around signs

Former-commit-id: 052f6f0faf2d6ac7ca539ea87f9fcf9a5b971a1c [formerly 19f3722dee9b28657c081386a5d5feae77ebd9ba]
Former-commit-id: ec11206e51a4641c5ed365a497074180ff83d8b3
This commit is contained in:
Sotr committed 2019-04-29 00:11:33 +08:00
1 parent 571a11e94f
commit 18370bc828
2 files changed
+5 -19

No files matched your search

@@ -540,8 +540,7 @@ public class ContainerShop implements Shop {
blocks[1] = loc.getBlock().getRelative(BlockFace.NORTH);
blocks[2] = loc.getBlock().getRelative(BlockFace.SOUTH);
blocks[3] = loc.getBlock().getRelative(BlockFace.WEST);
final String signHeader = MsgUtil.getMessage("signs.header", "");
final String signHeader2 = MsgUtil.getMessage("sign.header", this.ownerName());
final String signHeader = MsgUtil.getMessage("sign.header", this.ownerName());
for (Block b : blocks) {
if (!Util.isWallSign(b.getType())) {
@@ -552,30 +551,16 @@ public class ContainerShop implements Shop {
Util.debugLog(b.toString()+" not attached");
continue;
}
org.bukkit.block.Sign sign = (org.bukkit.block.Sign) b.getState();
if (sign.getLine(0).contains(signHeader)||sign.getLine(0).contains(signHeader2)) {
org.bukkit.block.Sign sign = (org.bukkit.block.Sign) b.getState();
if (sign.getLine(0).contains(signHeader)) {
signs.add(sign);
Util.debugLog(sign.toString()+" added in sign list");
} else {
boolean text = false;
for (String s : sign.getLines()) {
if (!s.isEmpty()) {
text = true;
break;
}
}
if (!text) {
signs.add(sign);
Util.debugLog(sign.toString()+" added in sign list");
}
}
}
return signs;
}
public boolean isAttached(Block b) {
if (!Util.isWallSign(b.getType()))
new IllegalArgumentException(b + " Is not a sign!").printStackTrace();
Util.debugLog("CHECK ATTACHEDING : "+this.getLocation().getBlock().toString()+ " WITH "+Util.getAttached(b));
return this.getLocation().getBlock().equals(Util.getAttached(b));
}
@@ -14,6 +14,7 @@ import java.util.logging.Level;
import java.util.UUID;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@@ -749,7 +750,7 @@ public class MsgUtil {
return raw;
}
for (int i = 0; i < args.length; i++) {
raw = raw.replace("{" + i + "}", args[i]==null ? "null" : args[i]);
raw = StringUtils.replace(raw, "{" + i + "}", args[i] == null ? "" : args[i]);
}
return raw;
}