Solved PlayerInteractEvent

Discussion in 'Plugin Development' started by PhilDEV_Acc, Jan 6, 2020.

  1. Offline

    PhilDEV_Acc

    Hello,
    Im having a problem I want to code am Compass Menu with the RightClick event code:


    Code:
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    
    public class RechtklickListner implements Listener {
    
        @EventHandler
        public void onEvent(PlayerInteractEvent event) {
            Player spieler = event.getPlayer();
            Action rechtcklick = event.getAction();
           
            if(rechtcklick == Action.RIGHT_CLICK_AIR) {
            ItemStack gegenstand = event.getItem();
            ItemMeta metaData = gegenstand.getItemMeta();
           
                if(metaData.getDisplayName().equals(ChatColor.DARK_BLUE + "Lobby Teleporter")) {
                   
                    Bukkit.broadcastMessage("Das ist ein Lobby Teleporter");
            }
            }
        }
    }
    But It doesnt work and I made the Teleporter in the PlayerJoinEvent and you get it when you join the Server.

    Please Tell me how to fix it.
    Thanks.
     
  2. Offline

    timtower Moderator Moderator

  3. Offline

    PhilDEV_Acc

    Ohhh my God Im so Stupid Sorry that I wasted your time:(
     
  4. Offline

    timtower Moderator Moderator

    Time enjoy wasting is not wasted time ;)
    Marked as solved.
     

Share This Page