BungeeSwitchListener 2.2.1

Cross server synchronization for sql supported plugins.

  1. SkyWolf461
    Native Minecraft Version:
    Legacy (< 1.13)
    Tested Minecraft Versions:
    • 1.12
    • 1.16
    Source Code:
    **Warning, This project will not updates more for personal use.**
    Best synchronization system for your SQL system
    What is this?
    BungeeSwitchListener is cross-server synchronization for SQL system.

    How it works?
    BungeeSwitchListener injecting handler to Bungeecord to receive custom packets. If connection is localhost, and first 8 byte is equals to identify variable, connection will establish.

    What do I need for this plugin?
    You will need Java 8.
    Cause Java 9 not supported private reflection, It will need patch.
    I'll upload Java 9 bungeecord patch later.

    You need to add BungeeSwitchListener to your bungeecord, and BukkitSwitchHandler to bukkit.

    BungeeSwitchListener is bungee based repeater, and you need to add reciever to bukkit.

    How I can use it?
    Add BukkitSwitchListener to plugin dependency.

    When server startup, use BukkitSwitchHandler#register(Consumer<UUID,DataInput> load,Consumer<UUID,DataInput> reload) to register reciever.

    When player quit, save to SQL.

    After save complete, use BukkitSwitchHandler#saveCompleteRequest(String task, UUID uid)

    ** Warning** On player join, plugin will load with null parameter.

    Is there an example?
    Sure. Look next line.

    Deerializer / Reloader register
    Code (Java):
    public class TestPlugin extends JavaPlugin implements Listener{
        public void onEnable() {
            if (Bukkit.getPluginManager().getPlugin("BukkitSwitchHandler") != null){
                    PreparedStatement stmt = BukkitSwitchHandler.getSQL().prepareStatement("create table if not exists testTable(user varchar(50), dataName varchar(20),data varchar(200), primary key (user)) CHARACTER SET utf8 COLLATE utf8_general_ci;");
                }catch (Exception ex){
               BukkitSwitchHandler.register("TestPlugin", (uid,di) -> {
                   // You can use DataInput for read external data
                   try {
                       PreparedStatement stmt = BukkitSwitchHandler.getSQL().prepareStatement("select * from EssQL where user = ?");
                       stmt.setString(1, uid.toString());
                       ResultSet rs = stmt.executeQuery();
                       if(rs.next()) {
                           // Print "data" column
                       } else {
                           System.out.println("Data not exist: " + uid.toString());
                   } catch (Exception ex){
               }, (uid, di) -> {
                   // Reload request here.
        public void ev(PlayerQuitEvent e){
            try {
                // Save.
                PreparedStatement stmt = BukkitSwitchHandler.getSQL().prepareStatement("insert into testTable values(?, ?, ?)");
                stmt.setString(1, e.getPlayer().getUniqueID().toString());
                stmt.setString(2, "Test Data");
                stmt.setString(3, "Hello, World");
                BukkitSwitchHandler.saveCompleteRequest("TestPlugin", e.getPlayer().getUniqueId());
            } catch (Exception ex){