mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-18 20:41:37 +02:00
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
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
@@ -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");
|
||||
}
|
||||
}
|
||||
|
@@ -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())
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user