1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-17 12:01:20 +02:00

Code Cleanup

This commit is contained in:
Chris Ward
2013-04-07 20:35:57 +10:00
parent 4d8543bb3a
commit bf3e03fdaf
30 changed files with 57 additions and 142 deletions

View File

@@ -55,10 +55,9 @@ public class EssentialsTimer implements Runnable
user.setLastOnlineActivity(currentTime); user.setLastOnlineActivity(currentTime);
user.checkActivity(); user.checkActivity();
boolean mailDisabled = false;
ISettings settings = ess.getSettings(); ISettings settings = ess.getSettings();
mailDisabled = settings.getData().getCommands().isDisabled("mail"); boolean mailDisabled = settings.getData().getCommands().isDisabled("mail");
// New mail notification // New mail notification
if (!mailDisabled && Permissions.MAIL.isAuthorized(user) && !user.gotMailInfo()) if (!mailDisabled && Permissions.MAIL.isAuthorized(user) && !user.gotMailInfo())

View File

@@ -154,7 +154,6 @@ public class ItemDb implements IItemDb
{ {
throw new Exception(_("§4Unknown item id:§r {0}§4.", itemid)); throw new Exception(_("§4Unknown item id:§r {0}§4.", itemid));
} }
final ItemStack retval = new ItemStack(mat, mat.getMaxStackSize(), metaData); return new ItemStack(mat, mat.getMaxStackSize(), metaData);
return retval;
} }
} }

View File

@@ -156,7 +156,7 @@ public class MetaItemStack
{ {
final String owner = split[1]; final String owner = split[1];
final SkullMeta meta = (SkullMeta)stack.getItemMeta(); final SkullMeta meta = (SkullMeta)stack.getItemMeta();
boolean result = meta.setOwner(owner); meta.setOwner(owner);
stack.setItemMeta(meta); stack.setItemMeta(meta);
} }
else else
@@ -286,7 +286,7 @@ public class MetaItemStack
} }
else if (split[0].equalsIgnoreCase("shape") || split[0].equalsIgnoreCase("type") || (allowShortName && (split[0].equalsIgnoreCase("s") || split[0].equalsIgnoreCase("t")))) else if (split[0].equalsIgnoreCase("shape") || split[0].equalsIgnoreCase("type") || (allowShortName && (split[0].equalsIgnoreCase("s") || split[0].equalsIgnoreCase("t"))))
{ {
FireworkEffect.Type finalEffect = null; FireworkEffect.Type finalEffect;
split[1] = (split[1].equalsIgnoreCase("large") ? "BALL_LARGE" : split[1]); split[1] = (split[1].equalsIgnoreCase("large") ? "BALL_LARGE" : split[1]);
if (fireworkShape.containsKey(split[1].toUpperCase())) if (fireworkShape.containsKey(split[1].toUpperCase()))
{ {
@@ -513,7 +513,6 @@ public class MetaItemStack
private boolean hasMetaPermission(final IUser user, final String metaPerm, final boolean graceful, final boolean includeBase) throws Exception private boolean hasMetaPermission(final IUser user, final String metaPerm, final boolean graceful, final boolean includeBase) throws Exception
{ {
final String permBase = includeBase ? "essentials.itemspawn.meta-" : "essentials.";
if (user == null || (includeBase ? Permissions.ITEMSPAWN.isAuthorized(user, "meta-" + metaPerm) : Permissions.ESSENTIALS.isAuthorized(user, metaPerm))) if (user == null || (includeBase ? Permissions.ITEMSPAWN.isAuthorized(user, "meta-" + metaPerm) : Permissions.ESSENTIALS.isAuthorized(user, metaPerm)))
{ {
return true; return true;

17
Essentials/src/net/ess3/bukkit/BukkitPlugin.java Normal file → Executable file
View File

@@ -100,14 +100,15 @@ public class BukkitPlugin extends JavaPlugin implements IPlugin
final MetricsStarter metricsStarter = new MetricsStarter(ess); final MetricsStarter metricsStarter = new MetricsStarter(ess);
if (metricsStarter.getStart() != null && metricsStarter.getStart() == true) if (metricsStarter.getStart() != null)
{ {
getServer().getScheduler().runTaskLaterAsynchronously(this, metricsStarter, 1); if(metricsStarter.getStart())
} getServer().getScheduler().runTaskLaterAsynchronously(this, metricsStarter, 1);
else if (metricsStarter.getStart() != null && metricsStarter.getStart() == false) else
{ {
final MetricsListener metricsListener = new MetricsListener(ess, metricsStarter); final MetricsListener metricsListener = new MetricsListener(ess, metricsStarter);
pm.registerEvents(metricsListener, this); pm.registerEvents(metricsListener, this);
}
} }
} }
@@ -149,7 +150,7 @@ public class BukkitPlugin extends JavaPlugin implements IPlugin
{ {
return getServer().getScheduler().runTaskLaterAsynchronously(this, run, delay); return getServer().getScheduler().runTaskLaterAsynchronously(this, run, delay);
} }
@Override @Override
public BukkitTask runTaskTimerAsynchronously(final Runnable run, final long delay, final long delay2) public BukkitTask runTaskTimerAsynchronously(final Runnable run, final long delay, final long delay2)
{ {

View File

@@ -55,7 +55,7 @@ public class Commandeco extends EssentialsCommand
break; break;
} }
} }
if (ecoResetAll == true) if (ecoResetAll)
{ {
ess.broadcastMessage(null, _("ecoResetAll", settings.getData().getEconomy().getCurrencySymbol() + amount)); ess.broadcastMessage(null, _("ecoResetAll", settings.getData().getEconomy().getCurrencySymbol() + amount));
} }
@@ -89,7 +89,7 @@ public class Commandeco extends EssentialsCommand
break; break;
} }
} }
if (ecoResetAllOnline == true) if (ecoResetAllOnline)
{ {
ess.broadcastMessage(null, _("ecoResetAllOnline", settings.getData().getEconomy().getCurrencySymbol() + amount)); ess.broadcastMessage(null, _("ecoResetAllOnline", settings.getData().getEconomy().getCurrencySymbol() + amount));
} }

