forked from SteamWar/SteamWar
Fix entity hider.
This commit is contained in:
@@ -25,6 +25,7 @@ import de.steamwar.fightsystem.FightSystem;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface BlockIdWrapper {
|
||||
@@ -41,6 +42,6 @@ public interface BlockIdWrapper {
|
||||
int blockToId(Block block);
|
||||
void setBlock(World world, int x, int y, int z, int blockState);
|
||||
|
||||
void trackEntity(Player player, int entity);
|
||||
void untrackEntity(Player player, int entity);
|
||||
void trackEntity(Player player, Entity entity);
|
||||
void untrackEntity(Player player, Entity entity);
|
||||
}
|
||||
|
||||
@@ -87,18 +87,16 @@ public class Hull {
|
||||
}
|
||||
|
||||
public void addPlayer(Player player) {
|
||||
System.out.println("Added " + player + " to " + region.centerZ());
|
||||
if(players.add(player)) {
|
||||
for(Entity entity : entities)
|
||||
BlockIdWrapper.impl.untrackEntity(player, entity.getEntityId());
|
||||
BlockIdWrapper.impl.untrackEntity(player, entity);
|
||||
}
|
||||
}
|
||||
|
||||
public void removePlayer(Player player, boolean activeRemoval) {
|
||||
System.out.println("Removed " + player + " from " + region.centerZ());
|
||||
if(players.remove(player) && activeRemoval) {
|
||||
for(Entity entity : entities)
|
||||
BlockIdWrapper.impl.trackEntity(player, entity.getEntityId());
|
||||
BlockIdWrapper.impl.trackEntity(player, entity);
|
||||
// techhider triggers block change sending
|
||||
}
|
||||
}
|
||||
@@ -108,12 +106,12 @@ public class Hull {
|
||||
if(region.inRegion(location) && !visibility.get(new IntVector(location).toId(region))) {
|
||||
if(entities.add(entity)) {
|
||||
for(Player player : players)
|
||||
BlockIdWrapper.impl.untrackEntity(player, entity.getEntityId());
|
||||
BlockIdWrapper.impl.untrackEntity(player, entity);
|
||||
}
|
||||
} else {
|
||||
if(entities.remove(entity)) {
|
||||
for(Player player : players)
|
||||
BlockIdWrapper.impl.trackEntity(player, entity.getEntityId());
|
||||
BlockIdWrapper.impl.trackEntity(player, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,7 +181,7 @@ public class Hull {
|
||||
if(uncoveredSet.contains(new IntVector(entity.getLocation()))) {
|
||||
it.remove();
|
||||
for(Player player : players)
|
||||
BlockIdWrapper.impl.trackEntity(player, entity.getEntityId());
|
||||
BlockIdWrapper.impl.trackEntity(player, entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user