mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-05 02:11:06 +01:00
Add multiverse.* and all other recursive perms
This commit is contained in:
parent
e374a97257
commit
a3e27da978
@ -1 +1 @@
|
|||||||
Subproject commit c82805a10708224cd9e2eae41e6d28b7f0604b7f
|
Subproject commit 1261045daa106a084a6883d88524c57844cdb135
|
@ -134,6 +134,7 @@ public class MVWorld {
|
|||||||
this.permission = new Permission("multiverse.access." + this.getName(), "Allows access to " + this.getName(), PermissionDefault.TRUE);
|
this.permission = new Permission("multiverse.access." + this.getName(), "Allows access to " + this.getName(), PermissionDefault.TRUE);
|
||||||
try {
|
try {
|
||||||
this.plugin.getServer().getPluginManager().addPermission(this.permission);
|
this.plugin.getServer().getPluginManager().addPermission(this.permission);
|
||||||
|
addToUpperLists(this.permission);
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
}
|
}
|
||||||
// The following 3 lines will add some sample data to new worlds created.
|
// The following 3 lines will add some sample data to new worlds created.
|
||||||
@ -142,6 +143,23 @@ public class MVWorld {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addToUpperLists(Permission permission2) {
|
||||||
|
Permission all = this.plugin.getServer().getPluginManager().getPermission("multiverse.*");
|
||||||
|
Permission allWorlds = this.plugin.getServer().getPluginManager().getPermission("multiverse.access.*");
|
||||||
|
if(all == null) {
|
||||||
|
all = new Permission("multiverse.*");
|
||||||
|
this.plugin.getServer().getPluginManager().addPermission(all);
|
||||||
|
}
|
||||||
|
if(allWorlds == null) {
|
||||||
|
allWorlds = new Permission("multiverse.access.*");
|
||||||
|
this.plugin.getServer().getPluginManager().addPermission(allWorlds);
|
||||||
|
}
|
||||||
|
all.getChildren().put(this.permission.getName(), true);
|
||||||
|
allWorlds.getChildren().put(this.permission.getName(), true);
|
||||||
|
this.plugin.getServer().getPluginManager().recalculatePermissionDefaults(all);
|
||||||
|
this.plugin.getServer().getPluginManager().recalculatePermissionDefaults(allWorlds);
|
||||||
|
}
|
||||||
|
|
||||||
private void translateTempSpawn(Configuration config) {
|
private void translateTempSpawn(Configuration config) {
|
||||||
String tempspawn = config.getString("worlds." + this.name + ".tempspawn", "");
|
String tempspawn = config.getString("worlds." + this.name + ".tempspawn", "");
|
||||||
if (tempspawn.length() > 0) {
|
if (tempspawn.length() > 0) {
|
||||||
@ -533,6 +551,10 @@ public class MVWorld {
|
|||||||
|
|
||||||
public void setRespawnToWorld(String respawnToWorld) {
|
public void setRespawnToWorld(String respawnToWorld) {
|
||||||
this.respawnWorld = respawnToWorld;
|
this.respawnWorld = respawnToWorld;
|
||||||
this.config.setProperty("worlds."+this.name+".respawnworld", respawnToWorld);
|
this.config.setProperty("worlds." + this.name + ".respawnworld", respawnToWorld);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Permission getPermission() {
|
||||||
|
return this.permission;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.Event.Priority;
|
import org.bukkit.event.Event.Priority;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
import org.bukkit.permissions.Permission;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@ -25,7 +26,30 @@ import org.bukkit.util.config.Configuration;
|
|||||||
|
|
||||||
import com.fernferret.allpay.AllPay;
|
import com.fernferret.allpay.AllPay;
|
||||||
import com.fernferret.allpay.GenericBank;
|
import com.fernferret.allpay.GenericBank;
|
||||||
import com.onarandombox.MultiverseCore.commands.*;
|
import com.onarandombox.MultiverseCore.commands.ConfirmCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.CoordCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.CreateCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.DeleteCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.EnvironmentCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.HelpCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.ImportCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.InfoCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.ListCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.ModifyAddCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.ModifyClearCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.ModifyCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.ModifyRemoveCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.ModifySetCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.PurgeCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.ReloadCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.RemoveCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.SetSpawnCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.SleepCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.SpawnCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.TeleportCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.UnloadCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.VersionCommand;
|
||||||
|
import com.onarandombox.MultiverseCore.commands.WhoCommand;
|
||||||
import com.onarandombox.MultiverseCore.configuration.DefaultConfiguration;
|
import com.onarandombox.MultiverseCore.configuration.DefaultConfiguration;
|
||||||
import com.onarandombox.utils.DebugLog;
|
import com.onarandombox.utils.DebugLog;
|
||||||
import com.onarandombox.utils.PurgeWorlds;
|
import com.onarandombox.utils.PurgeWorlds;
|
||||||
@ -224,6 +248,18 @@ public class MultiverseCore extends JavaPlugin {
|
|||||||
|
|
||||||
// Force the worlds to be loaded, ie don't just load new worlds.
|
// Force the worlds to be loaded, ie don't just load new worlds.
|
||||||
if (forceLoad) {
|
if (forceLoad) {
|
||||||
|
// Remove all world permissions.
|
||||||
|
Permission all = this.getServer().getPluginManager().getPermission("multiverse.*");
|
||||||
|
for (MVWorld w : this.worlds.values()) {
|
||||||
|
// Remove this world from the master list
|
||||||
|
if (all != null) {
|
||||||
|
all.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.worlds.clear();
|
this.worlds.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ public class VersionCommand extends MultiverseCommand {
|
|||||||
this.plugin.log(Level.INFO, "Dumping Config Values: (version " + this.plugin.getConfig().getString("version", "NOT SET") + ")");
|
this.plugin.log(Level.INFO, "Dumping Config Values: (version " + this.plugin.getConfig().getString("version", "NOT SET") + ")");
|
||||||
this.plugin.log(Level.INFO, "messagecooldown: " + this.plugin.getConfig().getString("messagecooldown", "NOT SET"));
|
this.plugin.log(Level.INFO, "messagecooldown: " + this.plugin.getConfig().getString("messagecooldown", "NOT SET"));
|
||||||
this.plugin.log(Level.INFO, "teleportcooldown: " + this.plugin.getConfig().getString("teleportcooldown", "NOT SET"));
|
this.plugin.log(Level.INFO, "teleportcooldown: " + this.plugin.getConfig().getString("teleportcooldown", "NOT SET"));
|
||||||
this.plugin.log(Level.INFO, "worldnameprefix: " + this.plugin.getConfig().getString("messagecooldown", "NOT SET"));
|
this.plugin.log(Level.INFO, "worldnameprefix: " + this.plugin.getConfig().getString("worldnameprefix", "NOT SET"));
|
||||||
this.plugin.log(Level.INFO, "opfallback: " + this.plugin.getConfig().getString("worldnameprefix", "NOT SET"));
|
this.plugin.log(Level.INFO, "opfallback: " + this.plugin.getConfig().getString("opfallback", "NOT SET"));
|
||||||
this.plugin.log(Level.INFO, "disableautoheal: " + this.plugin.getConfig().getString("disableautoheal", "NOT SET"));
|
this.plugin.log(Level.INFO, "disableautoheal: " + this.plugin.getConfig().getString("disableautoheal", "NOT SET"));
|
||||||
this.plugin.log(Level.INFO, "fakepvp: " + this.plugin.getConfig().getString("fakepvp", "NOT SET"));
|
this.plugin.log(Level.INFO, "fakepvp: " + this.plugin.getConfig().getString("fakepvp", "NOT SET"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user