Solved BungeeCord - Teleport player to another server using sign

Discussion in 'BungeeCord Plugin Development' started by Exorth, May 31, 2017.

  1. Hey,
    I'm trying to connect a player to another server, by using a PlayerInteractEvent on a sign.
    I want the player to be connected to the server named in the second line of the Sign.

    I want to use this for a mini-game lobby, I can't use BungeeSigns because it disturb the mini-game plugin.

    This is the part of my plugin code :

    Code (Text):
    public class SignClickEvent implements Listener {
        public FileConfiguration config = Main.getInstance().getConfig();
        List<Location> signlocations = (List<Location>)config.getList("arenasigns");
        public void onClick(PlayerInteractEvent e){
            if(e.getClickedBlock().getType()==Material.WALL_SIGN && e.getAction()== Action.RIGHT_CLICK_BLOCK){
                Sign sign = (Sign) e.getClickedBlock().getState();
                Location loc = sign.getLocation();
                    String server = sign.getLine(1);
                         ByteArrayDataOutput out = ByteStreams.newDataOutput();
                       e.getPlayer().sendPluginMessage(Main.getInstance(), "BungeeCord", out.toByteArray());

    My problem is that this is working only if the player is Op, if the player isn't Op nothing happens.

    Any solution ?
  2. Are you sure that you are using this method? I do not see any op/permission statements.
    Furthermore are you sure that no other sign plugin blocks it? Remove all plugins that has something to do with signs and then test your method. I think an other InteractEvent is calling and interrupt your method.
  3. Thank you for your answer,
    After removing all other plugins, no results.
    After doing some debug mode, I saw that if the player isn't Op the event isn't even called, so the problem has nothing to do with the code.

    Nevertheless, i figured it out and i feel stupid :oops:, the sign was in the bukkit spawn-protection, and it seems it was preventing the event from being called.