[REQ] /hero who by a right click on a player

Discussion in 'Archived: Plugin Requests' started by phtje, Apr 2, 2012.

  1. Offline

    phtje

    Plugin category: Roleplay

    Suggested name: WhoIsThis

    A bit about me: I'm phtje, playing on a roleplay server named, "CraftHammer". We are using some plugins that makes the roleplay more fun, like heroes.

    What I want: Since we've got heroes installed, and being teired of typing /hero who <player>, we were thinking about a plugin that would let us right click a person and display his level and race, you could simply make an event right clicking a person and call /hero who <player>.

    Ideas for commands: No commands needed for this plugin, just a right click on the person.

    Ideas for permissions: Every player can use it.

    When I'd like it by: Soon, it shouldn't be hard, i hope?

    Similar plugin requests: None.

    Devs who might be interested in this: @LordKainzo , DThielke , Sleaker , jonDatz , Multitallented , @SolarflareFuG , @Archelinux, Rigby90

    Very much thanks,
    -Phtje
     
  2. Offline

    phtje

    Mabye it could be a skill?
     
  3. Offline

    phtje

    This is what i found out,
    event.getPlayer() = player that right clicked
    event.getRightClicked() = entity that has been clicked
    Is somebody able to do it now?

    Also,
    Code:
    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "/hero who <player>");
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 25, 2016
  4. Offline

    tobiyas

  5. Offline

    phtje

    No, everybody can use it.
    Thanks, soo much. I tried this myself, bukkti code changed and i failed so hard lol.
    Is it easy to update it?
     
  6. Offline

    tobiyas

    yeah.

    Code:
        @EventHandler
        public void onPlayerInteractEntity(PlayerInteractEntityEvent event){
            Entity entity = event.getRightClicked();
           
            if(entity == null) return;       
            if(!(entity instanceof Player)) return;
           
            Player clickedPlayer = (Player) entity;
            Player player = event.getPlayer();
           
            Bukkit.dispatchCommand(player, "hero who " + clickedPlayer.getName());
        }
    This is all the magic.

    Here the source with eclipse Project: WhoIsThis.zip
     

    Attached Files:

  7. Offline

    phtje

    I see, I see what i did wrong now, thanks :)
     

Share This Page