mirror of
https://github.com/PaperMC/Waterfall.git
synced 2024-12-04 08:03:35 +01:00
d6688e05e6
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing BungeeCord Changes: 511017ab #3396: Update Netty version c3e8cfac #3374, #3389: Improve log handling of normal java.util Logger usage by forwarding the LogRecords directly to the BungeeLogger instead of the fallback err stream. bf2b3c68 #3384: Update documentation of ProxyPingEvent 68e74a8c #3378: Remove KickStringWriter from the pipeline after handshake arrives 5b4a5404 #3361: Cache MessageFormats for translations 88da5c05 #3353: Update GitHub actions
182 lines
6.7 KiB
Diff
182 lines
6.7 KiB
Diff
From d5aef08f1513e5e51b92d60e10e528d7b82ad40d Mon Sep 17 00:00:00 2001
|
|
From: Jamie Mansfield <dev@jamierocks.uk>
|
|
Date: Thu, 19 May 2016 10:55:20 -0700
|
|
Subject: [PATCH] Disable Metrics
|
|
|
|
MCStats has not been stable for a long while now, and in our opinion it is not worth migrating to an alternative service. Waterfall has been maintained for the past two years without any or much consideration to statistics, we have users and that's enough for us ;)
|
|
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
index f1ddb4d0..ffff990a 100644
|
|
--- a/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
+++ b/proxy/src/main/java/net/md_5/bungee/BungeeCord.java
|
|
@@ -125,7 +125,7 @@ public class BungeeCord extends ProxyServer
|
|
* locations.yml save thread.
|
|
*/
|
|
private final Timer saveThread = new Timer( "Reconnect Saver" );
|
|
- private final Timer metricsThread = new Timer( "Metrics Thread" );
|
|
+ // private final Timer metricsThread = new Timer( "Metrics Thread" ); // Waterfall: Disable Metrics
|
|
/**
|
|
* Server socket listener.
|
|
*/
|
|
@@ -312,7 +312,7 @@ public class BungeeCord extends ProxyServer
|
|
}
|
|
}
|
|
}, 0, TimeUnit.MINUTES.toMillis( 5 ) );
|
|
- metricsThread.scheduleAtFixedRate( new Metrics(), 0, TimeUnit.MINUTES.toMillis( Metrics.PING_INTERVAL ) );
|
|
+ //metricsThread.scheduleAtFixedRate( new Metrics(), 0, TimeUnit.MINUTES.toMillis( Metrics.PING_INTERVAL ) ); // Waterfall: Disable Metrics
|
|
|
|
Runtime.getRuntime().addShutdownHook( new Thread()
|
|
{
|
|
@@ -470,7 +470,7 @@ public class BungeeCord extends ProxyServer
|
|
reconnectHandler.close();
|
|
}
|
|
saveThread.cancel();
|
|
- metricsThread.cancel();
|
|
+ //metricsThread.cancel(); // Waterfall: Disable Metrics
|
|
|
|
getLogger().info( "Disabling plugins" );
|
|
for ( Plugin plugin : Lists.reverse( new ArrayList<>( pluginManager.getPlugins() ) ) )
|
|
diff --git a/proxy/src/main/java/net/md_5/bungee/Metrics.java b/proxy/src/main/java/net/md_5/bungee/Metrics.java
|
|
deleted file mode 100644
|
|
index eabf7573..00000000
|
|
--- a/proxy/src/main/java/net/md_5/bungee/Metrics.java
|
|
+++ /dev/null
|
|
@@ -1,134 +0,0 @@
|
|
-package net.md_5.bungee;
|
|
-
|
|
-import java.io.BufferedReader;
|
|
-import java.io.IOException;
|
|
-import java.io.InputStreamReader;
|
|
-import java.io.OutputStreamWriter;
|
|
-import java.io.UnsupportedEncodingException;
|
|
-import java.net.URL;
|
|
-import java.net.URLConnection;
|
|
-import java.net.URLEncoder;
|
|
-import java.util.TimerTask;
|
|
-import net.md_5.bungee.api.ProxyServer;
|
|
-
|
|
-public class Metrics extends TimerTask
|
|
-{
|
|
-
|
|
- /**
|
|
- * The current revision number
|
|
- */
|
|
- private static final int REVISION = 5;
|
|
- /**
|
|
- * The base url of the metrics domain
|
|
- */
|
|
- private static final String BASE_URL = "https://mcstats.spigotmc.org";
|
|
- /**
|
|
- * The url used to report a server's status
|
|
- */
|
|
- private static final String REPORT_URL = "/report/%s";
|
|
- /**
|
|
- * Interval of time to ping (in minutes)
|
|
- */
|
|
- static final int PING_INTERVAL = 10;
|
|
- boolean firstPost = true;
|
|
-
|
|
- @Override
|
|
- public void run()
|
|
- {
|
|
- try
|
|
- {
|
|
- // We use the inverse of firstPost because if it is the first time we are posting,
|
|
- // it is not a interval ping, so it evaluates to FALSE
|
|
- // Each time thereafter it will evaluate to TRUE, i.e PING!
|
|
- postPlugin( !firstPost );
|
|
-
|
|
- // After the first post we set firstPost to false
|
|
- // Each post thereafter will be a ping
|
|
- firstPost = false;
|
|
- } catch ( IOException ex )
|
|
- {
|
|
- // ProxyServer.getInstance().getLogger().info( "[Metrics] " + ex.getMessage() );
|
|
- }
|
|
- }
|
|
-
|
|
- /**
|
|
- * Generic method that posts a plugin to the metrics website.
|
|
- *
|
|
- * @param isPing first post or not
|
|
- * @throws IOException any errors encountered
|
|
- */
|
|
- private void postPlugin(boolean isPing) throws IOException
|
|
- {
|
|
- // Construct the post data
|
|
- final StringBuilder data = new StringBuilder();
|
|
- data.append( encode( "guid" ) ).append( '=' ).append( encode( BungeeCord.getInstance().config.getUuid() ) );
|
|
- encodeDataPair( data, "version", ProxyServer.getInstance().getVersion() );
|
|
- encodeDataPair( data, "server", "0" );
|
|
- encodeDataPair( data, "players", Integer.toString( ProxyServer.getInstance().getOnlineCount() ) );
|
|
- encodeDataPair( data, "revision", String.valueOf( REVISION ) );
|
|
-
|
|
- // If we're pinging, append it
|
|
- if ( isPing )
|
|
- {
|
|
- encodeDataPair( data, "ping", "true" );
|
|
- }
|
|
-
|
|
- // Create the url
|
|
- URL url = new URL( BASE_URL + String.format( REPORT_URL, encode( "BungeeCord" ) ) );
|
|
-
|
|
- // Connect to the website
|
|
- URLConnection connection;
|
|
-
|
|
- connection = url.openConnection();
|
|
-
|
|
- connection.setDoOutput( true );
|
|
- final BufferedReader reader;
|
|
- final String response;
|
|
- try ( OutputStreamWriter writer = new OutputStreamWriter( connection.getOutputStream() ) )
|
|
- {
|
|
- writer.write( data.toString() );
|
|
- writer.flush();
|
|
- reader = new BufferedReader( new InputStreamReader( connection.getInputStream() ) );
|
|
- response = reader.readLine();
|
|
- }
|
|
- reader.close();
|
|
-
|
|
- if ( response == null || response.startsWith( "ERR" ) )
|
|
- {
|
|
- throw new IOException( response ); //Throw the exception
|
|
- }
|
|
- }
|
|
-
|
|
- /**
|
|
- * <p>
|
|
- * Encode a key/value data pair to be used in a HTTP post request. This
|
|
- * INCLUDES a & so the first key/value pair MUST be included manually,
|
|
- * e.g:</p>
|
|
- * <code>
|
|
- * StringBuffer data = new StringBuffer();
|
|
- * data.append(encode("guid")).append('=').append(encode(guid));
|
|
- * encodeDataPair(data, "version", description.getVersion());
|
|
- * </code>
|
|
- *
|
|
- * @param buffer the StringBuilder to append the data pair onto
|
|
- * @param key the key value
|
|
- * @param value the value
|
|
- * @throws UnsupportedEncodingException if UTF-8 encoding not supported
|
|
- */
|
|
- private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) throws UnsupportedEncodingException
|
|
- {
|
|
- buffer.append( '&' ).append( encode( key ) ).append( '=' ).append( encode( value ) );
|
|
- }
|
|
-
|
|
- /**
|
|
- * Encode text as UTF-8
|
|
- *
|
|
- * @param text the text to encode
|
|
- * @return the encoded text, as UTF-8
|
|
- * @throws UnsupportedEncodingException if UTF-8 encoding not supported
|
|
- */
|
|
- private static String encode(final String text) throws UnsupportedEncodingException
|
|
- {
|
|
- return URLEncoder.encode( text, "UTF-8" );
|
|
- }
|
|
-}
|
|
--
|
|
2.38.1
|
|
|