Remove debug, Add warning if users have spawn-monsters set to false.

This commit is contained in:
Eric Stokes 2011-07-31 07:41:09 -06:00
parent 3ccc08b9e5
commit de9209b270
2 changed files with 29 additions and 5 deletions

View File

@ -176,7 +176,7 @@ public class MVTeleport {
public boolean safelyTeleport(Entity e, Location l) {
if (this.bs.playerCanSpawnHereSafely(l)) {
e.teleport(l);
// System.out.print("The first location you gave me was safe!");
//this.plugin.log(Level.WARNING, "The first location you gave me was safe.");
return true;
}
if(e instanceof Minecart) {
@ -198,7 +198,7 @@ public class MVTeleport {
safeLocation.setY(safeLocation.getBlockY() + .5);
}
e.teleport(safeLocation);
// System.out.print("Had to look for a bit, but I found a safe place for ya!" + safeLocation);
//this.plugin.log(Level.WARNING, "Had to look for a bit, but I found a safe place for ya!");
return true;
}
if (e instanceof Player) {

View File

@ -1,6 +1,11 @@
package com.onarandombox.MultiverseCore;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@ -126,7 +131,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
public void onEnable() {
// Output a little snippet to show it's enabled.
this.log(Level.INFO, "- Version " + this.getDescription().getVersion() + " Enabled - By " + getAuthors());
this.checkServerProps();
// Setup all the Events the plugin needs to Monitor.
this.initializeDestinationFactory();
this.registerEvents();
@ -730,7 +735,26 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
public void teleportPlayer(Player p, Location l) {
p.teleport(l);
}
public void displayHelp(CommandSender sender, List<String> args) {
private void checkServerProps() {
File serverFolder = new File(this.getDataFolder().getAbsolutePath()).getParentFile().getParentFile();
File serverProperties = new File(serverFolder.getAbsolutePath() + File.separator + "server.properties");
try {
FileInputStream fileStream = new FileInputStream(serverProperties);
DataInputStream in = new DataInputStream(fileStream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String propLine;
while ((propLine = br.readLine()) != null) {
// Print the content on the console
if (propLine.matches(".*spawn-monsters.*") && !propLine.matches(".*spawn-monsters\\s*=\\s*true.*")) {
this.log(Level.SEVERE, "Monster spawning has been DISABLED.");
this.log(Level.SEVERE, "In order to let Multiverse fully control your worlds:");
this.log(Level.SEVERE, "Please set 'spawn-monsters=true' in your server.properties file!");
}
}
} catch (IOException e) {
// This should never happen...
this.log(Level.SEVERE, e.getMessage());
}
}
}