Not teleporting all players to lobby?

Discussion in 'Plugin Development' started by jusjus112, Sep 13, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    jusjus112

    Can someone help me with this, i know its from bungee.
    But it is in a bukkit plugin on a bukkit server!
    Why is this code not working?
    So i hope you guys can help me?


    Code:java
    1. public void onDisable() {
    2. for (Player all : Bukkit.getServer().getOnlinePlayers()) {
    3. serverConnect("lobby", all);
    4. }
    5. }
    6.  
    7. public void serverConnect(String server, Player p) {
    8. ByteArrayDataOutput out = ByteStreams.newDataOutput();
    9. out.writeUTF("Connect");
    10. out.writeUTF(server);
    11. p.sendPluginMessage(this, "BungeeCord", out.toByteArray());
    12. }
     
  2. Offline

    xTigerRebornx

    jusjus112 Players are kicked pre-disable of your Plugin, therefor there are no Players on when the code is called. Assuming you have control of the the entire server, just call the serverConnect() where valid (I.e. at the end of a minigame, command, etc)
     
  3. Offline

    jusjus112

    xTigerRebornx
    My goal is, when the server goes off/crashes that the players are teleported to the lobby
     
  4. Offline

    Rocoty

    jusjus112 Then you should make that a Bungee Plugin. Because the server can't do anything once crashed, now can it?
     
  5. Offline

    jusjus112

    Rocoty
    but, when a admin uses /reload. then the player must send to the lobby
     
  6. Offline

    4thegame3

    you cant do all in a single plugin.
     
  7. Offline

    jusjus112

    4thegame3
    The only goal, is when the plugin goes off. the player must be send to the lobby
     
  8. Offline

    4thegame3

    you cant do it if the server crashes
     
  9. Offline

    fireblast709

    The CB source claims the opposite. First all plugins are disabled, then the players are kicked.

    Plugins are disabled in the finally block of the main loop, thus even if the MC server crashes (note: it won't save you if the JVM or the physical server crash. Hence the suggestion of Rocoty to create a plugin on the proxy side rather than on the server side) it will still call onDisable.


    jusjus112 Have you registered the outgoing channel?
     
  10. Offline

    jusjus112

    fireblast709
    yes i have.
    Code:java
    1. getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
     
  11. Offline

    Unica

    Mixing software n stuff.
    Just make it a bungee only plugin?
     
Thread Status:
Not open for further replies.

Share This Page