mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-07-03 12:31:46 +00:00
Switch to the new I18n class and format cleanup of all classes
This commit is contained in:
parent
19f5a2340d
commit
220d68f375
207 changed files with 1247 additions and 1306 deletions
|
@ -1,7 +1,8 @@
|
|||
package com.earth2me.essentials.commands;
|
||||
|
||||
import static com.earth2me.essentials.I18n._;
|
||||
import com.earth2me.essentials.User;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.Locale;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -23,16 +24,16 @@ public class Commandnick extends EssentialsCommand
|
|||
}
|
||||
if (!ess.getSettings().changeDisplayName())
|
||||
{
|
||||
throw new Exception(Util.i18n("nickDisplayName"));
|
||||
throw new Exception(_("nickDisplayName"));
|
||||
}
|
||||
if (args.length > 1)
|
||||
{
|
||||
if (!user.isAuthorized("essentials.nick.others"))
|
||||
{
|
||||
throw new Exception(Util.i18n("nickOthersPermission"));
|
||||
throw new Exception(_("nickOthersPermission"));
|
||||
}
|
||||
setNickname(server, getPlayer(server, args, 0), args[1]);
|
||||
user.sendMessage(Util.i18n("nickChanged"));
|
||||
user.sendMessage(_("nickChanged"));
|
||||
return;
|
||||
}
|
||||
setNickname(server, user, args[0]);
|
||||
|
@ -47,23 +48,23 @@ public class Commandnick extends EssentialsCommand
|
|||
}
|
||||
if (!ess.getSettings().changeDisplayName())
|
||||
{
|
||||
throw new Exception(Util.i18n("nickDisplayName"));
|
||||
throw new Exception(_("nickDisplayName"));
|
||||
}
|
||||
setNickname(server, getPlayer(server, args, 0), args[1]);
|
||||
sender.sendMessage(Util.i18n("nickChanged"));
|
||||
sender.sendMessage(_("nickChanged"));
|
||||
}
|
||||
|
||||
private void setNickname(final Server server, final User target, final String nick) throws Exception
|
||||
{
|
||||
if (nick.matches("[^a-zA-Z_0-9]"))
|
||||
{
|
||||
throw new Exception(Util.i18n("nickNamesAlpha"));
|
||||
throw new Exception(_("nickNamesAlpha"));
|
||||
}
|
||||
else if ("off".equalsIgnoreCase(nick) || target.getName().equalsIgnoreCase(nick))
|
||||
{
|
||||
target.setNickname(null);
|
||||
target.setDisplayNick();
|
||||
target.sendMessage(Util.i18n("nickNoMore"));
|
||||
target.sendMessage(_("nickNoMore"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -74,18 +75,18 @@ public class Commandnick extends EssentialsCommand
|
|||
{
|
||||
continue;
|
||||
}
|
||||
String dn = p.getDisplayName().toLowerCase();
|
||||
String n = p.getName().toLowerCase();
|
||||
String nk = formattedNick.toLowerCase();
|
||||
String dn = p.getDisplayName().toLowerCase(Locale.ENGLISH);
|
||||
String n = p.getName().toLowerCase(Locale.ENGLISH);
|
||||
String nk = formattedNick.toLowerCase(Locale.ENGLISH);
|
||||
if (nk.equals(dn) || nk.equals(n))
|
||||
{
|
||||
throw new Exception(Util.i18n("nickInUse"));
|
||||
throw new Exception(_("nickInUse"));
|
||||
}
|
||||
}
|
||||
|
||||
target.setNickname(formattedNick);
|
||||
target.setDisplayNick();
|
||||
target.sendMessage(Util.format("nickSet", target.getDisplayName() + "§7."));
|
||||
target.sendMessage(_("nickSet", target.getDisplayName() + "§7."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue