What's wrong!?!?

Discussion in 'Plugin Development' started by Muod, Nov 27, 2013.

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

    Muod

    I'm making a plugin where it does not let you have enchanted swords with sharpness. If you have a sharpness enchanted sword it will remove your sword. I made this code.
    Code:java
    1. @EventHandler
    2. public void onInteractEvent(PlayerInteractEvent e)
    3. {
    4. Player player = e.getPlayer();
    5. ItemStack DA = new ItemStack(Material.DIAMOND_SWORD, 1);
    6. if (player.getInventory().contains(DA)){
    7. if (DA.containsEnchantment(Enchantment.DAMAGE_ALL)){
    8. player.getInventory().remove(DA);
    9. }
    10. }
    11. }

    Though when I try it it doesn't work. I have also tried adding sharpness into the itemstack. Doesn anybody know how to fix this?
     
  2. Offline

    AnonymousDev

    Did you register the event in your main calss??
     
  3. Offline

    AlexHH251997

    Did you register the event in the Main class?
     
  4. Offline

    Muod

  5. Offline

    WhaleAnarchy

    Have you implemented Listener?
    What is the error you are getting?
     
Thread Status:
Not open for further replies.

Share This Page