You are not logged in.

  • Login
Bitte besucht unser neues Forum unter https://forum.nitrado.net | Please visit our new Forum at https://forum.nitrado.net

Dear visitor, welcome to Nitrado.net Prepaid Gameserver Community-Support - Archiv. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

AlexBex

User / Kunde

  • "AlexBex" started this thread

Posts: 1

  • Send private message

1

Wednesday, November 1st 2017, 1:47am

Es kommt eine Fehlermeldung, obwohl alles richtig funktioniert

Hier ist die Fehlermeldung:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[00:30:19 ERROR]: Could not pass event InventoryClickEvent to BexLobby_v0.1 v0.1org.bukkit.event.EventException
	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:305) ~[spigot-1.8.jar:git-Spigot-550ebac-7019900]
	at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot-1.8.jar:git-Spigot-550ebac-7019900]
	at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
	at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
	at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:1588) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
	at net.minecraft.server.v1_8_R1.PacketPlayInWindowClick.a(SourceFile:31) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
	at net.minecraft.server.v1_8_R1.PacketPlayInWindowClick.a(SourceFile:9) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
	at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_131]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_131]
	at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:696) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
	at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:316) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
	at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:634) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
	at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:537) [spigot-1.8.jar:git-Spigot-550ebac-7019900]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
Caused by: java.lang.NullPointerException
	at ml.gamesucht.bexlobby.main.Main.onClick(Main.java:64) ~[?:?]
	at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
	at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301) ~[spigot-1.8.jar:git-Spigot-550ebac-7019900]  ... 14 more



Source code

1
2
3
4
5
6
7
8
9
10
11
12
@EventHandlerpublic void onClick(InventoryClickEvent e){
    Player p = (Player) e.getWhoClicked();
    if(e.getClickedInventory().getTitle().equals("§6Tele§3Porter§7 | Gamesucht")) {
        e.setCancelled(true);
        if (e.getCurrentItem().getItemMeta().getDisplayName().equals("§3Spawn")) {
            Main.loadlocation(p, "spawn");
            Main.loaditems(p);
            p.closeInventory();
            p.playSound(p.getLocation(), Sound.LEVEL_UP, 1, 1);
        }
    }
}



Zeile 64 ist (also die zeile wo der fehler sein sollte) if(e.getClickedInventory().getTitle().equals("§6Tele§3Porter§7 | Gamesucht")) {


Ich will einfach die Fehlermeldung weghaben.

Stuppsman

User / Kunde

Posts: 2,766

Thanks: 25

  • Send private message

2

Wednesday, November 1st 2017, 5:14am

if (e.getCurrentItem().getItemMeta().getDisplayName()


Der Fehler kommt, weil du sowohl auf die Meta, als auch auf den DisplayName zugreifst, ohne vorher zu checken, ob sie existieren. hasItemMeta und hasDisplayName müssten die Methoden dafür sein.
Nein, ich hab kein Skype.. bei Interesse an einer privaten Unterrichtsstunde, wende dich bitte direkt an mein Team! 8)

Bitte besucht unser neues Forum unter https://forum.nitrado.net| Please visit our new Forum at https://forum.nitrado.net