Arrows Stopping in Techhider Blocks #208
@ -26,7 +26,6 @@ import de.steamwar.fightsystem.states.FightState;
|
|||||||
import de.steamwar.fightsystem.states.StateDependent;
|
import de.steamwar.fightsystem.states.StateDependent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.AbstractArrow;
|
import org.bukkit.entity.AbstractArrow;
|
||||||
@ -52,18 +51,14 @@ public class ArrowStopper implements StateDependent {
|
|||||||
if(arrows.isEmpty())
|
if(arrows.isEmpty())
|
||||||
return;
|
return;
|
||||||
for (Entity entity : arrows) {
|
for (Entity entity : arrows) {
|
||||||
if(entity.getTicksLived() > Config.ArrowTechhiderCollision){
|
if(entity.getTicksLived() > Config.ArrowTechhiderCollision ||
|
||||||
LAST_LOCATION.remove(entity);
|
((AbstractArrow) entity).isInBlock()){
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(((AbstractArrow) entity).isInBlock()) {
|
|
||||||
LAST_LOCATION.remove(entity);
|
LAST_LOCATION.remove(entity);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!LAST_LOCATION.containsKey(entity))
|
if(!LAST_LOCATION.containsKey(entity))
|
||||||
LAST_LOCATION.put(entity, ((Player) ((AbstractArrow) entity).getShooter()).getEyeLocation());
|
LAST_LOCATION.put(entity, ((Player) ((AbstractArrow) entity).getShooter()).getEyeLocation());
|
||||||
Location last = LAST_LOCATION.get(entity);
|
Location last = LAST_LOCATION.remove(entity);
|
||||||
LAST_LOCATION.remove(entity);
|
|
||||||
if(checkBlocks(entity.getLocation().getBlock(), last.getBlock()))
|
if(checkBlocks(entity.getLocation().getBlock(), last.getBlock()))
|
||||||
entity.remove();
|
entity.remove();
|
||||||
else
|
else
|
||||||
@ -78,7 +73,7 @@ public class ArrowStopper implements StateDependent {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable() {
|
public void enable() {
|
||||||
task = Bukkit.getScheduler().runTaskTimerAsynchronously(FightSystem.getPlugin(), this::run, 1, 0);
|
task = Bukkit.getScheduler().runTaskTimerAsynchronously(FightSystem.getPlugin(), this::run, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren