Anonymní profil Patrik – Programujte.com
 x   TIP: Přetáhni ikonu na hlavní panel pro připnutí webu

Anonymní profil Patrik – Programujte.comAnonymní profil Patrik – Programujte.com

 

Příspěvky odeslané z IP adresy 91.127.50.–

Patrik
Java › Začiatky s java pluginom pre…
2. 5. 2015   #201893

   

[22:35:04 ERROR]: Could not pass event PlayerInteractEvent to Skusobny v1.0
org.bukkit.event.EventException
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:305) ~[minecraft_server.jar:git-Spigot-8a983f9-9ae3381]
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
a:62) ~[minecraft_server.jar:git-Spigot-8a983f9-9ae3381]
        at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
ava:502) [minecraft_server.jar:git-Spigot-8a983f9-9ae3381]
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
ava:487) [minecraft_server.jar:git-Spigot-8a983f9-9ae3381]
        at org.bukkit.craftbukkit.v1_8_R1.event.CraftEventFactory.callPlayerInte
ractEvent(CraftEventFactory.java:226) [minecraft_server.jar:git-Spigot-8a983f9-9
ae3381]
        at org.bukkit.craftbukkit.v1_8_R1.event.CraftEventFactory.callPlayerInte
ractEvent(CraftEventFactory.java:193) [minecraft_server.jar:git-Spigot-8a983f9-9
ae3381]
        at org.bukkit.craftbukkit.v1_8_R1.event.CraftEventFactory.callPlayerInte
ractEvent(CraftEventFactory.java:189) [minecraft_server.jar:git-Spigot-8a983f9-9
ae3381]
        at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java
:682) [minecraft_server.jar:git-Spigot-8a983f9-9ae3381]
        at net.minecraft.server.v1_8_R1.PacketPlayInBlockPlace.a(PacketPlayInBlo
ckPlace.java:50) [minecraft_server.jar:git-Spigot-8a983f9-9ae3381]
        at net.minecraft.server.v1_8_R1.PacketPlayInBlockPlace.a(PacketPlayInBlo
ckPlace.java:80) [minecraft_server.jar:git-Spigot-8a983f9-9ae3381]
        at net.minecraft.server.v1_8_R1.PacketHandleTask.run(SourceFile:13) [min
ecraft_server.jar:git-Spigot-8a983f9-9ae3381]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [
?:1.7.0_80]
        at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_80]
        at net.minecraft.server.v1_8_R1.MinecraftServer.z(MinecraftServer.java:6
85) [minecraft_server.jar:git-Spigot-8a983f9-9ae3381]
        at net.minecraft.server.v1_8_R1.DedicatedServer.z(DedicatedServer.java:3
16) [minecraft_server.jar:git-Spigot-8a983f9-9ae3381]
        at net.minecraft.server.v1_8_R1.MinecraftServer.y(MinecraftServer.java:6
23) [minecraft_server.jar:git-Spigot-8a983f9-9ae3381]
        at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java
:526) [minecraft_server.jar:git-Spigot-8a983f9-9ae3381]
        at java.lang.Thread.run(Unknown Source) [?:1.7.0_80]
Caused by: java.lang.NullPointerException
        at skusobny.SobkyLuckSK.sk.main.Main.onPlayerInteract(Main.java:61) ~[?:
?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0
_80]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0
_80]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.7.0_80]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_80]
        at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:301) ~[minecraft_server.jar:git-Spigot-8a983f9-9ae3381]
        ... 17 more
>
Patrik
Java › Začiatky s java pluginom pre…
2. 5. 2015   #201891

Zdravím, trochu sa účím programovať v jave. A chcel by som vytvoriť nejaký plugin pre minecraft. Napísal som taký jednoduchý kód, ktorý polovične funguje. Ide o to, kedy hráč klikne pravým a má v ruke Premenovanú Paličku tak napíše(len zaital) Paráda. A mám nastavené že ked nie, tak napíše nesprávne. Lenže ono to len hodí error do console. Tu je kód:

 Ďakujem za odpoveď :)

@EventHandler
	public void onPlayerInteract(PlayerInteractEvent click){
		if(click.getAction() == Action.RIGHT_CLICK_AIR || click.getAction() == Action.RIGHT_CLICK_BLOCK){
			Player player = click.getPlayer();
			if(player.getInventory().getItemInHand().getType() == Material.STICK){
				if(player.getInventory().getItemInHand().getItemMeta().getDisplayName().equalsIgnoreCase(ChatColor.AQUA + "" +ChatColor.BOLD+"Magic Stick")){
					player.sendMessage(ChatColor.DARK_GREEN+"Paráda :)");
				}else{
					player.sendMessage(ChatColor.DARK_GREEN+"Nesprávne!");
				}
			}
		}
	}

 

 

Hostujeme u Českého hostingu       ISSN 1801-1586       ⇡ Nahoru Webtea.cz logo © 20032024 Programujte.com
Zasadilo a pěstuje Webtea.cz, šéfredaktor Lukáš Churý