1

Help with Bukkit plugin code!!!

fillpant's Avatar fillpant2/22/14 7:06 pm
1 emeralds 967 7
2/23/2014 11:21 am
fillpant's Avatar fillpant
Well im making a plugin with exploding arrows and exploding snowballs. well i already claimed that if the source is player then the arrow will explode on contact with somthing, but if the source is from dispenser, i get a error in console
Click to reveal
Error: [02:05:06 ERROR]: Could not pass event ProjectileHitEvent to ExplosiveArrows v0.
0.1a
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:320) ~[spigot-1322.jar:git-Spigot-1322]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
a:62) ~[spigot-1322.jar:git-Spigot-1322]
at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredLi
stener.java:30) ~[spigot-1322.jar:git-Spigot-1322]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
ava:487) [spigot-1322.jar:git-Spigot-1322]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
ava:472) [spigot-1322.jar:git-Spigot-1322]
at org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callProjectile
HitEvent(CraftEventFactory.java:626) [spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.EntityArrow.h(EntityArrow.java:212) [spi
got-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.World.entityJoinedWorld(World.java:1484)
[spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.World.playerJoinedWorld(World.java:1460)
[spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.World.tickEntities(World.java:1329) [spi
got-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.WorldServer.tickEntities(WorldServer.jav
a:514) [spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:6
73) [spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:2
73) [spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:5
62) [spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java
:469) [spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:6
17) [spigot-1322.jar:git-Spigot-1322]
Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_7_R1.projecti
les.CraftBlockProjectileSource cannot be cast to org.bukkit.entity.Entity
at me.fillpant.arrow.ExplosiveArrows.onProjectileHit(ExplosiveArrows.jav
a:30) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0
_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0
_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.7.0_51]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:318) ~[spigot-1322.jar:git-Spigot-1322]
... 15 more
>


any ideas? how can i cancel the explosion event when source is dispeser?
Posted by fillpant's Avatar
fillpant
Level 65 : High Grandmaster Programmer
109

Create an account or sign in to comment.

7

1
02/23/2014 11:21 am
Level 65 : High Grandmaster Programmer
fillpant
fillpant's Avatar
i though it would be a better idea to specify what will hgappend if source is dispenser instead of saying what if the shooter is not a ploayer. any ideas?
1
02/22/2014 8:20 pm
Level 41 : Master Dragonborn
awesomestmason
awesomestmason's Avatar
Not tested but try adding this after you check if the thrown entity is a snowball

else if (projectile.matches("Snowball") || projectile.matches("Arrow") && !(shooter instanceof Player)) {
Location location = event.getEntity().getLocation();
event.getEntity().remove();
event.getEntity().getWorld().createExplosion(location, spow+.0F);
}
1
02/23/2014 4:23 am
Level 65 : High Grandmaster Programmer
fillpant
fillpant's Avatar
Well... now i got this:
Click to reveal
[11:18:28 ERROR]: Could not pass event ProjectileHitEvent to ExplosiveArrows v0.
0.1a
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:320) ~[spigot-1322.jar:git-Spigot-1322]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
a:62) ~[spigot-1322.jar:git-Spigot-1322]
at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredLi
stener.java:30) ~[spigot-1322.jar:git-Spigot-1322]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
ava:487) [spigot-1322.jar:git-Spigot-1322]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
ava:472) [spigot-1322.jar:git-Spigot-1322]
at org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callProjectile
HitEvent(CraftEventFactory.java:626) [spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.EntityArrow.h(EntityArrow.java:212) [spi
got-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.World.entityJoinedWorld(World.java:1484)
[spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.World.playerJoinedWorld(World.java:1460)
[spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.World.tickEntities(World.java:1329) [spi
got-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.WorldServer.tickEntities(WorldServer.jav
a:514) [spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:6
73) [spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:2
73) [spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:5
62) [spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java
:469) [spigot-1322.jar:git-Spigot-1322]
at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:6
17) [spigot-1322.jar:git-Spigot-1322]
Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_7_R1.projecti
les.CraftBlockProjectileSource cannot be cast to org.bukkit.entity.Entity
at me.fillpant.arrow.ExplosiveArrows.onProjectileHit(ExplosiveArrows.jav
a:30) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0
_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0
_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
.7.0_51]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
va:318) ~[spigot-1322.jar:git-Spigot-1322]
... 15 more
>


Still not fixed :S
1
02/23/2014 4:11 am
Level 65 : High Grandmaster Programmer
fillpant
fillpant's Avatar
I already done this, but all i want is if the source is not player make arrow un-explosive.
so i have to skip "event.getEntity().getWorld().createExplosion(location, spow+.0F);" from your code, Thanks ill let you know if it worked
1
02/22/2014 7:37 pm
Level 5 : Apprentice Miner
lukejnorris
lukejnorris's Avatar
Can i see your code so far? Rather than just the error.

In particular, ExplosiveArrows.java.
1
02/22/2014 7:50 pm
Level 65 : High Grandmaster Programmer
fillpant
fillpant's Avatar
Well ok, here: you may find it kinda nooby... im a newbie on bukkit plugins...
http://www.mediafire.com/view/a86v1s4df45btke/Codey.txt
Thanks!
1
02/22/2014 7:28 pm
Level 2 : Apprentice Network
VotableSword00x
VotableSword00x's Avatar
Hmm, Im not really good at this type of code. If you would like, I can give you the skype of one of my plugin developers? PM me if you do.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome