Not Teleporting

Discussion in 'BungeeCord Plugin Development' started by Ultimate, Sep 14, 2013.

  1. Code (Text):
    public void onEnable() {
          getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
          getServer().getPluginManager().registerEvents(this, this);
      }
     
      @EventHandler
      public void onPlayerJoin(PlayerJoinEvent event) {
          event.getPlayer().sendMessage("hi");
          ByteArrayOutputStream b = new ByteArrayOutputStream();
          DataOutputStream out = new DataOutputStream(b);
          try {
            out.writeUTF("Connect");
            out.writeUTF("lobbytwo");
          } catch (IOException eee) {
            // Won't happen
          }
          event.getPlayer().sendPluginMessage(this, "BungeeCord", b.toByteArray());
      }
     
    I receive the message hi, then nothing happens. lobbytwo is a registered server in my BungeeConfig.
     
  2. joehot200

    Supporter

    // Won't happen? Maybe it is happening? Try putting a message there.
     
  3. Again, nothing.
     
  4. joehot200

    Supporter

    Ok: Put a message after EVERY line of code, so we can see what line of code fails. After we find that out, we have to discover why its failing to work.
    There's nothing in the console(s)?
     
  5. You act as if I don't know how to debug a simple plugin.. I've already tried this.
    Code (Text):
      public void onEnable() {
          getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
          getServer().getPluginManager().registerEvents(this, this);
      }
     
      @EventHandler
      public void onPlayerJoin(PlayerJoinEvent event) {
          event.getPlayer().sendMessage("1");
          ByteArrayOutputStream b = new ByteArrayOutputStream();
          event.getPlayer().sendMessage("2");
          DataOutputStream out = new DataOutputStream(b);
          event.getPlayer().sendMessage("3");
          try {
            out.writeUTF("Connect");
            event.getPlayer().sendMessage("4");
            out.writeUTF("lobbytwo");
            event.getPlayer().sendMessage("5");
          } catch (IOException eee) {
            event.getPlayer().sendMessage("Exception");
          }
          event.getPlayer().sendMessage("6");
          event.getPlayer().sendPluginMessage(this, "BungeeCord", b.toByteArray());
          event.getPlayer().sendMessage("7");
      }
     
     
  6. joehot200

    Supporter

    Then it would be convenient to have the line of code that stopped working.
     
  7. It never did stop working.
     
  8. Since you're using the onPlayerJoin event, You need to put a little delay (5ticks will work) before sending that plugin message.
     
    • Useful Useful x 1
  9. Oh really?