Solved Plugin do not do what I want :D

Discussion in 'Plugin Development' started by deleted_91027365, Jan 7, 2015.

Thread Status:
Not open for further replies.
  1. Hey guys,

    I have a problem.
    I want to code a "troll" Plugin that a player when he drop something get kicked. The Code is:

    Code:
        //Drop-Kick
        public void onDrop(PlayerDropItemEvent e) {
            Player p = e.getPlayer();
            if(p.isOp()){
                p.kickPlayer("Drop-Kick verschont keine OPS! - *BADUMMTS*");
                   
            }else {
                p.kickPlayer("§2Drop§f-§3Kick - *§1B§2A§3D§4U§5M§6M§7T§8S§9*");
    (NOTE: I am from Germany thatswhy the Code is German :D)

    In my cmd i had no error but the Plugin has been loaded.(I saw on boot-up)
    Whats wrong?
     
  2. Offline

    timtower Administrator Administrator Moderator

    VG.Developments likes this.
  3. Offline

    97WaterPolo

    @dunklesToast
    Also, make sure to register your event in your onEnable() method!
     
    VG.Developments likes this.
  4. Offline

    TheOatBaron

    Assuming this is the main class....
    Code:
    public void onEnable(){
            getServer().getPluginManager().registerEvents(this, this);
        }
        @EventHandler
        public void onDrop(PlayerDropItemEvent e) {
            Player p = e.getPlayer();
            if(p.isOp()){
                p.kickPlayer("Drop-Kick verschont keine OPS! - *BADUMMTS*");
                  
            }else {
                p.kickPlayer("§2Drop§f-§3Kick - *§1B§2A§3D§4U§5M§6M§7T§8S§9*");
            }
        }
     
    deleted_91027365 likes this.
  5. Offline

    FameForAim

    Register the listener ... ;)
     
  6. Oh yes :D I forgot it :D


    Now Eclipse say this on public void onDrop [...]

    "void is an invalid type for the variable onDrop"
     
    Last edited by a moderator: Jan 8, 2015
  7. Offline

    Skionz

    @dunklesToast Java is a prerequisite to Bukkit as Bukkit is simply an API written in Java. Bukkit follows Java syntax. Not the other way around.
     
  8. Offline

    TheOatBaron

    onDrop isn't a variable, it's a method. You screwed up your { } symbols somewhere or are using a semi colon in the wrong place.
     
Thread Status:
Not open for further replies.

Share This Page