Add a manual toggle

This commit is contained in:
Sam 2017-03-25 14:14:26 +00:00 committed by cnr
parent 4b22355348
commit 4053e43964

View File

@ -17,6 +17,11 @@ import java.util.Map;
public class AprilFoolsManager extends MiniPlugin public class AprilFoolsManager extends MiniPlugin
{ {
/**
* Manually can be toggled to enable or disable the April Fools activities.
*/
private static final boolean ENABLED = true;
private static final Map<String, String> CHAT_REPLACEMENTS = ImmutableMap.<String, String>builder() private static final Map<String, String> CHAT_REPLACEMENTS = ImmutableMap.<String, String>builder()
.put("you", "ye") .put("you", "ye")
.put("yes", "aye") .put("yes", "aye")
@ -88,7 +93,7 @@ public class AprilFoolsManager extends MiniPlugin
super("April Fools"); super("April Fools");
_instance = this; _instance = this;
_enabled = true; setEnabled(true);
_enabledTitle = UtilServer.isHubServer() || UtilServer.isTestServer(); _enabledTitle = UtilServer.isHubServer() || UtilServer.isTestServer();
if (_enabled) if (_enabled)
@ -184,7 +189,7 @@ public class AprilFoolsManager extends MiniPlugin
@EventHandler @EventHandler
public void updateRandomMessage(UpdateEvent event) public void updateRandomMessage(UpdateEvent event)
{ {
if (!_enabledTitle || event.getType() != UpdateType.SLOW) if (!_enabled || !_enabledTitle || event.getType() != UpdateType.SLOW)
{ {
return; return;
} }
@ -219,7 +224,7 @@ public class AprilFoolsManager extends MiniPlugin
public void setEnabled(boolean enabled) public void setEnabled(boolean enabled)
{ {
_enabled = enabled; _enabled = ENABLED && enabled;
} }
public static AprilFoolsManager getInstance() public static AprilFoolsManager getInstance()