SteamWar/FightSystem
Archiviert
13
1

Arrows Stopping in Techhider Blocks #208

Manuell gemergt
Lixfel hat 17 Commits von arrow-in-techhider nach master 2021-01-02 09:20:42 +01:00 zusammengeführt
Nur Änderungen aus Commit 5eedf7bf50 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

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