mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-02-07 07:51:55 +01:00
Switch to the new I18n class and format cleanup of all classes
This commit is contained in:
parent
19f5a2340d
commit
220d68f375
@ -29,7 +29,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blank
|
|||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.blankLinesBeforeClass=2
|
||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement=NEW_LINE
|
||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.expand-tabs=false
|
||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=*;static *
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.importGroupsOrder=*
|
||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indent-shift-width=4
|
||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.indentCasesFromSwitch=false
|
||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement=NEW_LINE
|
||||||
@ -38,7 +38,7 @@ auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.place
|
|||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeElseOnNewLine=true
|
||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeFinallyOnNewLine=true
|
||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.placeWhileOnNewLine=true
|
||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateStaticImports=true
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.separateImportGroups=false
|
||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceAfterTypeCast=false
|
||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaces-per-tab=4
|
||||||
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
|
auxiliary.org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.tab-size=4
|
||||||
|
@ -31,7 +31,7 @@ public class AlternativeCommandsHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final List<Command> commands = PluginCommandYamlParser.parse(plugin);
|
final List<Command> commands = PluginCommandYamlParser.parse(plugin);
|
||||||
final String pluginName = plugin.getDescription().getName().toLowerCase();
|
final String pluginName = plugin.getDescription().getName().toLowerCase(Locale.ENGLISH);
|
||||||
|
|
||||||
for (Command command : commands)
|
for (Command command : commands)
|
||||||
{
|
{
|
||||||
@ -39,18 +39,18 @@ public class AlternativeCommandsHandler
|
|||||||
final List<String> labels = new ArrayList<String>(pc.getAliases());
|
final List<String> labels = new ArrayList<String>(pc.getAliases());
|
||||||
labels.add(pc.getName());
|
labels.add(pc.getName());
|
||||||
|
|
||||||
PluginCommand reg = ess.getServer().getPluginCommand(pluginName + ":" + pc.getName().toLowerCase());
|
PluginCommand reg = ess.getServer().getPluginCommand(pluginName + ":" + pc.getName().toLowerCase(Locale.ENGLISH));
|
||||||
if (reg == null)
|
if (reg == null)
|
||||||
{
|
{
|
||||||
reg = Bukkit.getServer().getPluginCommand(pc.getName().toLowerCase());
|
reg = Bukkit.getServer().getPluginCommand(pc.getName().toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
for (String label : labels)
|
for (String label : labels)
|
||||||
{
|
{
|
||||||
List<PluginCommand> plugincommands = altcommands.get(label.toLowerCase());
|
List<PluginCommand> plugincommands = altcommands.get(label.toLowerCase(Locale.ENGLISH));
|
||||||
if (plugincommands == null)
|
if (plugincommands == null)
|
||||||
{
|
{
|
||||||
plugincommands = new ArrayList<PluginCommand>();
|
plugincommands = new ArrayList<PluginCommand>();
|
||||||
altcommands.put(label.toLowerCase(), plugincommands);
|
altcommands.put(label.toLowerCase(Locale.ENGLISH), plugincommands);
|
||||||
}
|
}
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for (PluginCommand pc2 : plugincommands)
|
for (PluginCommand pc2 : plugincommands)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
@ -60,7 +61,7 @@ public class Backup implements Runnable
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOGGER.log(Level.INFO, Util.i18n("backupStarted"));
|
LOGGER.log(Level.INFO, _("backupStarted"));
|
||||||
final CommandSender cs = server.getConsoleSender();
|
final CommandSender cs = server.getConsoleSender();
|
||||||
server.dispatchCommand(cs, "save-all");
|
server.dispatchCommand(cs, "save-all");
|
||||||
server.dispatchCommand(cs, "save-off");
|
server.dispatchCommand(cs, "save-off");
|
||||||
@ -123,7 +124,7 @@ public class Backup implements Runnable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
active = false;
|
active = false;
|
||||||
LOGGER.log(Level.INFO, Util.i18n("backupFinished"));
|
LOGGER.log(Level.INFO, _("backupFinished"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -71,7 +72,7 @@ public final class DescParseTickFormat
|
|||||||
public static long parse(String desc) throws NumberFormatException
|
public static long parse(String desc) throws NumberFormatException
|
||||||
{
|
{
|
||||||
// Only look at alphanumeric and lowercase and : for 24:00
|
// Only look at alphanumeric and lowercase and : for 24:00
|
||||||
desc = desc.toLowerCase().replaceAll("[^A-Za-z0-9:]", "");
|
desc = desc.toLowerCase(Locale.ENGLISH).replaceAll("[^A-Za-z0-9:]", "");
|
||||||
|
|
||||||
// Detect ticks format
|
// Detect ticks format
|
||||||
try
|
try
|
||||||
@ -132,7 +133,7 @@ public final class DescParseTickFormat
|
|||||||
throw new NumberFormatException();
|
throw new NumberFormatException();
|
||||||
}
|
}
|
||||||
|
|
||||||
desc = desc.toLowerCase().replaceAll("[^0-9]", "");
|
desc = desc.toLowerCase(Locale.ENGLISH).replaceAll("[^0-9]", "");
|
||||||
|
|
||||||
if (desc.length() != 4)
|
if (desc.length() != 4)
|
||||||
{
|
{
|
||||||
@ -155,7 +156,7 @@ public final class DescParseTickFormat
|
|||||||
int hours = 0;
|
int hours = 0;
|
||||||
int minutes = 0;
|
int minutes = 0;
|
||||||
|
|
||||||
desc = desc.toLowerCase().replaceAll("[^0-9]", "");
|
desc = desc.toLowerCase(Locale.ENGLISH).replaceAll("[^0-9]", "");
|
||||||
|
|
||||||
if (desc.length() > 4)
|
if (desc.length() > 4)
|
||||||
{
|
{
|
||||||
@ -230,7 +231,7 @@ public final class DescParseTickFormat
|
|||||||
// --------------------------------------------
|
// --------------------------------------------
|
||||||
public static String format(final long ticks)
|
public static String format(final long ticks)
|
||||||
{
|
{
|
||||||
return Util.format("timeFormat", format24(ticks), format12(ticks), formatTicks(ticks));
|
return _("timeFormat", format24(ticks), format12(ticks), formatTicks(ticks));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String formatTicks(final long ticks)
|
public static String formatTicks(final long ticks)
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.api.Economy;
|
import com.earth2me.essentials.api.Economy;
|
||||||
import com.earth2me.essentials.commands.EssentialsCommand;
|
import com.earth2me.essentials.commands.EssentialsCommand;
|
||||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||||
@ -71,6 +72,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
private transient AlternativeCommandsHandler alternativeCommandsHandler;
|
private transient AlternativeCommandsHandler alternativeCommandsHandler;
|
||||||
private transient UserMap userMap;
|
private transient UserMap userMap;
|
||||||
private transient ExecuteTimer execTimer;
|
private transient ExecuteTimer execTimer;
|
||||||
|
private transient I18n i18n;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ISettings getSettings()
|
public ISettings getSettings()
|
||||||
@ -89,10 +91,13 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
{
|
{
|
||||||
throw new IOException();
|
throw new IOException();
|
||||||
}
|
}
|
||||||
LOGGER.log(Level.INFO, Util.i18n("usingTempFolderForTesting"));
|
i18n = new I18n(this);
|
||||||
|
i18n.onEnable();
|
||||||
|
LOGGER.log(Level.INFO, _("usingTempFolderForTesting"));
|
||||||
LOGGER.log(Level.INFO, dataFolder.toString());
|
LOGGER.log(Level.INFO, dataFolder.toString());
|
||||||
this.initialize(null, server, new PluginDescriptionFile(new FileReader(new File("src" + File.separator + "plugin.yml"))), dataFolder, null, null);
|
this.initialize(null, server, new PluginDescriptionFile(new FileReader(new File("src" + File.separator + "plugin.yml"))), dataFolder, null, null);
|
||||||
settings = new Settings(this);
|
settings = new Settings(this);
|
||||||
|
i18n.updateLocale("en");
|
||||||
userMap = new UserMap(this);
|
userMap = new UserMap(this);
|
||||||
permissionsHandler = new PermissionsHandler(this, false);
|
permissionsHandler = new PermissionsHandler(this, false);
|
||||||
Economy.setEss(this);
|
Economy.setEss(this);
|
||||||
@ -103,6 +108,9 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
{
|
{
|
||||||
execTimer = new ExecuteTimer();
|
execTimer = new ExecuteTimer();
|
||||||
execTimer.start();
|
execTimer.start();
|
||||||
|
i18n = new I18n(this);
|
||||||
|
i18n.onEnable();
|
||||||
|
execTimer.mark("I18n1");
|
||||||
final EssentialsUpgrade upgrade = new EssentialsUpgrade(this);
|
final EssentialsUpgrade upgrade = new EssentialsUpgrade(this);
|
||||||
upgrade.beforeSettings();
|
upgrade.beforeSettings();
|
||||||
execTimer.mark("Upgrade");
|
execTimer.mark("Upgrade");
|
||||||
@ -112,7 +120,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
execTimer.mark("Settings");
|
execTimer.mark("Settings");
|
||||||
upgrade.afterSettings();
|
upgrade.afterSettings();
|
||||||
execTimer.mark("Upgrade2");
|
execTimer.mark("Upgrade2");
|
||||||
Util.updateLocale(settings.getLocale(), this);
|
i18n.updateLocale(settings.getLocale());
|
||||||
userMap = new UserMap(this);
|
userMap = new UserMap(this);
|
||||||
confList.add(userMap);
|
confList.add(userMap);
|
||||||
execTimer.mark("Init(Usermap)");
|
execTimer.mark("Init(Usermap)");
|
||||||
@ -135,7 +143,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
if (plugin.getDescription().getName().startsWith("Essentials")
|
if (plugin.getDescription().getName().startsWith("Essentials")
|
||||||
&& !plugin.getDescription().getVersion().equals(this.getDescription().getVersion()))
|
&& !plugin.getDescription().getVersion().equals(this.getDescription().getVersion()))
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, Util.format("versionMismatch", plugin.getDescription().getName()));
|
LOGGER.log(Level.WARNING, _("versionMismatch", plugin.getDescription().getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Matcher versionMatch = Pattern.compile("git-Bukkit-([0-9]+).([0-9]+).([0-9]+)-R[0-9]+-[0-9]+-[0-9a-z]+-b([0-9]+)jnks.*").matcher(getServer().getVersion());
|
final Matcher versionMatch = Pattern.compile("git-Bukkit-([0-9]+).([0-9]+).([0-9]+)-R[0-9]+-[0-9]+-[0-9a-z]+-b([0-9]+)jnks.*").matcher(getServer().getVersion());
|
||||||
@ -144,12 +152,12 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
final int versionNumber = Integer.parseInt(versionMatch.group(4));
|
final int versionNumber = Integer.parseInt(versionMatch.group(4));
|
||||||
if (versionNumber < BUKKIT_VERSION)
|
if (versionNumber < BUKKIT_VERSION)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, Util.i18n("notRecommendedBukkit"));
|
LOGGER.log(Level.WARNING, _("notRecommendedBukkit"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.INFO, Util.i18n("bukkitFormatChanged"));
|
LOGGER.log(Level.INFO, _("bukkitFormatChanged"));
|
||||||
LOGGER.log(Level.INFO, getServer().getVersion());
|
LOGGER.log(Level.INFO, getServer().getVersion());
|
||||||
LOGGER.log(Level.INFO, getServer().getBukkitVersion());
|
LOGGER.log(Level.INFO, getServer().getBukkitVersion());
|
||||||
}
|
}
|
||||||
@ -218,7 +226,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 100);
|
getScheduler().scheduleSyncRepeatingTask(this, timer, 1, 100);
|
||||||
Economy.setEss(this);
|
Economy.setEss(this);
|
||||||
execTimer.mark("RegListeners");
|
execTimer.mark("RegListeners");
|
||||||
LOGGER.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Util.joinList(this.getDescription().getAuthors())));
|
LOGGER.info(_("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Util.joinList(this.getDescription().getAuthors())));
|
||||||
final String timeroutput = execTimer.end();
|
final String timeroutput = execTimer.end();
|
||||||
if (getSettings().isDebug())
|
if (getSettings().isDebug())
|
||||||
{
|
{
|
||||||
@ -229,6 +237,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
@Override
|
@Override
|
||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
|
i18n.onDisable();
|
||||||
Economy.setEss(null);
|
Economy.setEss(null);
|
||||||
Trade.closeLog();
|
Trade.closeLog();
|
||||||
}
|
}
|
||||||
@ -244,7 +253,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
execTimer.mark("Reload(" + iConf.getClass().getSimpleName() + ")");
|
execTimer.mark("Reload(" + iConf.getClass().getSimpleName() + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.updateLocale(settings.getLocale(), this);
|
i18n.updateLocale(settings.getLocale());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -282,7 +291,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
final List<String> mail = user.getMails();
|
final List<String> mail = user.getMails();
|
||||||
if (mail != null && !mail.isEmpty())
|
if (mail != null && !mail.isEmpty())
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.format("youHaveNewMail", mail.size()));
|
user.sendMessage(_("youHaveNewMail", mail.size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,16 +309,16 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("commandNotLoaded", commandLabel));
|
sender.sendMessage(_("commandNotLoaded", commandLabel));
|
||||||
LOGGER.log(Level.SEVERE, Util.format("commandNotLoaded", commandLabel), ex);
|
LOGGER.log(Level.SEVERE, _("commandNotLoaded", commandLabel), ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check authorization
|
// Check authorization
|
||||||
if (user != null && !user.isAuthorized(cmd, permissionPrefix))
|
if (user != null && !user.isAuthorized(cmd, permissionPrefix))
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, Util.format("deniedAccessCommand", user.getName()));
|
LOGGER.log(Level.WARNING, _("deniedAccessCommand", user.getName()));
|
||||||
user.sendMessage(Util.i18n("noAccessCommand"));
|
user.sendMessage(_("noAccessCommand"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,7 +353,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, Util.format("commandFailed", commandLabel), ex);
|
LOGGER.log(Level.SEVERE, _("commandFailed", commandLabel), ex);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -352,8 +361,8 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||||||
@Override
|
@Override
|
||||||
public void showError(final CommandSender sender, final Throwable exception, final String commandLabel)
|
public void showError(final CommandSender sender, final Throwable exception, final String commandLabel)
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("errorWithMessage", exception.getMessage()));
|
sender.sendMessage(_("errorWithMessage", exception.getMessage()));
|
||||||
final LogRecord logRecord = new LogRecord(Level.WARNING, Util.format("errorCallingCommand", commandLabel));
|
final LogRecord logRecord = new LogRecord(Level.WARNING, _("errorCallingCommand", commandLabel));
|
||||||
logRecord.setThrown(exception);
|
logRecord.setThrown(exception);
|
||||||
if (getSettings().isDebug())
|
if (getSettings().isDebug())
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -38,7 +39,7 @@ public class EssentialsConf extends Configuration
|
|||||||
{
|
{
|
||||||
if (!configFile.getParentFile().mkdirs())
|
if (!configFile.getParentFile().mkdirs())
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()));
|
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// This will delete files where the first character is 0. In most cases they are broken.
|
// This will delete files where the first character is 0. In most cases they are broken.
|
||||||
@ -81,22 +82,22 @@ public class EssentialsConf extends Configuration
|
|||||||
{
|
{
|
||||||
if (templateName != null)
|
if (templateName != null)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.INFO, Util.format("creatingConfigFromTemplate", configFile.toString()));
|
LOGGER.log(Level.INFO, _("creatingConfigFromTemplate", configFile.toString()));
|
||||||
createFromTemplate();
|
createFromTemplate();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.INFO, Util.format("creatingEmptyConfig", configFile.toString()));
|
LOGGER.log(Level.INFO, _("creatingEmptyConfig", configFile.toString()));
|
||||||
if (!configFile.createNewFile())
|
if (!configFile.createNewFile())
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()));
|
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, Util.format("failedToCreateConfig", configFile.toString()), ex);
|
LOGGER.log(Level.SEVERE, _("failedToCreateConfig", configFile.toString()), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +127,7 @@ public class EssentialsConf extends Configuration
|
|||||||
istr = resourceClass.getResourceAsStream(templateName);
|
istr = resourceClass.getResourceAsStream(templateName);
|
||||||
if (istr == null)
|
if (istr == null)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, Util.format("couldNotFindTemplate", templateName));
|
LOGGER.log(Level.SEVERE, _("couldNotFindTemplate", templateName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ostr = new FileOutputStream(configFile);
|
ostr = new FileOutputStream(configFile);
|
||||||
@ -141,7 +142,7 @@ public class EssentialsConf extends Configuration
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, Util.format("failedToWriteConfig", configFile.toString()), ex);
|
LOGGER.log(Level.SEVERE, _("failedToWriteConfig", configFile.toString()), ex);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -165,7 +166,7 @@ public class EssentialsConf extends Configuration
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, Util.format("failedToCloseConfig", configFile.toString()), ex);
|
LOGGER.log(Level.SEVERE, _("failedToCloseConfig", configFile.toString()), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,7 +202,7 @@ public class EssentialsConf extends Configuration
|
|||||||
final World world = server.getWorld(worldName);
|
final World world = server.getWorld(worldName);
|
||||||
if (world == null)
|
if (world == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("invalidWorld"));
|
throw new Exception(_("invalidWorld"));
|
||||||
}
|
}
|
||||||
return new Location(world,
|
return new Location(world,
|
||||||
getDouble((path == null ? "" : path + ".") + "x", 0),
|
getDouble((path == null ? "" : path + ".") + "x", 0),
|
||||||
@ -226,8 +227,10 @@ public class EssentialsConf extends Configuration
|
|||||||
return new ItemStack(
|
return new ItemStack(
|
||||||
Material.valueOf(getString(path + ".type", "AIR")),
|
Material.valueOf(getString(path + ".type", "AIR")),
|
||||||
getInt(path + ".amount", 1),
|
getInt(path + ".amount", 1),
|
||||||
(short)getInt(path + ".damage", 0)/*,
|
(short)getInt(path + ".damage", 0)/*
|
||||||
(byte)getInt(path + ".data", 0)*/);
|
* ,
|
||||||
|
* (byte)getInt(path + ".data", 0)
|
||||||
|
*/);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProperty(final String path, final ItemStack stack)
|
public void setProperty(final String path, final ItemStack stack)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -77,7 +78,7 @@ public class EssentialsEntityListener extends EntityListener
|
|||||||
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
|
if (user.isAuthorized("essentials.back.ondeath") && !ess.getSettings().isCommandDisabled("back"))
|
||||||
{
|
{
|
||||||
user.setLastLocation();
|
user.setLastLocation();
|
||||||
user.sendMessage(Util.i18n("backAfterDeath"));
|
user.sendMessage(_("backAfterDeath"));
|
||||||
}
|
}
|
||||||
if (!ess.getSettings().areDeathMessagesEnabled())
|
if (!ess.getSettings().areDeathMessagesEnabled())
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.textreader.IText;
|
import com.earth2me.essentials.textreader.IText;
|
||||||
import com.earth2me.essentials.textreader.KeywordReplacer;
|
import com.earth2me.essentials.textreader.KeywordReplacer;
|
||||||
import com.earth2me.essentials.textreader.TextInput;
|
import com.earth2me.essentials.textreader.TextInput;
|
||||||
@ -8,6 +9,7 @@ import java.io.IOException;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -50,8 +52,8 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
if (user.isMuted())
|
if (user.isMuted())
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
user.sendMessage(Util.i18n("playerMuted"));
|
user.sendMessage(_("playerMuted"));
|
||||||
LOGGER.info(Util.format("mutedUserSpeaks", user.getName()));
|
LOGGER.info(_("mutedUserSpeaks", user.getName()));
|
||||||
}
|
}
|
||||||
final Iterator<Player> it = event.getRecipients().iterator();
|
final Iterator<Player> it = event.getRecipients().iterator();
|
||||||
while (it.hasNext())
|
while (it.hasNext())
|
||||||
@ -136,7 +138,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
rt.gc();
|
rt.gc();
|
||||||
mem = rt.freeMemory() - mem;
|
mem = rt.freeMemory() - mem;
|
||||||
mem /= 1024 * 1024;
|
mem /= 1024 * 1024;
|
||||||
LOGGER.log(Level.INFO, Util.format("freedMemory", mem));
|
LOGGER.log(Level.INFO, _("freedMemory", mem));
|
||||||
}
|
}
|
||||||
catch (InterruptedException ex)
|
catch (InterruptedException ex)
|
||||||
{
|
{
|
||||||
@ -184,11 +186,11 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
final List<String> mail = user.getMails();
|
final List<String> mail = user.getMails();
|
||||||
if (mail.isEmpty())
|
if (mail.isEmpty())
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("noNewMail"));
|
user.sendMessage(_("noNewMail"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.format("youHaveNewMail", mail.size()));
|
user.sendMessage(_("youHaveNewMail", mail.size()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,13 +214,13 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
if (banExpired == false && (user.isBanned() || event.getResult() == Result.KICK_BANNED))
|
if (banExpired == false && (user.isBanned() || event.getResult() == Result.KICK_BANNED))
|
||||||
{
|
{
|
||||||
final String banReason = user.getBanReason();
|
final String banReason = user.getBanReason();
|
||||||
event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() && !banReason.equalsIgnoreCase("ban") ? banReason : Util.i18n("defaultBanReason"));
|
event.disallow(Result.KICK_BANNED, banReason != null && !banReason.isEmpty() && !banReason.equalsIgnoreCase("ban") ? banReason : _("defaultBanReason"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server.getOnlinePlayers().length >= server.getMaxPlayers() && !user.isAuthorized("essentials.joinfullserver"))
|
if (server.getOnlinePlayers().length >= server.getMaxPlayers() && !user.isAuthorized("essentials.joinfullserver"))
|
||||||
{
|
{
|
||||||
event.disallow(Result.KICK_FULL, Util.i18n("serverFull"));
|
event.disallow(Result.KICK_FULL, _("serverFull"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
event.allow();
|
event.allow();
|
||||||
@ -271,7 +273,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
{
|
{
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
user.setHome();
|
user.setHome();
|
||||||
user.sendMessage(Util.i18n("homeSetToBed"));
|
user.sendMessage(_("homeSetToBed"));
|
||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
@ -365,7 +367,7 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final User user = ess.getUser(event.getPlayer());
|
final User user = ess.getUser(event.getPlayer());
|
||||||
final String cmd = event.getMessage().toLowerCase().split(" ")[0].replace("/", "").toLowerCase();
|
final String cmd = event.getMessage().toLowerCase(Locale.ENGLISH).split(" ")[0].replace("/", "").toLowerCase(Locale.ENGLISH);
|
||||||
final List<String> commands = Arrays.asList("msg", "r", "mail", "m", "t", "emsg", "tell", "er", "reply", "ereply", "email");
|
final List<String> commands = Arrays.asList("msg", "r", "mail", "m", "t", "emsg", "tell", "er", "reply", "ereply", "email");
|
||||||
if (commands.contains(cmd))
|
if (commands.contains(cmd))
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.DigestInputStream;
|
import java.security.DigestInputStream;
|
||||||
@ -67,7 +68,7 @@ public class EssentialsUpgrade
|
|||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, Util.i18n("upgradingFilesError"), e);
|
LOGGER.log(Level.SEVERE, _("upgradingFilesError"), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +112,7 @@ public class EssentialsUpgrade
|
|||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch (Throwable e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, Util.i18n("upgradingFilesError"), e);
|
LOGGER.log(Level.SEVERE, _("upgradingFilesError"), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,11 +162,11 @@ public class EssentialsUpgrade
|
|||||||
{
|
{
|
||||||
if (!file.renameTo(new File(file.getParentFile(), file.getName().concat("." + System.currentTimeMillis() + ".upgradebackup"))))
|
if (!file.renameTo(new File(file.getParentFile(), file.getName().concat("." + System.currentTimeMillis() + ".upgradebackup"))))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("configFileMoveError"));
|
throw new Exception(_("configFileMoveError"));
|
||||||
}
|
}
|
||||||
if (!tempFile.renameTo(file))
|
if (!tempFile.renameTo(file))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("configFileRenameError"));
|
throw new Exception(_("configFileRenameError"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -220,7 +221,7 @@ public class EssentialsUpgrade
|
|||||||
((Number)vals.get(3)).floatValue(),
|
((Number)vals.get(3)).floatValue(),
|
||||||
((Number)vals.get(4)).floatValue());
|
((Number)vals.get(4)).floatValue());
|
||||||
|
|
||||||
final String worldName = world.getName().toLowerCase();
|
final String worldName = world.getName().toLowerCase(Locale.ENGLISH);
|
||||||
if (worldName != null && !worldName.isEmpty())
|
if (worldName != null && !worldName.isEmpty())
|
||||||
{
|
{
|
||||||
config.removeProperty("home");
|
config.removeProperty("home");
|
||||||
@ -347,7 +348,7 @@ public class EssentialsUpgrade
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
worldName = loc.getWorld().getName().toLowerCase();
|
worldName = loc.getWorld().getName().toLowerCase(Locale.ENGLISH);
|
||||||
if (worldName != null && !worldName.isEmpty())
|
if (worldName != null && !worldName.isEmpty())
|
||||||
{
|
{
|
||||||
config.setProperty("homes." + worldName, loc);
|
config.setProperty("homes." + worldName, loc);
|
||||||
@ -493,7 +494,7 @@ public class EssentialsUpgrade
|
|||||||
ess.getWarps().setWarp(filename.substring(0, filename.length() - 4), loc);
|
ess.getWarps().setWarp(filename.substring(0, filename.length() - 4), loc);
|
||||||
if (!listOfFiles[i].renameTo(new File(warpsFolder, filename + ".old")))
|
if (!listOfFiles[i].renameTo(new File(warpsFolder, filename + ".old")))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("fileRenameError", filename));
|
throw new Exception(_("fileRenameError", filename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -541,7 +542,7 @@ public class EssentialsUpgrade
|
|||||||
ess.getWarps().setWarp(name, loc);
|
ess.getWarps().setWarp(name, loc);
|
||||||
if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old")))
|
if (!warpFile.renameTo(new File(ess.getDataFolder(), "warps.txt.old")))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("fileRenameError", "warps.txt"));
|
throw new Exception(_("fileRenameError", "warps.txt"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -585,17 +586,17 @@ public class EssentialsUpgrade
|
|||||||
final File newFile = new File(listOfFiles[i].getParentFile(), sanitizedFilename);
|
final File newFile = new File(listOfFiles[i].getParentFile(), sanitizedFilename);
|
||||||
if (!listOfFiles[i].renameTo(tmpFile))
|
if (!listOfFiles[i].renameTo(tmpFile))
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, Util.format("userdataMoveError", filename, sanitizedFilename));
|
LOGGER.log(Level.WARNING, _("userdataMoveError", filename, sanitizedFilename));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (newFile.exists())
|
if (newFile.exists())
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, Util.format("duplicatedUserdata", filename, sanitizedFilename));
|
LOGGER.log(Level.WARNING, _("duplicatedUserdata", filename, sanitizedFilename));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!tmpFile.renameTo(newFile))
|
if (!tmpFile.renameTo(newFile))
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, Util.format("userdataMoveBackError", sanitizedFilename, sanitizedFilename));
|
LOGGER.log(Level.WARNING, _("userdataMoveBackError", sanitizedFilename, sanitizedFilename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
doneFile.setProperty("sanitizeAllUserFilenames", true);
|
doneFile.setProperty("sanitizeAllUserFilenames", true);
|
||||||
|
@ -18,16 +18,30 @@ public class I18n
|
|||||||
private static final String MESSAGES = "messages";
|
private static final String MESSAGES = "messages";
|
||||||
private final transient Locale defaultLocale = Locale.getDefault();
|
private final transient Locale defaultLocale = Locale.getDefault();
|
||||||
private transient Locale currentLocale = defaultLocale;
|
private transient Locale currentLocale = defaultLocale;
|
||||||
private transient ResourceBundle customBundle = ResourceBundle.getBundle(MESSAGES, defaultLocale);
|
private transient ResourceBundle customBundle;
|
||||||
private transient ResourceBundle localeBundle = ResourceBundle.getBundle(MESSAGES, defaultLocale);
|
private transient ResourceBundle localeBundle;
|
||||||
private final transient ResourceBundle defaultBundle = ResourceBundle.getBundle(MESSAGES, Locale.ENGLISH);
|
private final transient ResourceBundle defaultBundle;
|
||||||
private final transient Map<String, MessageFormat> messageFormatCache = new HashMap<String, MessageFormat>();
|
private final transient Map<String, MessageFormat> messageFormatCache = new HashMap<String, MessageFormat>();
|
||||||
|
private final transient IEssentials ess;
|
||||||
|
|
||||||
public I18n()
|
public I18n(final IEssentials ess)
|
||||||
|
{
|
||||||
|
this.ess = ess;
|
||||||
|
customBundle = ResourceBundle.getBundle(MESSAGES, defaultLocale);
|
||||||
|
localeBundle = ResourceBundle.getBundle(MESSAGES, defaultLocale);
|
||||||
|
defaultBundle = ResourceBundle.getBundle(MESSAGES, Locale.ENGLISH);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onEnable()
|
||||||
{
|
{
|
||||||
instance = this;
|
instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onDisable()
|
||||||
|
{
|
||||||
|
instance = null;
|
||||||
|
}
|
||||||
|
|
||||||
public Locale getCurrentLocale()
|
public Locale getCurrentLocale()
|
||||||
{
|
{
|
||||||
return currentLocale;
|
return currentLocale;
|
||||||
@ -77,7 +91,7 @@ public class I18n
|
|||||||
return messageFormat.format(objects);
|
return messageFormat.format(objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateLocale(final String loc, final IEssentials ess)
|
public void updateLocale(final String loc)
|
||||||
{
|
{
|
||||||
if (loc == null || loc.isEmpty())
|
if (loc == null || loc.isEmpty())
|
||||||
{
|
{
|
||||||
@ -101,11 +115,6 @@ public class I18n
|
|||||||
localeBundle = ResourceBundle.getBundle(MESSAGES, currentLocale);
|
localeBundle = ResourceBundle.getBundle(MESSAGES, currentLocale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String lowerCase(final String input)
|
|
||||||
{
|
|
||||||
return input == null ? null : input.toLowerCase(Locale.ENGLISH);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String capitalCase(final String input)
|
public static String capitalCase(final String input)
|
||||||
{
|
{
|
||||||
return input == null || input.length() == 0
|
return input == null || input.length() == 0
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -25,7 +27,8 @@ public class ItemDb implements IConf
|
|||||||
{
|
{
|
||||||
final List<String> lines = file.getLines();
|
final List<String> lines = file.getLines();
|
||||||
|
|
||||||
if (lines.isEmpty()) {
|
if (lines.isEmpty())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +37,7 @@ public class ItemDb implements IConf
|
|||||||
|
|
||||||
for (String line : lines)
|
for (String line : lines)
|
||||||
{
|
{
|
||||||
line = line.trim().toLowerCase();
|
line = line.trim().toLowerCase(Locale.ENGLISH);
|
||||||
if (line.length() > 0 && line.charAt(0) == '#')
|
if (line.length() > 0 && line.charAt(0) == '#')
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -48,14 +51,14 @@ public class ItemDb implements IConf
|
|||||||
|
|
||||||
final int numeric = Integer.parseInt(parts[1]);
|
final int numeric = Integer.parseInt(parts[1]);
|
||||||
|
|
||||||
durabilities.put(parts[0].toLowerCase(), parts.length > 2 && !parts[2].equals("0") ? Short.parseShort(parts[2]) : 0);
|
durabilities.put(parts[0].toLowerCase(Locale.ENGLISH), parts.length > 2 && !parts[2].equals("0") ? Short.parseShort(parts[2]) : 0);
|
||||||
items.put(parts[0].toLowerCase(), numeric);
|
items.put(parts[0].toLowerCase(Locale.ENGLISH), numeric);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack get(final String id, final int quantity) throws Exception
|
public ItemStack get(final String id, final int quantity) throws Exception
|
||||||
{
|
{
|
||||||
final ItemStack retval = get(id.toLowerCase());
|
final ItemStack retval = get(id.toLowerCase(Locale.ENGLISH));
|
||||||
retval.setAmount(quantity);
|
retval.setAmount(quantity);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -76,12 +79,12 @@ public class ItemDb implements IConf
|
|||||||
}
|
}
|
||||||
else if (id.matches("^[^:+',;.]+[:+',;.]\\d+$"))
|
else if (id.matches("^[^:+',;.]+[:+',;.]\\d+$"))
|
||||||
{
|
{
|
||||||
itemname = id.split("[:+',;.]")[0].toLowerCase();
|
itemname = id.split("[:+',;.]")[0].toLowerCase(Locale.ENGLISH);
|
||||||
metaData = Short.parseShort(id.split("[:+',;.]")[1]);
|
metaData = Short.parseShort(id.split("[:+',;.]")[1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
itemname = id.toLowerCase();
|
itemname = id.toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemname != null)
|
if (itemname != null)
|
||||||
@ -101,14 +104,14 @@ public class ItemDb implements IConf
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("unknownItemName", id));
|
throw new Exception(_("unknownItemName", id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final Material mat = Material.getMaterial(itemid);
|
final Material mat = Material.getMaterial(itemid);
|
||||||
if (mat == null)
|
if (mat == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("unknownItemId", itemid));
|
throw new Exception(_("unknownItemId", itemid));
|
||||||
}
|
}
|
||||||
final ItemStack retval = new ItemStack(mat);
|
final ItemStack retval = new ItemStack(mat);
|
||||||
retval.setAmount(ess.getSettings().getDefaultStackSize());
|
retval.setAmount(ess.getSettings().getDefaultStackSize());
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
@ -25,18 +27,18 @@ public class Jail extends BlockListener implements IConf
|
|||||||
|
|
||||||
public void setJail(Location loc, String jailName) throws Exception
|
public void setJail(Location loc, String jailName) throws Exception
|
||||||
{
|
{
|
||||||
config.setProperty(jailName.toLowerCase(), loc);
|
config.setProperty(jailName.toLowerCase(Locale.ENGLISH), loc);
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getJail(String jailName) throws Exception
|
public Location getJail(String jailName) throws Exception
|
||||||
{
|
{
|
||||||
if (jailName == null || config.getProperty(jailName.toLowerCase()) == null)
|
if (jailName == null || config.getProperty(jailName.toLowerCase(Locale.ENGLISH)) == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("jailNotExist"));
|
throw new Exception(_("jailNotExist"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Location loc = config.getLocation(jailName.toLowerCase(), ess.getServer());
|
Location loc = config.getLocation(jailName.toLowerCase(Locale.ENGLISH), ess.getServer());
|
||||||
return loc;
|
return loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +53,7 @@ public class Jail extends BlockListener implements IConf
|
|||||||
|
|
||||||
public void delJail(String jail) throws Exception
|
public void delJail(String jail) throws Exception
|
||||||
{
|
{
|
||||||
config.removeProperty(jail.toLowerCase());
|
config.removeProperty(jail.toLowerCase(Locale.ENGLISH));
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.*;
|
||||||
@ -55,9 +56,9 @@ public class JailPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, Util.i18n("returnPlayerToJailError"), ex);
|
LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
|
||||||
}
|
}
|
||||||
user.sendMessage(Util.i18n("jailMessage"));
|
user.sendMessage(_("jailMessage"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -72,9 +73,9 @@ public class JailPlayerListener extends PlayerListener
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.WARNING, Util.i18n("returnPlayerToJailError"), ex);
|
LOGGER.log(Level.WARNING, _("returnPlayerToJailError"), ex);
|
||||||
}
|
}
|
||||||
u.sendMessage(Util.i18n("jailMessage"));
|
u.sendMessage(_("jailMessage"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.security.DigestInputStream;
|
import java.security.DigestInputStream;
|
||||||
@ -45,7 +46,7 @@ public class ManagedFile
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
Bukkit.getLogger().log(Level.SEVERE, Util.i18n("itemsCsvNotLoaded"), ex);
|
Bukkit.getLogger().log(Level.SEVERE, _("itemsCsvNotLoaded"), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -61,7 +63,7 @@ public enum Mob
|
|||||||
{
|
{
|
||||||
for (Mob mob : Mob.values())
|
for (Mob mob : Mob.values())
|
||||||
{
|
{
|
||||||
hashMap.put(mob.name.toLowerCase(), mob);
|
hashMap.put(mob.name.toLowerCase(Locale.ENGLISH), mob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +73,7 @@ public enum Mob
|
|||||||
final LivingEntity entity = player.getWorld().spawnCreature(loc, this.bukkitType);
|
final LivingEntity entity = player.getWorld().spawnCreature(loc, this.bukkitType);
|
||||||
if (entity == null)
|
if (entity == null)
|
||||||
{
|
{
|
||||||
logger.log(Level.WARNING, Util.i18n("unableToSpawnMob"));
|
logger.log(Level.WARNING, _("unableToSpawnMob"));
|
||||||
throw new MobException();
|
throw new MobException();
|
||||||
}
|
}
|
||||||
return entity;
|
return entity;
|
||||||
@ -98,7 +100,7 @@ public enum Mob
|
|||||||
|
|
||||||
public static Mob fromName(final String name)
|
public static Mob fromName(final String name)
|
||||||
{
|
{
|
||||||
return hashMap.get(name.toLowerCase());
|
return hashMap.get(name.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import lombok.Delegate;
|
import lombok.Delegate;
|
||||||
@ -179,25 +179,25 @@ public class OfflinePlayer implements Player
|
|||||||
@Override
|
@Override
|
||||||
public int getRemainingAir()
|
public int getRemainingAir()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRemainingAir(int i)
|
public void setRemainingAir(int i)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaximumAir()
|
public int getMaximumAir()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMaximumAir(int i)
|
public void setMaximumAir(int i)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -209,73 +209,73 @@ public class OfflinePlayer implements Player
|
|||||||
@Override
|
@Override
|
||||||
public void setSneaking(boolean bln)
|
public void setSneaking(boolean bln)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateInventory()
|
public void updateInventory()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void chat(String string)
|
public void chat(String string)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getEyeHeight()
|
public double getEyeHeight()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getEyeHeight(boolean bln)
|
public double getEyeHeight(boolean bln)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Block> getLineOfSight(HashSet<Byte> hs, int i)
|
public List<Block> getLineOfSight(HashSet<Byte> hs, int i)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Block getTargetBlock(HashSet<Byte> hs, int i)
|
public Block getTargetBlock(HashSet<Byte> hs, int i)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> hs, int i)
|
public List<Block> getLastTwoTargetBlocks(HashSet<Byte> hs, int i)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFireTicks()
|
public int getFireTicks()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxFireTicks()
|
public int getMaxFireTicks()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFireTicks(int i)
|
public void setFireTicks(int i)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove()
|
public void remove()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -286,252 +286,252 @@ public class OfflinePlayer implements Player
|
|||||||
|
|
||||||
public Vector getMomentum()
|
public Vector getMomentum()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMomentum(Vector vector)
|
public void setMomentum(Vector vector)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVelocity(Vector vector)
|
public void setVelocity(Vector vector)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vector getVelocity()
|
public Vector getVelocity()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void damage(int i)
|
public void damage(int i)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void damage(int i, Entity entity)
|
public void damage(int i, Entity entity)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location getEyeLocation()
|
public Location getEyeLocation()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendRawMessage(String string)
|
public void sendRawMessage(String string)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Location getCompassTarget()
|
public Location getCompassTarget()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaximumNoDamageTicks()
|
public int getMaximumNoDamageTicks()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMaximumNoDamageTicks(int i)
|
public void setMaximumNoDamageTicks(int i)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getLastDamage()
|
public int getLastDamage()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLastDamage(int i)
|
public void setLastDamage(int i)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNoDamageTicks()
|
public int getNoDamageTicks()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNoDamageTicks(int i)
|
public void setNoDamageTicks(int i)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean teleport(Location lctn)
|
public boolean teleport(Location lctn)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean teleport(Entity entity)
|
public boolean teleport(Entity entity)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Entity getPassenger()
|
public Entity getPassenger()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setPassenger(Entity entity)
|
public boolean setPassenger(Entity entity)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEmpty()
|
public boolean isEmpty()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean eject()
|
public boolean eject()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveData()
|
public void saveData()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void loadData()
|
public void loadData()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSleeping()
|
public boolean isSleeping()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSleepTicks()
|
public int getSleepTicks()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Entity> getNearbyEntities(double d, double d1, double d2)
|
public List<Entity> getNearbyEntities(double d, double d1, double d2)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDead()
|
public boolean isDead()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getFallDistance()
|
public float getFallDistance()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFallDistance(float f)
|
public void setFallDistance(float f)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSleepingIgnored(boolean bln)
|
public void setSleepingIgnored(boolean bln)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSleepingIgnored()
|
public boolean isSleepingIgnored()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void awardAchievement(Achievement a)
|
public void awardAchievement(Achievement a)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incrementStatistic(Statistic ststc)
|
public void incrementStatistic(Statistic ststc)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incrementStatistic(Statistic ststc, int i)
|
public void incrementStatistic(Statistic ststc, int i)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incrementStatistic(Statistic ststc, Material mtrl)
|
public void incrementStatistic(Statistic ststc, Material mtrl)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void incrementStatistic(Statistic ststc, Material mtrl, int i)
|
public void incrementStatistic(Statistic ststc, Material mtrl, int i)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playNote(Location lctn, byte b, byte b1)
|
public void playNote(Location lctn, byte b, byte b1)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendBlockChange(Location lctn, Material mtrl, byte b)
|
public void sendBlockChange(Location lctn, Material mtrl, byte b)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendBlockChange(Location lctn, int i, byte b)
|
public void sendBlockChange(Location lctn, int i, byte b)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLastDamageCause(EntityDamageEvent ede)
|
public void setLastDamageCause(EntityDamageEvent ede)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityDamageEvent getLastDamageCause()
|
public EntityDamageEvent getLastDamageCause()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playEffect(Location lctn, Effect effect, int i)
|
public void playEffect(Location lctn, Effect effect, int i)
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException(Util.i18n("notSupportedYet"));
|
throw new UnsupportedOperationException(_("notSupportedYet"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -111,7 +113,7 @@ public class Settings implements ISettings
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return config.getBoolean("disable-" + label.toLowerCase(), false);
|
return config.getBoolean("disable-" + label.toLowerCase(Locale.ENGLISH), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -131,7 +133,7 @@ public class Settings implements ISettings
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return config.getBoolean("restrict-" + label.toLowerCase(), false);
|
return config.getBoolean("restrict-" + label.toLowerCase(Locale.ENGLISH), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -161,7 +163,7 @@ public class Settings implements ISettings
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return config.getBoolean("override-" + name.toLowerCase(), false);
|
return config.getBoolean("override-" + name.toLowerCase(Locale.ENGLISH), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -360,7 +362,7 @@ public class Settings implements ISettings
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, "item-spawn-blacklist"));
|
logger.log(Level.SEVERE, _("unknownItemInList", itemName, "item-spawn-blacklist"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return epItemSpwn;
|
return epItemSpwn;
|
||||||
@ -377,7 +379,6 @@ public class Settings implements ISettings
|
|||||||
{
|
{
|
||||||
return config.getBoolean("protect.disable.warn-on-build-disallow", false);
|
return config.getBoolean("protect.disable.warn-on-build-disallow", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean debug = false;
|
private boolean debug = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -447,7 +448,7 @@ public class Settings implements ISettings
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.SEVERE, Util.format("unknownItemInList", itemName, configName));
|
logger.log(Level.SEVERE, _("unknownItemInList", itemName, configName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
import com.earth2me.essentials.commands.NotEnoughArgumentsException;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
@ -93,7 +94,7 @@ public class Teleport implements Runnable
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
cooldown(false);
|
cooldown(false);
|
||||||
user.sendMessage(Util.i18n("teleportationCommencing"));
|
user.sendMessage(_("teleportationCommencing"));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -110,7 +111,7 @@ public class Teleport implements Runnable
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.format("cooldownWithMessage", ex.getMessage()));
|
user.sendMessage(_("cooldownWithMessage", ex.getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,7 +131,7 @@ public class Teleport implements Runnable
|
|||||||
{
|
{
|
||||||
Location loc = ess.getWarps().getWarp(warp);
|
Location loc = ess.getWarps().getWarp(warp);
|
||||||
teleport(new Target(loc), chargeFor);
|
teleport(new Target(loc), chargeFor);
|
||||||
user.sendMessage(Util.format("warpingTo", warp));
|
user.sendMessage(_("warpingTo", warp));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cooldown(boolean check) throws Exception
|
public void cooldown(boolean check) throws Exception
|
||||||
@ -145,7 +146,7 @@ public class Teleport implements Runnable
|
|||||||
cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
|
cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
|
||||||
if (cooldownTime.after(now) && !user.isAuthorized("essentials.teleport.cooldown.bypass"))
|
if (cooldownTime.after(now) && !user.isAuthorized("essentials.teleport.cooldown.bypass"))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("timeBeforeTeleport", Util.formatDateDiff(cooldownTime.getTimeInMillis())));
|
throw new Exception(_("timeBeforeTeleport", Util.formatDateDiff(cooldownTime.getTimeInMillis())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if justCheck is set, don't update lastTeleport; we're just checking
|
// if justCheck is set, don't update lastTeleport; we're just checking
|
||||||
@ -166,7 +167,7 @@ public class Teleport implements Runnable
|
|||||||
ess.getServer().getScheduler().cancelTask(teleTimer);
|
ess.getServer().getScheduler().cancelTask(teleTimer);
|
||||||
if (notifyUser)
|
if (notifyUser)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("pendingTeleportCancelled"));
|
user.sendMessage(_("pendingTeleportCancelled"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@ -214,7 +215,7 @@ public class Teleport implements Runnable
|
|||||||
Calendar c = new GregorianCalendar();
|
Calendar c = new GregorianCalendar();
|
||||||
c.add(Calendar.SECOND, (int)delay);
|
c.add(Calendar.SECOND, (int)delay);
|
||||||
c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
|
c.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
|
||||||
user.sendMessage(Util.format("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis())));
|
user.sendMessage(_("dontMoveMessage", Util.formatDateDiff(c.getTimeInMillis())));
|
||||||
initTimer((long)(delay * 1000.0), target, chargeFor);
|
initTimer((long)(delay * 1000.0), target, chargeFor);
|
||||||
|
|
||||||
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
|
teleTimer = ess.scheduleSyncRepeatingTask(this, 10, 10);
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -50,13 +52,13 @@ public class Trade
|
|||||||
&& getMoney() > 0
|
&& getMoney() > 0
|
||||||
&& !user.isAuthorized("essentials.eco.loan"))
|
&& !user.isAuthorized("essentials.eco.loan"))
|
||||||
{
|
{
|
||||||
throw new ChargeException(Util.i18n("notEnoughMoney"));
|
throw new ChargeException(_("notEnoughMoney"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getItemStack() != null
|
if (getItemStack() != null
|
||||||
&& !InventoryWorkaround.containsItem(user.getInventory(), true, itemStack))
|
&& !InventoryWorkaround.containsItem(user.getInventory(), true, itemStack))
|
||||||
{
|
{
|
||||||
throw new ChargeException(Util.format("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase().replace("_", " ")));
|
throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " ")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command != null && !command.isEmpty()
|
if (command != null && !command.isEmpty()
|
||||||
@ -66,7 +68,7 @@ public class Trade
|
|||||||
&& 0 < ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command)
|
&& 0 < ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command)
|
||||||
&& !user.isAuthorized("essentials.eco.loan"))
|
&& !user.isAuthorized("essentials.eco.loan"))
|
||||||
{
|
{
|
||||||
throw new ChargeException(Util.i18n("notEnoughMoney"));
|
throw new ChargeException(_("notEnoughMoney"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +110,7 @@ public class Trade
|
|||||||
final double mon = user.getMoney();
|
final double mon = user.getMoney();
|
||||||
if (mon < getMoney() && getMoney() > 0 && !user.isAuthorized("essentials.eco.loan"))
|
if (mon < getMoney() && getMoney() > 0 && !user.isAuthorized("essentials.eco.loan"))
|
||||||
{
|
{
|
||||||
throw new ChargeException(Util.i18n("notEnoughMoney"));
|
throw new ChargeException(_("notEnoughMoney"));
|
||||||
}
|
}
|
||||||
user.takeMoney(getMoney());
|
user.takeMoney(getMoney());
|
||||||
}
|
}
|
||||||
@ -116,7 +118,7 @@ public class Trade
|
|||||||
{
|
{
|
||||||
if (!InventoryWorkaround.containsItem(user.getInventory(), true, itemStack))
|
if (!InventoryWorkaround.containsItem(user.getInventory(), true, itemStack))
|
||||||
{
|
{
|
||||||
throw new ChargeException(Util.format("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase().replace("_", " ")));
|
throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " ")));
|
||||||
}
|
}
|
||||||
InventoryWorkaround.removeItem(user.getInventory(), true, getItemStack());
|
InventoryWorkaround.removeItem(user.getInventory(), true, getItemStack());
|
||||||
user.updateInventory();
|
user.updateInventory();
|
||||||
@ -129,7 +131,7 @@ public class Trade
|
|||||||
final double cost = ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command);
|
final double cost = ess.getSettings().getCommandCost(command.charAt(0) == '/' ? command.substring(1) : command);
|
||||||
if (mon < cost && cost > 0 && !user.isAuthorized("essentials.eco.loan"))
|
if (mon < cost && cost > 0 && !user.isAuthorized("essentials.eco.loan"))
|
||||||
{
|
{
|
||||||
throw new ChargeException(Util.i18n("notEnoughMoney"));
|
throw new ChargeException(_("notEnoughMoney"));
|
||||||
}
|
}
|
||||||
user.takeMoney(cost);
|
user.takeMoney(cost);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.commands.IEssentialsCommand;
|
import com.earth2me.essentials.commands.IEssentialsCommand;
|
||||||
import com.earth2me.essentials.register.payment.Method;
|
import com.earth2me.essentials.register.payment.Method;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@ -82,7 +83,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
|
cooldownTime.add(Calendar.MILLISECOND, (int)((cooldown * 1000.0) % 1000.0));
|
||||||
if (cooldownTime.after(now) && !isAuthorized("essentials.heal.cooldown.bypass"))
|
if (cooldownTime.after(now) && !isAuthorized("essentials.heal.cooldown.bypass"))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("timeBeforeHeal", Util.formatDateDiff(cooldownTime.getTimeInMillis())));
|
throw new Exception(_("timeBeforeHeal", Util.formatDateDiff(cooldownTime.getTimeInMillis())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setLastHealTimestamp(now.getTimeInMillis());
|
setLastHealTimestamp(now.getTimeInMillis());
|
||||||
@ -101,10 +102,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setMoney(getMoney() + value);
|
setMoney(getMoney() + value);
|
||||||
sendMessage(Util.format("addedToAccount", Util.formatCurrency(value, ess)));
|
sendMessage(_("addedToAccount", Util.formatCurrency(value, ess)));
|
||||||
if (initiator != null)
|
if (initiator != null)
|
||||||
{
|
{
|
||||||
initiator.sendMessage(Util.format("addedToOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
|
initiator.sendMessage(_("addedToOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,12 +119,12 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
{
|
{
|
||||||
setMoney(getMoney() - value);
|
setMoney(getMoney() - value);
|
||||||
reciever.setMoney(reciever.getMoney() + value);
|
reciever.setMoney(reciever.getMoney() + value);
|
||||||
sendMessage(Util.format("moneySentTo", Util.formatCurrency(value, ess), reciever.getDisplayName()));
|
sendMessage(_("moneySentTo", Util.formatCurrency(value, ess), reciever.getDisplayName()));
|
||||||
reciever.sendMessage(Util.format("moneyRecievedFrom", Util.formatCurrency(value, ess), getDisplayName()));
|
reciever.sendMessage(_("moneyRecievedFrom", Util.formatCurrency(value, ess), getDisplayName()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("notEnoughMoney"));
|
throw new Exception(_("notEnoughMoney"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,10 +141,10 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setMoney(getMoney() - value);
|
setMoney(getMoney() - value);
|
||||||
sendMessage(Util.format("takenFromAccount", Util.formatCurrency(value, ess)));
|
sendMessage(_("takenFromAccount", Util.formatCurrency(value, ess)));
|
||||||
if (initiator != null)
|
if (initiator != null)
|
||||||
{
|
{
|
||||||
initiator.sendMessage(Util.format("takenFromOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
|
initiator.sendMessage(_("takenFromOthersAccount", Util.formatCurrency(value, ess), this.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,7 +413,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
{
|
{
|
||||||
setJailTimeout(0);
|
setJailTimeout(0);
|
||||||
setJailed(false);
|
setJailed(false);
|
||||||
sendMessage(Util.i18n("haveBeenReleased"));
|
sendMessage(_("haveBeenReleased"));
|
||||||
setJail(null);
|
setJail(null);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -432,7 +433,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
if (getMuteTimeout() > 0 && getMuteTimeout() < currentTime && isMuted())
|
if (getMuteTimeout() > 0 && getMuteTimeout() < currentTime && isMuted())
|
||||||
{
|
{
|
||||||
setMuteTimeout(0);
|
setMuteTimeout(0);
|
||||||
sendMessage(Util.i18n("canTalkAgain"));
|
sendMessage(_("canTalkAgain"));
|
||||||
setMuted(false);
|
setMuted(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -458,7 +459,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
setAfk(false);
|
setAfk(false);
|
||||||
if (broadcast && !isHidden())
|
if (broadcast && !isHidden())
|
||||||
{
|
{
|
||||||
ess.broadcastMessage(this, Util.format("userIsNotAway", getDisplayName()));
|
ess.broadcastMessage(this, _("userIsNotAway", getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastActivity = System.currentTimeMillis();
|
lastActivity = System.currentTimeMillis();
|
||||||
@ -470,7 +471,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
if (autoafkkick > 0 && lastActivity + autoafkkick * 1000 < System.currentTimeMillis()
|
if (autoafkkick > 0 && lastActivity + autoafkkick * 1000 < System.currentTimeMillis()
|
||||||
&& !isHidden() && !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt"))
|
&& !isHidden() && !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt"))
|
||||||
{
|
{
|
||||||
final String kickReason = Util.format("autoAfkKickReason", autoafkkick / 60.0);
|
final String kickReason = _("autoAfkKickReason", autoafkkick / 60.0);
|
||||||
kickPlayer(kickReason);
|
kickPlayer(kickReason);
|
||||||
|
|
||||||
|
|
||||||
@ -479,7 +480,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
final User user = ess.getUser(player);
|
final User user = ess.getUser(player);
|
||||||
if (user.isAuthorized("essentials.kick.notify"))
|
if (user.isAuthorized("essentials.kick.notify"))
|
||||||
{
|
{
|
||||||
player.sendMessage(Util.format("playerKicked", Console.NAME, getName(), kickReason));
|
player.sendMessage(_("playerKicked", Console.NAME, getName(), kickReason));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -489,7 +490,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
setAfk(true);
|
setAfk(true);
|
||||||
if (!isHidden())
|
if (!isHidden())
|
||||||
{
|
{
|
||||||
ess.broadcastMessage(this, Util.format("userIsAway", getDisplayName()));
|
ess.broadcastMessage(this, _("userIsAway", getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -503,18 +500,18 @@ public abstract class UserData extends PlayerExtension implements IConf
|
|||||||
|
|
||||||
public boolean isIgnoredPlayer(String name)
|
public boolean isIgnoredPlayer(String name)
|
||||||
{
|
{
|
||||||
return ignoredPlayers.contains(name.toLowerCase());
|
return ignoredPlayers.contains(name.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIgnoredPlayer(String name, boolean set)
|
public void setIgnoredPlayer(String name, boolean set)
|
||||||
{
|
{
|
||||||
if (set)
|
if (set)
|
||||||
{
|
{
|
||||||
ignoredPlayers.add(name.toLowerCase());
|
ignoredPlayers.add(name.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ignoredPlayers.remove(name.toLowerCase());
|
ignoredPlayers.remove(name.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
setIgnoredPlayers(ignoredPlayers);
|
setIgnoredPlayers(ignoredPlayers);
|
||||||
}
|
}
|
||||||
@ -669,7 +666,6 @@ public abstract class UserData extends PlayerExtension implements IConf
|
|||||||
config.setProperty("timestamps.login", time);
|
config.setProperty("timestamps.login", time);
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private long lastLogout;
|
private long lastLogout;
|
||||||
|
|
||||||
private long _getLastLogout()
|
private long _getLastLogout()
|
||||||
@ -688,7 +684,6 @@ public abstract class UserData extends PlayerExtension implements IConf
|
|||||||
config.setProperty("timestamps.logout", time);
|
config.setProperty("timestamps.logout", time);
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String lastLoginAddress;
|
private String lastLoginAddress;
|
||||||
|
|
||||||
private String _getLastLoginAddress()
|
private String _getLastLoginAddress()
|
||||||
@ -707,7 +702,6 @@ public abstract class UserData extends PlayerExtension implements IConf
|
|||||||
config.setProperty("ipAddress", address);
|
config.setProperty("ipAddress", address);
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean afk;
|
private boolean afk;
|
||||||
|
|
||||||
private boolean getAfk()
|
private boolean getAfk()
|
||||||
@ -856,13 +850,13 @@ public abstract class UserData extends PlayerExtension implements IConf
|
|||||||
|
|
||||||
public Long getKitTimestamp(final String name)
|
public Long getKitTimestamp(final String name)
|
||||||
{
|
{
|
||||||
final Number num = (Number)kitTimestamps.get(name.toLowerCase());
|
final Number num = (Number)kitTimestamps.get(name.toLowerCase(Locale.ENGLISH));
|
||||||
return num == null ? null : num.longValue();
|
return num == null ? null : num.longValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKitTimestamp(final String name, final long time)
|
public void setKitTimestamp(final String name, final long time)
|
||||||
{
|
{
|
||||||
kitTimestamps.put(name.toLowerCase(), time);
|
kitTimestamps.put(name.toLowerCase(Locale.ENGLISH), time);
|
||||||
config.setProperty("timestamps.kits", kitTimestamps);
|
config.setProperty("timestamps.kits", kitTimestamps);
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import com.google.common.cache.CacheLoader;
|
|||||||
import com.google.common.collect.ConcurrentHashMultiset;
|
import com.google.common.collect.ConcurrentHashMultiset;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@ -47,7 +48,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final String name = string.substring(0, string.length() - 4);
|
final String name = string.substring(0, string.length() - 4);
|
||||||
keys.add(name.toLowerCase());
|
keys.add(name.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -55,14 +56,14 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
|||||||
|
|
||||||
public boolean userExists(final String name)
|
public boolean userExists(final String name)
|
||||||
{
|
{
|
||||||
return keys.contains(name.toLowerCase());
|
return keys.contains(name.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
public User getUser(final String name) throws NullPointerException
|
public User getUser(final String name) throws NullPointerException
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return users.get(name.toLowerCase());
|
return users.get(name.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
catch (ExecutionException ex)
|
catch (ExecutionException ex)
|
||||||
{
|
{
|
||||||
@ -77,7 +78,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
|||||||
{
|
{
|
||||||
if (player.getName().equalsIgnoreCase(name))
|
if (player.getName().equalsIgnoreCase(name))
|
||||||
{
|
{
|
||||||
keys.add(name.toLowerCase());
|
keys.add(name.toLowerCase(Locale.ENGLISH));
|
||||||
return new User(player, ess);
|
return new User(player, ess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -85,7 +86,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
|||||||
final File userFile = new File(userFolder, Util.sanitizeFileName(name) + ".yml");
|
final File userFile = new File(userFolder, Util.sanitizeFileName(name) + ".yml");
|
||||||
if (userFile.exists())
|
if (userFile.exists())
|
||||||
{
|
{
|
||||||
keys.add(name.toLowerCase());
|
keys.add(name.toLowerCase(Locale.ENGLISH));
|
||||||
return new User(new OfflinePlayer(name, ess), ess);
|
return new User(new OfflinePlayer(name, ess), ess);
|
||||||
}
|
}
|
||||||
throw new Exception("User not found!");
|
throw new Exception("User not found!");
|
||||||
@ -99,8 +100,8 @@ public class UserMap extends CacheLoader<String, User> implements IConf
|
|||||||
|
|
||||||
public void removeUser(final String name)
|
public void removeUser(final String name)
|
||||||
{
|
{
|
||||||
keys.remove(name.toLowerCase());
|
keys.remove(name.toLowerCase(Locale.ENGLISH));
|
||||||
users.invalidate(name.toLowerCase());
|
users.invalidate(name.toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<User> getAllUsers()
|
public Set<User> getAllUsers()
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import java.io.*;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.text.MessageFormat;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -27,7 +23,7 @@ public class Util
|
|||||||
|
|
||||||
public static String sanitizeFileName(String name)
|
public static String sanitizeFileName(String name)
|
||||||
{
|
{
|
||||||
return name.toLowerCase().replaceAll("[^a-z0-9]", "_");
|
return name.toLowerCase(Locale.ENGLISH).replaceAll("[^a-z0-9]", "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String formatDateDiff(long date)
|
public static String formatDateDiff(long date)
|
||||||
@ -43,7 +39,7 @@ public class Util
|
|||||||
boolean future = false;
|
boolean future = false;
|
||||||
if (toDate.equals(fromDate))
|
if (toDate.equals(fromDate))
|
||||||
{
|
{
|
||||||
return Util.i18n("now");
|
return _("now");
|
||||||
}
|
}
|
||||||
if (toDate.after(fromDate))
|
if (toDate.after(fromDate))
|
||||||
{
|
{
|
||||||
@ -62,18 +58,18 @@ public class Util
|
|||||||
};
|
};
|
||||||
String[] names = new String[]
|
String[] names = new String[]
|
||||||
{
|
{
|
||||||
Util.i18n("year"),
|
_("year"),
|
||||||
Util.i18n("years"),
|
_("years"),
|
||||||
Util.i18n("month"),
|
_("month"),
|
||||||
Util.i18n("months"),
|
_("months"),
|
||||||
Util.i18n("day"),
|
_("day"),
|
||||||
Util.i18n("days"),
|
_("days"),
|
||||||
Util.i18n("hour"),
|
_("hour"),
|
||||||
Util.i18n("hours"),
|
_("hours"),
|
||||||
Util.i18n("minute"),
|
_("minute"),
|
||||||
Util.i18n("minutes"),
|
_("minutes"),
|
||||||
Util.i18n("second"),
|
_("second"),
|
||||||
Util.i18n("seconds")
|
_("seconds")
|
||||||
};
|
};
|
||||||
for (int i = 0; i < types.length; i++)
|
for (int i = 0; i < types.length; i++)
|
||||||
{
|
{
|
||||||
@ -173,7 +169,7 @@ public class Util
|
|||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("illegalDate"));
|
throw new Exception(_("illegalDate"));
|
||||||
}
|
}
|
||||||
Calendar c = new GregorianCalendar();
|
Calendar c = new GregorianCalendar();
|
||||||
if (years > 0)
|
if (years > 0)
|
||||||
@ -206,12 +202,12 @@ public class Util
|
|||||||
}
|
}
|
||||||
return c.getTimeInMillis();
|
return c.getTimeInMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
// The player can stand inside these materials
|
// The player can stand inside these materials
|
||||||
private static final Set<Integer> AIR_MATERIALS = new HashSet<Integer>();
|
private static final Set<Integer> AIR_MATERIALS = new HashSet<Integer>();
|
||||||
private static final HashSet<Byte> AIR_MATERIALS_TARGET = new HashSet<Byte>();
|
private static final HashSet<Byte> AIR_MATERIALS_TARGET = new HashSet<Byte>();
|
||||||
|
|
||||||
static {
|
static
|
||||||
|
{
|
||||||
AIR_MATERIALS.add(Material.AIR.getId());
|
AIR_MATERIALS.add(Material.AIR.getId());
|
||||||
AIR_MATERIALS.add(Material.SAPLING.getId());
|
AIR_MATERIALS.add(Material.SAPLING.getId());
|
||||||
AIR_MATERIALS.add(Material.POWERED_RAIL.getId());
|
AIR_MATERIALS.add(Material.POWERED_RAIL.getId());
|
||||||
@ -254,9 +250,11 @@ public class Util
|
|||||||
AIR_MATERIALS_TARGET.add((byte)Material.STATIONARY_WATER.getId());
|
AIR_MATERIALS_TARGET.add((byte)Material.STATIONARY_WATER.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Location getTarget(final LivingEntity entity) throws Exception {
|
public static Location getTarget(final LivingEntity entity) throws Exception
|
||||||
|
{
|
||||||
final Block block = entity.getTargetBlock(AIR_MATERIALS_TARGET, 300);
|
final Block block = entity.getTargetBlock(AIR_MATERIALS_TARGET, 300);
|
||||||
if (block == null) {
|
if (block == null)
|
||||||
|
{
|
||||||
throw new Exception("Not targeting a block");
|
throw new Exception("Not targeting a block");
|
||||||
}
|
}
|
||||||
return block.getLocation();
|
return block.getLocation();
|
||||||
@ -266,7 +264,7 @@ public class Util
|
|||||||
{
|
{
|
||||||
if (loc == null || loc.getWorld() == null)
|
if (loc == null || loc.getWorld() == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("destinationNotSet"));
|
throw new Exception(_("destinationNotSet"));
|
||||||
}
|
}
|
||||||
final World world = loc.getWorld();
|
final World world = loc.getWorld();
|
||||||
int x = loc.getBlockX();
|
int x = loc.getBlockX();
|
||||||
@ -300,7 +298,7 @@ public class Util
|
|||||||
x += 1;
|
x += 1;
|
||||||
if (x - 32 > loc.getBlockX())
|
if (x - 32 > loc.getBlockX())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("holeInFloor"));
|
throw new Exception(_("holeInFloor"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -349,170 +347,6 @@ public class Util
|
|||||||
return Math.round(d * 100.0) / 100.0;
|
return Math.round(d * 100.0) / 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Locale getCurrentLocale()
|
|
||||||
{
|
|
||||||
return currentLocale;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static class ConfigClassLoader extends ClassLoader
|
|
||||||
{
|
|
||||||
private final transient File dataFolder;
|
|
||||||
private final transient ClassLoader cl;
|
|
||||||
private final transient IEssentials ess;
|
|
||||||
|
|
||||||
public ConfigClassLoader(final ClassLoader cl, final IEssentials ess)
|
|
||||||
{
|
|
||||||
this.ess = ess;
|
|
||||||
this.dataFolder = ess.getDataFolder();
|
|
||||||
this.cl = cl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public URL getResource(final String string)
|
|
||||||
{
|
|
||||||
final File file = new File(dataFolder, string);
|
|
||||||
if (file.exists())
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return file.toURI().toURL();
|
|
||||||
}
|
|
||||||
catch (MalformedURLException ex)
|
|
||||||
{
|
|
||||||
return cl.getResource(string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cl.getResource(string);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void clearAssertionStatus()
|
|
||||||
{
|
|
||||||
cl.clearAssertionStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public InputStream getResourceAsStream(final String string)
|
|
||||||
{
|
|
||||||
final File file = new File(dataFolder, string);
|
|
||||||
if (file.exists())
|
|
||||||
{
|
|
||||||
BufferedReader br = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
br = new BufferedReader(new FileReader(file));
|
|
||||||
final String version = br.readLine();
|
|
||||||
|
|
||||||
if (version == null || !version.equals("#version: " + ess.getDescription().getVersion()))
|
|
||||||
{
|
|
||||||
logger.log(Level.WARNING, String.format("Translation file %s is not updated for Essentials version. Will use default.", file));
|
|
||||||
return cl.getResourceAsStream(string);
|
|
||||||
}
|
|
||||||
return new FileInputStream(file);
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
return cl.getResourceAsStream(string);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (br != null)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
br.close();
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cl.getResourceAsStream(string);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Enumeration<URL> getResources(final String string) throws IOException
|
|
||||||
{
|
|
||||||
return cl.getResources(string);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<?> loadClass(final String string) throws ClassNotFoundException
|
|
||||||
{
|
|
||||||
return cl.loadClass(string);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void setClassAssertionStatus(final String string, final boolean bln)
|
|
||||||
{
|
|
||||||
cl.setClassAssertionStatus(string, bln);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void setDefaultAssertionStatus(final boolean bln)
|
|
||||||
{
|
|
||||||
cl.setDefaultAssertionStatus(bln);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void setPackageAssertionStatus(final String string, final boolean bln)
|
|
||||||
{
|
|
||||||
cl.setPackageAssertionStatus(string, bln);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private static final Locale defaultLocale = Locale.getDefault();
|
|
||||||
private static Locale currentLocale = defaultLocale;
|
|
||||||
private static ResourceBundle bundle = ResourceBundle.getBundle("messages", defaultLocale);
|
|
||||||
private static ResourceBundle defaultBundle = ResourceBundle.getBundle("messages", Locale.US);
|
|
||||||
|
|
||||||
public static String i18n(String string)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return bundle.getString(string);
|
|
||||||
}
|
|
||||||
catch (MissingResourceException ex)
|
|
||||||
{
|
|
||||||
logger.log(Level.WARNING, String.format("Missing translation key \"%s\" in translation file %s", ex.getKey(), bundle.getLocale().toString()), ex);
|
|
||||||
return defaultBundle.getString(string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String format(String string, Object... objects)
|
|
||||||
{
|
|
||||||
MessageFormat mf = new MessageFormat(i18n(string));
|
|
||||||
return mf.format(objects);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void updateLocale(String loc, IEssentials ess)
|
|
||||||
{
|
|
||||||
if (loc == null || loc.isEmpty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String[] parts = loc.split("[_\\.]");
|
|
||||||
if (parts.length == 1)
|
|
||||||
{
|
|
||||||
currentLocale = new Locale(parts[0]);
|
|
||||||
}
|
|
||||||
if (parts.length == 2)
|
|
||||||
{
|
|
||||||
currentLocale = new Locale(parts[0], parts[1]);
|
|
||||||
}
|
|
||||||
if (parts.length == 3)
|
|
||||||
{
|
|
||||||
currentLocale = new Locale(parts[0], parts[1], parts[2]);
|
|
||||||
}
|
|
||||||
logger.log(Level.INFO, String.format("Using locale %s", currentLocale.toString()));
|
|
||||||
bundle = ResourceBundle.getBundle("messages", currentLocale, new ConfigClassLoader(Util.class.getClassLoader(), ess));
|
|
||||||
if (!bundle.keySet().containsAll(defaultBundle.keySet()))
|
|
||||||
{
|
|
||||||
logger.log(Level.WARNING, String.format("Translation file %s does not contain all translation keys.", currentLocale.toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String joinList(Object... list)
|
public static String joinList(Object... list)
|
||||||
{
|
{
|
||||||
return joinList(", ", list);
|
return joinList(", ", list);
|
||||||
@ -546,9 +380,4 @@ public class Util
|
|||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String capitalCase(String s)
|
|
||||||
{
|
|
||||||
return s.toUpperCase().charAt(0) + s.toLowerCase().substring(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@ -47,7 +48,7 @@ public class Warps implements IConf
|
|||||||
EssentialsConf conf = warpPoints.get(new StringIgnoreCase(warp));
|
EssentialsConf conf = warpPoints.get(new StringIgnoreCase(warp));
|
||||||
if (conf == null)
|
if (conf == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("warpNotExist"));
|
throw new Exception(_("warpNotExist"));
|
||||||
}
|
}
|
||||||
return conf.getLocation(null, server);
|
return conf.getLocation(null, server);
|
||||||
}
|
}
|
||||||
@ -61,7 +62,7 @@ public class Warps implements IConf
|
|||||||
File confFile = new File(warpsFolder, filename + ".yml");
|
File confFile = new File(warpsFolder, filename + ".yml");
|
||||||
if (confFile.exists())
|
if (confFile.exists())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("similarWarpExist"));
|
throw new Exception(_("similarWarpExist"));
|
||||||
}
|
}
|
||||||
conf = new EssentialsConf(confFile);
|
conf = new EssentialsConf(confFile);
|
||||||
warpPoints.put(new StringIgnoreCase(name), conf);
|
warpPoints.put(new StringIgnoreCase(name), conf);
|
||||||
@ -76,11 +77,11 @@ public class Warps implements IConf
|
|||||||
EssentialsConf conf = warpPoints.get(new StringIgnoreCase(name));
|
EssentialsConf conf = warpPoints.get(new StringIgnoreCase(name));
|
||||||
if (conf == null)
|
if (conf == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("warpNotExist"));
|
throw new Exception(_("warpNotExist"));
|
||||||
}
|
}
|
||||||
if (!conf.getFile().delete())
|
if (!conf.getFile().delete())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("warpDeleteError"));
|
throw new Exception(_("warpDeleteError"));
|
||||||
}
|
}
|
||||||
warpPoints.remove(new StringIgnoreCase(name));
|
warpPoints.remove(new StringIgnoreCase(name));
|
||||||
}
|
}
|
||||||
@ -109,7 +110,7 @@ public class Warps implements IConf
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.log(Level.WARNING, Util.format("loadWarpError", filename), ex);
|
logger.log(Level.WARNING, _("loadWarpError", filename), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,7 +130,7 @@ public class Warps implements IConf
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
return getString().toLowerCase().hashCode();
|
return getString().toLowerCase(Locale.ENGLISH).hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.earth2me.essentials;
|
package com.earth2me.essentials;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ public class Worth implements IConf
|
|||||||
|
|
||||||
public double getPrice(ItemStack itemStack)
|
public double getPrice(ItemStack itemStack)
|
||||||
{
|
{
|
||||||
String itemname = itemStack.getType().toString().toLowerCase().replace("_", "");
|
String itemname = itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
|
||||||
double result;
|
double result;
|
||||||
result = config.getDouble("worth." + itemname + "." + itemStack.getDurability(), Double.NaN);
|
result = config.getDouble("worth." + itemname + "." + itemStack.getDurability(), Double.NaN);
|
||||||
if (Double.isNaN(result))
|
if (Double.isNaN(result))
|
||||||
@ -41,12 +42,12 @@ public class Worth implements IConf
|
|||||||
{
|
{
|
||||||
if (itemStack.getType().getData() == null)
|
if (itemStack.getType().getData() == null)
|
||||||
{
|
{
|
||||||
config.setProperty("worth." + itemStack.getType().toString().toLowerCase().replace("_", ""), price);
|
config.setProperty("worth." + itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", ""), price);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Bukkit-bug: getDurability still contains the correct value, while getData().getData() is 0.
|
// Bukkit-bug: getDurability still contains the correct value, while getData().getData() is 0.
|
||||||
config.setProperty("worth." + itemStack.getType().toString().toLowerCase().replace("_", "") + "." + itemStack.getDurability(), price);
|
config.setProperty("worth." + itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "") + "." + itemStack.getDurability(), price);
|
||||||
}
|
}
|
||||||
config.removeProperty("worth-" + itemStack.getTypeId());
|
config.removeProperty("worth-" + itemStack.getTypeId());
|
||||||
config.save();
|
config.save();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.earth2me.essentials.api;
|
package com.earth2me.essentials.api;
|
||||||
|
|
||||||
import com.earth2me.essentials.EssentialsConf;
|
import com.earth2me.essentials.EssentialsConf;
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.IEssentials;
|
import com.earth2me.essentials.IEssentials;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
@ -59,7 +60,7 @@ public final class Economy
|
|||||||
{
|
{
|
||||||
if (!config.delete())
|
if (!config.delete())
|
||||||
{
|
{
|
||||||
logger.log(Level.WARNING, Util.format("deleteFileError", config));
|
logger.log(Level.WARNING, _("deleteFileError", config));
|
||||||
}
|
}
|
||||||
ess.getUserMap().removeUser(name);
|
ess.getUserMap().removeUser(name);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package com.earth2me.essentials.api;
|
package com.earth2me.essentials.api;
|
||||||
|
|
||||||
import com.earth2me.essentials.Util;
|
import static com.earth2me.essentials.I18n._;
|
||||||
|
|
||||||
|
|
||||||
public class NoLoanPermittedException extends Exception
|
public class NoLoanPermittedException extends Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
public NoLoanPermittedException()
|
public NoLoanPermittedException()
|
||||||
{
|
{
|
||||||
super(Util.i18n("negativeBalanceError"));
|
super(_("negativeBalanceError"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package com.earth2me.essentials.api;
|
package com.earth2me.essentials.api;
|
||||||
|
|
||||||
import com.earth2me.essentials.Util;
|
import static com.earth2me.essentials.I18n._;
|
||||||
|
|
||||||
|
|
||||||
public class UserDoesNotExistException extends Exception
|
public class UserDoesNotExistException extends Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
public UserDoesNotExistException(String name)
|
public UserDoesNotExistException(String name)
|
||||||
{
|
{
|
||||||
super(Util.format("userDoesNotExist", name));
|
super(_("userDoesNotExist", name));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -33,19 +33,19 @@ public class Commandafk extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (!user.toggleAfk())
|
if (!user.toggleAfk())
|
||||||
{
|
{
|
||||||
//user.sendMessage(Util.i18n("markedAsNotAway"));
|
//user.sendMessage(_("markedAsNotAway"));
|
||||||
if (!user.isHidden())
|
if (!user.isHidden())
|
||||||
{
|
{
|
||||||
ess.broadcastMessage(user, Util.format("userIsNotAway", user.getDisplayName()));
|
ess.broadcastMessage(user, _("userIsNotAway", user.getDisplayName()));
|
||||||
}
|
}
|
||||||
user.updateActivity(false);
|
user.updateActivity(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//user.sendMessage(Util.i18n("markedAsAway"));
|
//user.sendMessage(_("markedAsAway"));
|
||||||
if (!user.isHidden())
|
if (!user.isHidden())
|
||||||
{
|
{
|
||||||
ess.broadcastMessage(user, Util.format("userIsAway", user.getDisplayName()));
|
ess.broadcastMessage(user, _("userIsAway", user.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -18,7 +18,7 @@ public class Commandback extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
final Trade charge = new Trade(this.getName(), ess);
|
final Trade charge = new Trade(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.sendMessage(Util.i18n("backUsageMsg"));
|
user.sendMessage(_("backUsageMsg"));
|
||||||
user.getTeleport().back(charge);
|
user.getTeleport().back(charge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Backup;
|
import com.earth2me.essentials.Backup;
|
||||||
import com.earth2me.essentials.Util;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@ -22,6 +22,6 @@ public class Commandbackup extends EssentialsCommand
|
|||||||
throw new Exception();
|
throw new Exception();
|
||||||
}
|
}
|
||||||
backup.run();
|
backup.run();
|
||||||
sender.sendMessage(Util.i18n("backupStarted"));
|
sender.sendMessage(_("backupStarted"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -20,7 +21,7 @@ public class Commandbalance extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
sender.sendMessage(Util.format("balance", Util.formatCurrency(getPlayer(server, args, 0, true).getMoney(), ess)));
|
sender.sendMessage(_("balance", Util.formatCurrency(getPlayer(server, args, 0, true).getMoney(), ess)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -31,6 +32,6 @@ public class Commandbalance extends EssentialsCommand
|
|||||||
|| user.isAuthorized("essentials.balance.other"))
|
|| user.isAuthorized("essentials.balance.other"))
|
||||||
? user
|
? user
|
||||||
: getPlayer(server, args, 0, true)).getMoney();
|
: getPlayer(server, args, 0, true)).getMoney();
|
||||||
user.sendMessage(Util.format("balance", Util.formatCurrency(bal, ess)));
|
user.sendMessage(_("balance", Util.formatCurrency(bal, ess)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -49,7 +50,7 @@ public class Commandbalancetop extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
int count = 0;
|
int count = 0;
|
||||||
sender.sendMessage(Util.format("balanceTop", max));
|
sender.sendMessage(_("balanceTop", max));
|
||||||
for (Map.Entry<User, Double> entry : sortedEntries)
|
for (Map.Entry<User, Double> entry : sortedEntries)
|
||||||
{
|
{
|
||||||
if (count == max)
|
if (count == max)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Console;
|
import com.earth2me.essentials.Console;
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.OfflinePlayer;
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -29,7 +29,7 @@ public class Commandban extends EssentialsCommand
|
|||||||
if (sender instanceof Player
|
if (sender instanceof Player
|
||||||
&& !ess.getUser(sender).isAuthorized("essentials.ban.offline"))
|
&& !ess.getUser(sender).isAuthorized("essentials.ban.offline"))
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.i18n("banExempt"));
|
sender.sendMessage(_("banExempt"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ public class Commandban extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (user.isAuthorized("essentials.ban.exempt"))
|
if (user.isAuthorized("essentials.ban.exempt"))
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.i18n("banExempt"));
|
sender.sendMessage(_("banExempt"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,7 +50,7 @@ public class Commandban extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
banReason = Util.i18n("defaultBanReason");
|
banReason = _("defaultBanReason");
|
||||||
}
|
}
|
||||||
user.setBanned(true);
|
user.setBanned(true);
|
||||||
user.kickPlayer(banReason);
|
user.kickPlayer(banReason);
|
||||||
@ -61,7 +61,7 @@ public class Commandban extends EssentialsCommand
|
|||||||
final User player = ess.getUser(onlinePlayer);
|
final User player = ess.getUser(onlinePlayer);
|
||||||
if (player.isAuthorized("essentials.ban.notify"))
|
if (player.isAuthorized("essentials.ban.notify"))
|
||||||
{
|
{
|
||||||
onlinePlayer.sendMessage(Util.format("playerBanned", senderName, user.getName(), banReason));
|
onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@ -26,17 +26,17 @@ public class Commandbanip extends EssentialsCommand
|
|||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
ess.getServer().banIP(args[0]);
|
ess.getServer().banIP(args[0]);
|
||||||
sender.sendMessage(Util.i18n("banIpAddress"));
|
sender.sendMessage(_("banIpAddress"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final String ipAddress = player.getLastLoginAddress();
|
final String ipAddress = player.getLastLoginAddress();
|
||||||
if (ipAddress.length() == 0)
|
if (ipAddress.length() == 0)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
ess.getServer().banIP(player.getLastLoginAddress());
|
ess.getServer().banIP(player.getLastLoginAddress());
|
||||||
sender.sendMessage(Util.i18n("banIpAddress"));
|
sender.sendMessage(_("banIpAddress"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -36,11 +37,11 @@ public class Commandbigtree extends EssentialsCommand
|
|||||||
final boolean success = user.getWorld().generateTree(safeLocation, tree);
|
final boolean success = user.getWorld().generateTree(safeLocation, tree);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("bigTreeSuccess"));
|
user.sendMessage(_("bigTreeSuccess"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("bigTreeFailure"));
|
throw new Exception(_("bigTreeFailure"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Util;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@ -20,6 +20,6 @@ public class Commandbroadcast extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
ess.broadcastMessage(null, Util.format("broadcast", getFinalArg(args, 0)));
|
ess.broadcastMessage(null, _("broadcast", getFinalArg(args, 0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Util;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -24,7 +24,7 @@ public class Commandburn extends EssentialsCommand
|
|||||||
for (Player p : server.matchPlayer(args[0]))
|
for (Player p : server.matchPlayer(args[0]))
|
||||||
{
|
{
|
||||||
p.setFireTicks(Integer.parseInt(args[1]) * 20);
|
p.setFireTicks(Integer.parseInt(args[1]) * 20);
|
||||||
sender.sendMessage(Util.format("burnMsg", p.getDisplayName(), Integer.parseInt(args[1])));
|
sender.sendMessage(_("burnMsg", p.getDisplayName(), Integer.parseInt(args[1])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -31,11 +31,11 @@ public class Commandclearinventory extends EssentialsCommand
|
|||||||
for (Player p : online)
|
for (Player p : online)
|
||||||
{
|
{
|
||||||
p.getInventory().clear();
|
p.getInventory().clear();
|
||||||
user.sendMessage(Util.format("inventoryClearedOthers", p.getDisplayName()));
|
user.sendMessage(_("inventoryClearedOthers", p.getDisplayName()));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new Exception(Util.i18n("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -43,18 +43,18 @@ public class Commandclearinventory extends EssentialsCommand
|
|||||||
if (p != null)
|
if (p != null)
|
||||||
{
|
{
|
||||||
p.getInventory().clear();
|
p.getInventory().clear();
|
||||||
user.sendMessage(Util.format("inventoryClearedOthers", p.getDisplayName()));
|
user.sendMessage(_("inventoryClearedOthers", p.getDisplayName()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user.getInventory().clear();
|
user.getInventory().clear();
|
||||||
user.sendMessage(Util.i18n("inventoryCleared"));
|
user.sendMessage(_("inventoryCleared"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,11 +75,11 @@ public class Commandclearinventory extends EssentialsCommand
|
|||||||
for (Player p : online)
|
for (Player p : online)
|
||||||
{
|
{
|
||||||
p.getInventory().clear();
|
p.getInventory().clear();
|
||||||
sender.sendMessage(Util.format("inventoryClearedOthers", p.getDisplayName()));
|
sender.sendMessage(_("inventoryClearedOthers", p.getDisplayName()));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new Exception(Util.i18n("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -87,11 +87,11 @@ public class Commandclearinventory extends EssentialsCommand
|
|||||||
if (u != null)
|
if (u != null)
|
||||||
{
|
{
|
||||||
u.getInventory().clear();
|
u.getInventory().clear();
|
||||||
sender.sendMessage(Util.format("inventoryClearedOthers", u.getDisplayName()));
|
sender.sendMessage(_("inventoryClearedOthers", u.getDisplayName()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -53,6 +53,6 @@ public class Commandcompass extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
dir = "N";
|
dir = "N";
|
||||||
}
|
}
|
||||||
user.sendMessage(Util.format("compassBearing", dir, bearing));
|
user.sendMessage(_("compassBearing", dir, bearing));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import java.util.Locale;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ public class Commanddelhome extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
name = expandedArgs[0];
|
name = expandedArgs[0];
|
||||||
}
|
}
|
||||||
user.delHome(name.toLowerCase());
|
user.delHome(name.toLowerCase(Locale.ENGLISH));
|
||||||
sender.sendMessage(Util.format("deleteHome", name));
|
sender.sendMessage(_("deleteHome", name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Util;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@ -20,6 +20,6 @@ public class Commanddeljail extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
ess.getJail().delJail(args[0]);
|
ess.getJail().delJail(args[0]);
|
||||||
sender.sendMessage(Util.format("deleteJail", args[0]));
|
sender.sendMessage(_("deleteJail", args[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Util;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@ -20,6 +20,6 @@ public class Commanddelwarp extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
ess.getWarps().delWarp(args[0]);
|
ess.getWarps().delWarp(args[0]);
|
||||||
sender.sendMessage(Util.format("deleteWarp", args[0]));
|
sender.sendMessage(_("deleteWarp", args[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -18,15 +18,15 @@ public class Commanddepth extends EssentialsCommand
|
|||||||
final int depth = user.getLocation().getBlockY() - 63;
|
final int depth = user.getLocation().getBlockY() - 63;
|
||||||
if (depth > 0)
|
if (depth > 0)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.format("depthAboveSea", depth));
|
user.sendMessage(_("depthAboveSea", depth));
|
||||||
}
|
}
|
||||||
else if (depth < 0)
|
else if (depth < 0)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.format("depthBelowSea", (-depth)));
|
user.sendMessage(_("depthBelowSea", (-depth)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("depth"));
|
user.sendMessage(_("depth"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Util;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -108,7 +108,7 @@ public class Commandessentials extends EssentialsCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ess.reload();
|
ess.reload();
|
||||||
sender.sendMessage(Util.format("essentialsReload", ess.getDescription().getVersion()));
|
sender.sendMessage(_("essentialsReload", ess.getDescription().getVersion()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopTune()
|
private void stopTune()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -31,7 +31,7 @@ public class Commandext extends EssentialsCommand
|
|||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
user.setFireTicks(0);
|
user.setFireTicks(0);
|
||||||
user.sendMessage(Util.i18n("extinguish"));
|
user.sendMessage(_("extinguish"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ public class Commandext extends EssentialsCommand
|
|||||||
for (Player matchPlayer : server.matchPlayer(name))
|
for (Player matchPlayer : server.matchPlayer(name))
|
||||||
{
|
{
|
||||||
matchPlayer.setFireTicks(0);
|
matchPlayer.setFireTicks(0);
|
||||||
sender.sendMessage(Util.format("extinguishOthers", matchPlayer.getDisplayName()));
|
sender.sendMessage(_("extinguishOthers", matchPlayer.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import java.util.Locale;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -36,7 +37,7 @@ public class Commandgamemode extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
user.setGameMode(user.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
|
user.setGameMode(user.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
|
||||||
user.sendMessage(Util.format("gameMode", Util.i18n(user.getGameMode().toString().toLowerCase()), user.getDisplayName()));
|
user.sendMessage(_("gameMode", _(user.getGameMode().toString().toLowerCase(Locale.ENGLISH)), user.getDisplayName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final String name)
|
private void gamemodeOtherPlayers(final Server server, final CommandSender sender, final String name)
|
||||||
@ -50,9 +51,7 @@ public class Commandgamemode extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
|
player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
|
||||||
sender.sendMessage(Util.format("gameMode", Util.i18n(player.getGameMode().toString().toLowerCase()), player.getDisplayName()));
|
sender.sendMessage(_("gameMode", _(player.getGameMode().toString().toLowerCase(Locale.ENGLISH)), player.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Util;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -16,16 +16,16 @@ public class Commandgc extends EssentialsCommand
|
|||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("gcmax", (Runtime.getRuntime().maxMemory() / 1024 / 1024)));
|
sender.sendMessage(_("gcmax", (Runtime.getRuntime().maxMemory() / 1024 / 1024)));
|
||||||
sender.sendMessage(Util.format("gctotal", (Runtime.getRuntime().totalMemory() / 1024 / 1024)));
|
sender.sendMessage(_("gctotal", (Runtime.getRuntime().totalMemory() / 1024 / 1024)));
|
||||||
sender.sendMessage(Util.format("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024)));
|
sender.sendMessage(_("gcfree", (Runtime.getRuntime().freeMemory() / 1024 / 1024)));
|
||||||
|
|
||||||
for (World w : server.getWorlds())
|
for (World w : server.getWorlds())
|
||||||
{
|
{
|
||||||
sender.sendMessage(
|
sender.sendMessage(
|
||||||
(w.getEnvironment() == World.Environment.NETHER ? "Nether" : "World") + " \"" + w.getName() + "\": "
|
(w.getEnvironment() == World.Environment.NETHER ? "Nether" : "World") + " \"" + w.getName() + "\": "
|
||||||
+ w.getLoadedChunks().length + Util.i18n("gcchunks")
|
+ w.getLoadedChunks().length + _("gcchunks")
|
||||||
+ w.getEntities().size() + Util.i18n("gcentities"));
|
+ w.getEntities().size() + _("gcentities"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
|
import java.util.Locale;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -27,7 +28,7 @@ public class Commandgive extends EssentialsCommand
|
|||||||
|
|
||||||
final ItemStack stack = ess.getItemDb().get(args[1]);
|
final ItemStack stack = ess.getItemDb().get(args[1]);
|
||||||
|
|
||||||
final String itemname = stack.getType().toString().toLowerCase().replace("_", "");
|
final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
|
||||||
if (sender instanceof Player
|
if (sender instanceof Player
|
||||||
&& (ess.getSettings().permissionBasedItemSpawn()
|
&& (ess.getSettings().permissionBasedItemSpawn()
|
||||||
? (!ess.getUser(sender).isAuthorized("essentials.give.item-all")
|
? (!ess.getUser(sender).isAuthorized("essentials.give.item-all")
|
||||||
@ -49,7 +50,7 @@ public class Commandgive extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
final User giveTo = getPlayer(server, args, 0);
|
final User giveTo = getPlayer(server, args, 0);
|
||||||
final String itemName = stack.getType().toString().toLowerCase().replace('_', ' ');
|
final String itemName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
|
||||||
sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + ".");
|
sender.sendMessage(ChatColor.BLUE + "Giving " + stack.getAmount() + " of " + itemName + " to " + giveTo.getDisplayName() + ".");
|
||||||
giveTo.getInventory().addItem(stack);
|
giveTo.getInventory().addItem(stack);
|
||||||
giveTo.updateInventory();
|
giveTo.updateInventory();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -34,7 +34,7 @@ public class Commandgod extends EssentialsCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
user.sendMessage(Util.format("godMode", (user.toggleGodModeEnabled()? Util.i18n("enabled") : Util.i18n("disabled"))));
|
user.sendMessage(_("godMode", (user.toggleGodModeEnabled() ? _("enabled") : _("disabled"))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void godOtherPlayers(final Server server, final CommandSender sender, final String name)
|
private void godOtherPlayers(final Server server, final CommandSender sender, final String name)
|
||||||
@ -47,8 +47,8 @@ public class Commandgod extends EssentialsCommand
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final boolean enabled = player.toggleGodModeEnabled();
|
final boolean enabled = player.toggleGodModeEnabled();
|
||||||
player.sendMessage(Util.format("godMode", (enabled ? Util.i18n("enabled") : Util.i18n("disabled"))));
|
player.sendMessage(_("godMode", (enabled ? _("enabled") : _("disabled"))));
|
||||||
sender.sendMessage(Util.format("godMode",Util.format(enabled ? "godEnabledFor": "godDisabledFor", matchPlayer.getDisplayName())));
|
sender.sendMessage(_("godMode", _(enabled ? "godEnabledFor" : "godDisabledFor", matchPlayer.getDisplayName())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -35,7 +35,7 @@ public class Commandheal extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
user.setHealth(20);
|
user.setHealth(20);
|
||||||
user.setFoodLevel(20);
|
user.setFoodLevel(20);
|
||||||
user.sendMessage(Util.i18n("heal"));
|
user.sendMessage(_("heal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -54,7 +54,7 @@ public class Commandheal extends EssentialsCommand
|
|||||||
final List<Player> players = server.matchPlayer(name);
|
final List<Player> players = server.matchPlayer(name);
|
||||||
if (players.isEmpty())
|
if (players.isEmpty())
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.i18n("playerNotFound"));
|
sender.sendMessage(_("playerNotFound"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Player p : players)
|
for (Player p : players)
|
||||||
@ -64,7 +64,7 @@ public class Commandheal extends EssentialsCommand
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
p.setHealth(20);
|
p.setHealth(20);
|
||||||
sender.sendMessage(Util.format("healOther", p.getDisplayName()));
|
sender.sendMessage(_("healOther", p.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
@ -8,6 +9,7 @@ import java.io.FileReader;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -40,7 +42,7 @@ public class Commandhelp extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (args.length > 0)
|
if (args.length > 0)
|
||||||
{
|
{
|
||||||
match = args[0].toLowerCase();
|
match = args[0].toLowerCase(Locale.ENGLISH);
|
||||||
page = Integer.parseInt(args[args.length - 1]);
|
page = Integer.parseInt(args[args.length - 1]);
|
||||||
if (args.length == 1)
|
if (args.length == 1)
|
||||||
{
|
{
|
||||||
@ -53,20 +55,20 @@ public class Commandhelp extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (args.length == 1)
|
if (args.length == 1)
|
||||||
{
|
{
|
||||||
match = args[0].toLowerCase();
|
match = args[0].toLowerCase(Locale.ENGLISH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<String> lines = getHelpLines(user, match);
|
final List<String> lines = getHelpLines(user, match);
|
||||||
if (lines.isEmpty())
|
if (lines.isEmpty())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("noHelpFound"));
|
throw new Exception(_("noHelpFound"));
|
||||||
}
|
}
|
||||||
|
|
||||||
final int start = (page - 1) * 9;
|
final int start = (page - 1) * 9;
|
||||||
final int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0);
|
final int pages = lines.size() / 9 + (lines.size() % 9 > 0 ? 1 : 0);
|
||||||
|
|
||||||
user.sendMessage(Util.format("helpPages", page, pages));
|
user.sendMessage(_("helpPages", page, pages));
|
||||||
for (int i = start; i < lines.size() && i < start + 9; i++)
|
for (int i = start; i < lines.size() && i < start + 9; i++)
|
||||||
{
|
{
|
||||||
user.sendMessage(lines.get(i));
|
user.sendMessage(lines.get(i));
|
||||||
@ -76,7 +78,7 @@ public class Commandhelp extends EssentialsCommand
|
|||||||
@Override
|
@Override
|
||||||
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.i18n("helpConsole"));
|
sender.sendMessage(_("helpConsole"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("CallToThreadDumpStack")
|
@SuppressWarnings("CallToThreadDumpStack")
|
||||||
@ -101,7 +103,8 @@ public class Commandhelp extends EssentialsCommand
|
|||||||
while (bufferedReader.ready())
|
while (bufferedReader.ready())
|
||||||
{
|
{
|
||||||
final String line = bufferedReader.readLine();
|
final String line = bufferedReader.readLine();
|
||||||
if (line == null) {
|
if (line == null)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
retval.add(line.replace('&', '§'));
|
retval.add(line.replace('&', '§'));
|
||||||
@ -122,15 +125,15 @@ public class Commandhelp extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
final PluginDescriptionFile desc = p.getDescription();
|
final PluginDescriptionFile desc = p.getDescription();
|
||||||
final HashMap<String, HashMap<String, Object>> cmds = (HashMap<String, HashMap<String, Object>>)desc.getCommands();
|
final HashMap<String, HashMap<String, Object>> cmds = (HashMap<String, HashMap<String, Object>>)desc.getCommands();
|
||||||
pluginName = p.getDescription().getName().toLowerCase();
|
pluginName = p.getDescription().getName().toLowerCase(Locale.ENGLISH);
|
||||||
for (Entry<String, HashMap<String, Object>> k : cmds.entrySet())
|
for (Entry<String, HashMap<String, Object>> k : cmds.entrySet())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ((!match.equalsIgnoreCase(""))
|
if ((!match.equalsIgnoreCase(""))
|
||||||
&& (!k.getKey().toLowerCase().contains(match))
|
&& (!k.getKey().toLowerCase(Locale.ENGLISH).contains(match))
|
||||||
&& (!(k.getValue().get(DESCRIPTION) instanceof String
|
&& (!(k.getValue().get(DESCRIPTION) instanceof String
|
||||||
&& ((String)k.getValue().get(DESCRIPTION)).toLowerCase().contains(match)))
|
&& ((String)k.getValue().get(DESCRIPTION)).toLowerCase(Locale.ENGLISH).contains(match)))
|
||||||
&& (!pluginName.contains(match)))
|
&& (!pluginName.contains(match)))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -223,7 +226,7 @@ public class Commandhelp extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (!reported)
|
if (!reported)
|
||||||
{
|
{
|
||||||
logger.log(Level.WARNING, Util.format("commandHelpFailedForPlugin", pluginName), ex);
|
logger.log(Level.WARNING, _("commandHelpFailedForPlugin", pluginName), ex);
|
||||||
}
|
}
|
||||||
reported = true;
|
reported = true;
|
||||||
continue;
|
continue;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -22,7 +22,7 @@ public class Commandhelpop extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
final String message = Util.format("helpOp", user.getDisplayName(), getFinalArg(args, 0));
|
final String message = _("helpOp", user.getDisplayName(), getFinalArg(args, 0));
|
||||||
logger.log(Level.INFO, message);
|
logger.log(Level.INFO, message);
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -40,7 +42,7 @@ public class Commandhome extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
user.getTeleport().home(player, homeName.toLowerCase(), charge);
|
user.getTeleport().home(player, homeName.toLowerCase(Locale.ENGLISH), charge);
|
||||||
}
|
}
|
||||||
catch (NotEnoughArgumentsException e)
|
catch (NotEnoughArgumentsException e)
|
||||||
{
|
{
|
||||||
@ -51,7 +53,7 @@ public class Commandhome extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
else if (homes.isEmpty())
|
else if (homes.isEmpty())
|
||||||
{
|
{
|
||||||
throw new Exception(player == user ? Util.i18n("noHomeSet") : Util.i18n("noHomeSetPlayer"));
|
throw new Exception(player == user ? _("noHomeSet") : _("noHomeSetPlayer"));
|
||||||
}
|
}
|
||||||
else if (homes.size() == 1 && player.equals(user))
|
else if (homes.size() == 1 && player.equals(user))
|
||||||
{
|
{
|
||||||
@ -59,7 +61,7 @@ public class Commandhome extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.format("homes", Util.joinList(homes)));
|
user.sendMessage(_("homes", Util.joinList(homes)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new NoChargeException();
|
throw new NoChargeException();
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
public class Commandignore extends EssentialsCommand
|
public class Commandignore extends EssentialsCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
public Commandignore()
|
public Commandignore()
|
||||||
{
|
{
|
||||||
super("ignore");
|
super("ignore");
|
||||||
@ -31,19 +30,18 @@ public class Commandignore extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
final String name = player.getName();
|
final String name = player.getName();
|
||||||
if (user.isIgnoredPlayer(name)) {
|
if (user.isIgnoredPlayer(name))
|
||||||
|
{
|
||||||
user.setIgnoredPlayer(name, false);
|
user.setIgnoredPlayer(name, false);
|
||||||
user.sendMessage(Util.format("unignorePlayer", player.getName()));
|
user.sendMessage(_("unignorePlayer", player.getName()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user.setIgnoredPlayer(name, true);
|
user.setIgnoredPlayer(name, true);
|
||||||
user.sendMessage(Util.format("ignorePlayer", player.getName()));
|
user.sendMessage(_("ignorePlayer", player.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -31,7 +31,7 @@ public class Commandinvsee extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
invUser.getInventory().setContents(user.getSavedInventory());
|
invUser.getInventory().setContents(user.getSavedInventory());
|
||||||
user.setSavedInventory(null);
|
user.setSavedInventory(null);
|
||||||
user.sendMessage(Util.i18n("invRestored"));
|
user.sendMessage(_("invRestored"));
|
||||||
throw new NoChargeException();
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,15 +41,17 @@ public class Commandinvsee extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
ItemStack[] invUserStack = invUser.getInventory().getContents();
|
ItemStack[] invUserStack = invUser.getInventory().getContents();
|
||||||
final int userStackLength = user.getInventory().getContents().length;
|
final int userStackLength = user.getInventory().getContents().length;
|
||||||
if (invUserStack.length < userStackLength) {
|
if (invUserStack.length < userStackLength)
|
||||||
|
{
|
||||||
invUserStack = Arrays.copyOf(invUserStack, userStackLength);
|
invUserStack = Arrays.copyOf(invUserStack, userStackLength);
|
||||||
}
|
}
|
||||||
if (invUserStack.length > userStackLength) {
|
if (invUserStack.length > userStackLength)
|
||||||
throw new Exception(Util.i18n("invBigger"));
|
{
|
||||||
|
throw new Exception(_("invBigger"));
|
||||||
}
|
}
|
||||||
user.getInventory().setContents(invUserStack);
|
user.getInventory().setContents(invUserStack);
|
||||||
user.sendMessage(Util.format("invSee", invUser.getDisplayName()));
|
user.sendMessage(_("invSee", invUser.getDisplayName()));
|
||||||
user.sendMessage(Util.i18n("invSeeHelp"));
|
user.sendMessage(_("invSeeHelp"));
|
||||||
throw new NoChargeException();
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import java.util.Locale;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -23,7 +24,7 @@ public class Commanditem extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
final ItemStack stack = ess.getItemDb().get(args[0]);
|
final ItemStack stack = ess.getItemDb().get(args[0]);
|
||||||
|
|
||||||
final String itemname = stack.getType().toString().toLowerCase().replace("_", "");
|
final String itemname = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace("_", "");
|
||||||
if (ess.getSettings().permissionBasedItemSpawn()
|
if (ess.getSettings().permissionBasedItemSpawn()
|
||||||
? (!user.isAuthorized("essentials.itemspawn.item-all")
|
? (!user.isAuthorized("essentials.itemspawn.item-all")
|
||||||
&& !user.isAuthorized("essentials.itemspawn.item-" + itemname)
|
&& !user.isAuthorized("essentials.itemspawn.item-" + itemname)
|
||||||
@ -31,7 +32,7 @@ public class Commanditem extends EssentialsCommand
|
|||||||
: (!user.isAuthorized("essentials.itemspawn.exempt")
|
: (!user.isAuthorized("essentials.itemspawn.exempt")
|
||||||
&& !user.canSpawnItem(stack.getTypeId())))
|
&& !user.canSpawnItem(stack.getTypeId())))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("cantSpawnItem", itemname));
|
throw new Exception(_("cantSpawnItem", itemname));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length > 1 && Integer.parseInt(args[1]) > 0)
|
if (args.length > 1 && Integer.parseInt(args[1]) > 0)
|
||||||
@ -41,11 +42,11 @@ public class Commanditem extends EssentialsCommand
|
|||||||
|
|
||||||
if (stack.getType() == Material.AIR)
|
if (stack.getType() == Material.AIR)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("cantSpawnItem", "Air"));
|
throw new Exception(_("cantSpawnItem", "Air"));
|
||||||
}
|
}
|
||||||
|
|
||||||
final String displayName = stack.getType().toString().toLowerCase().replace('_', ' ');
|
final String displayName = stack.getType().toString().toLowerCase(Locale.ENGLISH).replace('_', ' ');
|
||||||
user.sendMessage(Util.format("itemSpawn", stack.getAmount(), displayName));
|
user.sendMessage(_("itemSpawn", stack.getAmount(), displayName));
|
||||||
user.getInventory().addItem(stack);
|
user.getInventory().addItem(stack);
|
||||||
user.updateInventory();
|
user.updateInventory();
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.TargetBlock;
|
import com.earth2me.essentials.TargetBlock;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ public class Commandjump extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
catch (NullPointerException ex)
|
catch (NullPointerException ex)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("jumpError"), ex);
|
throw new Exception(_("jumpError"), ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Trade charge = new Trade(this.getName(), ess);
|
final Trade charge = new Trade(this.getName(), ess);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Console;
|
import com.earth2me.essentials.Console;
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -26,9 +26,9 @@ public class Commandkick extends EssentialsCommand
|
|||||||
final User user = getPlayer(server, args, 0);
|
final User user = getPlayer(server, args, 0);
|
||||||
if (user.isAuthorized("essentials.kick.exempt"))
|
if (user.isAuthorized("essentials.kick.exempt"))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("kickExempt"));
|
throw new Exception(_("kickExempt"));
|
||||||
}
|
}
|
||||||
final String kickReason = args.length > 1 ? getFinalArg(args, 1) : Util.i18n("kickDefault");
|
final String kickReason = args.length > 1 ? getFinalArg(args, 1) : _("kickDefault");
|
||||||
user.kickPlayer(kickReason);
|
user.kickPlayer(kickReason);
|
||||||
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
final String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public class Commandkick extends EssentialsCommand
|
|||||||
User player = ess.getUser(onlinePlayer);
|
User player = ess.getUser(onlinePlayer);
|
||||||
if (player.isAuthorized("essentials.kick.notify"))
|
if (player.isAuthorized("essentials.kick.notify"))
|
||||||
{
|
{
|
||||||
onlinePlayer.sendMessage(Util.format("playerKicked", senderName, user.getName(), kickReason));
|
onlinePlayer.sendMessage(_("playerKicked", senderName, user.getName(), kickReason));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Util;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -24,7 +24,7 @@ public class Commandkickall extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
onlinePlayer.kickPlayer(args.length > 0 ? getFinalArg(args, 0) : Util.i18n("kickDefault"));
|
onlinePlayer.kickPlayer(args.length > 0 ? getFinalArg(args, 0) : _("kickDefault"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Util;
|
import static com.earth2me.essentials.I18n._;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -32,7 +32,7 @@ public class Commandkill extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
matchPlayer.setHealth(0);
|
matchPlayer.setHealth(0);
|
||||||
sender.sendMessage(Util.format("kill", matchPlayer.getDisplayName()));
|
sender.sendMessage(_("kill", matchPlayer.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
@ -27,36 +28,36 @@ public class Commandkit extends EssentialsCommand
|
|||||||
final StringBuilder list = new StringBuilder();
|
final StringBuilder list = new StringBuilder();
|
||||||
for (String kiteItem : kits.keySet())
|
for (String kiteItem : kits.keySet())
|
||||||
{
|
{
|
||||||
if (user.isAuthorized("essentials.kit." + kiteItem.toLowerCase()))
|
if (user.isAuthorized("essentials.kit." + kiteItem.toLowerCase(Locale.ENGLISH)))
|
||||||
{
|
{
|
||||||
list.append(" ").append(kiteItem);
|
list.append(" ").append(kiteItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (list.length() > 0)
|
if (list.length() > 0)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.format("kits", list.toString()));
|
user.sendMessage(_("kits", list.toString()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("noKits"));
|
user.sendMessage(_("noKits"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("kitError"));
|
user.sendMessage(_("kitError"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
final String kitName = args[0].toLowerCase();
|
final String kitName = args[0].toLowerCase(Locale.ENGLISH);
|
||||||
final Object kit = ess.getSettings().getKit(kitName);
|
final Object kit = ess.getSettings().getKit(kitName);
|
||||||
List<String> items;
|
List<String> items;
|
||||||
|
|
||||||
if (!user.isAuthorized("essentials.kit." + kitName))
|
if (!user.isAuthorized("essentials.kit." + kitName))
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.format("noKitPermission", "essentials.kit." + kitName));
|
user.sendMessage(_("noKitPermission", "essentials.kit." + kitName));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,15 +75,18 @@ public class Commandkit extends EssentialsCommand
|
|||||||
final long mintime = c.getTimeInMillis();
|
final long mintime = c.getTimeInMillis();
|
||||||
|
|
||||||
final Long lastTime = user.getKitTimestamp(kitName);
|
final Long lastTime = user.getKitTimestamp(kitName);
|
||||||
if (lastTime == null || lastTime < mintime) {
|
if (lastTime == null || lastTime < mintime)
|
||||||
|
{
|
||||||
final Calendar now = new GregorianCalendar();
|
final Calendar now = new GregorianCalendar();
|
||||||
user.setKitTimestamp(kitName, now.getTimeInMillis());
|
user.setKitTimestamp(kitName, now.getTimeInMillis());
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
final Calendar future = new GregorianCalendar();
|
final Calendar future = new GregorianCalendar();
|
||||||
future.setTimeInMillis(lastTime);
|
future.setTimeInMillis(lastTime);
|
||||||
future.add(Calendar.SECOND, (int)delay);
|
future.add(Calendar.SECOND, (int)delay);
|
||||||
future.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
|
future.add(Calendar.MILLISECOND, (int)((delay * 1000.0) % 1000.0));
|
||||||
user.sendMessage(Util.format("kitTimed", Util.formatDateDiff(future.getTimeInMillis())));
|
user.sendMessage(_("kitTimed", Util.formatDateDiff(future.getTimeInMillis())));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +122,7 @@ public class Commandkit extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (spew)
|
if (spew)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("kitInvFull"));
|
user.sendMessage(_("kitInvFull"));
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -128,12 +132,12 @@ public class Commandkit extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
user.sendMessage(ex.getMessage());
|
user.sendMessage(ex.getMessage());
|
||||||
}
|
}
|
||||||
user.sendMessage(Util.format("kitGive", kitName));
|
user.sendMessage(_("kitGive", kitName));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("kitError2"));
|
user.sendMessage(_("kitError2"));
|
||||||
user.sendMessage(Util.i18n("kitErrorHelp"));
|
user.sendMessage(_("kitErrorHelp"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -31,19 +31,20 @@ public class Commandlightning extends EssentialsCommand
|
|||||||
|
|
||||||
if (server.matchPlayer(args[0]).isEmpty())
|
if (server.matchPlayer(args[0]).isEmpty())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player matchPlayer : server.matchPlayer(args[0]))
|
for (Player matchPlayer : server.matchPlayer(args[0]))
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("lightningUse", matchPlayer.getDisplayName()));
|
sender.sendMessage(_("lightningUse", matchPlayer.getDisplayName()));
|
||||||
matchPlayer.getWorld().strikeLightning(matchPlayer.getLocation());
|
matchPlayer.getWorld().strikeLightning(matchPlayer.getLocation());
|
||||||
if (!ess.getUser(matchPlayer).isGodModeEnabled()) {
|
if (!ess.getUser(matchPlayer).isGodModeEnabled())
|
||||||
|
{
|
||||||
matchPlayer.setHealth(matchPlayer.getHealth() < 5 ? 0 : matchPlayer.getHealth() - 5);
|
matchPlayer.setHealth(matchPlayer.getHealth() < 5 ? 0 : matchPlayer.getHealth() - 5);
|
||||||
}
|
}
|
||||||
if (ess.getSettings().warnOnSmite())
|
if (ess.getSettings().warnOnSmite())
|
||||||
{
|
{
|
||||||
matchPlayer.sendMessage(Util.i18n("lightningSmited"));
|
matchPlayer.sendMessage(_("lightningSmited"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -117,7 +117,7 @@ public class Commandlist extends EssentialsCommand
|
|||||||
Collections.sort(users);
|
Collections.sort(users);
|
||||||
|
|
||||||
final StringBuilder onlineUsers = new StringBuilder();
|
final StringBuilder onlineUsers = new StringBuilder();
|
||||||
onlineUsers.append(Util.i18n("connectedPlayers"));
|
onlineUsers.append(_("connectedPlayers"));
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (User user : users)
|
for (User user : users)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -25,21 +25,21 @@ public class Commandmail extends EssentialsCommand
|
|||||||
final List<String> mail = user.getMails();
|
final List<String> mail = user.getMails();
|
||||||
if (mail.isEmpty())
|
if (mail.isEmpty())
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("noMail"));
|
user.sendMessage(_("noMail"));
|
||||||
throw new NoChargeException();
|
throw new NoChargeException();
|
||||||
}
|
}
|
||||||
for (String messages : mail)
|
for (String messages : mail)
|
||||||
{
|
{
|
||||||
user.sendMessage(messages);
|
user.sendMessage(messages);
|
||||||
}
|
}
|
||||||
user.sendMessage(Util.i18n("mailClear"));
|
user.sendMessage(_("mailClear"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
|
if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
|
||||||
{
|
{
|
||||||
if (!user.isAuthorized("essentials.mail.send"))
|
if (!user.isAuthorized("essentials.mail.send"))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("noMailSendPerm"));
|
throw new Exception(_("noMailSendPerm"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = server.getPlayer(args[1]);
|
Player player = server.getPlayer(args[1]);
|
||||||
@ -54,19 +54,19 @@ public class Commandmail extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (u == null)
|
if (u == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("playerNeverOnServer", args[1]));
|
throw new Exception(_("playerNeverOnServer", args[1]));
|
||||||
}
|
}
|
||||||
if (!u.isIgnoredPlayer(user.getName()))
|
if (!u.isIgnoredPlayer(user.getName()))
|
||||||
{
|
{
|
||||||
u.addMail(ChatColor.stripColor(user.getDisplayName()) + ": " + getFinalArg(args, 2));
|
u.addMail(ChatColor.stripColor(user.getDisplayName()) + ": " + getFinalArg(args, 2));
|
||||||
}
|
}
|
||||||
user.sendMessage(Util.i18n("mailSent"));
|
user.sendMessage(_("mailSent"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (args.length >= 1 && "clear".equalsIgnoreCase(args[0]))
|
if (args.length >= 1 && "clear".equalsIgnoreCase(args[0]))
|
||||||
{
|
{
|
||||||
user.setMails(null);
|
user.setMails(null);
|
||||||
user.sendMessage(Util.i18n("mailCleared"));
|
user.sendMessage(_("mailCleared"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
@ -77,11 +77,11 @@ public class Commandmail extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (args.length >= 1 && "read".equalsIgnoreCase(args[0]))
|
if (args.length >= 1 && "read".equalsIgnoreCase(args[0]))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("onlyPlayers", commandLabel + " read"));
|
throw new Exception(_("onlyPlayers", commandLabel + " read"));
|
||||||
}
|
}
|
||||||
else if (args.length >= 1 && "clear".equalsIgnoreCase(args[0]))
|
else if (args.length >= 1 && "clear".equalsIgnoreCase(args[0]))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("onlyPlayers", commandLabel + " clear"));
|
throw new Exception(_("onlyPlayers", commandLabel + " clear"));
|
||||||
}
|
}
|
||||||
else if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
|
else if (args.length >= 3 && "send".equalsIgnoreCase(args[0]))
|
||||||
{
|
{
|
||||||
@ -97,10 +97,10 @@ public class Commandmail extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (u == null)
|
if (u == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("playerNeverOnServer", args[1]));
|
throw new Exception(_("playerNeverOnServer", args[1]));
|
||||||
}
|
}
|
||||||
u.addMail("Server: " + getFinalArg(args, 2));
|
u.addMail("Server: " + getFinalArg(args, 2));
|
||||||
sender.sendMessage(Util.i18n("mailSent"));
|
sender.sendMessage(_("mailSent"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (args.length >= 2)
|
else if (args.length >= 2)
|
||||||
@ -118,10 +118,10 @@ public class Commandmail extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (u == null)
|
if (u == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("playerNeverOnServer", args[0]));
|
throw new Exception(_("playerNeverOnServer", args[0]));
|
||||||
}
|
}
|
||||||
u.addMail("Server: " + getFinalArg(args, 1));
|
u.addMail("Server: " + getFinalArg(args, 1));
|
||||||
sender.sendMessage(Util.i18n("mailSent"));
|
sender.sendMessage(_("mailSent"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ public class Commandme extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (user.isMuted())
|
if (user.isMuted())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("voiceSilenced"));
|
throw new Exception(_("voiceSilenced"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
@ -31,6 +31,6 @@ public class Commandme extends EssentialsCommand
|
|||||||
message = message.replaceAll("&([0-9a-f])", "§$1");
|
message = message.replaceAll("&([0-9a-f])", "§$1");
|
||||||
}
|
}
|
||||||
|
|
||||||
ess.broadcastMessage(user, Util.format("action", user.getDisplayName(), message));
|
ess.broadcastMessage(user, _("action", user.getDisplayName(), message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Console;
|
import com.earth2me.essentials.Console;
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.IReplyTo;
|
import com.earth2me.essentials.IReplyTo;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -30,21 +30,21 @@ public class Commandmsg extends EssentialsCommand
|
|||||||
User user = ess.getUser(sender);
|
User user = ess.getUser(sender);
|
||||||
if (user.isMuted())
|
if (user.isMuted())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("voiceSilenced"));
|
throw new Exception(_("voiceSilenced"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String message = getFinalArg(args, 1);
|
String message = getFinalArg(args, 1);
|
||||||
String translatedMe = Util.i18n("me");
|
String translatedMe = _("me");
|
||||||
|
|
||||||
IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
|
IReplyTo replyTo = sender instanceof Player ? ess.getUser((Player)sender) : Console.getConsoleReplyTo();
|
||||||
String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
String senderName = sender instanceof Player ? ((Player)sender).getDisplayName() : Console.NAME;
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase(Console.NAME))
|
if (args[0].equalsIgnoreCase(Console.NAME))
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("msgFormat", translatedMe, Console.NAME, message));
|
sender.sendMessage(_("msgFormat", translatedMe, Console.NAME, message));
|
||||||
CommandSender cs = Console.getCommandSender(server);
|
CommandSender cs = Console.getCommandSender(server);
|
||||||
cs.sendMessage(Util.format("msgFormat", senderName, translatedMe, message));
|
cs.sendMessage(_("msgFormat", senderName, translatedMe, message));
|
||||||
replyTo.setReplyTo(cs);
|
replyTo.setReplyTo(cs);
|
||||||
Console.getConsoleReplyTo().setReplyTo(sender);
|
Console.getConsoleReplyTo().setReplyTo(sender);
|
||||||
return;
|
return;
|
||||||
@ -54,7 +54,7 @@ public class Commandmsg extends EssentialsCommand
|
|||||||
|
|
||||||
if (matches.isEmpty())
|
if (matches.isEmpty())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@ -68,18 +68,18 @@ public class Commandmsg extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (i == matches.size())
|
if (i == matches.size())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player p : matches)
|
for (Player p : matches)
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("msgFormat", translatedMe, p.getDisplayName(), message));
|
sender.sendMessage(_("msgFormat", translatedMe, p.getDisplayName(), message));
|
||||||
final User u = ess.getUser(p);
|
final User u = ess.getUser(p);
|
||||||
if (sender instanceof Player && (u.isIgnoredPlayer(((Player)sender).getName()) || u.isHidden()))
|
if (sender instanceof Player && (u.isIgnoredPlayer(((Player)sender).getName()) || u.isHidden()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
p.sendMessage(Util.format("msgFormat", senderName, translatedMe, message));
|
p.sendMessage(_("msgFormat", senderName, translatedMe, message));
|
||||||
replyTo.setReplyTo(ess.getUser(p));
|
replyTo.setReplyTo(ess.getUser(p));
|
||||||
ess.getUser(p).setReplyTo(sender);
|
ess.getUser(p).setReplyTo(sender);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -24,7 +25,7 @@ public class Commandmute extends EssentialsCommand
|
|||||||
final User player = getPlayer(server, args, 0, true);
|
final User player = getPlayer(server, args, 0, true);
|
||||||
if (!player.isMuted() && player.isAuthorized("essentials.mute.exempt"))
|
if (!player.isMuted() && player.isAuthorized("essentials.mute.exempt"))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("muteExempt"));
|
throw new Exception(_("muteExempt"));
|
||||||
}
|
}
|
||||||
long muteTimestamp = 0;
|
long muteTimestamp = 0;
|
||||||
if (args.length > 1)
|
if (args.length > 1)
|
||||||
@ -37,14 +38,14 @@ public class Commandmute extends EssentialsCommand
|
|||||||
sender.sendMessage(
|
sender.sendMessage(
|
||||||
muted
|
muted
|
||||||
? (muteTimestamp > 0
|
? (muteTimestamp > 0
|
||||||
? Util.format("mutedPlayerFor", player.getDisplayName(), Util.formatDateDiff(muteTimestamp))
|
? _("mutedPlayerFor", player.getDisplayName(), Util.formatDateDiff(muteTimestamp))
|
||||||
: Util.format("mutedPlayer", player.getDisplayName()))
|
: _("mutedPlayer", player.getDisplayName()))
|
||||||
: Util.format("unmutedPlayer", player.getDisplayName()));
|
: _("unmutedPlayer", player.getDisplayName()));
|
||||||
player.sendMessage(
|
player.sendMessage(
|
||||||
muted
|
muted
|
||||||
? (muteTimestamp > 0
|
? (muteTimestamp > 0
|
||||||
? Util.format("playerMutedFor", Util.formatDateDiff(muteTimestamp))
|
? _("playerMutedFor", Util.formatDateDiff(muteTimestamp))
|
||||||
: Util.i18n("playerMuted"))
|
: _("playerMuted"))
|
||||||
: Util.i18n("playerUnmuted"));
|
: _("playerUnmuted"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import java.util.Locale;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -23,16 +24,16 @@ public class Commandnick extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (!ess.getSettings().changeDisplayName())
|
if (!ess.getSettings().changeDisplayName())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("nickDisplayName"));
|
throw new Exception(_("nickDisplayName"));
|
||||||
}
|
}
|
||||||
if (args.length > 1)
|
if (args.length > 1)
|
||||||
{
|
{
|
||||||
if (!user.isAuthorized("essentials.nick.others"))
|
if (!user.isAuthorized("essentials.nick.others"))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("nickOthersPermission"));
|
throw new Exception(_("nickOthersPermission"));
|
||||||
}
|
}
|
||||||
setNickname(server, getPlayer(server, args, 0), args[1]);
|
setNickname(server, getPlayer(server, args, 0), args[1]);
|
||||||
user.sendMessage(Util.i18n("nickChanged"));
|
user.sendMessage(_("nickChanged"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setNickname(server, user, args[0]);
|
setNickname(server, user, args[0]);
|
||||||
@ -47,23 +48,23 @@ public class Commandnick extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (!ess.getSettings().changeDisplayName())
|
if (!ess.getSettings().changeDisplayName())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("nickDisplayName"));
|
throw new Exception(_("nickDisplayName"));
|
||||||
}
|
}
|
||||||
setNickname(server, getPlayer(server, args, 0), args[1]);
|
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
|
private void setNickname(final Server server, final User target, final String nick) throws Exception
|
||||||
{
|
{
|
||||||
if (nick.matches("[^a-zA-Z_0-9]"))
|
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))
|
else if ("off".equalsIgnoreCase(nick) || target.getName().equalsIgnoreCase(nick))
|
||||||
{
|
{
|
||||||
target.setNickname(null);
|
target.setNickname(null);
|
||||||
target.setDisplayNick();
|
target.setDisplayNick();
|
||||||
target.sendMessage(Util.i18n("nickNoMore"));
|
target.sendMessage(_("nickNoMore"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -74,18 +75,18 @@ public class Commandnick extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String dn = p.getDisplayName().toLowerCase();
|
String dn = p.getDisplayName().toLowerCase(Locale.ENGLISH);
|
||||||
String n = p.getName().toLowerCase();
|
String n = p.getName().toLowerCase(Locale.ENGLISH);
|
||||||
String nk = formattedNick.toLowerCase();
|
String nk = formattedNick.toLowerCase(Locale.ENGLISH);
|
||||||
if (nk.equals(dn) || nk.equals(n))
|
if (nk.equals(dn) || nk.equals(n))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("nickInUse"));
|
throw new Exception(_("nickInUse"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
target.setNickname(formattedNick);
|
target.setNickname(formattedNick);
|
||||||
target.setDisplayNick();
|
target.setDisplayNick();
|
||||||
target.sendMessage(Util.format("nickSet", target.getDisplayName() + "§7."));
|
target.sendMessage(_("nickSet", target.getDisplayName() + "§7."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,8 @@ public class Commandnuke extends EssentialsCommand
|
|||||||
ess.getTNTListener().enable();
|
ess.getTNTListener().enable();
|
||||||
for (Player player : targets)
|
for (Player player : targets)
|
||||||
{
|
{
|
||||||
if (player == null) {
|
if (player == null)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
player.sendMessage("May death rain upon them");
|
player.sendMessage("May death rain upon them");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -35,8 +35,9 @@ public class Commandpay extends EssentialsCommand
|
|||||||
foundUser = true;
|
foundUser = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(foundUser == false) {
|
if (foundUser == false)
|
||||||
throw new NoSuchFieldException(Util.i18n("playerNotFound"));
|
{
|
||||||
|
throw new NoSuchFieldException(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -15,6 +15,6 @@ public class Commandping extends EssentialsCommand
|
|||||||
@Override
|
@Override
|
||||||
public void run(Server server, User player, String commandLabel, String[] args) throws Exception
|
public void run(Server server, User player, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
player.sendMessage(Util.i18n("pong"));
|
player.sendMessage(_("pong"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -25,17 +27,17 @@ public class Commandpowertool extends EssentialsCommand
|
|||||||
if (command != null && command.equalsIgnoreCase("c:"))
|
if (command != null && command.equalsIgnoreCase("c:"))
|
||||||
{
|
{
|
||||||
user.clearAllPowertools();
|
user.clearAllPowertools();
|
||||||
user.sendMessage(Util.i18n("powerToolClearAll"));
|
user.sendMessage(_("powerToolClearAll"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ItemStack itemStack = user.getItemInHand();
|
final ItemStack itemStack = user.getItemInHand();
|
||||||
if (itemStack == null || itemStack.getType() == Material.AIR)
|
if (itemStack == null || itemStack.getType() == Material.AIR)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("powerToolAir"));
|
throw new Exception(_("powerToolAir"));
|
||||||
}
|
}
|
||||||
|
|
||||||
final String itemName = itemStack.getType().toString().toLowerCase().replaceAll("_", " ");
|
final String itemName = itemStack.getType().toString().toLowerCase(Locale.ENGLISH).replaceAll("_", " ");
|
||||||
List<String> powertools = user.getPowertool(itemStack);
|
List<String> powertools = user.getPowertool(itemStack);
|
||||||
if (command != null && !command.isEmpty())
|
if (command != null && !command.isEmpty())
|
||||||
{
|
{
|
||||||
@ -43,11 +45,11 @@ public class Commandpowertool extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (powertools == null || powertools.isEmpty())
|
if (powertools == null || powertools.isEmpty())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("powerToolListEmpty", itemName));
|
throw new Exception(_("powerToolListEmpty", itemName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.format("powerToolList", Util.joinList(powertools), itemName));
|
user.sendMessage(_("powerToolList", Util.joinList(powertools), itemName));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -58,11 +60,11 @@ public class Commandpowertool extends EssentialsCommand
|
|||||||
command = command.substring(2);
|
command = command.substring(2);
|
||||||
if (!powertools.contains(command))
|
if (!powertools.contains(command))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("powerToolNoSuchCommandAssigned", command, itemName));
|
throw new Exception(_("powerToolNoSuchCommandAssigned", command, itemName));
|
||||||
}
|
}
|
||||||
|
|
||||||
powertools.remove(command);
|
powertools.remove(command);
|
||||||
user.sendMessage(Util.format("powerToolRemove", command, itemName));
|
user.sendMessage(_("powerToolRemove", command, itemName));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -77,7 +79,7 @@ public class Commandpowertool extends EssentialsCommand
|
|||||||
command = command.substring(2);
|
command = command.substring(2);
|
||||||
if (powertools.contains(command))
|
if (powertools.contains(command))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("powerToolAlreadySet", command, itemName));
|
throw new Exception(_("powerToolAlreadySet", command, itemName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (powertools != null && !powertools.isEmpty())
|
else if (powertools != null && !powertools.isEmpty())
|
||||||
@ -91,7 +93,7 @@ public class Commandpowertool extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
powertools.add(command);
|
powertools.add(command);
|
||||||
user.sendMessage(Util.format("powerToolAttach", Util.joinList(powertools), itemName));
|
user.sendMessage(_("powerToolAttach", Util.joinList(powertools), itemName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -100,7 +102,7 @@ public class Commandpowertool extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
powertools.clear();
|
powertools.clear();
|
||||||
}
|
}
|
||||||
user.sendMessage(Util.format("powerToolRemoveAll", itemName));
|
user.sendMessage(_("powerToolRemoveAll", itemName));
|
||||||
}
|
}
|
||||||
|
|
||||||
user.setPowertool(itemStack, powertools);
|
user.setPowertool(itemStack, powertools);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -17,13 +17,11 @@ public class Commandpowertooltoggle extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (!user.hasPowerTools())
|
if (!user.hasPowerTools())
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("noPowerTools"));
|
user.sendMessage(_("noPowerTools"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
user.sendMessage(user.togglePowerToolsEnabled()
|
user.sendMessage(user.togglePowerToolsEnabled()
|
||||||
? Util.i18n("powerToolsEnabled")
|
? _("powerToolsEnabled")
|
||||||
: Util.i18n("powerToolsDisabled"));
|
: _("powerToolsDisabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.DescParseTickFormat;
|
import com.earth2me.essentials.DescParseTickFormat;
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -48,7 +48,7 @@ public class Commandptime extends EssentialsCommand
|
|||||||
User user = ess.getUser(sender);
|
User user = ess.getUser(sender);
|
||||||
if ((!users.contains(user) || users.size() > 1) && user != null && !user.isAuthorized("essentials.ptime.others"))
|
if ((!users.contains(user) || users.size() > 1) && user != null && !user.isAuthorized("essentials.ptime.others"))
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("pTimeOthersPermission"));
|
user.sendMessage(_("pTimeOthersPermission"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,25 +93,25 @@ public class Commandptime extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (users.size() > 1)
|
if (users.size() > 1)
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("pTimePlayers"));
|
sender.sendMessage(_("pTimePlayers"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (User user : users)
|
for (User user : users)
|
||||||
{
|
{
|
||||||
if (user.getPlayerTimeOffset() == 0)
|
if (user.getPlayerTimeOffset() == 0)
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("pTimeNormal", user.getName()));
|
sender.sendMessage(_("pTimeNormal", user.getName()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String time = DescParseTickFormat.format(user.getPlayerTime());
|
String time = DescParseTickFormat.format(user.getPlayerTime());
|
||||||
if (!user.isPlayerTimeRelative())
|
if (!user.isPlayerTimeRelative())
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("pTimeCurrentFixed", user.getName(), time));
|
sender.sendMessage(_("pTimeCurrentFixed", user.getName(), time));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("pTimeCurrent", user.getName(), time));
|
sender.sendMessage(_("pTimeCurrent", user.getName(), time));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -162,18 +162,18 @@ public class Commandptime extends EssentialsCommand
|
|||||||
// Inform the sender of the change
|
// Inform the sender of the change
|
||||||
if (ticks == null)
|
if (ticks == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("pTimeReset", msg.toString()));
|
sender.sendMessage(_("pTimeReset", msg.toString()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String time = DescParseTickFormat.format(ticks);
|
String time = DescParseTickFormat.format(ticks);
|
||||||
if (!relative)
|
if (!relative)
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("pTimeSetFixed", time, msg.toString()));
|
sender.sendMessage(_("pTimeSetFixed", time, msg.toString()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("pTimeSet", time, msg.toString()));
|
sender.sendMessage(_("pTimeSet", time, msg.toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ public class Commandptime extends EssentialsCommand
|
|||||||
// We failed to understand the world target...
|
// We failed to understand the world target...
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return users;
|
return users;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Console;
|
import com.earth2me.essentials.Console;
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.IReplyTo;
|
import com.earth2me.essentials.IReplyTo;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -32,10 +32,10 @@ public class Commandr extends EssentialsCommand
|
|||||||
|
|
||||||
if (target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("foreverAlone"));
|
throw new Exception(_("foreverAlone"));
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(Util.format("msgFormat", Util.i18n("me"), targetName, message));
|
sender.sendMessage(_("msgFormat", _("me"), targetName, message));
|
||||||
if (target instanceof Player)
|
if (target instanceof Player)
|
||||||
{
|
{
|
||||||
User u = ess.getUser(target);
|
User u = ess.getUser(target);
|
||||||
@ -44,7 +44,7 @@ public class Commandr extends EssentialsCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
target.sendMessage(Util.format("msgFormat", senderName, Util.i18n("me"), message));
|
target.sendMessage(_("msgFormat", senderName, _("me"), message));
|
||||||
replyTo.setReplyTo(target);
|
replyTo.setReplyTo(target);
|
||||||
if (target != sender)
|
if (target != sender)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import java.util.Locale;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -22,7 +23,7 @@ public class Commandrealname extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
final String whois = args[0].toLowerCase();
|
final String whois = args[0].toLowerCase(Locale.ENGLISH);
|
||||||
for (Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User u = ess.getUser(p);
|
final User u = ess.getUser(p);
|
||||||
@ -30,14 +31,14 @@ public class Commandrealname extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final String displayName = ChatColor.stripColor(u.getDisplayName()).toLowerCase();
|
final String displayName = ChatColor.stripColor(u.getDisplayName()).toLowerCase(Locale.ENGLISH);
|
||||||
if (!whois.equals(displayName)
|
if (!whois.equals(displayName)
|
||||||
&& !displayName.equals(ChatColor.stripColor(ess.getSettings().getNicknamePrefix()) + whois)
|
&& !displayName.equals(ChatColor.stripColor(ess.getSettings().getNicknamePrefix()) + whois)
|
||||||
&& !whois.equalsIgnoreCase(u.getName()))
|
&& !whois.equalsIgnoreCase(u.getName()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sender.sendMessage(u.getDisplayName() + " " + Util.i18n("is") + " " + u.getName());
|
sender.sendMessage(u.getDisplayName() + " " + _("is") + " " + u.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.*;
|
import com.earth2me.essentials.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -28,9 +30,9 @@ public class Commandrepair extends EssentialsCommand
|
|||||||
final ItemStack item = user.getItemInHand();
|
final ItemStack item = user.getItemInHand();
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("repairInvalidType"));
|
throw new Exception(_("repairInvalidType"));
|
||||||
}
|
}
|
||||||
final String itemName = item.getType().toString().toLowerCase();
|
final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH);
|
||||||
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
|
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
|
||||||
|
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
@ -39,24 +41,25 @@ public class Commandrepair extends EssentialsCommand
|
|||||||
|
|
||||||
charge.charge(user);
|
charge.charge(user);
|
||||||
|
|
||||||
user.sendMessage(Util.format("repair", itemName.replace('_', ' ')));
|
user.sendMessage(_("repair", itemName.replace('_', ' ')));
|
||||||
}
|
}
|
||||||
else if (args[0].equalsIgnoreCase("all"))
|
else if (args[0].equalsIgnoreCase("all"))
|
||||||
{
|
{
|
||||||
final List<String> repaired = new ArrayList<String>();
|
final List<String> repaired = new ArrayList<String>();
|
||||||
repairItems(user.getInventory().getContents(), user, repaired);
|
repairItems(user.getInventory().getContents(), user, repaired);
|
||||||
|
|
||||||
if (user.isAuthorized("essentials.repair.armor")) {
|
if (user.isAuthorized("essentials.repair.armor"))
|
||||||
|
{
|
||||||
repairItems(user.getInventory().getArmorContents(), user, repaired);
|
repairItems(user.getInventory().getArmorContents(), user, repaired);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (repaired.isEmpty())
|
if (repaired.isEmpty())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("repairNone"));
|
throw new Exception(_("repairNone"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.format("repair", Util.joinList(repaired)));
|
user.sendMessage(_("repair", Util.joinList(repaired)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -71,12 +74,12 @@ public class Commandrepair extends EssentialsCommand
|
|||||||
final Material material = Material.getMaterial(item.getTypeId());
|
final Material material = Material.getMaterial(item.getTypeId());
|
||||||
if (material.isBlock() || material.getMaxDurability() < 0)
|
if (material.isBlock() || material.getMaxDurability() < 0)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("repairInvalidType"));
|
throw new Exception(_("repairInvalidType"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.getDurability() == 0)
|
if (item.getDurability() == 0)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("repairAlreadyFixed"));
|
throw new Exception(_("repairAlreadyFixed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
item.setDurability((short)0);
|
item.setDurability((short)0);
|
||||||
@ -90,7 +93,7 @@ public class Commandrepair extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final String itemName = item.getType().toString().toLowerCase();
|
final String itemName = item.getType().toString().toLowerCase(Locale.ENGLISH);
|
||||||
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
|
final Trade charge = new Trade("repair-" + itemName.replace('_', '-'), ess);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -23,16 +24,16 @@ public class Commandseen extends EssentialsCommand
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
User u = getPlayer(server, args, 0);
|
User u = getPlayer(server, args, 0);
|
||||||
sender.sendMessage(Util.format("seenOnline",u.getDisplayName(), Util.formatDateDiff(u.getLastLogin())));
|
sender.sendMessage(_("seenOnline", u.getDisplayName(), Util.formatDateDiff(u.getLastLogin())));
|
||||||
}
|
}
|
||||||
catch (NoSuchFieldException e)
|
catch (NoSuchFieldException e)
|
||||||
{
|
{
|
||||||
User u = ess.getOfflineUser(args[0]);
|
User u = ess.getOfflineUser(args[0]);
|
||||||
if (u == null)
|
if (u == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
sender.sendMessage(Util.format("seenOffline", u.getDisplayName(), Util.formatDateDiff(u.getLastLogout())));
|
sender.sendMessage(_("seenOffline", u.getDisplayName(), Util.formatDateDiff(u.getLastLogout())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.InventoryWorkaround;
|
import com.earth2me.essentials.InventoryWorkaround;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -76,7 +78,7 @@ public class Commandsell extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (is == null || is.getType() == Material.AIR)
|
if (is == null || is.getType() == Material.AIR)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("itemSellAir"));
|
throw new Exception(_("itemSellAir"));
|
||||||
}
|
}
|
||||||
int id = is.getTypeId();
|
int id = is.getTypeId();
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
@ -94,11 +96,11 @@ public class Commandsell extends EssentialsCommand
|
|||||||
|
|
||||||
if (Double.isNaN(worth))
|
if (Double.isNaN(worth))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("itemCannotBeSold"));
|
throw new Exception(_("itemCannotBeSold"));
|
||||||
}
|
}
|
||||||
if (requireStack && !stack)
|
if (requireStack && !stack)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("itemMustBeStacked"));
|
throw new Exception(_("itemMustBeStacked"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -137,9 +139,9 @@ public class Commandsell extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (!isBulkSell)
|
if (!isBulkSell)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("itemNotEnough1"));
|
user.sendMessage(_("itemNotEnough1"));
|
||||||
user.sendMessage(Util.i18n("itemNotEnough2"));
|
user.sendMessage(_("itemNotEnough2"));
|
||||||
throw new Exception(Util.i18n("itemNotEnough3"));
|
throw new Exception(_("itemNotEnough3"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -152,8 +154,8 @@ public class Commandsell extends EssentialsCommand
|
|||||||
user.updateInventory();
|
user.updateInventory();
|
||||||
Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(worth * amount, ess), user.getLocation(), ess);
|
Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(worth * amount, ess), user.getLocation(), ess);
|
||||||
user.giveMoney(worth * amount);
|
user.giveMoney(worth * amount);
|
||||||
user.sendMessage(Util.format("itemSold", Util.formatCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(), Util.formatCurrency(worth, ess)));
|
user.sendMessage(_("itemSold", Util.formatCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), Util.formatCurrency(worth, ess)));
|
||||||
logger.log(Level.INFO, Util.format("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(), Util.formatCurrency(worth * amount, ess), amount, Util.formatCurrency(worth, ess)));
|
logger.log(Level.INFO, _("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), Util.formatCurrency(worth * amount, ess), amount, Util.formatCurrency(worth, ess)));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import java.util.Locale;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -29,18 +30,19 @@ public class Commandsethome extends EssentialsCommand
|
|||||||
if (user.isAuthorized("essentials.sethome.multiple"))
|
if (user.isAuthorized("essentials.sethome.multiple"))
|
||||||
{
|
{
|
||||||
if ((user.isAuthorized("essentials.sethome.multiple.unlimited")) || (user.getHomes().size() < ess.getSettings().getHomeLimit(user))
|
if ((user.isAuthorized("essentials.sethome.multiple.unlimited")) || (user.getHomes().size() < ess.getSettings().getHomeLimit(user))
|
||||||
|| (user.getHomes().contains(args[0].toLowerCase())))
|
|| (user.getHomes().contains(args[0].toLowerCase(Locale.ENGLISH))))
|
||||||
{
|
{
|
||||||
user.setHome(args[0].toLowerCase());
|
user.setHome(args[0].toLowerCase(Locale.ENGLISH));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("maxHomes", ess.getSettings().getHomeLimit(user)));
|
throw new Exception(_("maxHomes", ess.getSettings().getHomeLimit(user)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
throw new Exception(Util.format("maxHomes", 1));
|
{
|
||||||
|
throw new Exception(_("maxHomes", 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -54,9 +56,9 @@ public class Commandsethome extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
if (usersHome == null)
|
if (usersHome == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("playerNotFound"));
|
throw new Exception(_("playerNotFound"));
|
||||||
}
|
}
|
||||||
String name = args[1].toLowerCase();
|
String name = args[1].toLowerCase(Locale.ENGLISH);
|
||||||
if (!user.isAuthorized("essentials.sethome.multiple"))
|
if (!user.isAuthorized("essentials.sethome.multiple"))
|
||||||
{
|
{
|
||||||
name = "home";
|
name = "home";
|
||||||
@ -69,7 +71,7 @@ public class Commandsethome extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
user.setHome();
|
user.setHome();
|
||||||
}
|
}
|
||||||
user.sendMessage(Util.i18n("homeSet"));
|
user.sendMessage(_("homeSet"));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ public class Commandsetjail extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
ess.getJail().setJail(user.getLocation(), args[0]);
|
ess.getJail().setJail(user.getLocation(), args[0]);
|
||||||
user.sendMessage(Util.format("jailSet",args[0]));
|
user.sendMessage(_("jailSet", args[0]));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
@ -23,6 +23,6 @@ public class Commandsetwarp extends EssentialsCommand
|
|||||||
|
|
||||||
Location loc = user.getLocation();
|
Location loc = user.getLocation();
|
||||||
ess.getWarps().setWarp(args[0], loc);
|
ess.getWarps().setWarp(args[0], loc);
|
||||||
user.sendMessage(Util.format("warpSet", args[0]));
|
user.sendMessage(_("warpSet", args[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -23,6 +23,6 @@ public class Commandsetworth extends EssentialsCommand
|
|||||||
|
|
||||||
ItemStack stack = ess.getItemDb().get(args[0]);
|
ItemStack stack = ess.getItemDb().get(args[0]);
|
||||||
ess.getWorth().setPrice(stack, Double.parseDouble(args[1]));
|
ess.getWorth().setPrice(stack, Double.parseDouble(args[1]));
|
||||||
user.sendMessage(Util.i18n("worthSet"));
|
user.sendMessage(_("worthSet"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
import com.earth2me.essentials.User;
|
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
|
import com.earth2me.essentials.User;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
public class Commandsocialspy extends EssentialsCommand
|
public class Commandsocialspy extends EssentialsCommand
|
||||||
@ -15,6 +15,6 @@ public class Commandsocialspy extends EssentialsCommand
|
|||||||
@Override
|
@Override
|
||||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
user.sendMessage("§7SocialSpy " + (user.toggleSocialSpy() ? Util.i18n("enabled") : Util.i18n("disabled")));
|
user.sendMessage("§7SocialSpy " + (user.toggleSocialSpy() ? _("enabled") : _("disabled")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Mob;
|
import com.earth2me.essentials.Mob;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -28,7 +28,7 @@ public class Commandspawner extends EssentialsCommand
|
|||||||
final Block target = user.getTarget().getTargetBlock();
|
final Block target = user.getTarget().getTargetBlock();
|
||||||
if (target.getType() != Material.MOB_SPAWNER)
|
if (target.getType() != Material.MOB_SPAWNER)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("mobSpawnTarget"));
|
throw new Exception(_("mobSpawnTarget"));
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -39,15 +39,15 @@ public class Commandspawner extends EssentialsCommand
|
|||||||
mob = Mob.fromName(name);
|
mob = Mob.fromName(name);
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("invalidMob"));
|
user.sendMessage(_("invalidMob"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
((CreatureSpawner)target.getState()).setCreatureType(mob.getType());
|
((CreatureSpawner)target.getState()).setCreatureType(mob.getType());
|
||||||
user.sendMessage(Util.format("setSpawner", mob.name));
|
user.sendMessage(_("setSpawner", mob.name));
|
||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("mobSpawnError"), ex);
|
throw new Exception(_("mobSpawnError"), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Mob;
|
import com.earth2me.essentials.Mob;
|
||||||
import com.earth2me.essentials.Mob.MobException;
|
import com.earth2me.essentials.Mob.MobException;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -58,18 +60,18 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
mob = Mob.fromName(mobType);
|
mob = Mob.fromName(mobType);
|
||||||
if (mob == null)
|
if (mob == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("invalidMob"));
|
throw new Exception(_("invalidMob"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase()))
|
if (ess.getSettings().getProtectPreventSpawn(mob.getType().toString().toLowerCase(Locale.ENGLISH)))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
throw new Exception(_("unableToSpawnMob"));
|
||||||
}
|
}
|
||||||
|
|
||||||
final Block block = Util.getTarget(user).getBlock();
|
final Block block = Util.getTarget(user).getBlock();
|
||||||
if (block == null)
|
if (block == null)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
throw new Exception(_("unableToSpawnMob"));
|
||||||
}
|
}
|
||||||
Location loc = block.getLocation();
|
Location loc = block.getLocation();
|
||||||
Location sloc = Util.getSafeDestination(loc);
|
Location sloc = Util.getSafeDestination(loc);
|
||||||
@ -79,7 +81,7 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
catch (MobException e)
|
catch (MobException e)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
throw new Exception(_("unableToSpawnMob"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mountType != null)
|
if (mountType != null)
|
||||||
@ -87,13 +89,13 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
mobMount = Mob.fromName(mountType);
|
mobMount = Mob.fromName(mountType);
|
||||||
if (mobMount == null)
|
if (mobMount == null)
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("invalidMob"));
|
user.sendMessage(_("invalidMob"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase()))
|
if (ess.getSettings().getProtectPreventSpawn(mobMount.getType().toString().toLowerCase(Locale.ENGLISH)))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
throw new Exception(_("unableToSpawnMob"));
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -101,7 +103,7 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
catch (MobException e)
|
catch (MobException e)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
throw new Exception(_("unableToSpawnMob"));
|
||||||
}
|
}
|
||||||
spawnedMob.setPassenger(spawnedMount);
|
spawnedMob.setPassenger(spawnedMount);
|
||||||
}
|
}
|
||||||
@ -120,7 +122,7 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
if (mobCount > serverLimit)
|
if (mobCount > serverLimit)
|
||||||
{
|
{
|
||||||
mobCount = serverLimit;
|
mobCount = serverLimit;
|
||||||
user.sendMessage(Util.i18n("mobSpawnLimit"));
|
user.sendMessage(_("mobSpawnLimit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -136,7 +138,7 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
catch (MobException e)
|
catch (MobException e)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("unableToSpawnMob"));
|
throw new Exception(_("unableToSpawnMob"));
|
||||||
}
|
}
|
||||||
spawnedMob.setPassenger(spawnedMount);
|
spawnedMob.setPassenger(spawnedMount);
|
||||||
}
|
}
|
||||||
@ -149,24 +151,24 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
changeMobData(mobMount.name, spawnedMount, mountData, user);
|
changeMobData(mobMount.name, spawnedMount, mountData, user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
user.sendMessage(args[1] + " " + mob.name.toLowerCase() + mob.suffix + " " + Util.i18n("spawned"));
|
user.sendMessage(args[1] + " " + mob.name.toLowerCase(Locale.ENGLISH) + mob.suffix + " " + _("spawned"));
|
||||||
}
|
}
|
||||||
catch (MobException e1)
|
catch (MobException e1)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("unableToSpawnMob"), e1);
|
throw new Exception(_("unableToSpawnMob"), e1);
|
||||||
}
|
}
|
||||||
catch (NumberFormatException e2)
|
catch (NumberFormatException e2)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("numberRequired"), e2);
|
throw new Exception(_("numberRequired"), e2);
|
||||||
}
|
}
|
||||||
catch (NullPointerException np)
|
catch (NullPointerException np)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("soloMob"), np);
|
throw new Exception(_("soloMob"), np);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
user.sendMessage(mob.name + " " + Util.i18n("spawned"));
|
user.sendMessage(mob.name + " " + _("spawned"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,7 +182,7 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("slimeMalformedSize"), e);
|
throw new Exception(_("slimeMalformedSize"), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ("Sheep".equalsIgnoreCase(type))
|
if ("Sheep".equalsIgnoreCase(type))
|
||||||
@ -199,7 +201,7 @@ public class Commandspawnmob extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("sheepMalformedColor"), e);
|
throw new Exception(_("sheepMalformedColor"), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("tamed"))
|
if ("Wolf".equalsIgnoreCase(type) && data.equalsIgnoreCase("tamed"))
|
||||||
|
@ -24,7 +24,8 @@ public class Commandsudo extends EssentialsCommand
|
|||||||
final User user = getPlayer(server, args, 0, false);
|
final User user = getPlayer(server, args, 0, false);
|
||||||
final String command = args[1];
|
final String command = args[1];
|
||||||
final String[] arguments = new String[args.length - 2];
|
final String[] arguments = new String[args.length - 2];
|
||||||
if (arguments.length > 0) {
|
if (arguments.length > 0)
|
||||||
|
{
|
||||||
System.arraycopy(args, 2, arguments, 0, args.length - 2);
|
System.arraycopy(args, 2, arguments, 0, args.length - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -16,8 +16,8 @@ public class Commandsuicide extends EssentialsCommand
|
|||||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||||
{
|
{
|
||||||
user.setHealth(0);
|
user.setHealth(0);
|
||||||
user.sendMessage(Util.i18n("suicideMessage"));
|
user.sendMessage(_("suicideMessage"));
|
||||||
ess.broadcastMessage(user,
|
ess.broadcastMessage(user,
|
||||||
Util.format("suicideSuccess", user.getDisplayName()));
|
_("suicideSuccess", user.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Console;
|
import com.earth2me.essentials.Console;
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.OfflinePlayer;
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
@ -29,7 +30,7 @@ public class Commandtempban extends EssentialsCommand
|
|||||||
if (sender instanceof Player
|
if (sender instanceof Player
|
||||||
&& !ess.getUser(sender).isAuthorized("essentials.tempban.offline"))
|
&& !ess.getUser(sender).isAuthorized("essentials.tempban.offline"))
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.i18n("tempbanExempt"));
|
sender.sendMessage(_("tempbanExempt"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -37,14 +38,14 @@ public class Commandtempban extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (user.isAuthorized("essentials.tempban.exempt"))
|
if (user.isAuthorized("essentials.tempban.exempt"))
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.i18n("tempbanExempt"));
|
sender.sendMessage(_("tempbanExempt"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final String time = getFinalArg(args, 1);
|
final String time = getFinalArg(args, 1);
|
||||||
final long banTimestamp = Util.parseDateDiff(time, true);
|
final long banTimestamp = Util.parseDateDiff(time, true);
|
||||||
|
|
||||||
final String banReason = Util.format("tempBanned", Util.formatDateDiff(banTimestamp));
|
final String banReason = _("tempBanned", Util.formatDateDiff(banTimestamp));
|
||||||
user.setBanReason(banReason);
|
user.setBanReason(banReason);
|
||||||
user.setBanTimeout(banTimestamp);
|
user.setBanTimeout(banTimestamp);
|
||||||
user.setBanned(true);
|
user.setBanned(true);
|
||||||
@ -56,7 +57,7 @@ public class Commandtempban extends EssentialsCommand
|
|||||||
final User player = ess.getUser(onlinePlayer);
|
final User player = ess.getUser(onlinePlayer);
|
||||||
if (player.isAuthorized("essentials.ban.notify"))
|
if (player.isAuthorized("essentials.ban.notify"))
|
||||||
{
|
{
|
||||||
onlinePlayer.sendMessage(Util.format("playerBanned", senderName, user.getName(), banReason));
|
onlinePlayer.sendMessage(_("playerBanned", senderName, user.getName(), banReason));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
@ -28,13 +28,13 @@ public class Commandthunder extends EssentialsCommand
|
|||||||
|
|
||||||
world.setThundering(setThunder ? true : false);
|
world.setThundering(setThunder ? true : false);
|
||||||
world.setThunderDuration(Integer.parseInt(args[1]) * 20);
|
world.setThunderDuration(Integer.parseInt(args[1]) * 20);
|
||||||
user.sendMessage(Util.format("thunderDuration", (setThunder ? Util.i18n("enabled") : Util.i18n("disabled")), Integer.parseInt(args[1])));
|
user.sendMessage(_("thunderDuration", (setThunder ? _("enabled") : _("disabled")), Integer.parseInt(args[1])));
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
world.setThundering(setThunder ? true : false);
|
world.setThundering(setThunder ? true : false);
|
||||||
user.sendMessage(Util.format("thunder", setThunder ? Util.i18n("enabled") : Util.i18n("disabled")));
|
user.sendMessage(_("thunder", setThunder ? _("enabled") : _("disabled")));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.DescParseTickFormat;
|
import com.earth2me.essentials.DescParseTickFormat;
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -37,7 +37,7 @@ public class Commandtime extends EssentialsCommand
|
|||||||
final User user = ess.getUser(sender);
|
final User user = ess.getUser(sender);
|
||||||
if (user != null && !user.isAuthorized("essentials.time.set"))
|
if (user != null && !user.isAuthorized("essentials.time.set"))
|
||||||
{
|
{
|
||||||
user.sendMessage(Util.i18n("timeSetPermission"));
|
user.sendMessage(_("timeSetPermission"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ public class Commandtime extends EssentialsCommand
|
|||||||
|
|
||||||
for (World world : worlds)
|
for (World world : worlds)
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("timeWorldCurrent", world.getName(), DescParseTickFormat.format(world.getTime())));
|
sender.sendMessage(_("timeWorldCurrent", world.getName(), DescParseTickFormat.format(world.getTime())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ public class Commandtime extends EssentialsCommand
|
|||||||
output.append(world.getName());
|
output.append(world.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(Util.format("timeWorldSet", DescParseTickFormat.format(ticks), output.toString()));
|
sender.sendMessage(_("timeWorldSet", DescParseTickFormat.format(ticks), output.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,7 +136,7 @@ public class Commandtime extends EssentialsCommand
|
|||||||
// We failed to understand the world target...
|
// We failed to understand the world target...
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("invalidWorld"));
|
throw new Exception(_("invalidWorld"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return worlds;
|
return worlds;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.OfflinePlayer;
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
import com.earth2me.essentials.Util;
|
||||||
@ -32,7 +33,7 @@ public class Commandtogglejail extends EssentialsCommand
|
|||||||
if (sender instanceof Player
|
if (sender instanceof Player
|
||||||
&& !ess.getUser(sender).isAuthorized("essentials.togglejail.offline"))
|
&& !ess.getUser(sender).isAuthorized("essentials.togglejail.offline"))
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.i18n("mayNotJail"));
|
sender.sendMessage(_("mayNotJail"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,7 +41,7 @@ public class Commandtogglejail extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
if (player.isAuthorized("essentials.jail.exempt"))
|
if (player.isAuthorized("essentials.jail.exempt"))
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.i18n("mayNotJail"));
|
sender.sendMessage(_("mayNotJail"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -54,7 +55,7 @@ public class Commandtogglejail extends EssentialsCommand
|
|||||||
ess.getJail().getJail(args[1]);
|
ess.getJail().getJail(args[1]);
|
||||||
}
|
}
|
||||||
player.setJailed(true);
|
player.setJailed(true);
|
||||||
player.sendMessage(Util.i18n("userJailed"));
|
player.sendMessage(_("userJailed"));
|
||||||
player.setJail(null);
|
player.setJail(null);
|
||||||
player.setJail(args[1]);
|
player.setJail(args[1]);
|
||||||
long timeDiff = 0;
|
long timeDiff = 0;
|
||||||
@ -65,14 +66,14 @@ public class Commandtogglejail extends EssentialsCommand
|
|||||||
player.setJailTimeout(timeDiff);
|
player.setJailTimeout(timeDiff);
|
||||||
}
|
}
|
||||||
sender.sendMessage((timeDiff > 0
|
sender.sendMessage((timeDiff > 0
|
||||||
? Util.format("playerJailedFor", player.getName(), Util.formatDateDiff(timeDiff))
|
? _("playerJailedFor", player.getName(), Util.formatDateDiff(timeDiff))
|
||||||
: Util.format("playerJailed", player.getName())));
|
: _("playerJailed", player.getName())));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length >= 2 && player.isJailed() && !args[1].equalsIgnoreCase(player.getJail()))
|
if (args.length >= 2 && player.isJailed() && !args[1].equalsIgnoreCase(player.getJail()))
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.format("jailAlreadyIncarcerated", player.getJail()));
|
sender.sendMessage(_("jailAlreadyIncarcerated", player.getJail()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ public class Commandtogglejail extends EssentialsCommand
|
|||||||
final String time = getFinalArg(args, 2);
|
final String time = getFinalArg(args, 2);
|
||||||
final long timeDiff = Util.parseDateDiff(time, true);
|
final long timeDiff = Util.parseDateDiff(time, true);
|
||||||
player.setJailTimeout(timeDiff);
|
player.setJailTimeout(timeDiff);
|
||||||
sender.sendMessage(Util.format("jailSentenceExtended", Util.formatDateDiff(timeDiff)));
|
sender.sendMessage(_("jailSentenceExtended", Util.formatDateDiff(timeDiff)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,13 +94,13 @@ public class Commandtogglejail extends EssentialsCommand
|
|||||||
}
|
}
|
||||||
player.setJailed(false);
|
player.setJailed(false);
|
||||||
player.setJailTimeout(0);
|
player.setJailTimeout(0);
|
||||||
player.sendMessage(Util.format("jailReleasedPlayerNotify"));
|
player.sendMessage(_("jailReleasedPlayerNotify"));
|
||||||
player.setJail(null);
|
player.setJail(null);
|
||||||
if (!(player.getBase() instanceof OfflinePlayer))
|
if (!(player.getBase() instanceof OfflinePlayer))
|
||||||
{
|
{
|
||||||
player.getTeleport().back();
|
player.getTeleport().back();
|
||||||
}
|
}
|
||||||
sender.sendMessage(Util.format("jailReleased", player.getName()));
|
sender.sendMessage(_("jailReleased", player.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
@ -21,6 +21,6 @@ public class Commandtop extends EssentialsCommand
|
|||||||
final int topZ = user.getLocation().getBlockZ();
|
final int topZ = user.getLocation().getBlockZ();
|
||||||
final int topY = user.getWorld().getHighestBlockYAt(topX, topZ);
|
final int topY = user.getWorld().getHighestBlockYAt(topX, topZ);
|
||||||
user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Trade(this.getName(), ess));
|
user.getTeleport().teleport(new Location(user.getWorld(), user.getLocation().getX(), topY + 1, user.getLocation().getZ()), new Trade(this.getName(), ess));
|
||||||
user.sendMessage(Util.i18n("teleportTop"));
|
user.sendMessage(_("teleportTop"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
import com.earth2me.essentials.Console;
|
import com.earth2me.essentials.Console;
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
@ -27,9 +27,9 @@ public class Commandtp extends EssentialsCommand
|
|||||||
final User player = getPlayer(server, args, 0);
|
final User player = getPlayer(server, args, 0);
|
||||||
if (!player.isTeleportEnabled())
|
if (!player.isTeleportEnabled())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("teleportDisabled", player.getDisplayName()));
|
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
||||||
}
|
}
|
||||||
user.sendMessage(Util.i18n("teleporting"));
|
user.sendMessage(_("teleporting"));
|
||||||
final Trade charge = new Trade(this.getName(), ess);
|
final Trade charge = new Trade(this.getName(), ess);
|
||||||
charge.isAffordableFor(user);
|
charge.isAffordableFor(user);
|
||||||
user.getTeleport().teleport(player, charge);
|
user.getTeleport().teleport(player, charge);
|
||||||
@ -40,11 +40,11 @@ public class Commandtp extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
throw new Exception("You need access to /tpohere to teleport other players.");
|
throw new Exception("You need access to /tpohere to teleport other players.");
|
||||||
}
|
}
|
||||||
user.sendMessage(Util.i18n("teleporting"));
|
user.sendMessage(_("teleporting"));
|
||||||
final User target = getPlayer(server, args, 0);
|
final User target = getPlayer(server, args, 0);
|
||||||
final User toPlayer = getPlayer(server, args, 1);
|
final User toPlayer = getPlayer(server, args, 1);
|
||||||
target.getTeleport().now(toPlayer, false);
|
target.getTeleport().now(toPlayer, false);
|
||||||
target.sendMessage(Util.format("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName()));
|
target.sendMessage(_("teleportAtoB", user.getDisplayName(), toPlayer.getDisplayName()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,10 +57,10 @@ public class Commandtp extends EssentialsCommand
|
|||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(Util.i18n("teleporting"));
|
sender.sendMessage(_("teleporting"));
|
||||||
final User target = getPlayer(server, args, 0);
|
final User target = getPlayer(server, args, 0);
|
||||||
final User toPlayer = getPlayer(server, args, 1);
|
final User toPlayer = getPlayer(server, args, 1);
|
||||||
target.getTeleport().now(toPlayer, false);
|
target.getTeleport().now(toPlayer, false);
|
||||||
target.sendMessage(Util.format("teleportAtoB", Console.NAME, toPlayer.getDisplayName()));
|
target.sendMessage(_("teleportAtoB", Console.NAME, toPlayer.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -23,15 +23,15 @@ public class Commandtpa extends EssentialsCommand
|
|||||||
User player = getPlayer(server, args, 0);
|
User player = getPlayer(server, args, 0);
|
||||||
if (!player.isTeleportEnabled())
|
if (!player.isTeleportEnabled())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("teleportDisabled", player.getDisplayName()));
|
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
||||||
}
|
}
|
||||||
if (!player.isIgnoredPlayer(user.getName()))
|
if (!player.isIgnoredPlayer(user.getName()))
|
||||||
{
|
{
|
||||||
player.requestTeleport(user, false);
|
player.requestTeleport(user, false);
|
||||||
player.sendMessage(Util.format("teleportRequest", user.getDisplayName()));
|
player.sendMessage(_("teleportRequest", user.getDisplayName()));
|
||||||
player.sendMessage(Util.i18n("typeTpaccept"));
|
player.sendMessage(_("typeTpaccept"));
|
||||||
player.sendMessage(Util.i18n("typeTpdeny"));
|
player.sendMessage(_("typeTpdeny"));
|
||||||
}
|
}
|
||||||
user.sendMessage(Util.format("requestSent", player.getDisplayName()));
|
user.sendMessage(_("requestSent", player.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -33,7 +33,7 @@ public class Commandtpaall extends EssentialsCommand
|
|||||||
|
|
||||||
private void teleportAAllPlayers(final Server server, final CommandSender sender, final User user)
|
private void teleportAAllPlayers(final Server server, final CommandSender sender, final User user)
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.i18n("teleportAAll"));
|
sender.sendMessage(_("teleportAAll"));
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(onlinePlayer);
|
final User player = ess.getUser(onlinePlayer);
|
||||||
@ -48,8 +48,8 @@ public class Commandtpaall extends EssentialsCommand
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
player.requestTeleport(user, true);
|
player.requestTeleport(user, true);
|
||||||
player.sendMessage(Util.format("teleportHereRequest", user.getDisplayName()));
|
player.sendMessage(_("teleportHereRequest", user.getDisplayName()));
|
||||||
player.sendMessage(Util.i18n("typeTpaccept"));
|
player.sendMessage(_("typeTpaccept"));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.OfflinePlayer;
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import com.earth2me.essentials.Trade;
|
import com.earth2me.essentials.Trade;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ public class Commandtpaccept extends EssentialsCommand
|
|||||||
|| target.getBase() instanceof OfflinePlayer
|
|| target.getBase() instanceof OfflinePlayer
|
||||||
|| (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere")))
|
|| (user.isTeleportRequestHere() && !target.isAuthorized("essentials.tpahere")))
|
||||||
{
|
{
|
||||||
throw new Exception(Util.i18n("noPendingRequest"));
|
throw new Exception(_("noPendingRequest"));
|
||||||
}
|
}
|
||||||
|
|
||||||
final Trade charge = new Trade(this.getName(), ess);
|
final Trade charge = new Trade(this.getName(), ess);
|
||||||
@ -35,8 +35,8 @@ public class Commandtpaccept extends EssentialsCommand
|
|||||||
{
|
{
|
||||||
charge.isAffordableFor(target);
|
charge.isAffordableFor(target);
|
||||||
}
|
}
|
||||||
user.sendMessage(Util.i18n("requestAccepted"));
|
user.sendMessage(_("requestAccepted"));
|
||||||
target.sendMessage(Util.format("requestAcceptedFrom", user.getDisplayName()));
|
target.sendMessage(_("requestAcceptedFrom", user.getDisplayName()));
|
||||||
|
|
||||||
if (user.isTeleportRequestHere())
|
if (user.isTeleportRequestHere())
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
|
||||||
|
|
||||||
@ -23,11 +23,11 @@ public class Commandtpahere extends EssentialsCommand
|
|||||||
final User player = getPlayer(server, args, 0);
|
final User player = getPlayer(server, args, 0);
|
||||||
if (!player.isTeleportEnabled())
|
if (!player.isTeleportEnabled())
|
||||||
{
|
{
|
||||||
throw new Exception(Util.format("teleportDisabled", player.getDisplayName()));
|
throw new Exception(_("teleportDisabled", player.getDisplayName()));
|
||||||
}
|
}
|
||||||
player.requestTeleport(user, true);
|
player.requestTeleport(user, true);
|
||||||
player.sendMessage(Util.format("teleportHereRequest", user.getDisplayName()));
|
player.sendMessage(_("teleportHereRequest", user.getDisplayName()));
|
||||||
player.sendMessage(Util.i18n("typeTpaccept"));
|
player.sendMessage(_("typeTpaccept"));
|
||||||
user.sendMessage(Util.format("requestSent", player.getDisplayName()));
|
user.sendMessage(_("requestSent", player.getDisplayName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import static com.earth2me.essentials.I18n._;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
import com.earth2me.essentials.Util;
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -33,7 +33,7 @@ public class Commandtpall extends EssentialsCommand
|
|||||||
|
|
||||||
private void teleportAllPlayers(Server server, CommandSender sender, User user)
|
private void teleportAllPlayers(Server server, CommandSender sender, User user)
|
||||||
{
|
{
|
||||||
sender.sendMessage(Util.i18n("teleportAll"));
|
sender.sendMessage(_("teleportAll"));
|
||||||
for (Player onlinePlayer : server.getOnlinePlayers())
|
for (Player onlinePlayer : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
final User player = ess.getUser(onlinePlayer);
|
final User player = ess.getUser(onlinePlayer);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user