Plugin broke...

Discussion in 'Plugin Development' started by jeroenhero123, Oct 29, 2014.

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

    jeroenhero123

    Hey, I've tried everything, but I could't get this part of my plugin working...

    Only the Hulk and Pyro items are working, the other kit items aren't doing anything.

    Got any idea what is wrong?

    EDIT:
    Pastebin:
    http://pastebin.com/UFjszFR9
     
  2. Offline

    Abs0rbed

    To me it looks like you've got a brace missing after your ninja check (~Line 55), but I might've counted wrong. You might really benefit from using an interface and creating classes for each kit that implement said interface, that way you can have it be a bit cleaner
     
  3. Offline

    jeroenhero123

    Thanks, no errors on the braces in eclipse.

    I'm only using 1 class now with +- 1100 lines of code, different classes should be usefull
     
  4. Offline

    EgyptianKing

    jeroenhero123
    I know your problem is solved, but I'd like to point out that you should not store an instance of a player into a list but rather his name or UUID. Other than that, nice code.
     
  5. Offline

    jeroenhero123

    Thanks for your suggestion, I'm pretty new to plugin coding, so I could use tips like this ;).

    Not sure if the problem is solved yet, not on my pc atm...
     
  6. Offline

    Abs0rbed

    Code:java
    1. public interface Kit {
    2.  
    3. /**Called upon usage*/
    4. public void onUse(MainPluginClass main, Player p, PlayerInteractEvent event);
    5.  
    6. /**Cooldown time in seconds*/
    7. public int getCoolDownTime();
    8.  
    9. /**Kit name*/
    10. public String getName();
    11.  
    12. /**Gets the kit type*/
    13. public KitType getType();
    14.  
    15. /**Determines if the player is holding the kit item*/
    16. public boolean isHoldingKitItem(ItemStack i);
    17.  
    18. /**Calls upon damage by something*/
    19. public boolean onDamage(EntityDamageEvent event);
    20.  
    21. /**Calls when attacked by another player*/
    22. public boolean onDamageByPlayer(Player killer, Player victim, EntityDamageByEntityEvent event);
    23.  
    24. /**Gets the kit item type*/
    25. public Material getKitItem();
    26.  
    27. /**Used to specify items that should be given when choosing the kit, but are not used for the events*/
    28. public void onSelect(Player p);
    29.  
    30. /**Returns the kit's armor, if it exists*/
    31. public ItemStack[] getKitArmor();
    32.  
    33. }


    Something like this is very helpful, because then you can have multiple classes that implement all these methods and you can keep your classes altogether very neat
     
    CraftCreeper6 likes this.
Thread Status:
Not open for further replies.

Share This Page