Solved The compass does not open gui

Discussion in 'Spigot Plugin Development' started by Britizz, Jan 22, 2020.

  1. Hi, I'm trying to make a plugin who teleport you in another bungeecord linked server but my compass does not open the gui with the server list any idea ?

    Code (Java):
    package comp;


    import org.bukkit.Bukkit;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.inventory.InventoryClickEvent;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;

    public class pllistenner implements Listener {

        private Main main;

        public pllistenner(Main main) {
            this.main = main;
        public void onJoin(PlayerJoinEvent event) {
            Player player = event.getPlayer();
            ItemStack custw =  new ItemStack(Material.COMPASS);
            ItemMeta custv = custw.getItemMeta();
            custv.setDisplayName("Server Selector");
        public void onInteract(PlayerInteractEvent event) {
            ItemStack current = event.getItem();
            Player Player = event.getPlayer();
            if(current == null) return;
            if(current.getType() == Material.COMPASS && current.hasItemMeta() && current.getItemMeta().hasDisplayName() && current.getItemMeta().getDisplayName().equalsIgnoreCase("Server Selector"))
                Inventory inv = Bukkit.createInventory(null, 9, "Server Selector");
                inv.setItem(3, new ItemStack(Material.OBSIDIAN));
                inv.setItem(4, new ItemStack(Material.COMMAND));
                inv.setItem(5, new ItemStack(Material.GRASS));
        public void onClick(InventoryClickEvent eventt) {
            Inventory invc = eventt.getInventory();
            Player player = (Player) eventt.getWhoClicked();
            ItemStack used = eventt.getCurrentItem();
            if(invc.getName().equalsIgnoreCase("Server Selector") && used.getType() == Material.OBSIDIAN)
                ByteArrayOutputStream b = new ByteArrayOutputStream();
                DataOutputStream out = new DataOutputStream(b);
                }catch (IOException e) {
                player.sendPluginMessage(main, "BungeeCord", b.toByteArray());

            else if(invc.getName().equalsIgnoreCase("Server Selector") && used.getType() == Material.COMMAND)
                //"/server Dev");
            else if(invc.getName().equalsIgnoreCase("Server Selector") && used.getType() == Material.GRASS)
                //"/server Survivial");
  2. SteelPhoenix


    Your naming is horrible, please follow Java naming convention.

    You import the Player class and then also name your variable Player
    • Agree Agree x 1
  3. sorry but I made this plugin quickly

    also I see my error but I don't know how to fix it cas you tell me ?
  4. Solved thank you so much
  5. He is saying when you do Player Player = event.getPlayer(); you name your variable Player with a capital P. Should be lowercase (player).
  6. Please mark this thread as solved so other users know that you no longer need any help.
  7. Idk how i'm new on this forum
  8. At the top of your thread there is an option for "Thread Tools". Open that menu and click on "Edit Title". On the left of your title, there is an option to specify a prefix (which is currently "1.8.8"). Open that menu and change it to "Solved".