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);
}
else {
// Lets try it that way. Maybe now people don't "disappear" any longer
event.setFrom(event.getFrom());
event.setTo(event.getFrom().clone());
event.getPlayer().teleportTo(event.getFrom());

View File

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