Bonjour, j'ai un message d'erreur qui apparaît dans ma console dans je fais clique droit avec un block sur un autre, voici ce message :
Dans le "Caused by :" à la fin on voie :
Et donc ce qui correspond à ce code dans mon plugin :
Vous pouvez m'aider ?
Code:
[11:45:32] [Server thread/ERROR]: Could not pass event PlayerInteractEvent to RedHeadEmile v2.0
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:310) ~[server.jar:git-Spigot-7d15d07-c194444]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[server.jar:git-Spigot-7d15d07-c194444]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [server.jar:git-Spigot-7d15d07-c194444]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [server.jar:git-Spigot-7d15d07-c194444]
at org.bukkit.craftbukkit.v1_9_R1.event.CraftEventFactory.callPlayerInteractEvent(CraftEventFactory.java:212) [server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.PlayerInteractManager.a(PlayerInteractManager.java:482) [server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.PlayerConnection.a(PlayerConnection.java:840) [server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.PacketPlayInUseItem.a(SourceFile:55) [server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.PacketPlayInUseItem.a(SourceFile:11) [server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.PlayerConnectionUtils$1.run(SourceFile:13) [server.jar:git-Spigot-7d15d07-c194444]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.7.0_79]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_79]
at net.minecraft.server.v1_9_R1.SystemUtils.a(SourceFile:45) [server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.MinecraftServer.D(MinecraftServer.java:716) [server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.DedicatedServer.D(DedicatedServer.java:400) [server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.MinecraftServer.C(MinecraftServer.java:655) [server.jar:git-Spigot-7d15d07-c194444]
at net.minecraft.server.v1_9_R1.MinecraftServer.run(MinecraftServer.java:554) [server.jar:git-Spigot-7d15d07-c194444]
at java.lang.Thread.run(Unknown Source) [?:1.7.0_79]
Caused by: java.lang.NullPointerException
at fr.RedHeadEmile.RedHeadEmile.RedHeadEmile.onPlayerInteract(RedHeadEmile.java:361) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_79]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_79]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_79]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[server.jar:git-Spigot-7d15d07-c194444]
... 17 more
Dans le "Caused by :" à la fin on voie :
Code:
at fr.RedHeadEmile.RedHeadEmile.RedHeadEmile.onPlayerInteract(RedHeadEmile.java:361) ~[?:?]
Code:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
if(e.getPlayer().isOp()) {
if(e.getItem() != null) {
if(e.getAction() == Action.RIGHT_CLICK_AIR) {
if(e.getItem().getType() == Material.MAGMA_CREAM) {
if(e.getItem().getItemMeta().getDisplayName().equals("§7MagicMagma")) {
MagmaCube magmacube = (MagmaCube) e.getPlayer().getWorld().spawn(e.getPlayer().getLocation(), MagmaCube.class);
magmacube.setCustomName("§4M§ca§6g§ei§2c§aC§bu§3b§1e");
magmacube.setVelocity(e.getPlayer().getLocation().getDirection().multiply(5));
magmacube.setCustomNameVisible(true);
magmacube.setHealth(1);
ItemStack magma = new ItemStack(Material.MAGMA_CREAM, 1);
ItemMeta magmam = magma.getItemMeta();
magmam.setDisplayName("§7MagicMagma");
magma.setItemMeta(magmam);
e.getPlayer().getInventory().removeItem(magma);
}
}
if(e.getItem().getType() == Material.COMPASS) {
Menu.OpenMenu(e.getPlayer());
}
}
if(e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if(e.getItem().getItemMeta().getDisplayName().equals("§7MagicMagma")) {
MagmaCube magmacube = (MagmaCube) e.getPlayer().getWorld().spawn(e.getPlayer().getLocation(), MagmaCube.class);
magmacube.setCustomName("§4M§ca§6g§ei§2c§aC§bu§3b§1e");
magmacube.setVelocity(e.getPlayer().getLocation().getDirection().multiply(5));
magmacube.setCustomNameVisible(true);
magmacube.setHealth(1);
ItemStack magma = new ItemStack(Material.MAGMA_CREAM, 1);
ItemMeta magmam = magma.getItemMeta();
magmam.setDisplayName("§7MagicMagma");
magma.setItemMeta(magmam);
e.getPlayer().getInventory().removeItem(magma);
}
if(e.getItem().getType() == Material.COMPASS) {
Menu.OpenMenu(e.getPlayer());
}
}
}
}
}