diff --git a/src/com/onarandombox/MultiverseCore/MVPermissions.java b/src/com/onarandombox/MultiverseCore/MVPermissions.java index 482f6a70..b8b9615e 100644 --- a/src/com/onarandombox/MultiverseCore/MVPermissions.java +++ b/src/com/onarandombox/MultiverseCore/MVPermissions.java @@ -95,17 +95,19 @@ public class MVPermissions implements PermissionsInterface { if (!(sender instanceof Player)) { return true; } - + Player player = (Player) sender; - + boolean opFallback = this.plugin.configMV.getBoolean("opfallback", true); - if (player.isOp() && opFallback) { - // If Player is Op we always let them use it if they have the fallback enabled! - return true; - } else if (this.permissions != null && this.permissions.has(player, node)) { + if (this.permissions != null && this.permissions.has(player, node)) { // If Permissions is enabled we check against them. return true; - } else if(sender.hasPermission(node)) { + } else if (sender.hasPermission(node) && !opFallback) { + // If Now check the bukkit permissions + // OpFallback must be disabled for this to work + return true; + } else if (player.isOp() && opFallback) { + // If Player is Op we always let them use it if they have the fallback enabled! return true; } // If the Player doesn't have Permissions and isn't an Op then diff --git a/src/com/onarandombox/MultiverseCore/MVWorld.java b/src/com/onarandombox/MultiverseCore/MVWorld.java index ab0796a2..64faee62 100644 --- a/src/com/onarandombox/MultiverseCore/MVWorld.java +++ b/src/com/onarandombox/MultiverseCore/MVWorld.java @@ -8,6 +8,8 @@ import java.util.logging.Level; import org.bukkit.ChatColor; import org.bukkit.World; import org.bukkit.World.Environment; +import org.bukkit.permissions.Permission; +import org.bukkit.permissions.PermissionDefault; import org.bukkit.util.config.Configuration; enum EnglishChatColor { @@ -88,6 +90,7 @@ public class MVWorld { * The generator as a string. This is used only for reporting. ex: BukkitFullOfMoon:GenID */ private String generator; + private Permission permission; public MVWorld(World world, Configuration config, MultiverseCore instance, Long seed, String generatorString) { this.config = config; @@ -128,6 +131,11 @@ public class MVWorld { this.translateTempSpawn(config); config.save(); + this.permission = new Permission("multiverse.access." + this.getName(), "Allows access to " + this.getName(), PermissionDefault.TRUE); + try { + this.plugin.getServer().getPluginManager().addPermission(this.permission); + } catch (IllegalArgumentException e) { + } // The following 3 lines will add some sample data to new worlds created. // if (config.getIntList("worlds." + name + ".blockBlacklist", new ArrayList()).size() == 0) { // addSampleData(); diff --git a/src/com/onarandombox/MultiverseCore/commands/TeleportCommand.java b/src/com/onarandombox/MultiverseCore/commands/TeleportCommand.java index aa746247..2344ccb8 100644 --- a/src/com/onarandombox/MultiverseCore/commands/TeleportCommand.java +++ b/src/com/onarandombox/MultiverseCore/commands/TeleportCommand.java @@ -23,7 +23,7 @@ public class TeleportCommand extends MultiverseCommand { public TeleportCommand(MultiverseCore plugin) { super(plugin); Permission self = new Permission("multiverse.core.tp.self", "Allows you to teleport yourself to other worlds.", PermissionDefault.OP); - Permission other = new Permission("multiverse.core.tp.self", "Allows you to teleport yourself to other worlds.", PermissionDefault.OP); + Permission other = new Permission("multiverse.core.tp.other", "Allows you to teleport yourself to other worlds.", PermissionDefault.OP); this.plugin.getServer().getPluginManager().addPermission(self); this.plugin.getServer().getPluginManager().addPermission(other); Map children = new HashMap(); @@ -37,6 +37,7 @@ public class TeleportCommand extends MultiverseCommand { this.addKey("mvtp"); this.addKey("mv tp"); this.setPermission(tp); + this.playerTeleporter = new MVTeleport(this.plugin); } @Override @@ -51,8 +52,8 @@ public class TeleportCommand extends MultiverseCommand { String worldName; if (args.size() == 2) { - if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.world.tp.other", true)) { - sender.sendMessage("You don't have permission to teleport another player. (multiverse.world.tp.other)"); + if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.core.tp.other", true)) { + sender.sendMessage("You don't have permission to teleport another player. (multiverse.core.tp.other)"); return; } teleportee = this.plugin.getServer().getPlayer(args.get(0)); @@ -64,8 +65,8 @@ public class TeleportCommand extends MultiverseCommand { } else { worldName = args.get(0); - if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.world.tp.self", true)) { - sender.sendMessage("You don't have permission to teleport yourself between worlds. (multiverse.world.tp.self)"); + if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.core.tp.self", true)) { + sender.sendMessage("You don't have permission to teleport yourself between worlds. (multiverse.core.tp.self)"); return; }