Minor changes to logging

This commit is contained in:
Evenprime 2011-02-20 14:05:22 +01:00
parent 274dc260e2
commit f338325bd9
2 changed files with 29 additions and 31 deletions

View File

@ -332,6 +332,7 @@ public class MovingCheck {
event.getPlayer().teleportTo(data.movingSetBackPoint); event.getPlayer().teleportTo(data.movingSetBackPoint);
} }
else { else {
// Lets try it that way. Maybe now people don't "disappear" any longer
event.setFrom(event.getFrom()); event.setFrom(event.getFrom());
event.setTo(event.getFrom().clone()); event.setTo(event.getFrom().clone());
event.getPlayer().teleportTo(event.getFrom()); event.getPlayer().teleportTo(event.getFrom());

View File

@ -3,11 +3,9 @@ package cc.co.evenprime.bukkit.nocheat;
import java.io.File; import java.io.File;
import java.util.logging.Logger; import java.util.logging.Logger;
import org.bukkit.Server;
import org.bukkit.event.Event.Priority; import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginLoader;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.PluginManager;
@ -30,50 +28,49 @@ public class NoCheatPlugin extends JavaPlugin {
public static Logger log; public static Logger log;
public static PermissionHandler Permissions = null; public static PermissionHandler Permissions = null;
public NoCheatPlugin(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
super(pluginLoader, instance, desc, folder, plugin, cLoader);
playerListener = new NoCheatPluginPlayerListener(this); public NoCheatPlugin() {
vehicleListener = new NoCheatPluginVehicleListener(this, playerListener);
playerListener = new NoCheatPluginPlayerListener(this);
log = NoCheatConfiguration.logger; vehicleListener = new NoCheatPluginVehicleListener(this, playerListener);
}
log = NoCheatConfiguration.logger;
}
public void onDisable() { public void onDisable() {
} }
public void onEnable() { public void onEnable() {
PluginManager pm = getServer().getPluginManager(); PluginManager pm = getServer().getPluginManager();
pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Lowest, this); pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Lowest, this);
pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Monitor, this); pm.registerEvent(Event.Type.PLAYER_QUIT, playerListener, Priority.Monitor, this);
pm.registerEvent(Event.Type.VEHICLE_EXIT, vehicleListener, Priority.Monitor, this); pm.registerEvent(Event.Type.VEHICLE_EXIT, vehicleListener, Priority.Monitor, this);
pm.registerEvent(Event.Type.VEHICLE_DAMAGE, vehicleListener, Priority.Monitor, this); pm.registerEvent(Event.Type.VEHICLE_DAMAGE, vehicleListener, Priority.Monitor, this);
PluginDescriptionFile pdfFile = this.getDescription(); PluginDescriptionFile pdfFile = this.getDescription();
Logger.getLogger("Minecraft").info( "NoCheat version " + pdfFile.getVersion() + " is enabled!" ); Logger.getLogger("Minecraft").info( "NoCheat version " + pdfFile.getVersion() + " is enabled!" );
setupPermissions(); setupPermissions();
setupConfig(); setupConfig();
} }
public void setupPermissions() { public void setupPermissions() {
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions"); Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
if(Permissions == null) { if(Permissions == null) {
if(test != null) { if(test != null) {
Permissions = ((Permissions)test).getHandler(); Permissions = ((Permissions)test).getHandler();
} else { } else {
log.info("Nocheat couldn't find Permissions plugin. Fallback to OP -> all allowed."); log.info("Nocheat couldn't find Permissions plugin. Fallback to OP -> all allowed.");
this.getServer().getPluginManager().disablePlugin(this); this.getServer().getPluginManager().disablePlugin(this);
} }
} }
} }
public void setupConfig() { public void setupConfig() {
NoCheatConfiguration.config(new File("plugins/NoCheat/nocheat.yml")); NoCheatConfiguration.config(new File("plugins/NoCheat/nocheat.yml"));
} }
} }