Minor changes in User and IslandBuilder

Mainly spacing but also optimized the User#hasPermission() condition
This commit is contained in:
Florian CUNY 2018-01-03 21:06:28 +01:00
parent c6ea8ff4c4
commit 34f291b17f
2 changed files with 7 additions and 8 deletions

View File

@ -72,12 +72,12 @@ public class User {
users.remove(player.getUniqueId());
}
private final Player player;
private final UUID playerUUID;
// ----------------------------------------------------
private final BSkyBlock plugin = BSkyBlock.getInstance();
private final Player player;
private final UUID playerUUID;
private final CommandSender sender;
private User(CommandSender sender) {
@ -139,7 +139,7 @@ public class User {
* @return true if permission is empty or if the player has that permission
*/
public boolean hasPermission(String permission) {
return permission.isEmpty() ? true : sender.hasPermission(permission);
return permission.isEmpty() || sender.hasPermission(permission);
}
public boolean isOnline() {
@ -159,7 +159,7 @@ public class User {
public String getTranslation(String reference, String... variables) {
String translation = plugin.getLocalesManager().get(this, reference);
if (variables.length > 1) {
for (int i = 0; i < variables.length; i+=2) {
for (int i = 0; i < variables.length; i += 2) {
translation = translation.replace(variables[i], variables[i+1]);
}
}

View File

@ -468,8 +468,7 @@ public class IslandBuilder {
// Place a helpful sign in front of player
placeSign(x, islandHeight + 5, z + 3);
// Place the chest - no need to use the safe spawn function
// because we
// know what this island looks like
// because we know what this island looks like
placeChest(x, islandHeight + 5, z + 1);
}
@ -479,7 +478,7 @@ public class IslandBuilder {
if (this.playerUUID != null) {
Sign sign = (Sign) blockToChange.getState();
User user = User.getInstance(playerUUID);
for (int i=0; i<4; i++) {
for (int i = 0; i < 4; i++) {
sign.setLine(i, user.getTranslation("island.sign.line" + i, "[player]", playerName));
}
((org.bukkit.material.Sign) sign.getData()).setFacingDirection(BlockFace.NORTH);