Whats Wrong Whit My CODE?

Discussion in 'Plugin Development' started by Marius A. Winsjansen, Sep 24, 2011.

Thread Status:
Not open for further replies.
  1. Greetings,

    Why is this not working?

    Code:
    	public void onPlayerBuckyEmpty(PlayerBucketEmptyEvent event){
                Player p = event.getPlayer();
                String playername = p.getName();
                Server s = p.getServer();
            if (event.getBucket() != null && event.getBucket()==Material.LAVA_BUCKET){
                s.broadcastMessage(ChatColor.RED + playername + ChatColor.YELLOW + " has emptied a" + ChatColor.RED + " LAVA BUCKET!");
                p.sendMessage(ChatColor.YELLOW + playername + ", its NOT allowed to use, or empty a LAVA BUCKET! You need to stop or else you will be banned!");
    I emptied a lava bucket, but doesnt work!
     
  2. Offline

    iffa

    Wrong section. You might want to call it onPlayerBucketEmpty so it's actually called.
     
  3. OMG, that was emberresing! LOL! :p

    Do you think you could help me whit some other things? :)
     
  4. Offline

    TopGear93

    try this.

    Code:
        public void onPlayerBuckyEmpty(PlayerBucketEmptyEvent event){
            Player p = event.getPlayer();
            String playername = p.getName();
            if (event.getItemStack().getType()== Material.LAVA_BUCKET){
                Bukkit.getServer().broadcastMessage(ChatColor.RED + playername + ChatColor.YELLOW + " has emptied a" + ChatColor.RED + " LAVA BUCKET!");
                p.sendMessage(ChatColor.YELLOW + playername + ", its NOT allowed to use, or empty a LAVA BUCKET! You need to stop or else you will be banned!");
     
  5. It was only the event "onPlayerBUCKETEmpty" that was wrong:) hehe, but thanks!

    Do you btw mind helping me whit some new features i am trying to add? It would be nice, its my first plugin!^^;
     
    TopGear93 likes this.
  6. Offline

    TopGear93

    so basically your making a lava / tnt alert plugin?
     
    Butkicker12 likes this.
  7. No, its MUCH more! My plugin name is "BroadCast" and i am going to add so many features as possible, to prevent griefers!

    This is what i have so far:

    - IF player places lava/tnt/fire, it will be broadcastet, and a private messege is sendt to the player about his stupid actions!
    - IF player breaks diamond, gold, iron ore, it will get broadcastet, and a private messege is sendt to the player that the its not allowed whit xray, and that if he breaks to many to fast he will be listed as an user of x-ray!
    - IF player uses flint and steel, it will be broadcastet, and a private messege is sendt to the player about his stupid actions!
    - IF player empty a lava bucket, it will be broadcastet, and a private messege is sendt to the player about his stupid actions!

    TO-DO

    -IF player makes an portal, it will be broadcastet, and a private messege is sendt to the player that is not allowed!
    - IF player FILL a bucket whit lava, it will be broadcastet, and a private messege is sendt to the player about his stupid actions!
    - Config file whit true/false on everything!
     
  8. Offline

    TopGear93

    -_- im happy you wanna code but damn, theres too many anti grief plugins. if you do release it be prepared for alot of rage from others.

    http://plugins.bukkit.org/#ti=grief&ta=all&au=&subm=false&pno=0
     
  9. Oh, i will not releas it! Maybe if i come up whit some new super duper cool stuff, but..!

    I just wanna learn coding, and i think this is a good start! :D
    (and use it for my server ofc) :)
     
  10. Offline

    Plague

    moved
     
  11. Offline

    Kohle

    Maybe cancel the events...? But still broadcast the messages :)
     
  12. Offline

    Taco

    Thank Notch. We have heaps and heaps of plugins like this. Great start though! :D
     
Thread Status:
Not open for further replies.

Share This Page