Update Config.java references for Nicknames
This commit is contained in:
@@ -20,8 +20,6 @@ import java.util.UUID;
|
||||
public class NickUtilities
|
||||
{
|
||||
public static String stringRegen;
|
||||
static String[] blockedCodes = ChatPlugin.getInstance().getConfig().getStringList("Nicknames.BlockedColorCodes").toArray(new String[0]);;
|
||||
static String[] allowedColorCodes = ChatPlugin.getInstance().getConfig().getStringList("Nicknames.AllowedColorCodes").toArray(new String[0]);;
|
||||
|
||||
public static String applyColor(String message) {
|
||||
ChatColor hexColor1 = null;
|
||||
@@ -97,7 +95,7 @@ public class NickUtilities
|
||||
|
||||
public static String removeAllColors(String string) {
|
||||
|
||||
for (final String colorCodes : allowedColorCodes) {
|
||||
for (final String colorCodes : Config.NICK_ALLOWED_COLOR_CODESLIST) {
|
||||
string = string.replace(colorCodes, "");
|
||||
}
|
||||
|
||||
@@ -163,7 +161,7 @@ public class NickUtilities
|
||||
if (uniqueId.equals(uuid)){
|
||||
ChatPlugin.getInstance().getLogger().info(uuid + " " + uniqueId);
|
||||
}
|
||||
sender.sendMessage(applyColor(ChatPlugin.getInstance().getConfig().getString("Messages.NickTaken")));
|
||||
sender.sendMessage(applyColor(Config.NICK_TAKEN));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -172,19 +170,19 @@ public class NickUtilities
|
||||
return true;
|
||||
|
||||
} else {
|
||||
sender.sendMessage(applyColor(ChatPlugin.getInstance().getConfig().getString("Messages.NickInvalidCharacters")));
|
||||
sender.sendMessage(applyColor(Config.NICK_INVALID_CHARACTERS));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(applyColor(ChatPlugin.getInstance().getConfig().getString("Messages.NickLengthInvalid")));
|
||||
sender.sendMessage(applyColor(Config.NICK_INVALID_LENGTH));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(applyColor(ChatPlugin.getInstance().getConfig().getString("Messages.NickBlockedColorCodes")));
|
||||
sender.sendMessage(applyColor(Config.NICK_BLOCKED_COLOR_CODES));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean noBlockedCodes(final String getNick) {
|
||||
for (final String blockedCodes : blockedCodes) {
|
||||
for (final String blockedCodes : Config.NICK_BLOCKED_COLOR_CODESLIST) {
|
||||
if (getNick.contains(blockedCodes)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -88,13 +88,13 @@ public class Nicknames implements CommandExecutor, TabCompleter {
|
||||
LuckPerms api = ChatAPI.get().getLuckPerms();
|
||||
if (api != null){
|
||||
if (NickUtilities.validNick(player, player, args[1])) {
|
||||
sender.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickTryout")
|
||||
sender.sendMessage(format(Config.NICK_TRYOUT
|
||||
.replace("%prefix", api.getUserManager().getUser(player.getUniqueId())
|
||||
.getCachedData().getMetaData().getPrefix())
|
||||
.replace("%nick%", args[1])));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickNoLuckPerms")));
|
||||
sender.sendMessage(format(Config.NICK_NO_LUCKPERMS));
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage(format(helpMessage(sender, HelpType.TRY)));
|
||||
@@ -170,17 +170,17 @@ public class Nicknames implements CommandExecutor, TabCompleter {
|
||||
if (NickCache.containsKey(uniqueId)){
|
||||
Nick nick = NickCache.get(uniqueId);
|
||||
long timeSinceLastChange = new Date().getTime() - nick.getLastChangedDate();
|
||||
long waitTime = ChatPlugin.getInstance().getConfig().getLong("Nicknames.WaitTime");
|
||||
long waitTime = Config.NICK_WAIT_TIME;
|
||||
if (timeSinceLastChange > waitTime){
|
||||
if (nick.hasRequest()){
|
||||
player.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickRequestReplaced")
|
||||
player.sendMessage(format(Config.NICK_REQUEST_PLACED
|
||||
.replace("%oldRequestedNick%", nick.getNewNick())
|
||||
.replace("%newRequestedNick%", nickName)));
|
||||
}
|
||||
nick.setNewNick(nickName);
|
||||
nick.setRequestedDate(new Date().getTime());
|
||||
} else {
|
||||
player.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickTooSoon")
|
||||
player.sendMessage(format(Config.NICK_TOO_SOON
|
||||
.replace("%time%", formatTime((timeSinceLastChange-waitTime)*-1))));
|
||||
return;
|
||||
}
|
||||
@@ -189,7 +189,7 @@ public class Nicknames implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
Queries.newNicknameRequest(uniqueId, nickName);
|
||||
bungeeMessageRequest(player);
|
||||
player.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickRequested")
|
||||
player.sendMessage(format(Config.NICK_REQUESTED
|
||||
.replace("%nick%", nickName)));
|
||||
}
|
||||
|
||||
@@ -254,12 +254,12 @@ public class Nicknames implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
|
||||
if (!sender.equals(target)){
|
||||
sender.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickResetOthers")
|
||||
sender.sendMessage(format(Config.NICK_RESET_OTHERS
|
||||
.replace("%player%", target.getName())));
|
||||
}
|
||||
|
||||
if (target.isOnline()){
|
||||
target.getPlayer().sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickReset")));
|
||||
target.getPlayer().sendMessage(format(Config.NICK_RESET));
|
||||
}
|
||||
|
||||
NickEvent nickEvent = new NickEvent(sender.getName(), target.getName(), null, NickEvent.NickEventType.RESET);
|
||||
@@ -285,17 +285,17 @@ public class Nicknames implements CommandExecutor, TabCompleter {
|
||||
}
|
||||
|
||||
if (!sender.equals(target)){
|
||||
sender.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickChangedOthers")
|
||||
sender.sendMessage(format(Config.NICK_CHANGED_OTHERS
|
||||
.replace("%targetplayer%", target.getName())
|
||||
.replace("%nickname%", nickName)));
|
||||
if (target.isOnline()) {
|
||||
target.getPlayer().sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickTargetNickChange")
|
||||
target.getPlayer().sendMessage(format(Config.NICK_TARGET_NICK_CHANGE
|
||||
.replace("%nickname%", getNick(target.getPlayer()))
|
||||
.replace("%sendernick%", getNick(sender))
|
||||
.replace("%player%", target.getName())));
|
||||
}
|
||||
} else if (target.isOnline()){
|
||||
target.getPlayer().sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickChanged")
|
||||
target.getPlayer().sendMessage(format(Config.NICK_CHANGED
|
||||
.replace("%nickname%", getNick(target.getPlayer()))));
|
||||
}
|
||||
}
|
||||
@@ -353,7 +353,7 @@ public class Nicknames implements CommandExecutor, TabCompleter {
|
||||
|
||||
private boolean hasPermission(CommandSender sender, String permission) {
|
||||
if (!sender.hasPermission(permission)){
|
||||
sender.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NoPermission")));
|
||||
sender.sendMessage(format(Config.NO_PERMISSION));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class NicknamesEvents implements Listener, PluginMessageListener {
|
||||
}
|
||||
|
||||
if (i > 0) {
|
||||
player.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickRequestsOnLogin")
|
||||
player.sendMessage(format(Config.NICK_REQUESTS_ON_LOGIN
|
||||
.replace("%amount%", String.valueOf(i))));
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class NicknamesEvents implements Listener, PluginMessageListener {
|
||||
|
||||
switch (subChannel) {
|
||||
case "NickNameRequest":
|
||||
String notification = NickUtilities.applyColor(ChatPlugin.getInstance().getConfig().getString("Messages.NickNewRequest")
|
||||
String notification = NickUtilities.applyColor(Config.NICK_REQUEST_NEW
|
||||
.replace("%player%", name));
|
||||
TextComponent component = new TextComponent(TextComponent.fromLegacyText(NickUtilities.applyColor(notification)));
|
||||
component.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/nick review"));
|
||||
@@ -148,7 +148,7 @@ public class NicknamesEvents implements Listener, PluginMessageListener {
|
||||
Player target = Bukkit.getPlayer(playerUUID);
|
||||
if (target != null && nick != null && nick.getCurrentNick() != null) {
|
||||
Nicknames.getInstance().setNick(target, nick.getCurrentNick());
|
||||
target.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickChanged")
|
||||
target.sendMessage(format(Config.NICK_CHANGED
|
||||
.replace("%nickname%", nick.getCurrentNick())));
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public class NicknamesEvents implements Listener, PluginMessageListener {
|
||||
Player target = Bukkit.getPlayer(playerUUID);
|
||||
|
||||
if (target == null) break;
|
||||
target.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickNotChanged")
|
||||
target.sendMessage(format(Config.NICK_NOT_CHANGED
|
||||
.replace("%nickname%", nick.getCurrentNick())));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.alttd.chat.nicknames;
|
||||
|
||||
import com.alttd.chat.ChatPlugin;
|
||||
import com.alttd.chat.config.Config;
|
||||
import com.alttd.chat.database.Queries;
|
||||
import com.alttd.chat.events.NickEvent;
|
||||
import com.alttd.chat.objects.Nick;
|
||||
@@ -55,7 +56,7 @@ public class NicknamesGui implements Listener {
|
||||
for (Nick nick : Nicknames.getInstance().NickCache.values()) {
|
||||
if (nick.hasRequest()) {
|
||||
if (limit >= i / 27) {
|
||||
inv.setItem(i % 27, createPlayerSkull(nick, ChatPlugin.getInstance().getConfig().getStringList("Nicknames.Lore")));
|
||||
inv.setItem(i % 27, createPlayerSkull(nick, Config.NICK_ITEM_LORE));
|
||||
i++;
|
||||
} else {
|
||||
hasNextPage = true;
|
||||
@@ -146,7 +147,7 @@ public class NicknamesGui implements Listener {
|
||||
OfflinePlayer owningPlayer = meta.getOwningPlayer();
|
||||
|
||||
if (owningPlayer == null) {
|
||||
p.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickUserNotFound")));
|
||||
p.sendMessage(format(Config.NICK_USER_NOT_FOUND));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -164,7 +165,7 @@ public class NicknamesGui implements Listener {
|
||||
}
|
||||
|
||||
if (nick == null || !nick.hasRequest()) {
|
||||
p.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickAlreadyHandled")
|
||||
p.sendMessage(format(Config.NICK_ALREADY_HANDLED
|
||||
.replace("%targetPlayer%", clickedItem.getItemMeta().getDisplayName())));
|
||||
return;
|
||||
}
|
||||
@@ -183,14 +184,14 @@ public class NicknamesGui implements Listener {
|
||||
}
|
||||
}.runTask(ChatPlugin.getInstance());
|
||||
|
||||
p.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickAccepted")
|
||||
p.sendMessage(format(Config.NICK_ACCEPTED
|
||||
.replace("%targetPlayer%", clickedItem.getItemMeta().getDisplayName())
|
||||
.replace("%newNick%", nick.getNewNick())
|
||||
.replace("%oldNick%", nick.getCurrentNick() == null ? clickedItem.getItemMeta().getDisplayName() : nick.getCurrentNick())));
|
||||
|
||||
if (owningPlayer.isOnline()) {
|
||||
Nicknames.getInstance().setNick(owningPlayer.getPlayer(), nick.getNewNick());
|
||||
owningPlayer.getPlayer().sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickChanged")
|
||||
owningPlayer.getPlayer().sendMessage(format(Config.NICK_CHANGED
|
||||
.replace("%nickname%", nick.getNewNick())));
|
||||
}
|
||||
|
||||
@@ -211,7 +212,7 @@ public class NicknamesGui implements Listener {
|
||||
e.getInventory().setItem(e.getSlot(), itemStack);
|
||||
p.updateInventory();
|
||||
} else {
|
||||
p.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.CantFindPlayer")
|
||||
p.sendMessage(format(Config.NICK_PLAYER_NOT_ONLINE
|
||||
.replace("%playerName%", clickedItem.getItemMeta().getDisplayName())));
|
||||
}
|
||||
|
||||
@@ -229,7 +230,7 @@ public class NicknamesGui implements Listener {
|
||||
}
|
||||
}.runTask(ChatPlugin.getInstance());
|
||||
|
||||
p.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickDenied")
|
||||
p.sendMessage(format(Config.NICK_DENIED
|
||||
.replace("%targetPlayer%", owningPlayer.getName())
|
||||
.replace("%newNick%", nick.getNewNick())
|
||||
.replace("%oldNick%", nick.getCurrentNick() == null ? owningPlayer.getName() : nick.getCurrentNick())));
|
||||
@@ -245,7 +246,7 @@ public class NicknamesGui implements Listener {
|
||||
|
||||
if (owningPlayer.isOnline()) {
|
||||
Nicknames.getInstance().setNick(owningPlayer.getPlayer(), nick.getCurrentNick() == null ? owningPlayer.getName() : nick.getCurrentNick());
|
||||
owningPlayer.getPlayer().sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.NickNotChanged")));
|
||||
owningPlayer.getPlayer().sendMessage(format(Config.NICK_NOT_CHANGED));
|
||||
}
|
||||
|
||||
NickUtilities.bungeeMessageHandled(uniqueId, e.getWhoClicked().getServer().getPlayer(e.getWhoClicked().getName()), "Denied");
|
||||
@@ -265,7 +266,7 @@ public class NicknamesGui implements Listener {
|
||||
e.getInventory().setItem(e.getSlot(), itemStack);
|
||||
p.updateInventory();
|
||||
} else {
|
||||
p.sendMessage(format(ChatPlugin.getInstance().getConfig().getString("Messages.CantFindPlayer")
|
||||
p.sendMessage(format(Config.NICK_PLAYER_NOT_ONLINE
|
||||
.replace("%playerName%", clickedItem.getItemMeta().getDisplayName())));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user