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(), 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); "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(), this.limitbypassperm = new Permission("mv.bypass.playerlimit." + this.getName(),
"A player who can enter this world regardless of wether its full", PermissionDefault.OP); "A player who can enter this world regardless of wether its full", PermissionDefault.OP);
try { try {
@ -934,7 +934,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
public void setGenerator(String generator) { public void setGenerator(String generator) {
this.setPropertyValueUnchecked("generator", generator); this.setPropertyValueUnchecked("generator", generator);
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -942,7 +942,7 @@ public class MVWorld extends SerializationConfig implements MultiverseWorld {
public int getPlayerLimit() { public int getPlayerLimit() {
return this.playerLimit; return this.playerLimit;
} }
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */

View File

@ -18,7 +18,6 @@ import com.onarandombox.MultiverseCore.utils.SimpleBlockSafety;
import com.onarandombox.MultiverseCore.utils.SimpleLocationManipulation; import com.onarandombox.MultiverseCore.utils.SimpleLocationManipulation;
import com.onarandombox.MultiverseCore.utils.SimpleSafeTTeleporter; import com.onarandombox.MultiverseCore.utils.SimpleSafeTTeleporter;
import com.onarandombox.MultiverseCore.utils.VaultHandler; import com.onarandombox.MultiverseCore.utils.VaultHandler;
import com.onarandombox.MultiverseCore.utils.WorldManager;
import com.pneumaticraft.commandhandler.CommandHandler; import com.pneumaticraft.commandhandler.CommandHandler;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player; 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. * @param autoLoad True if players dying in this world respawn at their bed.
*/ */
void setBedRespawn(boolean autoLoad); void setBedRespawn(boolean autoLoad);
/** /**
* Sets the player limit for this world after which players without an override * 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 * permission node will not be allowed in. A value of -1 or less signifies no limit
* *
* @param limit The new limit * @param limit The new limit
*/ */
void setPlayerLimit(int 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 * 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 * permission node will not be allowed in. A value of -1 or less signifies no limit
* *
* @return The player limit * @return The player limit
*/ */
int getPlayerLimit(); int getPlayerLimit();

View File

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

View File

@ -257,17 +257,24 @@ public class PermissionTools {
} }
return true; 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) { public boolean playerCanBypassPlayerLimit(MultiverseWorld toWorld, CommandSender teleporter, Player teleportee) {
if (teleporter == null) { if (teleporter == null) {
teleporter = teleportee; teleporter = teleportee;
} }
if (!(teleporter instanceof Player)) { if (!(teleporter instanceof Player)) {
return true; return true;
} }
MVPermissions perms = plugin.getMVPerms(); MVPermissions perms = plugin.getMVPerms();
if (perms.hasPermission(teleportee, "mv.bypass.playerlimit." + toWorld.getName(), false)) { if (perms.hasPermission(teleportee, "mv.bypass.playerlimit." + toWorld.getName(), false)) {
return true; return true;

View File

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