Refactor the uName class

This commit is contained in:
Acrobot 2013-05-20 19:09:27 +02:00
parent 4b166bb801
commit fd7ccbc566
2 changed files with 4 additions and 4 deletions

View File

@ -25,7 +25,7 @@ public class Lockette implements Listener {
return; return;
} }
String shortPlayerName = uName.shortenName(player); String shortPlayerName = uName.stripName(player);
if (!org.yi.acru.bukkit.Lockette.Lockette.isUser(block, shortPlayerName, true)) { if (!org.yi.acru.bukkit.Lockette.Lockette.isUser(block, shortPlayerName, true)) {
event.setResult(Event.Result.DENY); event.setResult(Event.Result.DENY);

View File

@ -17,7 +17,7 @@ public class uName {
public static final String BANK_PREFIX = "$"; public static final String BANK_PREFIX = "$";
public static final String BANK_PREFIX_QUOTED = Pattern.quote(BANK_PREFIX); public static final String BANK_PREFIX_QUOTED = Pattern.quote(BANK_PREFIX);
public static final String BANK_PREFIX_REPLACE = "^" + BANK_PREFIX_QUOTED; public static final String BANK_PREFIX_REPLACE = '^' + BANK_PREFIX_QUOTED;
public static String getName(String shortName) { public static String getName(String shortName) {
return config.getString(shortName, shortName); return config.getString(shortName, shortName);
@ -40,12 +40,12 @@ public class uName {
return name; return name;
} }
public static String shortenName(Player player) { public static String stripName(Player player) {
return stripName(player.getName()); return stripName(player.getName());
} }
public static boolean canUseName(Player player, String name) { public static boolean canUseName(Player player, String name) {
return shortenName(player).equals(name) || Permission.otherName(player, name); return stripName(player).equals(name) || Permission.otherName(player, name);
} }
public static String stripBankPrefix(String name) { public static String stripBankPrefix(String name) {