6
Essentials/src/net/ess3/commands/Commandkickall.java Normal file → Executable file
View File

@@ -16,11 +16,7 @@ public class Commandkickall extends EssentialsCommand
kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n")); kickReason = FormatUtil.replaceFormat(kickReason.replace("\\n", "\n").replace("|", "\n"));
for (Player onlinePlayer : server.getOnlinePlayers()) for (Player onlinePlayer : server.getOnlinePlayers())
{ {
if (sender instanceof IUser && onlinePlayer.getName().equalsIgnoreCase(((Player)sender).getName())) if (!(sender instanceof IUser && onlinePlayer.getName().equalsIgnoreCase(sender.getName())))
{
continue;
}
else
{ {
onlinePlayer.kickPlayer(kickReason); onlinePlayer.kickPlayer(kickReason);
} }

View File

@@ -76,7 +76,7 @@ public class Commandlist extends EssentialsCommand
} }
list.add(getUser(onlinePlayer)); list.add(getUser(onlinePlayer));
} }
final String[] groups = sort.keySet().toArray(new String[0]); final String[] groups = sort.keySet().toArray(new String[sort.size()]);
Arrays.sort(groups, String.CASE_INSENSITIVE_ORDER); Arrays.sort(groups, String.CASE_INSENSITIVE_ORDER);
for (String group : groups) for (String group : groups)
{ {

View File

@@ -34,8 +34,7 @@ public class Commandspawner extends EssentialsCommand
{ {
String name = args[0]; String name = args[0];
EntityType mob = null; EntityType mob = LivingEntities.fromName(name);
mob = LivingEntities.fromName(name);
if (mob == null) if (mob == null)
{ {
user.sendMessage(_("Invalid mob type.")); user.sendMessage(_("Invalid mob type."));

View File

@@ -20,14 +20,14 @@ public class Commandthunder extends EssentialsCommand
if (args.length > 1) if (args.length > 1)
{ {
world.setThundering(setThunder ? true : false); world.setThundering(setThunder);
world.setThunderDuration(Integer.parseInt(args[1]) * 20); world.setThunderDuration(Integer.parseInt(args[1]) * 20);
user.sendMessage(_("§6You§c {0} §6thunder in your world for§c {1} §6seconds.", (setThunder ? _("enabled") : _("disabled")), Integer.parseInt(args[1]))); user.sendMessage(_("§6You§c {0} §6thunder in your world for§c {1} §6seconds.", (setThunder ? _("enabled") : _("disabled")), Integer.parseInt(args[1])));
} }
else else
{ {
world.setThundering(setThunder ? true : false); world.setThundering(setThunder);
user.sendMessage(_("§6You§c {0} §6thunder in your world.", setThunder ? _("enabled") : _("disabled"))); user.sendMessage(_("§6You§c {0} §6thunder in your world.", setThunder ? _("enabled") : _("disabled")));
} }

View File

@@ -26,7 +26,7 @@ public class Commandtime extends EssentialsCommand
add = true; add = true;
argList.set(0, argList.get(0) + "t"); argList.set(0, argList.get(0) + "t");
} }
final String[] validArgs = argList.toArray(new String[0]); final String[] validArgs = argList.toArray(new String[argList.size()]);
// Which World(s) are we interested in? // Which World(s) are we interested in?
String worldSelector = null; String worldSelector = null;

View File

@@ -39,8 +39,7 @@ public class Commandtpa extends EssentialsCommand
player.sendMessage(_("§c{0}§6 has requested to teleport to you.", user.getPlayer().getDisplayName())); player.sendMessage(_("§c{0}§6 has requested to teleport to you.", user.getPlayer().getDisplayName()));
player.sendMessage(_("§6To teleport, type §c/tpaccept§6.")); player.sendMessage(_("§6To teleport, type §c/tpaccept§6."));
player.sendMessage(_("§6To deny this request, type §c/tpdeny§6.")); player.sendMessage(_("§6To deny this request, type §c/tpdeny§6."));
int tpaAcceptCancellation = 0; int tpaAcceptCancellation = settings.getData().getCommands().getTeleport().getRequestTimeout();
tpaAcceptCancellation = settings.getData().getCommands().getTeleport().getRequestTimeout();
if (tpaAcceptCancellation != 0) if (tpaAcceptCancellation != 0)
{ {
player.sendMessage(_("§6This request will timeout after§c {0} seconds§6.", tpaAcceptCancellation)); player.sendMessage(_("§6This request will timeout after§c {0} seconds§6.", tpaAcceptCancellation));

View File

@@ -54,8 +54,7 @@ public class Commandtpaall extends EssentialsCommand
player.requestTeleport(user, true); player.requestTeleport(user, true);
player.sendMessage(_("§c{0}§6 has requested that you teleport to them.", user.getPlayer().getDisplayName())); player.sendMessage(_("§c{0}§6 has requested that you teleport to them.", user.getPlayer().getDisplayName()));
player.sendMessage(_("§6To teleport, type §c/tpaccept§6.")); player.sendMessage(_("§6To teleport, type §c/tpaccept§6."));
int tpaAcceptCancellation = 0; int tpaAcceptCancellation = settings.getData().getCommands().getTeleport().getRequestTimeout();
tpaAcceptCancellation = settings.getData().getCommands().getTeleport().getRequestTimeout();
if (tpaAcceptCancellation != 0) if (tpaAcceptCancellation != 0)
{ {
player.sendMessage(_("§6This request will timeout after§c {0} seconds§6.", tpaAcceptCancellation)); player.sendMessage(_("§6This request will timeout after§c {0} seconds§6.", tpaAcceptCancellation));

View File

@@ -38,10 +38,7 @@ public class Commandtpahere extends EssentialsCommand
player.sendMessage(_("§c{0}§6 has requested that you teleport to them.", user.getPlayer().getDisplayName())); player.sendMessage(_("§c{0}§6 has requested that you teleport to them.", user.getPlayer().getDisplayName()));
player.sendMessage(_("§6To teleport, type §c/tpaccept§6.")); player.sendMessage(_("§6To teleport, type §c/tpaccept§6."));
player.sendMessage(_("§6To deny this request, type §c/tpdeny§6.")); player.sendMessage(_("§6To deny this request, type §c/tpdeny§6."));
int tpaAcceptCancellation = 0; int tpaAcceptCancellation = settings.getData().getCommands().getTeleport().getRequestTimeout();
{
tpaAcceptCancellation = settings.getData().getCommands().getTeleport().getRequestTimeout();
}
if (tpaAcceptCancellation != 0) if (tpaAcceptCancellation != 0)
{ {
player.sendMessage(_("§6This request will timeout after§c {0} seconds§6.", tpaAcceptCancellation)); player.sendMessage(_("§6This request will timeout after§c {0} seconds§6.", tpaAcceptCancellation));

View File

@@ -32,7 +32,7 @@ public class Commandwarp extends EssentialsCommand
} }
if (args.length > 0) if (args.length > 0)
{ {
IUser otherUser = null; IUser otherUser;
if (args.length == 2 && Permissions.WARP_OTHERS.isAuthorized(user)) if (args.length == 2 && Permissions.WARP_OTHERS.isAuthorized(user))
{ {
if (Permissions.WARP_HIDDEN.isAuthorized(user)) if (Permissions.WARP_HIDDEN.isAuthorized(user))

View File

@@ -22,14 +22,14 @@ public class Commandweather extends EssentialsCommand
if (args.length > 1) if (args.length > 1)
{ {
world.setStorm(isStorm ? true : false); world.setStorm(isStorm);
world.setWeatherDuration(Integer.parseInt(args[1]) * 20); world.setWeatherDuration(Integer.parseInt(args[1]) * 20);
user.sendMessage( user.sendMessage(
isStorm ? _("§6You set the weather to §cstorm§6 in§c {0} §6for {1} seconds.", world.getName(), args[1]) : _("§6You set the weather to §csun§6 in§c {0} §6for {1} seconds.", world.getName(), args[1])); isStorm ? _("§6You set the weather to §cstorm§6 in§c {0} §6for {1} seconds.", world.getName(), args[1]) : _("§6You set the weather to §csun§6 in§c {0} §6for {1} seconds.", world.getName(), args[1]));
} }
else else
{ {
world.setStorm(isStorm ? true : false); world.setStorm(isStorm);
user.sendMessage( user.sendMessage(
isStorm ? _("§6You set the weather to §cstorm§6 in§c {0}§6.", world.getName()) : _("§6You set the weather to §csun§6 in§c {0}§6.", world.getName())); isStorm ? _("§6You set the weather to §cstorm§6 in§c {0}§6.", world.getName()) : _("§6You set the weather to §csun§6 in§c {0}§6.", world.getName()));
} }
@@ -52,14 +52,14 @@ public class Commandweather extends EssentialsCommand
if (args.length > 2) if (args.length > 2)
{ {
world.setStorm(isStorm ? true : false); world.setStorm(isStorm);
world.setWeatherDuration(Integer.parseInt(args[2]) * 20); world.setWeatherDuration(Integer.parseInt(args[2]) * 20);
sender.sendMessage( sender.sendMessage(
isStorm ? _("§6You set the weather to §cstorm§6 in§c {0} §6for {1} seconds.", world.getName(), args[2]) : _("§6You set the weather to §csun§6 in§c {0} §6for {1} seconds.", world.getName(), args[2])); isStorm ? _("§6You set the weather to §cstorm§6 in§c {0} §6for {1} seconds.", world.getName(), args[2]) : _("§6You set the weather to §csun§6 in§c {0} §6for {1} seconds.", world.getName(), args[2]));
} }
else else
{ {
world.setStorm(isStorm ? true : false); world.setStorm(isStorm);
sender.sendMessage( sender.sendMessage(
isStorm ? _("§6You set the weather to §cstorm§6 in§c {0}§6.", world.getName()) : _("§6You set the weather to §csun§6 in§c {0}§6.", world.getName())); isStorm ? _("§6You set the weather to §cstorm§6 in§c {0}§6.", world.getName()) : _("§6You set the weather to §csun§6 in§c {0}§6.", world.getName()));
} }

9
Essentials/src/net/ess3/commands/Commandwhois.java Normal file → Executable file
View File

@@ -83,11 +83,10 @@ public class Commandwhois extends EssentialsCommand
_( _(
"whoisMute", (userData.isMuted() ? user.getTimestamp(UserData.TimestampType.MUTE) > 0 ? DateUtil.formatDateDiff( "whoisMute", (userData.isMuted() ? user.getTimestamp(UserData.TimestampType.MUTE) > 0 ? DateUtil.formatDateDiff(
user.getTimestamp(UserData.TimestampType.MUTE)) : _("§atrue§r") : _("§4false§r")))); user.getTimestamp(UserData.TimestampType.MUTE)) : _("§atrue§r") : _("§4false§r"))));
}
if (!foundPlayer) if (!foundPlayer)
{ {
throw new NoSuchFieldException(_("§4Player not found.")); throw new NoSuchFieldException(_("§4Player not found."));
}
} }
} }
} }

View File

@@ -74,7 +74,7 @@ public class SetExpFix
//Without this people would be able to use exp and then still sell it. //Without this people would be able to use exp and then still sell it.
public static int getTotalExperience(final Player player) public static int getTotalExperience(final Player player)
{ {
int exp = (int)Math.round(getExpAtLevel(player) * player.getExp()); int exp = Math.round(getExpAtLevel(player) * player.getExp());
int currentLevel = player.getLevel(); int currentLevel = player.getLevel();
while (currentLevel > 0) while (currentLevel > 0)
@@ -87,7 +87,7 @@ public class SetExpFix
public static int getExpUntilNextLevel(final Player player) public static int getExpUntilNextLevel(final Player player)
{ {
int exp = (int)Math.round(getExpAtLevel(player) * player.getExp()); int exp = Math.round(getExpAtLevel(player) * player.getExp());
int nextLevel = player.getLevel(); int nextLevel = player.getLevel();
return getExpAtLevel(nextLevel) - exp; return getExpAtLevel(nextLevel) - exp;
} }

View File

@@ -112,7 +112,7 @@ public class Trade
final int maxStackSize = dropStack.getType().getMaxStackSize(); final int maxStackSize = dropStack.getType().getMaxStackSize();
final int stacks = dropStack.getAmount() / maxStackSize; final int stacks = dropStack.getAmount() / maxStackSize;
final int leftover = dropStack.getAmount() % maxStackSize; final int leftover = dropStack.getAmount() % maxStackSize;
final ItemStack[] itemStacks = new ItemStack[stacks + (leftover > 0 ? 1 : 0)]; final ItemStack[] itemStacks = new ItemStack[stacks + (leftover > 0 ? 1 : 0)]; // TODO: Written, but never read?
for (int i = 0; i < stacks; i++) for (int i = 0; i < stacks; i++)
{ {
final ItemStack stack = dropStack.clone(); final ItemStack stack = dropStack.clone();

View File

@@ -155,7 +155,7 @@ public class Methods
int count = 0; int count = 0;
boolean match = false; boolean match = false;
Plugin plugin = null; Plugin plugin;
for (String name : getDependencies()) for (String name : getDependencies())
{ {

View File

@@ -96,11 +96,7 @@ public class VaultEco implements Method
public boolean createAccount(String name, double balance) public boolean createAccount(String name, double balance)
{ {
if (!this.economy.createBank(name, "").transactionSuccess()) return this.economy.createBank(name, "").transactionSuccess() && this.economy.bankDeposit(name, balance).transactionSuccess();
{
return false;
}
return this.economy.bankDeposit(name, balance).transactionSuccess();
} }
@Override @Override
@@ -176,15 +172,7 @@ public class VaultEco implements Method
@Override @Override
public boolean set(double amount) public boolean set(double amount)
{ {
if (!this.economy.withdrawPlayer(this.name, this.balance()).transactionSuccess()) return this.economy.withdrawPlayer(this.name, this.balance()).transactionSuccess() && (amount == 0 || this.economy.depositPlayer(this.name, amount).transactionSuccess());
{
return false;
}
if (amount == 0)
{
return true;
}
return this.economy.depositPlayer(this.name, amount).transactionSuccess();
} }
@Override @Override
@@ -277,15 +265,7 @@ public class VaultEco implements Method
@Override @Override
public boolean set(double amount) public boolean set(double amount)
{ {
if (!this.economy.bankWithdraw(this.bank, this.balance()).transactionSuccess()) return this.economy.bankWithdraw(this.bank, this.balance()).transactionSuccess() && (amount == 0 || this.economy.bankDeposit(this.bank, amount).transactionSuccess());
{
return false;
}
if (amount == 0)
{
return true;
}
return this.economy.bankDeposit(this.bank, amount).transactionSuccess();
} }
@Override @Override

View File

@@ -82,12 +82,7 @@ public class iCo5 implements Method
@Override @Override
public boolean createAccount(String name) public boolean createAccount(String name)
{ {
if (hasAccount(name)) return !hasAccount(name) && com.iConomy.iConomy.Accounts.create(name);
{
return false;
}
return com.iConomy.iConomy.Accounts.create(name);
} }
@Override @Override

View File

@@ -81,23 +81,13 @@ public class iCo6 implements Method
@Override @Override
public boolean createAccount(String name) public boolean createAccount(String name)
{ {
if (hasAccount(name)) return !hasAccount(name) && (new Accounts()) .create(name);
{
return false;
}
return (new Accounts()).create(name);
} }
@Override @Override
public boolean createAccount(String name, Double balance) public boolean createAccount(String name, Double balance)
{ {
if (hasAccount(name)) return !hasAccount(name) && (new Accounts()).create(name, balance);
{
return false;
}
return (new Accounts()).create(name, balance);
} }
@Override @Override

View File

@@ -121,7 +121,7 @@ public class EssentialsEntityListener implements Listener
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void onPlayerDeathEvent(final PlayerDeathEvent event) public void onPlayerDeathEvent(final PlayerDeathEvent event)
{ {
final IUser user = ess.getUserMap().getUser((Player)event.getEntity()); final IUser user = ess.getUserMap().getUser(event.getEntity());
final ISettings settings = ess.getSettings(); final ISettings settings = ess.getSettings();
if (Permissions.BACK_ONDEATH.isAuthorized(user) && !settings.getData().getCommands().isDisabled("back")) if (Permissions.BACK_ONDEATH.isAuthorized(user) && !settings.getData().getCommands().isDisabled("back"))

View File

@@ -562,7 +562,6 @@ public class EssentialsPlayerListener implements Listener
if (command.matches(".*\\{player\\}.*")) if (command.matches(".*\\{player\\}.*"))
{ {
//user.sendMessage("Click a player to use this command"); //user.sendMessage("Click a player to use this command");
continue;
} }
else if (command.startsWith("c:")) else if (command.startsWith("c:"))
{ {
@@ -651,7 +650,7 @@ public class EssentialsPlayerListener implements Listener
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onPlayerFishEvent(final PlayerFishEvent event) public void onPlayerFishEvent(final PlayerFishEvent event)
{ {
final IUser user = userMap.getUser((Player)event.getPlayer()); final IUser user = userMap.getUser(event.getPlayer());
user.updateActivity(true); user.updateActivity(true);
} }
} }

View File

@@ -32,9 +32,6 @@ public class MetricsStarter implements Runnable
EssentialsXMPP EssentialsXMPP
} }
;
public MetricsStarter(final IEssentials plugin) public MetricsStarter(final IEssentials plugin)
{ {
ess = plugin; ess = plugin;
@@ -56,7 +53,7 @@ public class MetricsStarter implements Runnable
ess.getLogger().info(_("metrics4")); ess.getLogger().info(_("metrics4"));
start = false; start = false;
} }
else if (settings.getData().getGeneral().getMetricsEnabled() == true) else if (settings.getData().getGeneral().getMetricsEnabled())
{ {
start = true; start = true;
} }
@@ -140,7 +137,7 @@ public class MetricsStarter implements Runnable
ISettings settings = ess.getSettings(); ISettings settings = ess.getSettings();
final String BKcommand = settings.getData().getGeneral().getBackup().getCommand(); final String BKcommand = settings.getData().getGeneral().getBackup().getCommand();
;
if (BKcommand != null && !"".equals(BKcommand)) if (BKcommand != null && !"".equals(BKcommand))
{ {
enabledGraph.addPlotter(new SimplePlotter("Backup")); enabledGraph.addPlotter(new SimplePlotter("Backup"));

View File

@@ -33,8 +33,7 @@ public abstract class AbstractRanks
format = format.replace("{WORLDNAME}", "{1}"); format = format.replace("{WORLDNAME}", "{1}");
format = format.replace("{SHORTWORLDNAME}", "{2}"); format = format.replace("{SHORTWORLDNAME}", "{2}");
format = format.replaceAll("\\{(\\D*)\\}", "\\[$1\\]"); format = format.replaceAll("\\{(\\D*)\\}", "\\[$1\\]");
MessageFormat mFormat = new MessageFormat(format); return new MessageFormat(format);
return mFormat;
} }
protected abstract String getRawChatFormat(final CommandSender sender); protected abstract String getRawChatFormat(final CommandSender sender);

View File

@@ -175,11 +175,7 @@ public class GMGroups extends AbstractRanks implements IRanks
try try
{ {
final AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(getPlayer(player)); final AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(getPlayer(player));
if (handler == null) return handler != null && handler.inGroup(player.getName(), groupname);
{
return false;
}
return handler.inGroup(player.getName(), groupname);
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -39,7 +39,7 @@ public class RanksStorage extends AsyncStorageObjectHolder<Ranks> implements IRa
{ {
return Collections.emptyList(); return Collections.emptyList();
} }
final ArrayList<Entry<String, RankOptions>> list = new ArrayList(); final ArrayList<Entry<String, RankOptions>> list = new ArrayList<Entry<String, RankOptions>>();
for (Entry<String, RankOptions> entry : groups.entrySet()) for (Entry<String, RankOptions> entry : groups.entrySet())
{ {
if (Permissions.RANKS.isAuthorized(player, entry.getKey())) if (Permissions.RANKS.isAuthorized(player, entry.getKey()))

View File

@@ -41,28 +41,16 @@ public class Alert implements StorageObject
public boolean getAlertOnPlacementContains(Material mat) public boolean getAlertOnPlacementContains(Material mat)
{ {
if (alertOnPlacement == null) return alertOnPlacement != null && alertOnPlacement.contains(mat);
{
return false;
}
return alertOnPlacement.contains(mat);
} }
public boolean getAlertOnUseContains(Material mat) public boolean getAlertOnUseContains(Material mat)
{ {
if (alertOnUse == null) return alertOnUse != null && alertOnUse.contains(mat);
{
return false;
}
return alertOnUse.contains(mat);
} }
public boolean getAlertOnBreakContains(Material mat) public boolean getAlertOnBreakContains(Material mat)
{ {
if (alertOnBreak == null) return alertOnBreak != null && alertOnBreak.contains(mat);
{
return false;
}
return alertOnBreak.contains(mat);
} }
} }

View File

@@ -46,37 +46,21 @@ public class BlackList implements StorageObject
public boolean getPlacement(Material mat) public boolean getPlacement(Material mat)
{ {
if (placement == null) return placement != null && placement.contains(mat);
{
return false;
}
return placement.contains(mat);
} }
public boolean getUsage(Material mat) public boolean getUsage(Material mat)
{ {
if (usage == null) return usage != null && usage.contains(mat);
{
return false;
}
return usage.contains(mat);
} }
public boolean getBreaking(Material mat) public boolean getBreaking(Material mat)
{ {
if (breaking == null) return breaking != null && breaking.contains(mat);
{
return false;
}
return breaking.contains(mat);
} }
public boolean getPiston(Material mat) public boolean getPiston(Material mat)
{ {
if (piston == null) return piston != null && piston.contains(mat);
{
return false;
}
return piston.contains(mat);
} }
} }