From e846093fd0e8ea20c7ab9cec2deda2ae40573295 Mon Sep 17 00:00:00 2001 From: snowleo Date: Tue, 10 May 2011 19:57:59 +0000 Subject: More translation stuff. Translated Spawn, Chat, Protect, GeoIP Protect is only partly translated (sql stuff is not translated) EssentialsSpawn is changed to use the onCommand from Essentials jar, since that is more up to date. git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1408 e251c2fe-e539-e718-e476-b85c1f46cddb --- .../src/com/earth2me/essentials/Essentials.java | 8 +++- Essentials/src/messages.properties | 27 ++++++++++- .../earth2me/essentials/chat/EssentialsChat.java | 5 +- .../essentials/chat/EssentialsChatWorker.java | 15 +++--- .../earth2me/essentials/geoip/EssentialsGeoIP.java | 8 +++- .../geoip/EssentialsGeoIPPlayerListener.java | 15 +++--- .../essentials/protect/EssentialsProtect.java | 10 ++-- .../protect/EssentialsProtectBlockListener.java | 7 +-- .../protect/EssentialsProtectPlayerListener.java | 8 ++-- .../earth2me/essentials/spawn/Commandsetspawn.java | 3 +- .../earth2me/essentials/spawn/EssentialsSpawn.java | 20 ++------ .../spawn/EssentialsSpawnPlayerListener.java | 3 +- .../essentials/spawn/EssentialsSpawnWorker.java | 56 ---------------------- 13 files changed, 76 insertions(+), 109 deletions(-) delete mode 100644 EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnWorker.java diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java index 623077e5e..40f68a6fd 100644 --- a/Essentials/src/com/earth2me/essentials/Essentials.java +++ b/Essentials/src/com/earth2me/essentials/Essentials.java @@ -306,7 +306,11 @@ public class Essentials extends JavaPlugin @Override public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) { - + return onCommandEssentials(sender, command, commandLabel, args, Essentials.class.getClassLoader(), "com.earth2me.essentials.commands.Command"); + } + + public boolean onCommandEssentials(CommandSender sender, Command command, String commandLabel, String[] args, ClassLoader classLoader, String commandPath) + { if ("msg".equals(commandLabel.toLowerCase()) || "mail".equals(commandLabel.toLowerCase()) & sender instanceof CraftPlayer) { StringBuilder str = new StringBuilder(); @@ -393,7 +397,7 @@ public class Essentials extends JavaPlugin IEssentialsCommand cmd; try { - cmd = (IEssentialsCommand)Essentials.class.getClassLoader().loadClass("com.earth2me.essentials.commands.Command" + command.getName()).newInstance(); + cmd = (IEssentialsCommand)classLoader.loadClass(commandPath + command.getName()).newInstance(); } catch (Exception ex) { diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties index 6602f534c..85d8dea99 100644 --- a/Essentials/src/messages.properties +++ b/Essentials/src/messages.properties @@ -1,4 +1,4 @@ -loadinfo = Loaded {0} build {1} maintained by {2} +loadinfo = Loaded {0} build {1} by {2} markedAsNotAway = \u00a77You are no longer marked as away. markedAsAway = \u00a77You are now marked as away. userIsNotAway = {0} is no longer AFK @@ -123,4 +123,27 @@ holeInFloor = Hole in floor currency = {0,currency} warpNotExist = That warp does not exist. similarWarpExist = A warp with a similar name already exists. -warpDeleteError = Problem deleting the warp file. \ No newline at end of file +warpDeleteError = Problem deleting the warp file. +versionMismatchAll = Version mismatch! Please update all Essentials jars to the same version. +missingPrefixSuffix = Missing a prefix or suffix for {0} +permissionsError = Missing Permissions/GroupManager; chat prefixes/suffixes will be disabled. +shoutFormat = \u00a77[Shout]\u00a7f {0} +notAllowedToShout = \u00a7cYou are not authorized to shout. +questionFormat = \u00a77[Question]\u00a7f {0} +notAllowedToQuestion = \u00a7cYou are not authorized to use question. +localFormat = Local: <{0}> {1} +geoipJoinFormat = Player {0} comes from {1} +cantFindGeoIpDB = Can't find GeoIP database! +cantReadGeoIpDB = Failed to read GeoIP database! +geoIpUrlEmpty = GeoIP download url is empty. +downloadingGeoIp = Downloading GeoIP database ... this might take a while (country: 0.6 MB, city: 20MB) +geoIpUrlInvalid = GeoIP download url is invalid. +connectionFailed = Failed to open connection. +alertFormat = \u00a73[{0}] \u00a7f {1} \u00a76 {2} at: {3} +alertPlaced = placed: +alertBroke = broke: +alertUsed = used: +buildAlert = \u00a7cYou are not permitted to build +protectionOwner = \u00a76[EssentialsProtect] Protection owner: {0} +spawnSet = \u00a77Spawn location set for group {0}. +teleportNewPlayerError = Failed to teleport new player diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java index 266bd104e..2e89e9ee3 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChat.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.chat; import com.earth2me.essentials.Essentials; +import com.earth2me.essentials.Util; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.event.Event.Priority; @@ -32,9 +33,9 @@ public class EssentialsChat extends JavaPlugin pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this); pm.registerEvent(Type.PLAYER_CHAT, playerListener, Priority.Highest, this); if (!this.getDescription().getVersion().equals(Essentials.getStatic().getDescription().getVersion())) { - logger.log(Level.WARNING, "Version mismatch! Please update all Essentials jars to the same version."); + logger.log(Level.WARNING, Util.i18n("versionMismatchAll")); } - logger.info("Loaded " + this.getDescription().getName() + " build " + this.getDescription().getVersion() + " by " + Essentials.AUTHORS); + logger.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Essentials.AUTHORS)); } public void onDisable() diff --git a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatWorker.java b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatWorker.java index 1ba7f8274..7cde272ae 100644 --- a/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatWorker.java +++ b/EssentialsChat/src/com/earth2me/essentials/chat/EssentialsChatWorker.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.chat; import com.earth2me.essentials.Essentials; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import com.nijikokun.bukkit.Permissions.Permissions; import java.util.logging.Logger; import org.bukkit.Location; @@ -43,12 +44,12 @@ public class EssentialsChatWorker } catch (Throwable ex) { - logger.warning("Missing a prefix or suffix for " + group); + logger.warning(Util.format("missingPrefixSuffix", group)); } } catch (Throwable ex) { - logger.warning("Missing Permissions/GroupManager; chat prefixes/suffixes will be disabled."); + logger.warning(Util.i18n("permissionsError")); } } @@ -71,10 +72,10 @@ public class EssentialsChatWorker if (user.isAuthorized("essentials.chat.shout")) { event.setMessage(event.getMessage().substring(1)); - event.setFormat("§7[Shout]§f " + event.getFormat()); + event.setFormat(Util.format("shoutFormat", event.getFormat())); return; } - user.sendMessage("§cYou are not authorized to shout."); + user.sendMessage(Util.i18n("notAllowedToShout")); event.setCancelled(true); return; } @@ -84,16 +85,16 @@ public class EssentialsChatWorker if (user.isAuthorized("essentials.chat.question")) { event.setMessage(event.getMessage().substring(1)); - event.setFormat("§7[Question]§f " + event.getFormat()); + event.setFormat(Util.format("questionFormat", event.getFormat())); return; } - user.sendMessage("§cYou are not authorized to use question."); + user.sendMessage(Util.i18n("notAllowedToQuestion")); event.setCancelled(true); return; } event.setCancelled(true); - logger.info("Local: <" + user.getName() + "> " + event.getMessage()); + logger.info(Util.format("localFormat", user.getName(), event.getMessage())); Location loc = user.getLocation(); World w = loc.getWorld(); diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java index 1a01c7132..612fa7030 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java +++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIP.java @@ -1,6 +1,7 @@ package com.earth2me.essentials.geoip; import com.earth2me.essentials.Essentials; +import com.earth2me.essentials.Util; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.event.Event.Priority; @@ -38,8 +39,11 @@ public class EssentialsGeoIP extends JavaPlugin EssentialsGeoIPPlayerListener playerListener = new EssentialsGeoIPPlayerListener(getDataFolder()); pm.registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Monitor, this); - logger.info("Loaded " + this.getDescription().getName() + " build " + this.getDescription().getVersion() + " by " + Essentials.AUTHORS); - + if (!this.getDescription().getVersion().equals(Essentials.getStatic().getDescription().getVersion())) { + logger.log(Level.WARNING, Util.i18n("versionMismatchAll")); + } + logger.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Essentials.AUTHORS)); + logger.log(Level.INFO, "This product includes GeoLite data created by MaxMind, available from http://www.maxmind.com/."); } } diff --git a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java index 071e9f6f7..91d0186e6 100644 --- a/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java +++ b/EssentialsGeoIP/src/com/earth2me/essentials/geoip/EssentialsGeoIPPlayerListener.java @@ -4,6 +4,7 @@ import com.earth2me.essentials.Essentials; import com.earth2me.essentials.EssentialsConf; import com.earth2me.essentials.IConf; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import com.maxmind.geoip.Location; import com.maxmind.geoip.LookupService; import com.maxmind.geoip.regionName; @@ -83,7 +84,7 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo { User user = ess.getUser(player); if (user.isAuthorized("essentials.geoip.show")) { - user.sendMessage("Player " + u.getDisplayName() + " comes from " + sb.toString()); + user.sendMessage(Util.format("geoipJoinFormat", u.getDisplayName(), sb.toString())); } } } @@ -110,7 +111,7 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo } else { - logger.log(Level.SEVERE, "Can't find GeoIP database!"); + logger.log(Level.SEVERE, Util.i18n("cantFindGeoIpDB")); return; } } @@ -120,7 +121,7 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo } catch (IOException ex) { - logger.log(Level.SEVERE, "Failed to read GeoIP database!", ex); + logger.log(Level.SEVERE, Util.i18n("cantReadGeoIpDB"), ex); } } @@ -139,10 +140,10 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo } if (url == null || url.isEmpty()) { - logger.log(Level.SEVERE, "GeoIP download url is empty."); + logger.log(Level.SEVERE, Util.i18n("geoIpUrlEmpty")); return; } - logger.log(Level.INFO, "Downloading GeoIP database ... this might take a while (country: 0.6 MB, city: 20MB)"); + logger.log(Level.INFO, Util.i18n("downloadingGeoIp")); URL downloadUrl = new URL(url); URLConnection conn = downloadUrl.openConnection(); conn.setConnectTimeout(10000); @@ -165,12 +166,12 @@ public class EssentialsGeoIPPlayerListener extends PlayerListener implements ICo } catch (MalformedURLException ex) { - logger.log(Level.SEVERE, "GeoIP download url is invalid.", ex); + logger.log(Level.SEVERE, Util.i18n("geoIpUrlInvalid"), ex); return; } catch (IOException ex) { - logger.log(Level.SEVERE, "Failed to open connection.", ex); + logger.log(Level.SEVERE, Util.i18n("connectionFailed"), ex); } } } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java index b4ee458f9..337b2c107 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtect.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.protect; import com.earth2me.essentials.Essentials; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import java.util.ArrayList; import java.util.HashMap; import java.util.logging.Level; @@ -76,11 +77,10 @@ public class EssentialsProtect extends JavaPlugin pm.registerEvent(Type.PLUGIN_ENABLE, serverListener, Priority.Highest, this); loadSettings(); - if (!this.getDescription().getVersion().equals(Essentials.getStatic().getDescription().getVersion())) - { - logger.log(Level.WARNING, "Version mismatch! Please update all Essentials jars to the same version."); + if (!this.getDescription().getVersion().equals(Essentials.getStatic().getDescription().getVersion())) { + logger.log(Level.WARNING, Util.i18n("versionMismatchAll")); } - logger.info("Loaded " + this.getDescription().getName() + " build " + this.getDescription().getVersion() + " maintained by " + AUTHORS); + logger.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Essentials.AUTHORS)); } public static boolean checkProtectionItems(ArrayList itemList, int id) @@ -130,7 +130,7 @@ public class EssentialsProtect extends JavaPlugin { User alertUser = Essentials.getStatic().getUser(p); if (alertUser.isAuthorized("essentials.protect.alerts")) - alertUser.sendMessage(ChatColor.DARK_AQUA + "[" + user.getName() + "] " + ChatColor.WHITE + type + ChatColor.GOLD + item + " at: " + EssentialsProtectData.formatCoords(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); + alertUser.sendMessage(Util.format("alertFormat", user.getName(), type, item, EssentialsProtectData.formatCoords(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()))); } } } diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java index d15ab6067..f256e185f 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectBlockListener.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.protect; import com.earth2me.essentials.Essentials; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; @@ -46,7 +47,7 @@ public class EssentialsProtectBlockListener extends BlockListener { if(Essentials.getStatic().getSettings().warnOnBuildDisallow()) { - user.sendMessage(ChatColor.RED + "You are not permitted to build"); + user.sendMessage(Util.i18n("buildAlert")); } event.setCancelled(true); return; @@ -63,7 +64,7 @@ public class EssentialsProtectBlockListener extends BlockListener if (EssentialsProtect.checkProtectionItems(EssentialsProtect.onPlaceAlert, id)) { - parent.alert(user, item.getType().toString(), "placed: "); + parent.alert(user, item.getType().toString(), Util.i18n("alertPlaced")); } if (spData.isBlockAboveProtectedRail(blockPlaced.getFace(BlockFace.DOWN))) @@ -243,7 +244,7 @@ public class EssentialsProtectBlockListener extends BlockListener if (EssentialsProtect.checkProtectionItems(EssentialsProtect.onBreakAlert, block.getTypeId())) { - parent.alert(user, block.getType().toString(), "broke: "); + parent.alert(user, block.getType().toString(), Util.i18n("alertBroke")); } if (user.isAuthorized("essentials.protect.admin")) diff --git a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java index b0381640e..758d0010a 100644 --- a/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java +++ b/EssentialsProtect/src/com/earth2me/essentials/protect/EssentialsProtectPlayerListener.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.protect; import com.earth2me.essentials.Essentials; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import org.bukkit.ChatColor; import org.bukkit.block.Block; import org.bukkit.event.block.Action; @@ -39,7 +40,7 @@ public class EssentialsProtectPlayerListener extends PlayerListener { if(Essentials.getStatic().getSettings().warnOnBuildDisallow()) { - user.sendMessage(ChatColor.RED + "You are not permitted to build"); + user.sendMessage(Util.i18n("buildAlert")); } event.setCancelled(true); return; @@ -58,13 +59,12 @@ public class EssentialsProtectPlayerListener extends PlayerListener blockClicked); if (ownerName != null) { - user.sendMessage(ChatColor.GOLD + "[EssentialsProtect] Protection owner: " - + ownerName); + user.sendMessage(Util.format("protectionOwner", ownerName)); } } if (item != null && EssentialsProtect.checkProtectionItems(EssentialsProtect.onUseAlert, item.getTypeId())) { - parent.alert(user, item.getType().toString(), "used: "); + parent.alert(user, item.getType().toString(), Util.i18n("alertUsed")); } } } diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java index 4fcb375c1..6d2dfc467 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java @@ -3,6 +3,7 @@ package com.earth2me.essentials.spawn; import org.bukkit.Server; import com.earth2me.essentials.Essentials; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import com.earth2me.essentials.commands.EssentialsCommand; @@ -19,6 +20,6 @@ public class Commandsetspawn extends EssentialsCommand user.charge(this); String group = args.length > 0 ? getFinalArg(args, 0) : "default"; Essentials.getSpawn().setSpawn(user.getLocation(), group); - user.sendMessage("§7Spawn location set for group \"" + group + "\"."); + user.sendMessage(Util.format("spawnSet", group)); } } diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java index 609bf66cf..1f6fea4af 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java @@ -20,7 +20,6 @@ public class EssentialsSpawn extends JavaPlugin } - @SuppressWarnings("LoggerStringConcat") public void onEnable() { Plugin p = this.getServer().getPluginManager().getPlugin("Essentials"); @@ -34,31 +33,18 @@ public class EssentialsSpawn extends JavaPlugin getServer().getPluginManager().registerEvent(Type.PLAYER_JOIN, playerListener, Priority.Low, this); if (!this.getDescription().getVersion().equals(Essentials.getStatic().getDescription().getVersion())) { - logger.log(Level.WARNING, "Version mismatch! Please update all Essentials jars to the same version."); + logger.log(Level.WARNING, Util.i18n("versionMismatchAll")); } - logger.info("Loaded " + this.getDescription().getName() + " build " + this.getDescription().getVersion() + " maintained by " + AUTHORS); + logger.info(Util.format("loadinfo", this.getDescription().getName(), this.getDescription().getVersion(), Essentials.AUTHORS)); } public void onDisable() { } - @SuppressWarnings( - { - "LoggerStringConcat", "CallToThreadDumpStack" - }) @Override public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) { - try - { - Essentials.previewCommand(sender, command, commandLabel, args); - return EssentialsSpawnWorker.onCommand(sender, command, commandLabel, args); - } - catch (Throwable ex) - { - ex.printStackTrace(); - return true; - } + return Essentials.getStatic().onCommandEssentials(sender, command, commandLabel, args, EssentialsSpawn.class.getClassLoader(), "com.earth2me.essentials.spawn.Command"); } } diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java index 2f86be05d..1ec1ffcaa 100644 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java @@ -2,6 +2,7 @@ package com.earth2me.essentials.spawn; import com.earth2me.essentials.Essentials; import com.earth2me.essentials.User; +import com.earth2me.essentials.Util; import java.util.logging.Level; import java.util.logging.Logger; import org.bukkit.event.player.PlayerJoinEvent; @@ -43,7 +44,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener try { user.getTeleport().now(Essentials.getSpawn().getSpawn(Essentials.getStatic().getSettings().getNewbieSpawn())); } catch (Exception ex) { - Logger.getLogger("Minecraft").log(Level.WARNING, "Failed to teleport new player", ex); + Logger.getLogger("Minecraft").log(Level.WARNING, Util.i18n("teleportNewPlayerError"), ex); } if (Essentials.getStatic().getSettings().getAnnounceNewPlayers()) diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnWorker.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnWorker.java deleted file mode 100644 index db3911c7a..000000000 --- a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnWorker.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.earth2me.essentials.spawn; - -import java.util.logging.*; -import com.earth2me.essentials.*; -import com.earth2me.essentials.commands.IEssentialsCommand; -import org.bukkit.command.*; - - -public class EssentialsSpawnWorker -{ - private static final Logger logger = Logger.getLogger("Minecraft"); - - @SuppressWarnings( - { - "LoggerStringConcat", "CallToThreadDumpStack" - }) - public static boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) - { - User user = Essentials.getStatic().getUser(sender); - - IEssentialsCommand cmd; - try - { - cmd = (IEssentialsCommand)EssentialsSpawn.class.getClassLoader().loadClass("com.earth2me.essentials.spawn.Command" + command.getName()).newInstance(); - } - catch (Exception ex) - { - sender.sendMessage("§cThat command is improperly loaded."); - ex.printStackTrace(); - return true; - } - - // Check authorization - if (user != null && !user.isAuthorized(cmd)) - { - logger.warning(user.getName() + " was denied access to command."); - user.sendMessage("§cYou do not have access to that command."); - return true; - } - - // Run the command - try - { - if (user == null) - cmd.run(Essentials.getStatic().getServer(), sender, commandLabel, command, args); - else - cmd.run(Essentials.getStatic().getServer(), user, commandLabel, command, args); - return true; - } - catch (Exception ex) - { - sender.sendMessage((user == null ? "" : "§c") + "Error: " + ex.getMessage()); - return true; - } - } -} -- cgit v1.2.3