SteamWar/FightSystem
Archiviert
13
1

Block HullHider #416

Zusammengeführt
Lixfel hat 5 Commits von blockHullHider nach master 2024-03-13 17:13:38 +01:00 zusammengeführt
4 geänderte Dateien mit 26 neuen und 3 gelöschten Zeilen
Nur Änderungen aus Commit 3bd54fcdbd werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -48,6 +48,9 @@ public class HullHiderWrapper18 implements HullHiderWrapper {
return unchanged;
});
if(changes.isEmpty())
return null;
return generateBlockChangePacket(changes, blockdata.toArray());
}

Datei anzeigen

@ -94,6 +94,10 @@ public class Hull {
}
}
public boolean blockPrecise(Player player, int chunkX, int chunkY, int chunkZ) {
return players.contains(player) && !region.chunkSectionOutside(chunkX, chunkY, chunkZ);
}
public boolean isBlockHidden(Player player, int x, int y, int z) {
return region.inRegion(x, y, z) && players.contains(player) && !visibility.get(((y - region.getMinY()) * region.getSizeZ() + (z - region.getMinZ())) * region.getSizeX() + (x - region.getMinX()));
}
@ -234,6 +238,9 @@ public class Hull {
for (Map.Entry<IntVector, List<IntVector>> entry : sectionWise.entrySet()) {
Object packet = HullHiderWrapper.impl.generateBlockChangePacket(entry.getValue());
if(packet == null)
continue;
players.forEach(player -> TinyProtocol.instance.sendPacket(player, packet));
}
}

Datei anzeigen

@ -155,6 +155,16 @@ public class HullHider implements Listener {
return false;
}
public boolean blockPrecise(Player player, int chunkX, int chunkY, int chunkZ) {
if(!ENABLED)
return false;
for (Hull hull : hulls)
if(hull.blockPrecise(player, chunkX, chunkY, chunkZ))
return true;
return false;
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onSpawn(EntitySpawnEvent e) {

Datei anzeigen

@ -31,13 +31,11 @@ import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.techhider.TechHider;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.Collections;
import java.util.concurrent.ConcurrentHashMap;
public class TechHiderWrapper extends StateDependent implements TechHider.LocationEvaluator, Listener {
@ -49,7 +47,7 @@ public class TechHiderWrapper extends StateDependent implements TechHider.Locati
public TechHiderWrapper() {
super(ENABLED, FightState.Schem);
techHider = new TechHider(this, Material.getMaterial(Config.ObfuscateWith), Config.HiddenBlocks, Config.HiddenBlockEntities);
techHider = new TechHider(this, Config.ObfuscateWith, Config.HiddenBlocks, Config.HiddenBlockEntities);
new StateDependentListener(ENABLED, FightState.Schem, this);
register();
@ -123,6 +121,11 @@ public class TechHiderWrapper extends StateDependent implements TechHider.Locati
}
}
@Override
public boolean blockPrecise(Player player, int chunkX, int chunkY, int chunkZ) {
return FightSystem.getHullHider().blockPrecise(player, chunkX, chunkY, chunkZ);
}
private Region getHiddenRegion(Player player) {
if(Config.isReferee(player))
return Region.EMPTY;