mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-08 16:41:41 +01:00
Move the enforce access flag to canEnterWorld so other plugins don't have to check it also, Add "mv conf show"
This commit is contained in:
parent
25d9231d30
commit
e6f81b01d6
@ -23,12 +23,13 @@ public class ConfigCommand extends MultiverseCommand {
|
||||
super(plugin);
|
||||
this.setName("Configuration");
|
||||
this.setCommandUsage("/mv config " + ChatColor.GREEN + "{PROPERTY} {VALUE}");
|
||||
this.setArgRange(2, 2);
|
||||
this.setArgRange(1, 2);
|
||||
this.addKey("mv config");
|
||||
this.addKey("mvconfig");
|
||||
this.addKey("mv conf");
|
||||
this.addKey("mvconf");
|
||||
this.addCommandExample("All values: " + ConfigProperty.getAllValues());
|
||||
this.addCommandExample("/mv config show");
|
||||
this.addCommandExample("/mv config " + ChatColor.GREEN + "debug" + ChatColor.AQUA + " 3");
|
||||
this.addCommandExample("/mv config " + ChatColor.GREEN + "enforceaccess" + ChatColor.AQUA + " false");
|
||||
this.addCommandExample("/mv config " + ChatColor.GREEN + "bedrespawn" + ChatColor.AQUA + " true");
|
||||
@ -38,6 +39,22 @@ public class ConfigCommand extends MultiverseCommand {
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (args.size() <= 1) {
|
||||
String[] allProps = ConfigProperty.getAllValues().split(" ");
|
||||
String currentvals = "";
|
||||
for (String prop : allProps) {
|
||||
currentvals += ChatColor.GREEN;
|
||||
currentvals += prop;
|
||||
currentvals += ChatColor.WHITE;
|
||||
currentvals += " = ";
|
||||
currentvals += ChatColor.GOLD;
|
||||
currentvals += this.plugin.getMVConfiguration().get(prop, "NOT SET");
|
||||
currentvals += ChatColor.WHITE;
|
||||
currentvals += ", ";
|
||||
}
|
||||
sender.sendMessage(currentvals.substring(0, currentvals.length() - 2));
|
||||
return;
|
||||
}
|
||||
if (args.get(0).equalsIgnoreCase("messagecooldown") || args.get(0).equalsIgnoreCase("teleportcooldown") || args.get(0).equalsIgnoreCase("debug")) {
|
||||
try {
|
||||
this.plugin.getMVConfiguration().set(args.get(0).toLowerCase(), Integer.parseInt(args.get(1)));
|
||||
|
@ -40,7 +40,7 @@ public class ListCommand extends MultiverseCommand {
|
||||
String output = ChatColor.LIGHT_PURPLE + "Worlds which you can view:\n";
|
||||
for (MultiverseWorld world : this.plugin.getMVWorldManager().getMVWorlds()) {
|
||||
|
||||
if (MultiverseCore.EnforceAccess && p != null && (!this.plugin.getMVPerms().canEnterWorld(p, world))) {
|
||||
if (p != null && (!this.plugin.getMVPerms().canEnterWorld(p, world))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ public class WhoCommand extends MultiverseCommand {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (MultiverseCore.EnforceAccess && p != null && (!this.plugin.getMVPerms().canEnterWorld(p, world))) {
|
||||
if (p != null && (!this.plugin.getMVPerms().canEnterWorld(p, world))) {
|
||||
continue;
|
||||
}
|
||||
List<Player> players = world.getCBWorld().getPlayers();
|
||||
|
@ -78,6 +78,10 @@ public class MVPermissions implements PermissionsInterface {
|
||||
* @return
|
||||
*/
|
||||
public boolean canEnterWorld(Player p, MultiverseWorld w) {
|
||||
// If we're not enforcing access, anyone can enter.
|
||||
if (!MultiverseCore.EnforceAccess) {
|
||||
return true;
|
||||
}
|
||||
return this.hasPermission(p, "multiverse.access." + w.getName(), false);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user