Kicking a clicked player :P

Discussion in 'Plugin Development' started by MineDev, Jun 9, 2011.

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

    MineDev

    Code:
    public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
    
    Player player = event.getPlayer();
    Entity ent = event.getRightClicked();
    
    if(main.BanHammer.hammerEnabled.containsKey(player) && player.getItemInHand().getTypeId() == 275) {
    if(ent instanceof Player){
    player.getServer().broadcastMessage(ChatColor.RED + "The mighty BanHammer has fallen on " + ((Player) ent).getName());
    ((Player) ent).kickPlayer("Another victim has been claimed by the mighty BanHammer");
    }
    }
    }
    
    Anybody know what i am doing wrong?
    This is supposed to kick a player when they are right clicked :/
     
  2. Offline

    Daniel Heppner

    You should post all your code on GitHub. I have trouble with seeing what your code is without coloring and proper indents.
     
  3. Offline

    Shamebot

    Pastebin should suffice.
     
    Daniel Heppner likes this.
  4. Offline

    Arkel

    This works fine for me, so I would guess that there's an error getting the boolean from the hashmap, or something elsewhere.
     
  5. Offline

    iPhysX

    ok thanks :p

    EDIT - you will laugh at why it didnt work...

    I forgot this:
    PHP:
    public BHPlayerListener playerlistener = new BHPlayerListener();
     
  6. Offline

    DreadKyller

    I'm laughing, not really, it's a simple mistake. great that you figured it out though.
     
    MineDev likes this.
Thread Status:
Not open for further replies.

Share This Page