Version 1.00 - fixed some remaining errors after the merge

This commit is contained in:
Evenprime 2011-05-16 15:01:44 +02:00
parent 6cdc3171ec
commit 5a72df08f7
2 changed files with 21 additions and 5 deletions

View File

@ -3,7 +3,7 @@ name: NoCheat
author: Evenprime author: Evenprime
main: cc.co.evenprime.bukkit.nocheat.NoCheat main: cc.co.evenprime.bukkit.nocheat.NoCheat
version: 0.9.7 version: 1.00
commands: commands:
nocheat: nocheat:

View File

@ -1,7 +1,10 @@
package cc.co.evenprime.bukkit.nocheat; package cc.co.evenprime.bukkit.nocheat;
import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -142,7 +145,7 @@ public class NoCheat extends JavaPlugin implements CommandSender {
// parse the nocheat.yml config file // parse the nocheat.yml config file
setupConfig(); setupConfig();
if(allowFlightSet && movingCheck.isActive()) { if(!allowFlightSet && movingCheck.isActive()) {
Logger.getLogger("Minecraft").warning( "[NoCheat] you have set \"allow-flight=false\" in your server.properties file. That builtin anti-flying-mechanism will likely conflict with this plugin. Please consider deactivating it by setting it to \"true\""); Logger.getLogger("Minecraft").warning( "[NoCheat] you have set \"allow-flight=false\" in your server.properties file. That builtin anti-flying-mechanism will likely conflict with this plugin. Please consider deactivating it by setting it to \"true\"");
} }
@ -328,9 +331,22 @@ public class NoCheat extends JavaPlugin implements CommandSender {
this.setEnabled(false); this.setEnabled(false);
} }
Configuration serverConfig = new Configuration(new File("server.properties")); try {
BufferedReader reader = new BufferedReader(new FileReader(new File("server.properties")));
allowFlightSet = serverConfig.getBoolean("allow-flight", false); allowFlightSet = true;
String s = null;
while((s = reader.readLine()) != null) {
if(s.startsWith("allow-flight=false")) {
allowFlightSet = false;
}
}
} catch (Exception e) {
e.printStackTrace();
// ignore errors
}
} }
@ -375,7 +391,7 @@ public class NoCheat extends JavaPlugin implements CommandSender {
public void handleCustomAction(CustomAction a, Player player) { public void handleCustomAction(CustomAction a, Player player) {
Bukkit.getServer().dispatchCommand(this, a.command.replace("[player]", player.getName())); Bukkit.getServer().dispatchCommand(this, a.command.replace("[player]", player.getName()));
System.out.println("Would execute "+a.command + " now for Player " + player.getName() ); //System.out.println("Would execute "+a.command + " now for Player " + player.getName() );
} }