Giter Site home page Giter Site logo

bungee-server-tracker's Introduction

BungeeServerTracker

Track server data via bungeecord plugin messaging in a bukkit plugin.

How to use

This is an example POM that uses BungeeServerTracker.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.birthdates</groupId>
    <artifactId>BungeeServerTrackerTest</artifactId>
    <version>1.0-SNAPSHOT</version>
    
    <!-- REQUIRED !-->
    <repositories>
        <!-- Add the BungeeServerTracker repo via GitHub !-->
        <repository>
            <id>BungeeServerTracker-repo</id>
            <url>https://raw.githubusercontent.com/birthdates/BungeeServerTracker/repository/</url>
        </repository>
    </repositories>

    <dependencies>
        <!-- Add the BungeeServerTracker dependency and scope compile !-->
        <dependency>
            <groupId>com.birthdates</groupId>
            <artifactId>BungeeServerTracker</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>

This is an example class that would track two server's data (Factions, Skyblock)

import com.birthdates.bungeeservertracker.BungeeServerTracker;
import com.birthdates.bungeeservertracker.ServerData;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.logging.Level;

public class BungeeServerTrackerTest extends JavaPlugin {

    private BungeeServerTracker playerTracker;

    public void onEnable() {
        playerTracker = new BungeeServerTracker();

        playerTracker.init(this, 3);
        playerTracker.startTracking("factions", "127.0.0.1:25566");
        playerTracker.startTracking("skyblock", "127.0.0.1:25567");

        Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
            ServerData skyblockData = playerTracker.getServerData("skyblock");
            Bukkit.getLogger().log(Level.WARNING, "Skyblock is currently " + (skyblockData.isOnline() ? "online with " + skyblockData.getPlayers() + " players" : "offline") + ".");
        }, 0L, 20L);
    }

}

bungee-server-tracker's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.