Skip to content
This repository has been archived by the owner on Feb 15, 2019. It is now read-only.

Commit

Permalink
Add config option to disable metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
yawkat authored and Techcable committed Mar 12, 2016
1 parent 7c8ab3d commit 1b75a18
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
5 changes: 5 additions & 0 deletions api/src/main/java/net/md_5/bungee/api/ProxyConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,9 @@ default int getThrottle() {
* How often players can join
*/
long getJoinThrottle();

/**
* If metrics is enabled
*/
boolean isMetrics();
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package io.github.waterfallmc.waterfall.conf;

import lombok.*;

import java.io.File;
import java.util.concurrent.TimeUnit;

import net.md_5.bungee.conf.Configuration;
import net.md_5.bungee.conf.YamlConfig;

@Getter
public class WaterfallConfiguration extends Configuration {

/*
Expand All @@ -29,6 +32,13 @@ public class WaterfallConfiguration extends Configuration {
*/
private int joinThrottle = (int) TimeUnit.MILLISECONDS.convert(4, TimeUnit.SECONDS);

/**
* If metrics is enabled
* <p>
* Default is true (enabled)
*/
private boolean metrics = true;

@Override
public void load() {
super.load();
Expand All @@ -37,15 +47,6 @@ public void load() {
// Throttling options
tabThrottle = config.getInt("throttling.tab_complete", tabThrottle);
joinThrottle = config.getInt("throttling.join", joinThrottle);
}

@Override
public long getTabThrottle() {
return tabThrottle;
}

@Override
public long getJoinThrottle() {
return joinThrottle;
metrics = config.getBoolean("metrics", metrics);
}
}
4 changes: 3 additions & 1 deletion proxy/src/main/java/net/md_5/bungee/BungeeCord.java
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,9 @@ public void run()
}
}
}, 0, TimeUnit.MINUTES.toMillis( 5 ) );
metricsThread.scheduleAtFixedRate(new Metrics(), 0, TimeUnit.MINUTES.toMillis(Metrics.PING_INTERVAL));
if (config.isMetrics()) {
metricsThread.scheduleAtFixedRate(new Metrics(), 0, TimeUnit.MINUTES.toMillis(Metrics.PING_INTERVAL));
}
}

public void startListeners()
Expand Down

0 comments on commit 1b75a18

Please sign in to comment.