Added check if there's a custom message set.

This commit is contained in:
Jos van 't Hof
2012-04-04 14:15:33 +02:00
parent 5b91c7348f
commit 5f50119c2c
2 changed files with 16 additions and 5 deletions

View File

@@ -17,13 +17,13 @@ public class RandomSpawn extends JavaPlugin{
Logger logger;
YamlHandler yamlHandler;
public YamlHandler yamlHandler;
CommandHandler commandHandler;
RandomSpawnRespawnListener respawnListener;
RandomSpawnJoinListener joinListener;
RandomSpawnSignListener signListener;
RandomSpawnDebugListener debugListener;
DebugListener debugListener;
public HashMap<Player,RandomSpawnSpawner> tasks = new HashMap<Player,RandomSpawnSpawner>();
@@ -52,7 +52,7 @@ public class RandomSpawn extends JavaPlugin{
signListener = new RandomSpawnSignListener(this);
if(yamlHandler.config.getBoolean("debug",false)){
debugListener = new RandomSpawnDebugListener(this);
debugListener = new DebugListener(this);
}
}
@@ -64,6 +64,10 @@ public class RandomSpawn extends JavaPlugin{
if (yamlHandler.config.getBoolean("debug",false)) { logger.info("[Random Spawn] (DEBUG) " + message); }
}
public void logWarning(String message){
logger.warning("[Random Spawn] " + message);
}
public void playerInfo(Player player, String message){
player.sendMessage(ChatColor.AQUA + "[RandomSpawn] " + ChatColor.RESET + message);
}
@@ -74,9 +78,13 @@ public class RandomSpawn extends JavaPlugin{
public void randomSpawnPlayer(Player player, World spawnWorld) {
RandomSpawnSpawner spawner = new RandomSpawnSpawner(this, player, spawnWorld);
spawner.setTaskId(getServer().getScheduler().scheduleSyncRepeatingTask(this, spawner, 0, yamlHandler.config.getInt("generator.interval",4)));
player.setMaximumNoDamageTicks(12000);
player.setNoDamageTicks(12000);
player.sendMessage(yamlHandler.config.getString("messages.pleasewait"));
if(yamlHandler.config.contains("messages.pleasewait")){
player.sendMessage(yamlHandler.config.getString("messages.pleasewait"));
}
}
}

View File

@@ -310,7 +310,10 @@ public class RandomSpawnSpawner implements Runnable{
logStatus(playerName + " is dropped at: " + spawnLocation.getX() + "," + spawnLocation.getZ());
}else{
logStatus(playerName + " is spawned at: " + spawnLocation.getX() + "," + spawnLocation.getY() + "," + spawnLocation.getZ());
player.sendMessage(this.plugin.yamlHandler.config.getString("messages.randomspawned"));
if(plugin.yamlHandler.config.contains("messages.randomspawned")){
player.sendMessage(plugin.yamlHandler.config.getString("messages.randomspawned"));
}
}
if (this.plugin.yamlHandler.worlds.getBoolean(worldName + ".keeprandomspawns",false)){ //checks if spawn should be saved