Skip to content

Instantly share code, notes, and snippets.

View Bastian's full-sized avatar
🚀

Bastian Oppermann Bastian

🚀
View GitHub Profile
2019-05-28 12:05:26,872 <DEBUG> <main > <[]> <{}> < org.javacord.core.DiscordApiBuilderDelegateImpl> Creating shard 1 of 1
2019-05-28 12:05:27,114 <DEBUG> <acord - Central ExecutorService - 2> <[]> <{shard=0}> < org.javacord.core.util.rest.RestRequest> Trying to send GET request to https://discordapp.com/api/v6/gateway
2019-05-28 12:05:27,382 <DEBUG> <acord - Central ExecutorService - 2> <[]> <{shard=0}> < org.javacord.core.util.rest.RestRequest> Sent GET request to https://discordapp.com/api/v6/gateway and received status code 200 with body {"url": "wss://gateway.discord.gg"}
2019-05-28 12:05:27,388 <DEBUG> <acord - Central ExecutorService - 2> <[]> <{shard=0}> < org.javacord.core.util.ratelimit.RatelimitManager> Calculated an offset of -383 to the Discord time.
2019-05-28 12:05:28,363 <DEBUG> <ReadingThread > <[]> <{shard=0}> <javacord.core.util.gateway.DiscordWebSocketAdapter> Received HELLO packet
2019-05-28 12:05:28,374 <DEBUG> <Rea
@Bastian
Bastian / Metrics.java
Created March 24, 2018 13:40
This Metrics class is a special creation for the "other" category.
package org.bstats;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
@Bastian
Bastian / BarChart.java
Last active May 13, 2021 17:44
Bar chart example
@Override
public void onEnable() {
Metrics metrics = new Metrics(this);
// A simple bar chart for only one bar per category
metrics.addCustomChart(new SimpleBarChart("exampleBar", new Callable<Map<String, Integer>>() {
@Override
public Map<String, Integer> call() throws Exception {
Map<String, Integer> map = new HashMap<>();
map.put("Feature 1", 1);
return map;
@Bastian
Bastian / DrilldownPie.java
Last active May 13, 2021 17:43
Drilldown Pie example
@Override
public void onEnable() {
Metrics metrics = new Metrics(this);
metrics.addCustomChart(new DrilldownPie("java_version", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
String javaVersion = System.getProperty("java.version");
Map<String, Integer> entry = new HashMap<>();
entry.put(javaVersion, 1);
if (javaVersion.startsWith("1.7")) {
map.put("Java 1.7", entry);
@Bastian
Bastian / Metrics.java
Created April 13, 2017 10:35
This Metrics class is a special creation for Server Implementations
package org.bstats;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import javax.net.ssl.HttpsURLConnection;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.URL;
@Bastian
Bastian / onEnable.java
Created January 3, 2017 11:56
What you have to add in your onEnable method (Bungeecord)
@Override
public void onEnable() {
// All you have to do is adding this line in your onEnable method:
Metrics metrics = new Metrics(this);
}
@Bastian
Bastian / Metrics.java
Last active December 24, 2018 15:00
The Metrics class for bStats (Bungeecord)
~invalid~
@Bastian
Bastian / Main.java
Created December 8, 2016 10:17
How your plugin may look like (Sponge)
@Plugin(id = "exampleplugin", name = "ExamplePlugin", version = "1.0")
public class Main {
@Inject
private Metrics metrics;
@Listener
public void onServerStart(GameStartedServerEvent event) {
// No need to call a constructor or any method.
// The metrics field gets initialised using @Inject :)
@Bastian
Bastian / Metrics.java
Last active February 20, 2017 09:58
The Metrics class for bStats (Sponge)
~invalid~
@Bastian
Bastian / MultiLineChart.java
Last active May 13, 2021 17:44
Multi Line Chart example
@Override
public void onEnable() {
Metrics metrics = new Metrics(this);
metrics.addCustomChart(new MultiLineChart("players_and_servers", new Callable<Map<String, Integer>>() {
@Override
public Map<String, Integer> call() throws Exception {
Map<String, Integer> valueMap = new HashMap<>();
valueMap.put("servers", 1);
valueMap.put("players", Bukkit.getOnlinePlayers().size());
return valueMap;