mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-09-28 23:27:27 +02:00
Start adding the Config Command
This commit is contained in:
parent
73b42b5430
commit
1aad872333
@ -271,7 +271,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
|
||||
// Setup the Debug option, we'll default to false because this option will not be in the default config.
|
||||
GlobalDebug = this.configMV.getInt("debug", 0);
|
||||
GlobalDebug = this.configMV.getInt("debug", 0);
|
||||
this.messaging = new MVMessaging(this);
|
||||
this.messaging.setCooldown(this.configMV.getInt("messagecooldown", 5000));
|
||||
}
|
||||
@ -308,6 +307,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core {
|
||||
this.commandHandler.registerCommand(new ModifySetCommand(this));
|
||||
this.commandHandler.registerCommand(new ModifyRemoveCommand(this));
|
||||
this.commandHandler.registerCommand(new ModifyClearCommand(this));
|
||||
this.commandHandler.registerCommand(new ConfigCommand(this));
|
||||
// Misc Commands
|
||||
this.commandHandler.registerCommand(new EnvironmentCommand(this));
|
||||
this.commandHandler.registerCommand(new DebugCommand(this));
|
||||
|
@ -0,0 +1,56 @@
|
||||
/******************************************************************************
|
||||
* Multiverse 2 Copyright (c) the Multiverse Team 2011. *
|
||||
* Multiverse 2 is licensed under the BSD License. *
|
||||
* For more information please check the README.md file included *
|
||||
* with this project. *
|
||||
******************************************************************************/
|
||||
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.enums.ConfigProperty;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ConfigCommand extends MultiverseCommand {
|
||||
private MVWorldManager worldManager;
|
||||
|
||||
public ConfigCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Configuration");
|
||||
this.setCommandUsage("/mv config");
|
||||
this.setArgRange(2, 2);
|
||||
this.addKey("mv config");
|
||||
this.addKey("mvconfig");
|
||||
this.addKey("mv conf");
|
||||
this.addKey("mvconf");
|
||||
this.setPermission("multiverse.core.config", "Allows you to set Global MV Variables.", PermissionDefault.OP);
|
||||
this.worldManager = this.plugin.getMVWorldManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (args.get(0).equalsIgnoreCase("messagecooldown") || args.get(0).equalsIgnoreCase("teleportcooldown")) {
|
||||
try {
|
||||
this.plugin.getConfig().setProperty(args.get(0).toLowerCase(), Integer.parseInt(args.get(1)));
|
||||
this.plugin.loadConfigs();
|
||||
} catch (NumberFormatException e) {
|
||||
sender.sendMessage(ChatColor.RED + "Sorry, " + ChatColor.AQUA + args.get(0) + ChatColor.WHITE + " must be an integer!");
|
||||
}
|
||||
} else {
|
||||
if (ConfigProperty.valueOf(args.get(0).toLowerCase()) != null) {
|
||||
try {
|
||||
this.plugin.getConfig().setProperty(args.get(0).toLowerCase(), Boolean.parseBoolean(args.get(0)));
|
||||
this.plugin.loadConfigs();
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage(ChatColor.RED + "Sorry, " + ChatColor.AQUA + args.get(0) + ChatColor.WHITE + " must be true or false!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,5 +9,6 @@ package com.onarandombox.MultiverseCore.enums;
|
||||
|
||||
/** Multiverse 2 */
|
||||
public enum ConfigProperty {
|
||||
messagecooldown, teleportcooldown, worldnameprefix, useworldaccess, disableautoheal, fakepvp, bedrespawn
|
||||
messagecooldown, teleportcooldown, worldnameprefix, useworldaccess,
|
||||
disableautoheal, fakepvp, bedrespawn, finalsayaccess
|
||||
}
|
||||
|
@ -18,6 +18,10 @@ worldnameprefix: true
|
||||
# If value is set to false, Multiverse will NOT enforce permissions
|
||||
useworldaccess: false
|
||||
|
||||
# Should multiverse have the final say in world access? If set to false, Multiverse will only check access
|
||||
# for itself and any MVPlugin.
|
||||
finalsayaccess: true
|
||||
|
||||
# If you have a world(s) that has monsters = false, and you want to disable the built
|
||||
# in autohealing, set this to true. This will have NO EFFECT if monsters = true for a given world.
|
||||
disableautoheal: false
|
||||
|
Loading…
Reference in New Issue
Block a user