mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-30 14:03:21 +01:00
Refactor the uName class
This commit is contained in:
parent
4b166bb801
commit
fd7ccbc566
@ -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);
|
||||||
|
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user