Block HullHider #416
@ -48,6 +48,9 @@ public class HullHiderWrapper18 implements HullHiderWrapper {
|
|||||||
return unchanged;
|
return unchanged;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(changes.isEmpty())
|
||||||
|
return null;
|
||||||
|
|
||||||
return generateBlockChangePacket(changes, blockdata.toArray());
|
return generateBlockChangePacket(changes, blockdata.toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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) {
|
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()));
|
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()) {
|
for (Map.Entry<IntVector, List<IntVector>> entry : sectionWise.entrySet()) {
|
||||||
Object packet = HullHiderWrapper.impl.generateBlockChangePacket(entry.getValue());
|
Object packet = HullHiderWrapper.impl.generateBlockChangePacket(entry.getValue());
|
||||||
|
if(packet == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
players.forEach(player -> TinyProtocol.instance.sendPacket(player, packet));
|
players.forEach(player -> TinyProtocol.instance.sendPacket(player, packet));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,6 +155,16 @@ public class HullHider implements Listener {
|
|||||||
return false;
|
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)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onSpawn(EntitySpawnEvent e) {
|
public void onSpawn(EntitySpawnEvent e) {
|
||||||
|
@ -31,13 +31,11 @@ import de.steamwar.fightsystem.states.FightState;
|
|||||||
import de.steamwar.fightsystem.states.StateDependent;
|
import de.steamwar.fightsystem.states.StateDependent;
|
||||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||||
import de.steamwar.techhider.TechHider;
|
import de.steamwar.techhider.TechHider;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
public class TechHiderWrapper extends StateDependent implements TechHider.LocationEvaluator, Listener {
|
public class TechHiderWrapper extends StateDependent implements TechHider.LocationEvaluator, Listener {
|
||||||
@ -49,7 +47,7 @@ public class TechHiderWrapper extends StateDependent implements TechHider.Locati
|
|||||||
|
|
||||||
public TechHiderWrapper() {
|
public TechHiderWrapper() {
|
||||||
super(ENABLED, FightState.Schem);
|
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);
|
new StateDependentListener(ENABLED, FightState.Schem, this);
|
||||||
register();
|
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) {
|
private Region getHiddenRegion(Player player) {
|
||||||
if(Config.isReferee(player))
|
if(Config.isReferee(player))
|
||||||
return Region.EMPTY;
|
return Region.EMPTY;
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren