Skip to content

Commit

Permalink
Default to debug mode
Browse files Browse the repository at this point in the history
People are incapable of turning on debug mode. This should help.
  • Loading branch information
Ichbinjoe committed Jan 22, 2019
1 parent 0fa42b4 commit 99dbaa7
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ private boolean loadAndBind() {
return false;
}

debug = cfg.getBoolean("debug", false);
// the quiet flag always runs priority to the debug flag
if (cfg.isBoolean("quiet")) {
debug = !cfg.getBoolean("quiet");
} else {
// otherwise, default to being noisy
debug = cfg.getBoolean("debug", true);
}

// Load Votifier tokens.
ConfigurationSection tokenSection = cfg.getConfigurationSection("tokens");
Expand Down Expand Up @@ -210,8 +216,9 @@ private boolean loadAndBind() {
// Initialize the receiver.
final String host = cfg.getString("host", hostAddr);
final int port = cfg.getInt("port", 8192);
if (debug)
getLogger().info("DEBUG mode enabled!");
if (!debug)
getLogger().info("QUIET mode enabled!");

if (port >= 0) {
final boolean disablev1 = cfg.getBoolean("disable-v1-protocol");
if (disablev1) {
Expand Down
4 changes: 0 additions & 4 deletions bukkit/src/main/resources/bukkitConfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ host: %ip%
# Port to listen for new votes on
port: 8192

# Whether or not to print debug messages. In a production system, this should be set to false.
# This is useful when initially setting up NuVotifier to ensure votes are being delivered.
debug: false

# Setting this option to true will disable handling of Protocol v1 packets. While the old protocol is not secure, this
# option is currently not recommended as most voting sites only support the old protocol at present. However, if you are
# using NuVotifier's proxy forwarding mechanism, enabling this option will increase your server's security.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,14 @@ private void loadAndBind() {
// Initialize the receiver.
final String host = configuration.getString("host", "0.0.0.0");
final int port = configuration.getInt("port", 8192);
debug = configuration.getBoolean("debug", false);
if (debug)
getLogger().info("DEBUG mode enabled!");

if (configuration.get("quiet") != null)
debug = !configuration.getBoolean("quiet");
else
debug = configuration.getBoolean("debug", true);

if (!debug)
getLogger().info("QUIET mode enabled!");

final boolean disablev1 = configuration.getBoolean("disable-v1-protocol");
if (disablev1) {
Expand Down
4 changes: 0 additions & 4 deletions bungeecord/src/main/resources/bungeeConfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ host: 0.0.0.0
# Port to listen for new votes on
port: 8192

# Whether or not to print debug messages. In a production system, this should be set to false.
# This is useful when initially setting up NuVotifier to ensure votes are being delivered.
debug: false

# All tokens, labeled by the serviceName of each server list.
tokens:
# Default token for all server lists, if another isn't supplied.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
handler.onError(ctx.channel(), session.hasCompletedVote(), cause);

if (session.getVersion() == VotifierSession.ProtocolVersion.TWO) {

JsonObject object = new JsonObject();
object.addProperty("status", "error");
object.addProperty("cause", cause.getClass().getSimpleName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ public void onServerStart(GameStartedServerEvent event) {
// Initialize the receiver.
final String host = ConfigLoader.getSpongeConfig().host;
final int port = ConfigLoader.getSpongeConfig().port;
if (debug)
logger.info("DEBUG mode enabled!");

if (!debug)
logger.info("QUIET mode enabled!");

if (port >= 0) {
final boolean disablev1 = ConfigLoader.getSpongeConfig().disableV1Protocol;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class SpongeConfig {

@Setting(comment = "Whether or not to print debug messages. In a production system, this should be set to false.\n" +
"This is useful when initially setting up NuVotifier to ensure votes are being delivered.")
public boolean debug = false;
public boolean debug = true;

@Setting( value = "disable-v1-protocol", comment = "Setting this option to true will disable handling of Protocol v1 packets. While the old protocol is not secure, this\n" +
"option is currently not recommended as most voting sites only support the old protocol at present. However, if you are\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ host: %ip%
# Port to listen for new votes on
port: 8192

# Whether or not to print debug messages. In a production system, this should be set to false.
# This is useful when initially setting up NuVotifier to ensure votes are being delivered.
debug: false

# Setting this option to true will disable handling of Protocol v1 packets. While the old protocol is not secure, this
# option is currently not recommended as most voting sites only support the old protocol at present. However, if you are
# using NuVotifier's proxy forwarding mechanism, enabling this option will increase your server's security.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ public void onServerStart(ProxyInitializeEvent event) {
return;
}

debug = config.getBoolean("debug");
if (config.contains("quiet"))
debug = !config.getBoolean("quiet");
else
debug = config.getBoolean("debug", true);

// Load Votifier tokens.
config.getTable("tokens").toMap().forEach((service, key) -> {
Expand All @@ -109,8 +112,8 @@ public void onServerStart(ProxyInitializeEvent event) {
// Initialize the receiver.
final String host = config.getString("host");
final int port = Math.toIntExact(config.getLong("port"));
if (debug)
logger.info("DEBUG mode enabled!");
if (!debug)
logger.info("QUIET mode enabled!");

final boolean disablev1 = config.getBoolean("disable-v1-protocol", false);
if (disablev1) {
Expand Down
4 changes: 0 additions & 4 deletions velocity/src/main/resources/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ host = "%ip%"
# Port to listen for new votes on
port = 8192

# Whether or not to print debug messages. In a production system, this should be set to false.
# This is useful when initially setting up NuVotifier to ensure votes are being delivered.
debug = false

# Setting this option to true will disable handling of Protocol v1 packets. While the old protocol is not secure, this
# option is currently not recommended as most voting sites only support the old protocol at present. However, if you are
# using NuVotifier's proxy forwarding mechanism, enabling this option will increase your server's security.
Expand Down

0 comments on commit 99dbaa7

Please sign in to comment.