McPvP Phantom Kit w/ PlayerInteractEvent Is Not Working!

Discussion in 'Plugin Development' started by hatter274, May 18, 2014.

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

    hatter274

    Hi Guys, this is hatter274 and i was making the Phantom kit in McPvP and whenever i right click the feather it says on the console that it couldn't pass the "PlayerInteractEvent". Anyone help? Here is my code: http://pastebin.com/wi2v6AtM
     
  2. Offline

    cfil360

    hatter274 please post the full error code you receive.
     
  3. Offline

    hatter274

    Ok, how do I do that w/ cmd prompt

    Can anyone please rewrite the code for this w/ same messages?? Pleazzz

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  4. Offline

    Glumpz

    hatter274 Please only bump once per 24 hours.
     
  5. Offline

    hatter274

  6. Offline

    Glumpz

    hatter274 Bringing your post to the top of the thread.
     
  7. Offline

    hatter274

    O. Didnt know that posting a reply/comment at differ times is a bumb xD.

    But anyways plz help me and fix this code someone :/
     
  8. Offline

    Epixpenguin

    Well you should check if the player clicked on the feather when checking if the player clicked.
     
  9. Offline

    hatter274

    So you want me to check the code or in-game, id understand you "sentence" to well :/

    If you are telling me to change the code, idk wat to put :eek:

    If you are telling me to check in-game i did click on the feather and checked that i clicked it :p (This sentence is just some BS xD, id undertand)

    If anyone can just check what I did wrong w/ the code it would be awsome if you can fix it :O. Thanks, becuz i tried basic knowledge of Eclipse ik, not advanced, so i don't know wat i am doing wrong, it is probs very obvious and i don't know D:

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  10. Offline

    cfil360

    hatter274 if you don't know how to get the error code from the console then you shouldn't be developing plugins. If you provide the full error code, we will gladly help you.
     
  11. Offline

    hatter274

    cfil360 Im on a phone right now far from home, i will post the error as soon as i get home, ok? If you can try to fix it and look at the error urself, go ahead. On my "Main" of my plugin i put:

    pm.registerEvents(new Phantom(this), this);

    Maybe that's not the way but it worked w/ kit Switcher like:

    pm.registerEvents(new Switcher(this), this);

    So idk, i can tell you though that it says Cannot pass PlayerInteractEvent and blahblahblah D;
     
  12. Offline

    Epixpenguin

    hatter274 What I mean when checking if the feather is being clicked I meant in the code. It would be shown as...
    Code:java
    1. if(p.getItemInHand() == Material.FEATHER){
    2. //Do stuff
    3. }

    P.S p.getItemInHand() might not be the correct method but it is the closest I could think of, and I've used it before
     
  13. Offline

    hatter274

    Epixpenguin So I put that after the PlayerInteractEvent, right? Srry if im asking to many questions cuz im new to coding
     
  14. Offline

    Ba7marker

    Paste the full error then it would be easier to help.
     
  15. Offline

    hatter274

    imjack16 cfil360 Ok guys, here is the full error/error code:

    [17:42:03 ERROR]: Could not pass event PlayerInteractEvent to sKits_Listeners v1
    .0
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:320) ~[Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62) ~[Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:486) [Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:471) [Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callPlayerInte
    ractEvent(CraftEventFactory.java:195) [Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b30
    20jnks]
    at net.minecraft.server.v1_7_R1.PlayerInteractManager.interact(PlayerInt
    eractManager.java:374) [Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at net.minecraft.server.v1_7_R1.PlayerConnection.a(PlayerConnection.java
    :628) [Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at net.minecraft.server.v1_7_R1.PacketPlayInBlockPlace.a(SourceFile:60)
    [Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at net.minecraft.server.v1_7_R1.PacketPlayInBlockPlace.handle(SourceFile
    :9) [Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:146
    ) [Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134) [Craf
    tbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:6
    55) [Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:2
    50) [Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:5
    45) [Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java
    :457) [Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:6
    17) [Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    Caused by: java.lang.IllegalArgumentException: Cannot make player fly if getAllo
    wFlight() is false
    at org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer.setFlying(CraftPlay
    er.java:1099) ~[Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    at me.Hatter274.Phantom.onPlayerInteract(Phantom.java:49) ~[?:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0
    _07]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0
    _07]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    .7.0_07]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_07]
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:318) ~[Craftbukkit.jar:git-Bukkit-1.7.2-R0.3-b3020jnks]
    ... 15 more

    ^ Any Fix To This Problem Anyone? ^

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  16. Offline

    Ba7marker

    hatter274
    Stop bumping the post people are not here just to help you.
    Your error is:
    Caused by: java.lang.IllegalArgumentException: Cannot make player fly if getAllo
    wFlight() is false

    try switching around
    Code:java
    1. p.setFlying(true);
    2. p.setAllowFlight(true);
    3.  
     
  17. Offline

    hatter274

    So It should be like
    p.setAllowFlight(true);
    p.setFlying(true);

    ??
     
  18. Offline

    Ba7marker

    hatter274
    Well try and find out i'm not the one writing the code.
     
  19. Offline

    hatter274

    imjack16 Ok it works, but i only have Leather Boots, on my face not feet D: Can You tell me how to fix that?
     
  20. Offline

    Ba7marker

    hatter274
    Code:java
    1. p.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
    2. p.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
    3. p.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_LEGGINGS));
    4. p.getInventory().setHelmet(new ItemStack(Material.CHAINMAIL_BOOTS));

    Maybe cause your setting them to a helmet?
     
  21. Offline

    hatter274

    Oh, LOL

    imjack16 No im not actually, i changed that already D:

    imjack16 Here is my code, i get no armor for the first time if i have no armor, and if i do hace for example iron armor, it stays iron when im flying:

    http://pastebin.com/0kJ97kv1

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  22. Offline

    Ba7marker

    hatter274
    First set there armor slots to air or null then try.
     
  23. Offline

    hatter274

    imjack16 p.getInventory().setHelmet(new ItemStack(Material.AIR)); ????
     
  24. Offline

    Ba7marker

    hatter274
    Well try it
    or try p.getInventory().setHelmet(null);
     
  25. Offline

    xTigerRebornx

    hatter274
    Code:
     ItemStack helm = new ItemStack (Material.LEATHER_HELMET);
                                    ItemStack chest = new ItemStack (Material.LEATHER_CHESTPLATE);
                                    ItemStack leggs = new ItemStack (Material.LEATHER_LEGGINGS);
                                    ItemStack boots = new ItemStack (Material.LEATHER_BOOTS);
                                    helm.setDurability((short)(1));
                                    chest.setDurability((short)(1));
                                    leggs.setDurability((short)(1));
                                    boots.setDurability((short)(1));
                                    p.getInventory().setHelmet(helm);
                                    p.getInventory().setHelmet(chest);
                                    p.getInventory().setHelmet(leggs);
                                    p.getInventory().setHelmet(boots);
    You are clearly setting the Leather boots to the helmet slot....
     
  26. Offline

    hatter274

    I still get the ablility if u right click anything, its been too long 4 one snalk thing, cab someone just give or edit the code 4 me w/ same msgs
     
Thread Status:
Not open for further replies.

Share This Page