#Teleport Player on Projectile Hit
1 messages · Page 1 of 1 (latest)
so should i use this to check if the shooter is a player and otherwise not let the tp to happen
if(pie.getEntity().getShooter() instanceof Player){
if (((Player) entity).getItemInUse().getItemMeta().equals(ItemManager.shock_powder.getItemMeta()) ) {
entity.teleport(pie.getHitBlock().getLocation());
}
like this
(((Player) entity.getShooter()).getItemInUse().getItemMeta().equals(ItemManager.shock_powder.getItemMeta()) ) {
like this
ok
so i set my variable as projectile
should i keep it like that
or change it to Player
cast it on to player
so i should make a Projectile variable
ok thanks
oh , that makes way more sense
checking if the conditions are not right first
then executing if the condition is right
ok i will try it out
i mean
why are you even checking the item meta for equal
would this call even work?
since getItemMeta always creates a new instance of an itemmeta
and if they didnt overwrite the equals method
this will always be false
i think so too, because i'm still having the same issue and i think it isn't detecing my item
well, it seems i am having the same issue(nothing happens when the arrow hits the block) , i think it has something to do with the plugin not detecing the custom item meta
ok thank
s
just to make sure, im testing out the plugin without checking for a specific item meta to see if thats the problem
also, when im tellign the plugin to tp the player to the item, the line of code shouold look like this?
((Player) entity.getShooter()).teleport((Location) block);
bruh
then how should i look like
oh ok
but why not just cast it
oh ok
but it seems the other way isn't working as well
so should this owkr
okok
i'll try it out
oh ok
any way i can solve this? I want it so when the arrow hits it tps the player one block above where the arrow actually hit so they dont suffocate
ah ok so like this ((Player) entity.getShooter()).teleport(location.add(0,1,0));
i used to but recently im getting back into it
i mean i tested it and it worked