Add Message to ops and those who can create, Closes #25. Bullet proofed a few more methods.

This commit is contained in:
Eric Stokes 2011-06-30 22:07:17 -06:00
parent c43362bb5e
commit 79fba462b9
3 changed files with 13 additions and 4 deletions

View File

@ -97,6 +97,9 @@ public class MVPermissions {
*/ */
public Boolean canEnterWorld(Player p, World w) { public Boolean canEnterWorld(Player p, World w) {
if(!this.plugin.isMVWorld(w.getName())) {
return false;
}
List<String> whiteList = this.plugin.getMVWorld(w.getName()).getPlayerWhitelist(); List<String> whiteList = this.plugin.getMVWorld(w.getName()).getPlayerWhitelist();
List<String> blackList = this.plugin.getMVWorld(w.getName()).getPlayerBlacklist(); List<String> blackList = this.plugin.getMVWorld(w.getName()).getPlayerBlacklist();
boolean returnValue = true; boolean returnValue = true;

View File

@ -1,5 +1,6 @@
package com.onarandombox.MultiverseCore; package com.onarandombox.MultiverseCore;
import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerChatEvent;
@ -84,7 +85,7 @@ public class MVPlayerListener extends PlayerListener {
// TODO: Handle Alternate Respawn from config // TODO: Handle Alternate Respawn from config
MVPlayerSession ps = this.plugin.getPlayerSession(event.getPlayer()); MVPlayerSession ps = this.plugin.getPlayerSession(event.getPlayer());
//Location newrespawn = ps.getRespawnWorld().getSpawnLocation(); // Location newrespawn = ps.getRespawnWorld().getSpawnLocation();
Location newrespawn = event.getPlayer().getWorld().getSpawnLocation(); Location newrespawn = event.getPlayer().getWorld().getSpawnLocation();
String respawnStyle = this.plugin.configMV.getString("notchrespawnstyle", "none"); String respawnStyle = this.plugin.configMV.getString("notchrespawnstyle", "none");
String defaultWorld = this.plugin.configMV.getString("defaultspawnworld", "world"); String defaultWorld = this.plugin.configMV.getString("defaultspawnworld", "world");
@ -93,7 +94,7 @@ public class MVPlayerListener extends PlayerListener {
event.setRespawnLocation(newrespawn); event.setRespawnLocation(newrespawn);
} else if (respawnStyle.equalsIgnoreCase("default")) { } else if (respawnStyle.equalsIgnoreCase("default")) {
if(this.plugin.isMVWorld(defaultWorld)) { if (this.plugin.isMVWorld(defaultWorld)) {
event.setRespawnLocation(this.plugin.getServer().getWorld(defaultWorld).getSpawnLocation()); event.setRespawnLocation(this.plugin.getServer().getWorld(defaultWorld).getSpawnLocation());
} else { } else {
event.setRespawnLocation(newrespawn); event.setRespawnLocation(newrespawn);
@ -107,7 +108,12 @@ public class MVPlayerListener extends PlayerListener {
@Override @Override
public void onPlayerJoin(PlayerJoinEvent event) { public void onPlayerJoin(PlayerJoinEvent event) {
if (this.plugin.getMVWorlds().size() == 0 && this.plugin.ph.hasPermission(event.getPlayer(), "multiverse.world.import", true)) {
event.getPlayer().sendMessage("You don't have any worlds imported into Multiverse!");
event.getPlayer().sendMessage("You can import your current worlds with " + ChatColor.AQUA + "/mvimport");
event.getPlayer().sendMessage("or you can create new ones with " + ChatColor.GOLD + "/mvcreate");
event.getPlayer().sendMessage("If you just wanna see all of the Multiverse Help, type: " + ChatColor.GREEN + "/mv");
}
} }
@Override @Override

View File

@ -119,7 +119,7 @@ public class MultiverseCore extends JavaPlugin {
PluginManager pm = getServer().getPluginManager(); PluginManager pm = getServer().getPluginManager();
// pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Highest, this); // Low so it acts above any other. // pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Priority.Highest, this); // Low so it acts above any other.
pm.registerEvent(Event.Type.PLAYER_TELEPORT, this.playerListener, Priority.Highest, this); // Cancel Teleports if needed. pm.registerEvent(Event.Type.PLAYER_TELEPORT, this.playerListener, Priority.Highest, this); // Cancel Teleports if needed.
pm.registerEvent(Event.Type.PLAYER_LOGIN, this.playerListener, Priority.Normal, this); // To create the Player Session pm.registerEvent(Event.Type.PLAYER_JOIN, this.playerListener, Priority.Normal, this); // To create the Player Session
pm.registerEvent(Event.Type.PLAYER_QUIT, this.playerListener, Priority.Normal, this); // To remove Player Sessions pm.registerEvent(Event.Type.PLAYER_QUIT, this.playerListener, Priority.Normal, this); // To remove Player Sessions
pm.registerEvent(Event.Type.PLAYER_KICK, this.playerListener, Priority.Highest, this); pm.registerEvent(Event.Type.PLAYER_KICK, this.playerListener, Priority.Highest, this);
pm.registerEvent(Event.Type.PLAYER_RESPAWN, this.playerListener, Priority.Normal, this); pm.registerEvent(Event.Type.PLAYER_RESPAWN, this.playerListener, Priority.Normal, this);