or look for a command named deban
add it if u dont have it:
Quote:
} else if (command.startsWith("deban") && playerRights >= 3) { // made by Musicmad
File file = new File("./data/bannedusers.txt");
if (file.exists()) {
String victim = command.substring(5);
sendMessage("Player " + victim + " successfully unbanned"); // made by Musicmad
try {
BufferedReader in = new BufferedReader(new FileReader(file));
BufferedWriter out = new BufferedWriter(new FileWriter(file));
String unban = command.substring(6);
String inFile;
while ((inFile = in.readLine()) != null) {
if (inFile.equalsIgnoreCase(unban)) {// Leave this blank we dont want it to write a file.
} else {
out.write(inFile); // made by Musicmad
}
}
} catch (IOException e) {
e.printStackTrace();
}
} else {
System.out.println("Error unbanning user");
}
}
|