summaryrefslogtreecommitdiffstats
path: root/EssentialsSpawn/src
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsSpawn/src')
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/Commandsetspawn.java3
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java20
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnPlayerListener.java3
-rw-r--r--EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawnWorker.java56
4 files changed, 7 insertions, 75 deletions
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;
- }
- }
-}