How modify a plugin adding this command ?

Discussion in 'Server & Community Management' started by PlomPumpkin_, Jun 1, 2018.

  1. Hello, I tried to modify (with eclipse) KingKits' plugin adding this command but it gave me a lot of errors.
    I'd want remove bowls after eating soups...


















    Photo.PNG
     
  2. youve probs added it in wrong please send us the whole class so we can see
     
  3. Praya

    Benefactor

    use PlayerItemConsumeEvent if you want to remove bowl after eating soup
     
  4. @Kieranslayer Eclipse just says me that kingkits' files after decompiled are wrong and when I add the .jar file in my server it doesn't run
     
  5. Praya

    Benefactor

    listen PlayerItemConsumeEvent -> check if the ItemStack is bowl -> remove from player inventory
     
  6. Where, sorry I'm not understanding
     
  7. Weaves

    Resource Staff

    If I understand correctly you just want to remove bowls after soup is eaten. You don't need to modify the kit plugin to do that. You can just create your own plugin that removes bowls when someone eats soup. Use the event that @Praya mentioned above and follow the same basic format that you used in your original post but with the bowl removal instead of canceling the event. Also don't use the item I'd use the material enum. And get rid of the else that cancels the event. Then all you will have to do is register that in a basic plugin that you make yourself. There is a wiki page on spigot that will tell you how to make a basic plugin. It can be found here.
     
  8. Weaves

    Resource Staff

    I understand. But deompiling, editing ,and compiling another plugin will be harder in this case and require you to do it all over again when the kit plugin dev makes an update. Watch and read some tutorials especially about using a listener and give it a try, you have nothing to lose and lots to gain. :)
     
  9. I think that so (how I wanna do) is better.
     
  10. Strahan

    Benefactor

    Functions using item ID numbers are deprecated, you shouldn't use them. Also, playerdropevent is not what you want for when people eat soup. Like Praya said, listen to PlayerItemConsumeEvent. When it fires, check if it's a soup and if so remove the item from their hand after a slight delay.
     
  11. How Do I do that ??
     
  12. Strahan

    Benefactor

    Code (Text):
    @EventHandler
    public void poof(PlayerItemConsumeEvent e) {
      Is the item's .getType() either a beetroot or mushroom soup?  If Yes {
        Get the Scheduler().Schedule a sync delayed task {
          Get the player inventory and set the item in the main hand to null
        }, Give it about 5 ticks delay
      }
    }
     
    • Like Like x 1