Optimize codes

Former-commit-id: 725914a67f80177b7554906f9765e4498649d0e3 [formerly b06db6509ee159b6edaaba129d00697bbc64f14f]
Former-commit-id: d3d12abc0d7c892f4bdbf4611cfe17e9ff0d97c6
This commit is contained in:
Ghost_chu committed 2019-06-07 22:42:29 +08:00
1 parent da7ad5109c
commit 5369cf3c95
4 files changed
+9 -8

No files matched your search

@@ -31,7 +31,7 @@ public class BlockListener implements Listener {
@EventHandler(ignoreCancelled = true)
public void onPlace(BlockPlaceEvent e) {
BlockState bs = e.getBlock().getState();
if (bs instanceof DoubleChest == false)
if (!(bs instanceof DoubleChest))
return;
Block b = e.getBlock();
Player p = e.getPlayer();
@@ -518,7 +518,7 @@ public class ContainerShop implements Shop {
* Updates signs attached to the shop
*/
public void setSignText() {
if (Util.isLoaded(this.getLocation()) == false)
if (!Util.isLoaded(this.getLocation()))
return;
String[] lines = new String[4];
lines[0] = MsgUtil.getMessage("signs.header", this.ownerName());
@@ -361,7 +361,7 @@ public class ShopManager {
// Get the shop they interacted with
Shop shop = plugin.getShopManager().getShop(info.getLocation());
// It's not valid anymore
if (shop == null || Util.canBeShop(info.getLocation().getBlock()) == false) {
if (shop == null || !Util.canBeShop(info.getLocation().getBlock())) {
p.sendMessage(MsgUtil.getMessage("chest-was-removed"));
return;
}
@@ -583,7 +583,7 @@ public class ShopManager {
p.sendMessage(MsgUtil.getMessage("no-double-chests"));
return;
}
if (Util.canBeShop(info.getLocation().getBlock()) == false) {
if (!Util.canBeShop(info.getLocation().getBlock())) {
p.sendMessage(MsgUtil.getMessage("chest-was-removed"));
return;
}
@@ -853,12 +853,13 @@ public class Util {
pEffects.add(MsgUtil.getPotioni18n(potionEffect.getType()) + " " + formatEnchLevel(potionEffect.getAmplifier()));
}
}
if (pEffects != null && pEffects.isEmpty() == false) {
String result = new String();
if (!pEffects.isEmpty()) {
StringBuilder result = new StringBuilder();
for (String effectString : pEffects) {
result += effectString + "\n";
result.append(effectString);
result.append("\n");
}
return result;
return result.toString();
} else {
return null;
}