This commit is contained in:
main() 2012-11-05 16:40:06 +01:00
parent 63f8811b67
commit 73e394d5ec
6 changed files with 26 additions and 17 deletions

View File

@ -589,7 +589,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
this.exempt = new Permission("multiverse.exempt." + this.getName(),
"A player who has this does not pay to enter this world, or use any MV portals in it " + this.getName(), PermissionDefault.OP);
this.limitbypassperm = new Permission("mv.bypass.playerlimit." + this.getName(),
"A player who can enter this world regardless of wether its full", PermissionDefault.OP);
try {
@ -934,7 +934,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
public void setGenerator(String generator) {
this.setPropertyValueUnchecked("generator", generator);
}
/**
* {@inheritDoc}
*/
@ -942,7 +942,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
public int getPlayerLimit() {
return this.playerLimit;
}
/**
* {@inheritDoc}
*/

View File

@ -18,7 +18,6 @@ import com.onarandombox.MultiverseCore.utils.SimpleBlockSafety;
import com.onarandombox.MultiverseCore.utils.SimpleLocationManipulation;
import com.onarandombox.MultiverseCore.utils.SimpleSafeTTeleporter;
import com.onarandombox.MultiverseCore.utils.VaultHandler;
import com.onarandombox.MultiverseCore.utils.WorldManager;
import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;

View File

@ -620,11 +620,11 @@ public interface MultiverseWorld {
* @param autoLoad True if players dying in this world respawn at their bed.
*/
void setBedRespawn(boolean autoLoad);
/**
* Sets the player limit for this world after which players without an override
* permission node will not be allowed in. A value of -1 or less signifies no limit
*
*
* @param limit The new limit
*/
void setPlayerLimit(int limit);
@ -632,7 +632,7 @@ public interface MultiverseWorld {
/**
* Gets the player limit for this world after which players without an override
* permission node will not be allowed in. A value of -1 or less signifies no limit
*
*
* @return The player limit
*/
int getPlayerLimit();

View File

@ -193,7 +193,7 @@ public class MVPlayerListener implements Listener {
+ "' don't have the FUNDS required to enter it.");
return;
}
// Check if player is allowed to enter the world if we're enforcing permissions
if (plugin.getMVConfig().getEnforceAccess()) {
event.setCancelled(!pt.playerCanGoFromTo(fromWorld, toWorld, teleporter, teleportee));
@ -208,7 +208,7 @@ public class MVPlayerListener implements Listener {
this.plugin.log(Level.FINE, "Player '" + teleportee.getName()
+ "' was allowed to go to '" + toWorld.getAlias() + "' because enforceaccess is off.");
}
// Does a limit actually exist?
if (toWorld.getPlayerLimit() > -1) {
// Are there equal or more people on the world than the limit?
@ -224,7 +224,7 @@ public class MVPlayerListener implements Listener {
}
}
}
// By this point anything cancelling the event has returned on the method, meaning the teleport is a success \o/
this.stateSuccess(teleportee.getName(), toWorld.getAlias());
}

View File

@ -257,17 +257,24 @@ public class PermissionTools {
}
return true;
}
/**
* Checks to see if a player can bypass the player limit.
*
* @param toWorld The world travelling to.
* @param teleporter The player that initiated the teleport.
* @param teleportee The player travelling.
* @return True if they can bypass the player limit.
*/
public boolean playerCanBypassPlayerLimit(MultiverseWorld toWorld, CommandSender teleporter, Player teleportee) {
if (teleporter == null) {
teleporter = teleportee;
}
if (!(teleporter instanceof Player)) {
return true;
return true;
}
MVPermissions perms = plugin.getMVPerms();
if (perms.hasPermission(teleportee, "mv.bypass.playerlimit." + toWorld.getName(), false)) {
return true;

View File

@ -24,8 +24,8 @@ public class VaultHandler implements Listener {
private boolean setupVaultEconomy() {
if (Bukkit.getPluginManager().getPlugin("Vault") != null) {
final RegisteredServiceProvider<Economy> economyProvider
= Bukkit.getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
final RegisteredServiceProvider<Economy> economyProvider =
Bukkit.getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
if (economyProvider != null) {
Logging.fine("Vault economy enabled.");
economy = economyProvider.getProvider();
@ -41,6 +41,9 @@ public class VaultHandler implements Listener {
return (economy != null);
}
/**
* Listens for Vault plugin events.
*/
private class VaultListener implements Listener {
@EventHandler
private void vaultEnabled(PluginEnableEvent event) {