diff options
author | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-03-19 22:39:51 +0000 |
---|---|---|
committer | snowleo <snowleo@e251c2fe-e539-e718-e476-b85c1f46cddb> | 2011-03-19 22:39:51 +0000 |
commit | a3ebd254f2897951a2ce31fdd90b6944c582d82b (patch) | |
tree | 11c8670882eed130d7ff1b33cc7c65e496f1bbac /EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java | |
parent | 487577f2fa856a61077594ad6677f0bdd7150fcd (diff) | |
download | Essentials-a3ebd254f2897951a2ce31fdd90b6944c582d82b.tar Essentials-a3ebd254f2897951a2ce31fdd90b6944c582d82b.tar.gz Essentials-a3ebd254f2897951a2ce31fdd90b6944c582d82b.tar.lz Essentials-a3ebd254f2897951a2ce31fdd90b6944c582d82b.tar.xz Essentials-a3ebd254f2897951a2ce31fdd90b6944c582d82b.zip |
Moving all files to trunk.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@969 e251c2fe-e539-e718-e476-b85c1f46cddb
Diffstat (limited to 'EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java')
-rw-r--r-- | EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java new file mode 100644 index 000000000..54e6bd198 --- /dev/null +++ b/EssentialsSpawn/src/com/earth2me/essentials/spawn/EssentialsSpawn.java @@ -0,0 +1,65 @@ +package com.earth2me.essentials.spawn; + +import java.io.*; +import java.util.logging.*; +import com.earth2me.essentials.*; +import org.bukkit.command.*; +import org.bukkit.event.Event.Priority; +import org.bukkit.event.Event.Type; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.java.*; + + +public class EssentialsSpawn extends JavaPlugin +{ + public static final String AUTHORS = Essentials.AUTHORS; + private static final Logger logger = Logger.getLogger("Minecraft"); + + public EssentialsSpawn() throws IOException + { + + } + + @SuppressWarnings("LoggerStringConcat") + public void onEnable() + { + Plugin p = this.getServer().getPluginManager().getPlugin("Essentials"); + if (p != null) { + if (!this.getServer().getPluginManager().isPluginEnabled(p)) { + this.getServer().getPluginManager().enablePlugin(p); + } + } + EssentialsSpawnPlayerListener playerListener = new EssentialsSpawnPlayerListener(); + getServer().getPluginManager().registerEvent(Type.PLAYER_RESPAWN, playerListener, Priority.Low, this); + 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.info("Loaded " + this.getDescription().getName() + " build " + this.getDescription().getVersion() + " maintained by " + AUTHORS); + } + + public void onDisable() + { + } + + @SuppressWarnings( + { + "LoggerStringConcat", "CallToThreadDumpStack" + }) + @Override + public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) + { + try + { + Essentials.loadClasses(); + Essentials.previewCommand(sender, command, commandLabel, args); + return EssentialsSpawnWorker.onCommand(sender, command, commandLabel, args); + } + catch (Throwable ex) + { + ex.printStackTrace(); + return true; + } + } +} |