mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-09 17:57:36 +01:00
Added command "mv silent [on|off]" for enabling silent startup mode.
This commit is contained in:
parent
b93822502e
commit
aedbfd7bab
@ -54,6 +54,8 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
@Property
|
||||
private volatile int globaldebug;
|
||||
@Property
|
||||
private volatile boolean silentstart;
|
||||
@Property
|
||||
private volatile int messagecooldown;
|
||||
@Property
|
||||
private volatile double version;
|
||||
@ -88,6 +90,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
messagecooldown = 5000;
|
||||
teleportcooldown = 1000;
|
||||
this.version = 2.9;
|
||||
silentstart = false;
|
||||
// END CHECKSTYLE-SUPPRESSION: MagicNumberCheck
|
||||
}
|
||||
|
||||
@ -275,4 +278,15 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
public boolean getUseAsyncChat() {
|
||||
return this.useasyncchat;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSilentStart(boolean silentStart) {
|
||||
Logging.setShowingConfig(!silentStart);
|
||||
this.silentstart = silentStart;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getSilentStart() {
|
||||
return silentstart;
|
||||
}
|
||||
}
|
||||
|
@ -145,4 +145,18 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable {
|
||||
* @return useasyncchat.
|
||||
*/
|
||||
boolean getUseAsyncChat();
|
||||
|
||||
/**
|
||||
* Sets whether to suppress startup messages.
|
||||
*
|
||||
* @param silentStart true to suppress messages.
|
||||
*/
|
||||
void setSilentStart(boolean silentStart);
|
||||
|
||||
/**
|
||||
* Whether we are suppressing startup messages.
|
||||
*
|
||||
* @return true if we are suppressing startup messages.
|
||||
*/
|
||||
boolean getSilentStart();
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
/******************************************************************************
|
||||
* 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 org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.permissions.PermissionDefault;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Enables debug-information.
|
||||
*/
|
||||
public class SilentCommand extends MultiverseCommand {
|
||||
|
||||
public SilentCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.setName("Turn silent mode on/off?");
|
||||
this.setCommandUsage("/mv silent" + ChatColor.GOLD + " [true|false|on|off]");
|
||||
this.setArgRange(0, 1);
|
||||
this.addKey("mv silent");
|
||||
this.addKey("mvsilent");
|
||||
this.addCommandExample("/mv silent " + ChatColor.GOLD + "true");
|
||||
this.setPermission("multiverse.core.silent", "Reduces the amount of startup messages.", PermissionDefault.OP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (args.size() == 1) {
|
||||
if (args.get(0).equalsIgnoreCase("on")) {
|
||||
args.set(0, "true");
|
||||
}
|
||||
plugin.getMVConfig().setSilentStart(Boolean.valueOf(args.get(0)));
|
||||
plugin.saveMVConfigs();
|
||||
}
|
||||
this.displaySilentMode(sender);
|
||||
}
|
||||
|
||||
private void displaySilentMode(CommandSender sender) {
|
||||
if (plugin.getMVConfig().getSilentStart()) {
|
||||
sender.sendMessage("Multiverse Silent Start mode is " + ChatColor.GREEN + "ON");
|
||||
} else {
|
||||
sender.sendMessage("Multiverse Silent Start mode is " + ChatColor.RED + "OFF");
|
||||
}
|
||||
}
|
||||
}
|
@ -211,3 +211,7 @@ commands:
|
||||
usage: |
|
||||
/<command> <world> <environment>
|
||||
/<command> creative grieftastic -- Creates a world called 'grieftastic' exactly identical to the world 'creative'.
|
||||
mvsilent:
|
||||
description: Reduces startup messages
|
||||
usage: |
|
||||
/<command> [true|false]
|
||||
|
Loading…
Reference in New Issue
Block a user