Finall fix permissions issues

This commit is contained in:
Eric Stokes 2011-07-26 18:47:33 -06:00
parent 70e4bad62b
commit 970e06042a
4 changed files with 15 additions and 17 deletions

@ -1 +1 @@
Subproject commit daf74cd56d472571ba8e99e7fc152d8b8d31c0a5
Subproject commit 2bdfb13a1cd5e1bb94e523514937e05e1fcd450b

View File

@ -261,17 +261,16 @@ public class MultiverseCore extends JavaPlugin {
// Force the worlds to be loaded, ie don't just load new worlds.
if (forceLoad) {
// Remove all world permissions.
Permission all = this.getServer().getPluginManager().getPermission("multiverse.*");
Permission allAccess = this.getServer().getPluginManager().getPermission("multiverse.access.*");
for (MVWorld w : this.worlds.values()) {
// Remove this world from the master list
if (all != null) {
all.getChildren().remove(w.getPermission().getName());
if (allAccess != null) {
allAccess.getChildren().remove(w.getPermission().getName());
}
this.getServer().getPluginManager().removePermission(w.getPermission().getName());
}
// Recalc the all permission
this.getServer().getPluginManager().recalculatePermissionDefaults(all);
this.getServer().getPluginManager().removePermission("multiverse.access.*");
this.getServer().getPluginManager().recalculatePermissionDefaults(allAccess);
this.worlds.clear();
}

View File

@ -34,8 +34,8 @@ public class SpawnCommand extends MultiverseCommand {
}
// If a persons name was passed in, you must be A. the console, or B have permissions
if (args.size() == 1) {
if (player != null && !this.plugin.getPermissions().hasPermission(player, "multiverse.world.spawn.other", true)) {
sender.sendMessage("You don't have permission to teleport another player to spawn. (multiverse.world.spawn.other)");
if (player != null && !this.plugin.getPermissions().hasPermission(player, "multiverse.core.spawn.other", true)) {
sender.sendMessage("You don't have permission to teleport another player to spawn. (multiverse.core.spawn.other)");
return;
}
Player target = this.plugin.getServer().getPlayer(args.get(0));
@ -51,8 +51,8 @@ public class SpawnCommand extends MultiverseCommand {
sender.sendMessage(args.get(0) + " is not logged on right now!");
}
} else {
if (player != null && !this.plugin.getPermissions().hasPermission(player, "multiverse.world.spawn.self", true)) {
sender.sendMessage("You don't have permission to teleport yourself to spawn. (multiverse.world.spawn.self)");
if (player != null && !this.plugin.getPermissions().hasPermission(player, "multiverse.core.spawn.self", true)) {
sender.sendMessage("You don't have permission to teleport yourself to spawn. (multiverse.core.spawn.self)");
return;
}
if (player != null) {

View File

@ -23,23 +23,22 @@ 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.other", "Allows you to teleport yourself to other worlds.", PermissionDefault.OP);
this.plugin.getServer().getPluginManager().addPermission(self);
this.plugin.getServer().getPluginManager().addPermission(other);
Permission other = new Permission("multiverse.core.tp.other", "Allows you to teleport others to other worlds.", PermissionDefault.OP);
Map<String, Boolean> children = new HashMap<String, Boolean>();
children.put(self.getName(), true);
children.put(other.getName(), true);
Permission alltp = new Permission("multiverse.core.tp.*", "Allows teleportation to other worlds.", PermissionDefault.OP, children);
Permission tp = new Permission("multiverse.core.tp", "Allows teleportation to other worlds.", PermissionDefault.OP, children);
this.plugin.getServer().getPluginManager().addPermission(alltp);
this.setName("Teleport");
this.setCommandUsage("/mvtp " + ChatColor.GOLD + "[PLAYER]" + ChatColor.GREEN + " {WORLD}");
this.setArgRange(1, 2);
this.addKey("mvtp");
this.addKey("mv tp");
this.setPermission(tp);
this.playerTeleporter = new MVTeleport(this.plugin);
// setPermission in some for is REQUIRED
this.addAdditonalPermission(self);
this.addAdditonalPermission(other);
this.setPermission(tp);
}
@Override