SteamWar/FightSystem
Archiviert
13
1

Merge branch 'master' into lixfel-ai-v1

# Conflicts:
#	FightSystem_Core/src/de/steamwar/fightsystem/fight/FightSchematic.java
Dieser Commit ist enthalten in:
Lixfel 2024-03-23 07:13:17 +01:00
Commit dd1cd9cf37
27 geänderte Dateien mit 552 neuen und 151 gelöschten Zeilen

Datei anzeigen

@ -46,6 +46,8 @@ dependencies {
implementation project(":FightSystem_9") implementation project(":FightSystem_9")
implementation project(":FightSystem_8") implementation project(":FightSystem_8")
compileOnly 'it.unimi.dsi:fastutil:8.5.6'
compileOnly swdep("Spigot-1.14") compileOnly swdep("Spigot-1.14")
compileOnly swdep("WorldEdit-1.15") compileOnly swdep("WorldEdit-1.15")
compileOnly swdep("SpigotCore") compileOnly swdep("SpigotCore")

Datei anzeigen

@ -21,18 +21,31 @@ package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.Reflection;
import de.steamwar.core.Core; import de.steamwar.core.Core;
import de.steamwar.fightsystem.Config;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import java.util.Map;
public class BlockIdWrapper14 implements BlockIdWrapper { public class BlockIdWrapper14 implements BlockIdWrapper {
private static final Class<?> worldServer = Reflection.getClass("{nms.server.level}.WorldServer");
private static final Class<?> chunkProviderServer = Reflection.getClass("{nms.server.level}.ChunkProviderServer"); private static final Class<?> chunkProviderServer = Reflection.getClass("{nms.server.level}.ChunkProviderServer");
private static final Reflection.MethodInvoker getChunkProvider = Reflection.getTypedMethod(worldServer, null, chunkProviderServer);
private static final Class<?> playerChunkMap = Reflection.getClass("{nms.server.level}.PlayerChunkMap");
private static final Reflection.FieldAccessor<?> getPlayerChunkMap = Reflection.getField(chunkProviderServer, playerChunkMap, 0);
private static final Reflection.FieldAccessor<? extends Map> entityTrackers = Core.getVersion() > 15 ? Reflection.getField(playerChunkMap, Int2ObjectMap.class, 0) : Reflection.getField(playerChunkMap, org.bukkit.craftbukkit.libs.it.unimi.dsi.fastutil.ints.Int2ObjectMap.class, 0);
private static final Class<?> block = Reflection.getClass("{nms.world.level.block}.Block"); private static final Class<?> block = Reflection.getClass("{nms.world.level.block}.Block");
private static final Class<?> iBlockData = Reflection.getClass("{nms.world.level.block.state}.IBlockData"); private static final Class<?> iBlockData = Reflection.getClass("{nms.world.level.block.state}.IBlockData");
private static final Class<?> blockPosition = Reflection.getClass("{nms.core}.BlockPosition"); private static final Class<?> blockPosition = Reflection.getClass("{nms.core}.BlockPosition");
private final Map trackers;
public BlockIdWrapper14() {
trackers = entityTrackers.get(getPlayerChunkMap.get(getChunkProvider.invoke(getWorldHandle.invoke(Config.world))));
}
private static final Reflection.MethodInvoker getCombinedId = Reflection.getTypedMethod(block, null, int.class, iBlockData); private static final Reflection.MethodInvoker getCombinedId = Reflection.getTypedMethod(block, null, int.class, iBlockData);
private static final Reflection.MethodInvoker getNMS = Reflection.getTypedMethod(Reflection.getClass("{obc}.block.CraftBlock"), "getNMS", iBlockData); private static final Reflection.MethodInvoker getNMS = Reflection.getTypedMethod(Reflection.getClass("{obc}.block.CraftBlock"), "getNMS", iBlockData);
@Override @Override
@ -41,11 +54,9 @@ public class BlockIdWrapper14 implements BlockIdWrapper {
} }
private static final Reflection.MethodInvoker getByCombinedId = Reflection.getTypedMethod(block, null, iBlockData, int.class); private static final Reflection.MethodInvoker getByCombinedId = Reflection.getTypedMethod(block, null, iBlockData, int.class);
private static final Reflection.MethodInvoker getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle", worldServer);
private static final Reflection.ConstructorInvoker newBlockPosition = Reflection.getConstructor(blockPosition, int.class, int.class, int.class); private static final Reflection.ConstructorInvoker newBlockPosition = Reflection.getConstructor(blockPosition, int.class, int.class, int.class);
private static final Reflection.MethodInvoker getTypeAndData = Reflection.getMethod(worldServer, null, blockPosition, iBlockData, int.class); private static final Reflection.MethodInvoker getTypeAndData = Reflection.getMethod(worldServer, null, blockPosition, iBlockData, int.class);
private static final Reflection.MethodInvoker removeTileEntity = Reflection.getMethod(worldServer, Core.getVersion() > 15 ? "m" : "removeTileEntity", blockPosition); private static final Reflection.MethodInvoker removeTileEntity = Reflection.getMethod(worldServer, Core.getVersion() > 15 ? "m" : "removeTileEntity", blockPosition);
private static final Reflection.MethodInvoker getChunkProvider = Reflection.getTypedMethod(worldServer, null, chunkProviderServer);
private static final Reflection.MethodInvoker flagDirty = Reflection.getMethod(chunkProviderServer, null, blockPosition); private static final Reflection.MethodInvoker flagDirty = Reflection.getMethod(chunkProviderServer, null, blockPosition);
@Override @Override
public void setBlock(World world, int x, int y, int z, int blockState) { public void setBlock(World world, int x, int y, int z, int blockState) {
@ -58,6 +69,23 @@ public class BlockIdWrapper14 implements BlockIdWrapper {
flagDirty.invoke(getChunkProvider.invoke(nworld), pos); flagDirty.invoke(getChunkProvider.invoke(nworld), pos);
} }
private static final Class<?> entityTracker = Reflection.getClass("{nms.server.level}.PlayerChunkMap$EntityTracker");
private static final Reflection.MethodInvoker updatePlayer = Reflection.getMethod(entityTracker, Core.getVersion() > 15 ? "b" : "updatePlayer", entityPlayer);
@Override
public void trackEntity(Player player, int entity) {
Object tracker = trackers.get(entity);
if(tracker != null)
updatePlayer.invoke(tracker, getPlayer.invoke(player));
}
private static final Reflection.MethodInvoker clearPlayer = Reflection.getMethod(entityTracker, Core.getVersion() > 15 ? "a" : "clear", entityPlayer);
@Override
public void untrackEntity(Player player, int entity) {
Object tracker = trackers.get(entity);
if(tracker != null)
clearPlayer.invoke(tracker, getPlayer.invoke(player));
}
private static final Reflection.MethodInvoker getMaterialByBlock = Reflection.getTypedMethod(Reflection.getClass("{obc}.util.CraftMagicNumbers"), "getMaterial", Material.class, block); private static final Reflection.MethodInvoker getMaterialByBlock = Reflection.getTypedMethod(Reflection.getClass("{obc}.util.CraftMagicNumbers"), "getMaterial", Material.class, block);
private static final Reflection.MethodInvoker getBlockByBlockData = Reflection.getTypedMethod(iBlockData, null, block); private static final Reflection.MethodInvoker getBlockByBlockData = Reflection.getTypedMethod(iBlockData, null, block);
@Override @Override

Datei anzeigen

@ -48,6 +48,7 @@ dependencies {
compileOnly 'com.mojang:datafixerupper:4.0.26' compileOnly 'com.mojang:datafixerupper:4.0.26'
compileOnly 'io.netty:netty-all:4.1.68.Final' compileOnly 'io.netty:netty-all:4.1.68.Final'
compileOnly 'com.mojang:authlib:1.5.25' compileOnly 'com.mojang:authlib:1.5.25'
compileOnly 'it.unimi.dsi:fastutil:8.5.6'
compileOnly swdep("Spigot-1.18") compileOnly swdep("Spigot-1.18")
compileOnly swdep("WorldEdit-1.15") compileOnly swdep("WorldEdit-1.15")

Datei anzeigen

@ -0,0 +1,82 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection;
import de.steamwar.fightsystem.Config;
import it.unimi.dsi.fastutil.shorts.Short2ObjectArrayMap;
import net.minecraft.core.BlockPosition;
import net.minecraft.core.SectionPosition;
import net.minecraft.network.protocol.game.PacketPlayOutBlockChange;
import net.minecraft.network.protocol.game.PacketPlayOutMultiBlockChange;
import net.minecraft.world.level.block.state.IBlockData;
import org.bukkit.block.data.BlockData;
import java.util.ArrayList;
import java.util.List;
public class HullHiderWrapper18 implements HullHiderWrapper {
private static final Reflection.MethodInvoker getState = Reflection.getTypedMethod(Reflection.getClass("{obc}.block.data.CraftBlockData"), "getState", IBlockData.class);
@Override
public Object generateBlockChangePacket(List<Hull.IntVector> changes) {
List<Object> blockdata = new ArrayList<>(changes.size());
changes.removeIf(change -> {
BlockData data = Config.world.getBlockData(change.getX(), change.getY(), change.getZ());
boolean unchanged = data.getMaterial() == Config.ObfuscateWith || Config.HiddenBlocks.contains(data.getMaterial());
if(!unchanged)
blockdata.add(getState.invoke(data));
return unchanged;
});
if(changes.isEmpty())
return null;
return generateBlockChangePacket(changes, blockdata.toArray());
}
private Object generateBlockChangePacket(List<Hull.IntVector> changes, Object[] blockdata) {
if(changes.size() > 1) {
Hull.IntVector section = changes.get(0);
section = new Hull.IntVector(section.getX() >> 4, section.getY() >> 4, section.getZ() >> 4);
int xOffset = 16*section.getX();
int yOffset = 16*section.getY();
int zOffset = 16*section.getZ();
short[] pos = new short[changes.size()];
for(int i = 0; i < changes.size(); i++) {
Hull.IntVector change = changes.get(i);
pos[i] = (short) (((change.getX()-xOffset) << 8) + ((change.getZ()-zOffset) << 4) + (change.getY()-yOffset));
}
return constructMultiBlockChange(section, pos, blockdata);
} else {
Hull.IntVector pos = changes.get(0);
return new PacketPlayOutBlockChange(new BlockPosition(pos.getX(), pos.getY(), pos.getZ()), (IBlockData) blockdata[0]);
}
}
protected Object constructMultiBlockChange(Hull.IntVector section, short[] pos, Object[] blockdata) {
return new PacketPlayOutMultiBlockChange(SectionPosition.a(section.getX(), section.getY(), section.getZ()), new Short2ObjectArrayMap<>(pos, blockdata, blockdata.length), false);
}
}

Datei anzeigen

@ -46,6 +46,7 @@ dependencies {
implementation project(":FightSystem_18") implementation project(":FightSystem_18")
compileOnly 'org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT' compileOnly 'org.spigotmc:spigot-api:1.20-R0.1-SNAPSHOT'
compileOnly 'it.unimi.dsi:fastutil:8.5.6'
compileOnly swdep("Spigot-1.20") compileOnly swdep("Spigot-1.20")
} }

Datei anzeigen

@ -0,0 +1,32 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
import it.unimi.dsi.fastutil.shorts.Short2ObjectArrayMap;
import net.minecraft.core.SectionPosition;
import net.minecraft.network.protocol.game.PacketPlayOutMultiBlockChange;
public class HullHiderWrapper20 extends HullHiderWrapper18 {
@Override
protected Object constructMultiBlockChange(Hull.IntVector section, short[] pos, Object[] blockdata) {
return new PacketPlayOutMultiBlockChange(SectionPosition.a(section.getX(), section.getY(), section.getZ()), new Short2ObjectArrayMap<>(pos, blockdata, blockdata.length));
}
}

Datei anzeigen

@ -19,11 +19,25 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection;
import de.steamwar.fightsystem.Config;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player;
public class BlockIdWrapper8 implements BlockIdWrapper { public class BlockIdWrapper8 implements BlockIdWrapper {
private static final Class<?> entityTracker = Reflection.getClass("{nms}.EntityTracker");
private static final Reflection.FieldAccessor<?> getEntityTracker = Reflection.getField(worldServer, entityTracker, 0);
private static final Class<?> intHashMap = Reflection.getClass("{nms}.IntHashMap");
private static final Reflection.FieldAccessor<?> getTrackedEntities = Reflection.getField(entityTracker, intHashMap, 0);
private final Object trackers;
public BlockIdWrapper8() {
trackers = getTrackedEntities.get(getEntityTracker.get(getWorldHandle.invoke(Config.world)));
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public int blockToId(Block block) { public int blockToId(Block block) {
@ -39,6 +53,24 @@ public class BlockIdWrapper8 implements BlockIdWrapper {
world.getBlockAt(x, y, z).setTypeIdAndData(blockState >> 4, (byte)(blockState & 0b1111), false); world.getBlockAt(x, y, z).setTypeIdAndData(blockState >> 4, (byte)(blockState & 0b1111), false);
} }
private static final Class<?> entityTrackerEntry = Reflection.getClass("{nms}.EntityTrackerEntry");
private static final Reflection.MethodInvoker get = Reflection.getTypedMethod(intHashMap, "get", Object.class, int.class);
private static final Reflection.MethodInvoker updatePlayer = Reflection.getMethod(entityTrackerEntry, "updatePlayer", entityPlayer);
@Override
public void trackEntity(Player player, int entity) {
Object tracker = get.invoke(trackers, entity);
if(tracker != null)
updatePlayer.invoke(tracker, getPlayer.invoke(player));
}
private static final Reflection.MethodInvoker clearPlayer = Reflection.getMethod(entityTrackerEntry, "a", entityPlayer);
@Override
public void untrackEntity(Player player, int entity) {
Object tracker = get.invoke(trackers, entity);
if(tracker != null)
clearPlayer.invoke(tracker, getPlayer.invoke(player));
}
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public Material idToMaterial(int blockState) { public Material idToMaterial(int blockState) {

Datei anzeigen

@ -0,0 +1,55 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection;
import de.steamwar.fightsystem.Config;
import org.bukkit.Material;
import java.util.List;
public class HullHiderWrapper8 implements HullHiderWrapper {
private static final Reflection.ConstructorInvoker newMultiBlockChange = Reflection.getConstructor("{nms}.PacketPlayOutMultiBlockChange", int.class, short[].class, Reflection.getClass("{nms}.Chunk"));
private static final Reflection.MethodInvoker getHandle = Reflection.getMethod("{obc}.CraftChunk", "getHandle");
@Override
public Object generateBlockChangePacket(List<Hull.IntVector> changes) {
changes.removeIf(change -> {
Material material = Config.world.getBlockAt(change.getX(), change.getY(), change.getZ()).getType();
return material == Config.ObfuscateWith || Config.HiddenBlocks.contains(material);
});
if(changes.isEmpty())
return null;
Hull.IntVector chunk = changes.get(0);
chunk = new Hull.IntVector(chunk.getX() >> 4, chunk.getY() >> 4, chunk.getZ() >> 4);
int xOffset = 16*chunk.getX();
int zOffset = 16*chunk.getZ();
short[] pos = new short[changes.size()];
for(int i = 0; i < changes.size(); i++) {
Hull.IntVector change = changes.get(i);
pos[i] = (short) (((change.getX()-xOffset) << 12) + ((change.getZ()-zOffset) << 8) + change.getY());
}
return newMultiBlockChange.invoke(pos.length, pos, getHandle.invoke(Config.world.getChunkAt(chunk.getX(), chunk.getZ())));
}
}

Datei anzeigen

@ -21,10 +21,7 @@ package de.steamwar.fightsystem;
import de.steamwar.fightsystem.utils.Region; import de.steamwar.fightsystem.utils.Region;
import de.steamwar.fightsystem.winconditions.Winconditions; import de.steamwar.fightsystem.winconditions.Winconditions;
import de.steamwar.sql.Event; import de.steamwar.sql.*;
import de.steamwar.sql.EventFight;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.Team;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -122,11 +119,11 @@ public class Config {
public static final boolean TechhiderActive; public static final boolean TechhiderActive;
public static final Set<Material> HiddenBlocks; public static final Set<Material> HiddenBlocks;
public static final Set<String> HiddenBlockEntities; public static final Set<String> HiddenBlockEntities;
public static final String ObfuscateWith; public static final Material ObfuscateWith;
//event parameter //event parameter
private static final int EventKampfID;
public static final EventFight EventKampf; public static final EventFight EventKampf;
private static final Set<Integer> Referees;
public static final int EventTeamBlueID; public static final int EventTeamBlueID;
public static final int EventTeamRedID; public static final int EventTeamRedID;
public static final boolean BothTeamsPublic; public static final boolean BothTeamsPublic;
@ -141,10 +138,14 @@ public class Config {
//replay system parameter //replay system parameter
public static final String spectateIP = "127.0.0.1"; public static final String spectateIP = "127.0.0.1";
public static final int spectatePort = 2222; public static final int SpectatePort;
public static final int ReplayID; public static final int ReplayID;
static{ static{
CheckSchemID = Integer.parseInt(System.getProperty("checkSchemID", "0"));
PrepareSchemID = Integer.parseInt(System.getProperty("prepareSchemID", "0"));
ReplayID = Integer.parseInt(System.getProperty("replay", "0"));
String configFile = System.getProperty("config", "config.yml"); String configFile = System.getProperty("config", "config.yml");
if(!new File(FightSystem.getPlugin().getDataFolder(), configFile).exists()) { if(!new File(FightSystem.getPlugin().getDataFolder(), configFile).exists()) {
FightSystem.getPlugin().saveDefaultConfig(); FightSystem.getPlugin().saveDefaultConfig();
@ -213,7 +214,7 @@ public class Config {
ForbiddenItems = Collections.unmodifiableSet(config.getStringList("Kits.ForbiddenItems").stream().map(Material::valueOf).collect(Collectors.toSet())); ForbiddenItems = Collections.unmodifiableSet(config.getStringList("Kits.ForbiddenItems").stream().map(Material::valueOf).collect(Collectors.toSet()));
TechhiderActive = config.getBoolean("Techhider.Active", false); TechhiderActive = config.getBoolean("Techhider.Active", false);
ObfuscateWith = config.getString("Techhider.ObfuscateWith", "end_stone").toUpperCase(); ObfuscateWith = Material.getMaterial(config.getString("Techhider.ObfuscateWith", "end_stone").toUpperCase());
HiddenBlocks = config.getStringList("Techhider.HiddenBlocks").stream().map(String::toUpperCase).map(Material::getMaterial).collect(Collectors.toSet()); HiddenBlocks = config.getStringList("Techhider.HiddenBlocks").stream().map(String::toUpperCase).map(Material::getMaterial).collect(Collectors.toSet());
HiddenBlockEntities = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlockEntities"))); HiddenBlockEntities = Collections.unmodifiableSet(new HashSet<>(config.getStringList("Techhider.HiddenBlockEntities")));
@ -317,17 +318,17 @@ public class Config {
ArenaRegion = Region.withExtension(arenaMinX, blueCornerY, arenaMinZ, arenaMaxX - arenaMinX, schemsizeY, arenaMaxZ - arenaMinZ, 0, PreperationArea, 0); ArenaRegion = Region.withExtension(arenaMinX, blueCornerY, arenaMinZ, arenaMaxX - arenaMinX, schemsizeY, arenaMaxZ - arenaMinZ, 0, PreperationArea, 0);
PlayerRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX, world.getMaxHeight(), arenaMaxZ); PlayerRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX, world.getMaxHeight(), arenaMaxZ);
EventKampfID = Integer.parseInt(System.getProperty("fightID", "0")); int eventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
if(EventKampfID >= 1){ if(eventKampfID >= 1){
EventFight eventFight = EventFight.get(EventKampfID); EventKampf = EventFight.get(eventKampfID);
if(eventFight == null){ if(EventKampf == null){
Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight"); Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight");
Bukkit.shutdown(); Bukkit.shutdown();
} }
assert eventFight != null; assert EventKampf != null;
Team team1 = Team.get(eventFight.getTeamBlue()); Team team1 = Team.get(EventKampf.getTeamBlue());
Team team2 = Team.get(eventFight.getTeamRed()); Team team2 = Team.get(EventKampf.getTeamRed());
if(team1 == null || team2 == null){ if(team1 == null || team2 == null){
Bukkit.getLogger().log(Level.SEVERE, "Failed to load Team"); Bukkit.getLogger().log(Level.SEVERE, "Failed to load Team");
@ -343,9 +344,11 @@ public class Config {
EventTeamBlueID = team1.getTeamId(); EventTeamBlueID = team1.getTeamId();
EventTeamRedID = team2.getTeamId(); EventTeamRedID = team2.getTeamId();
BothTeamsPublic = EventTeamRedID == 0 && EventTeamBlueID == 0; BothTeamsPublic = EventTeamRedID == 0 && EventTeamBlueID == 0;
EventKampf = eventFight; SpectatePort = EventKampf.getSpectatePort();
LiveReplay = SpectatePort != 0;
Referees = Referee.get(Config.EventKampf.getEventID());
Event event = Event.get(eventFight.getEventID()); Event event = Event.get(EventKampf.getEventID());
if(BothTeamsPublic) { if(BothTeamsPublic) {
OnlyPublicSchematics = true; OnlyPublicSchematics = true;
MaximumTeamMembers = Integer.MAX_VALUE; MaximumTeamMembers = Integer.MAX_VALUE;
@ -353,7 +356,6 @@ public class Config {
OnlyPublicSchematics = event.publicSchemsOnly(); OnlyPublicSchematics = event.publicSchemsOnly();
MaximumTeamMembers = event.getMaximumTeamMembers(); MaximumTeamMembers = event.getMaximumTeamMembers();
} }
LiveReplay = event.spectateSystem();
}else{ }else{
//No event //No event
TeamRedColor = config.getString("Red.Prefix", "§c"); TeamRedColor = config.getString("Red.Prefix", "§c");
@ -365,8 +367,10 @@ public class Config {
EventTeamRedID = 0; EventTeamRedID = 0;
EventKampf = null; EventKampf = null;
BothTeamsPublic = true; BothTeamsPublic = true;
Referees = Collections.emptySet();
MaximumTeamMembers = Integer.MAX_VALUE; MaximumTeamMembers = Integer.MAX_VALUE;
LiveReplay = false; LiveReplay = false;
SpectatePort = -ReplayID;
} }
String blueLeader = System.getProperty("blueLeader", null); String blueLeader = System.getProperty("blueLeader", null);
@ -380,17 +384,13 @@ public class Config {
else else
RedLeader = null; RedLeader = null;
CheckSchemID = Integer.parseInt(System.getProperty("checkSchemID", "0"));
PrepareSchemID = Integer.parseInt(System.getProperty("prepareSchemID", "0"));
ReplayID = Integer.parseInt(System.getProperty("replay", "0"));
if(CheckSchemID != 0){ if(CheckSchemID != 0){
mode = ArenaMode.CHECK; mode = ArenaMode.CHECK;
}else if(PrepareSchemID != 0){ }else if(PrepareSchemID != 0){
mode = ArenaMode.PREPARE; mode = ArenaMode.PREPARE;
}else if(EventKampfID >= 1){ }else if(eventKampfID >= 1){
mode = ArenaMode.EVENT; mode = ArenaMode.EVENT;
}else if(EventKampfID == -1){ }else if(eventKampfID == -1){
mode = ArenaMode.TEST; mode = ArenaMode.TEST;
}else if(ReplayID != 0){ }else if(ReplayID != 0){
mode = ArenaMode.REPLAY; mode = ArenaMode.REPLAY;
@ -403,15 +403,13 @@ public class Config {
return ArenaMode.Test.contains(mode); return ArenaMode.Test.contains(mode);
} }
public static boolean replayserver(){ public static boolean replayserver(){
return ReplayID == -1; return ReplayID < 0;
} }
public static boolean blueNegZ(){ public static boolean blueNegZ(){
return BlueToRedZ > 0; return BlueToRedZ > 0;
} }
public static boolean isReferee(Player player) { public static boolean isReferee(Player player) {
if(EventKampf == null) return Referees.contains(SteamwarUser.get(player.getUniqueId()).getId());
return false;
return SteamwarUser.get(player.getUniqueId()).getId() == EventKampf.getKampfleiter();
} }
} }

Datei anzeigen

@ -83,8 +83,6 @@ public abstract class Countdown {
} }
for(Countdown countdown : new ArrayList<>(currentCountdowns)) { for(Countdown countdown : new ArrayList<>(currentCountdowns)) {
if(countdown.time - smallestTime <= 1)
countdown.prepareFinish();
countdown.time -= smallestTime; countdown.time -= smallestTime;
countdown.show(); countdown.show();
} }
@ -104,8 +102,6 @@ public abstract class Countdown {
Bukkit.getOnlinePlayers().forEach(p -> sendCountdownMessage(p, message, time / divisor, appendix)); Bukkit.getOnlinePlayers().forEach(p -> sendCountdownMessage(p, message, time / divisor, appendix));
} }
protected void prepareFinish() {}
public int getTimeLeft(){ public int getTimeLeft(){
return time; return time;
} }
@ -124,7 +120,6 @@ public abstract class Countdown {
broadcast("COUNTDOWN_SECONDS", 1); broadcast("COUNTDOWN_SECONDS", 1);
break; break;
case 1: case 1:
prepareFinish();
broadcast("COUNTDOWN_SECOND", 1); broadcast("COUNTDOWN_SECOND", 1);
break; break;
case 0: case 0:

Datei anzeigen

@ -22,8 +22,10 @@ package de.steamwar.fightsystem.countdown;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.events.BoardingEvent; import de.steamwar.fightsystem.events.BoardingEvent;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer; import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.utils.Message; import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.Region;
import de.steamwar.fightsystem.utils.SWSound; import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.techhider.ProtocolUtils; import de.steamwar.techhider.ProtocolUtils;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
@ -61,15 +63,10 @@ public class EnternCountdown extends Countdown {
FightSystem.getMessage().sendPrefixless("ENTERN_ALLOWED", fightPlayer.getEntity(), ChatMessageType.ACTION_BAR); FightSystem.getMessage().sendPrefixless("ENTERN_ALLOWED", fightPlayer.getEntity(), ChatMessageType.ACTION_BAR);
fightPlayer.ifPlayer(player -> { fightPlayer.ifPlayer(player -> {
FightSystem.getHullHider().updatePlayer(player); FightSystem.getHullHider().updatePlayer(player);
FightSystem.getTechHider().reloadChunks(player, chunkPos, false); FightSystem.getTechHider().reloadChunks(player, Fight.getOpposite(fightPlayer.getTeam()).getExtendRegion(), Region.EMPTY);
}); });
} }
@Override
protected void prepareFinish() {
chunkPos = FightSystem.getTechHider().prepareChunkReload(fightPlayer.getEntity(), false);
}
@Override @Override
protected void broadcast(String message, int divisor) { protected void broadcast(String message, int divisor) {
fightPlayer.ifPlayer(player -> { fightPlayer.ifPlayer(player -> {

Datei anzeigen

@ -153,6 +153,8 @@ public class FightSchematic extends StateDependent {
); );
FightSystem.getHullHider().initialize(team); FightSystem.getHullHider().initialize(team);
team.getPlayers().forEach(fightPlayer -> fightPlayer.ifAI(ai -> ai.schematic(clipboard))); team.getPlayers().forEach(fightPlayer -> fightPlayer.ifAI(ai -> ai.schematic(clipboard)));
if(ArenaMode.Check.contains(Config.mode) && !team.isBlue())
replaceSync(Material.TNT, Material.RED_WOOL);
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), freezer::disable, 3); Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), freezer::disable, 3);
} }

Datei anzeigen

@ -41,7 +41,6 @@ import de.steamwar.fightsystem.winconditions.Winconditions;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import de.steamwar.sql.SchematicNode; import de.steamwar.sql.SchematicNode;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import de.steamwar.techhider.ProtocolUtils;
import lombok.Getter; import lombok.Getter;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.*; import org.bukkit.*;
@ -204,13 +203,16 @@ public class FightTeam {
schematic.reset(); schematic.reset();
Set<UUID> playerSet = new HashSet<>(players.keySet()); Set<UUID> playerSet = new HashSet<>(players.keySet());
for(UUID uuid : playerSet){ playerSet.removeIf(uuid -> {
Player player = Bukkit.getPlayer(uuid); Player player = Bukkit.getPlayer(uuid);
if(player == null) if(player == null) {
removePlayer(players.get(uuid).getEntity()); removePlayer(players.get(uuid).getEntity());
} return true;
}
return false;
});
FightPlayer leaderBackup = leader; FightPlayer leaderBackup = leader;
playerSet.removeIf(uuid -> Bukkit.getPlayer(uuid) == null);
players.clear(); players.clear();
leader = null; leader = null;
@ -262,7 +264,6 @@ public class FightTeam {
} }
public void addMember(LivingEntity entity, SteamwarUser user, boolean silent) { public void addMember(LivingEntity entity, SteamwarUser user, boolean silent) {
final List<ProtocolUtils.ChunkPos> chunksToReload = FightSystem.getTechHider().prepareChunkReload(entity, false);
FightPlayer fightPlayer = getFightPlayer(entity) != null ? getFightPlayer(entity) : new FightPlayer(entity, user, this); FightPlayer fightPlayer = getFightPlayer(entity) != null ? getFightPlayer(entity) : new FightPlayer(entity, user, this);
fightPlayer.revive(); fightPlayer.revive();
players.put(entity.getUniqueId(), fightPlayer); players.put(entity.getUniqueId(), fightPlayer);
@ -291,7 +292,7 @@ public class FightTeam {
if(FightState.Running.contains(FightState.getFightState())) if(FightState.Running.contains(FightState.getFightState()))
fightPlayer.startEnternCountdown(Wincondition.getTimeOverCountdown()); fightPlayer.startEnternCountdown(Wincondition.getTimeOverCountdown());
fightPlayer.ifPlayer(player -> FightSystem.getTechHider().reloadChunks(player, chunksToReload, false)); fightPlayer.ifPlayer(player -> FightSystem.getTechHider().reloadChunks(player, Config.ArenaRegion, fightPlayer.canEntern() ? Region.EMPTY : Fight.getOpposite(this).getExtendRegion()));
if(isLeaderless()) if(isLeaderless())
setLeader(fightPlayer, silent); setLeader(fightPlayer, silent);
@ -304,7 +305,6 @@ public class FightTeam {
Bukkit.getPluginManager().callEvent(new TeamLeaveEvent(fightPlayer)); Bukkit.getPluginManager().callEvent(new TeamLeaveEvent(fightPlayer));
fightPlayer.ifPlayer(PersonalKitCreator::closeIfInKitCreator); fightPlayer.ifPlayer(PersonalKitCreator::closeIfInKitCreator);
List<ProtocolUtils.ChunkPos> chunksToReload = FightSystem.getTechHider().prepareChunkReload(entity, true);
players.remove(entity.getUniqueId()); players.remove(entity.getUniqueId());
team.removeEntry(entity.getName()); team.removeEntry(entity.getName());
Permanent.getSpectatorTeam().addEntry(entity.getName()); Permanent.getSpectatorTeam().addEntry(entity.getName());
@ -322,7 +322,7 @@ public class FightTeam {
if(player.isOnline()){ if(player.isOnline()){
FightSystem.getHullHider().updatePlayer(player); FightSystem.getHullHider().updatePlayer(player);
FightSystem.getTechHider().reloadChunks(player, chunksToReload, true); FightSystem.getTechHider().reloadChunks(player, Config.ArenaRegion, Fight.getOpposite(this).getExtendRegion());
if(ArenaMode.VariableTeams.contains(Config.mode)) if(ArenaMode.VariableTeams.contains(Config.mode))
HotbarKit.SPECTATOR_KIT.loadToPlayer(player); HotbarKit.SPECTATOR_KIT.loadToPlayer(player);

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.fightsystem.fight;
import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.listener.Recording; import de.steamwar.fightsystem.listener.Recording;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent; import de.steamwar.fightsystem.states.StateDependent;
@ -55,7 +56,7 @@ public class FightWorld extends StateDependent {
@Override @Override
public void disable() { public void disable() {
resetWorld(); Bukkit.getScheduler().runTask(FightSystem.getPlugin(), FightWorld::resetWorld); //Delay to prevent raceconditions with techhider and hullhider
} }
public static void forceLoad(){ public static void forceLoad(){

Datei anzeigen

@ -39,13 +39,13 @@ import org.bukkit.event.player.PlayerQuitEvent;
public class ArenaBorder implements Listener { public class ArenaBorder implements Listener {
private final Border spectatorBorder = new Border(Config.PlayerRegion, true, 5, "NO_ARENA_LEAVING"); private final Border spectatorBorder = new Border(Config.PlayerRegion, true, 5, "NO_ARENA_LEAVING", "ArenaBorder.spectatorBorder");
private final Border playerBorder = new Border(Config.PlayerRegion.to2d(), true, 5, "NO_ARENA_LEAVING"); private final Border playerBorder = new Border(Config.PlayerRegion.to2d(), true, 5, "NO_ARENA_LEAVING", "ArenaBorder.playerBorder");
public ArenaBorder() { public ArenaBorder() {
new StateDependentListener(ArenaMode.All, FightState.All, this); new StateDependentListener(ArenaMode.All, FightState.All, this);
new StateDependentTask(ArenaMode.All, FightState.Running, this::damage, 2, 2); new StateDependentTask(ArenaMode.All, FightState.Running, this::damage, 2, 2);
new StateDependentListener(!Config.GroundWalkable, FightState.AntiIngame, new Listener() { new StateDependentListener(!Config.GroundWalkable, FightState.AntiRunning, new Listener() {
@EventHandler @EventHandler
public void onMove(PlayerMoveEvent e) { public void onMove(PlayerMoveEvent e) {
Player player = e.getPlayer(); Player player = e.getPlayer();

Datei anzeigen

@ -27,29 +27,30 @@ import de.steamwar.fightsystem.states.StateDependentTask;
import de.steamwar.fightsystem.utils.FlatteningWrapper; import de.steamwar.fightsystem.utils.FlatteningWrapper;
import de.steamwar.fightsystem.utils.Region; import de.steamwar.fightsystem.utils.Region;
import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.HashMap; import java.util.*;
import java.util.HashSet; import java.util.logging.Level;
import java.util.Map;
import java.util.Set;
public class Border { public class Border {
private final Map<Player, Set<Block>> ghostBarriers = new HashMap<>(); private final Map<UUID, Set<Block>> ghostBarriers = new HashMap<>();
private final Map<Player, Location> lastLocation = new HashMap<>(); private final Map<UUID, Location> lastLocation = new HashMap<>();
private final boolean contain; private final boolean contain;
private final String resetMessage; private final String resetMessage;
private final String name;
private final Region region; private final Region region;
private final int ghostRange; private final int ghostRange;
private final int ghostSize; private final int ghostSize;
public Border(Region region, boolean contain, int ghostRange, String resetMessage) { public Border(Region region, boolean contain, int ghostRange, String resetMessage, String name) {
this.contain = contain; this.contain = contain;
this.resetMessage = resetMessage; this.resetMessage = resetMessage;
this.name = name;
this.region = region; this.region = region;
this.ghostRange = ghostRange; this.ghostRange = ghostRange;
this.ghostSize = 2*ghostRange + 1; this.ghostSize = 2*ghostRange + 1;
@ -58,20 +59,22 @@ public class Border {
} }
public void addPlayer(Player player) { public void addPlayer(Player player) {
if(ghostBarriers.containsKey(player)) if(ghostBarriers.containsKey(player.getUniqueId()))
return; return;
ghostBarriers.put(player, new HashSet<>()); ghostBarriers.put(player.getUniqueId(), new HashSet<>());
lastLocation.put(player, player.getLocation()); lastLocation.put(player.getUniqueId(), player.getLocation());
FightSystem.getPlugin().getLogger().log(Level.INFO, () -> player.getName() + " was added to border " + name);
} }
public boolean contains(Player player) { public boolean contains(Player player) {
return ghostBarriers.containsKey(player); return ghostBarriers.containsKey(player.getUniqueId());
} }
public void removePlayer(Player player) { public void removePlayer(Player player) {
lastLocation.remove(player); FightSystem.getPlugin().getLogger().log(Level.INFO, () -> player.getName() + " was removed from border " + name);
Set<Block> blocks = ghostBarriers.remove(player); lastLocation.remove(player.getUniqueId());
Set<Block> blocks = ghostBarriers.remove(player.getUniqueId());
if(blocks == null || !player.isOnline()) if(blocks == null || !player.isOnline())
return; return;
@ -80,11 +83,18 @@ public class Border {
} }
private void run() { private void run() {
for(Map.Entry<Player, Set<Block>> entry : ghostBarriers.entrySet()) { List<UUID> offline = new ArrayList<>();
Player player = entry.getKey(); for(Map.Entry<UUID, Set<Block>> entry : ghostBarriers.entrySet()) {
UUID uuid = entry.getKey();
Player player = Bukkit.getPlayer(uuid);
if(player == null) {
offline.add(uuid);
continue;
}
Location location = player.getLocation(); Location location = player.getLocation();
if(region.playerInRegion(location) != contain) { if(region.playerInRegion(location) != contain) {
player.teleport(lastLocation.get(player)); player.teleport(lastLocation.get(uuid));
FightSystem.getMessage().sendPrefixless(resetMessage, player, ChatMessageType.ACTION_BAR); FightSystem.getMessage().sendPrefixless(resetMessage, player, ChatMessageType.ACTION_BAR);
return; return;
} }
@ -117,6 +127,10 @@ public class Border {
lastLocation.put(entry.getKey(), location); lastLocation.put(entry.getKey(), location);
} }
offline.forEach(uuid -> FightSystem.getPlugin().getLogger().log(Level.INFO, () -> uuid + " was removed from border " + name));
offline.forEach(ghostBarriers::remove);
offline.forEach(lastLocation::remove);
} }
private void borderIteration(Player player, Set<Block> ghostBlocks, Region border) { private void borderIteration(Player player, Set<Block> ghostBlocks, Region border) {

Datei anzeigen

@ -52,8 +52,8 @@ public class TeamArea implements Listener {
public TeamArea(FightTeam team) { public TeamArea(FightTeam team) {
this.team = team; this.team = team;
this.spectatorBorder = new Border(team.getExtendRegion(), false, 5, "NO_TEAMAREA"); this.spectatorBorder = new Border(team.getExtendRegion(), false, 5, "NO_TEAMAREA", team.getName() + ".spectatorBorder");
this.bordingBorder = new Border(team.getExtendRegion().to2d(), true, 1, "NO_ENTERN"); this.bordingBorder = new Border(team.getExtendRegion().to2d(), true, 1, "NO_ENTERN", team.getName() + ".boardingBorder");
new StateDependentListener(ArenaMode.AntiTest, FightState.All, this); new StateDependentListener(ArenaMode.AntiTest, FightState.All, this);
new StateDependentTask(ArenaMode.AntiTest, FightState.TeamFix, this::realSpectatorCheck, 1, 1); new StateDependentTask(ArenaMode.AntiTest, FightState.TeamFix, this::realSpectatorCheck, 1, 1);

Datei anzeigen

@ -73,8 +73,13 @@ public class WaterRemover implements Listener {
FightTeam spawn = tnt.remove(event.getEntity().getEntityId()); FightTeam spawn = tnt.remove(event.getEntity().getEntityId());
if(spawn != null && !spawn.getExtendRegion().inRegion(event.getLocation())) { if(spawn != null && !spawn.getExtendRegion().inRegion(event.getLocation())) {
Block b = event.getLocation().getBlock(); Block b = event.getLocation().getBlock();
checkBlock(b); for(int y = -1; y <= 1; y++) {
checkNeighbours(b); for(int z = -1; z <= 1; z++) {
for(int x = -1; x <= 1; x++) {
checkBlock(b.getRelative(x, y, z));
}
}
}
} }
event.blockList().forEach(this::checkNeighbours); event.blockList().forEach(this::checkNeighbours);
@ -90,7 +95,7 @@ public class WaterRemover implements Listener {
} }
private void checkBlock(Block b) { private void checkBlock(Block b) {
//do not remove outside teamareasevent.getLocation().getBlock() //do not remove outside teamareas
if(!Config.BlueExtendRegion.inRegion(b) && !Config.RedExtendRegion.inRegion(b)) if(!Config.BlueExtendRegion.inRegion(b) && !Config.RedExtendRegion.inRegion(b))
return; return;

Datei anzeigen

@ -41,7 +41,7 @@ public class LiveRecorder extends StateDependent implements Recorder {
@Override @Override
public void enable() { public void enable() {
try { try {
socket = new Socket(Config.spectateIP, Config.spectatePort); socket = new Socket(Config.spectateIP, Config.SpectatePort);
socket.setSoTimeout(1); // Wait a maximum of 1ms on a blocking operation (flush) socket.setSoTimeout(1); // Wait a maximum of 1ms on a blocking operation (flush)
socket.setSoLinger(true, 1); // Wait a maximum of 1ms on disable socket.setSoLinger(true, 1); // Wait a maximum of 1ms on disable
socket.setTcpNoDelay(true); // Don't wait on ack socket.setTcpNoDelay(true); // Don't wait on ack

Datei anzeigen

@ -33,7 +33,7 @@ public class LiveServer {
private final ServerSocket socket; private final ServerSocket socket;
public LiveServer() throws IOException { public LiveServer() throws IOException {
socket = new ServerSocket(Config.spectatePort); socket = new ServerSocket(Config.SpectatePort);
Bukkit.getScheduler().runTaskAsynchronously(FightSystem.getPlugin(), this::acceptConnections); Bukkit.getScheduler().runTaskAsynchronously(FightSystem.getPlugin(), this::acceptConnections);
} }

Datei anzeigen

@ -89,7 +89,7 @@ public class PacketProcessor implements Listener {
private final BukkitTask task; private final BukkitTask task;
private final LinkedList<Runnable> syncList = new LinkedList<>(); private final LinkedList<Runnable> syncList = new LinkedList<>();
private final Set<Integer> hiddenBlockIds = Config.HiddenBlocks.stream().flatMap(m -> BlockIds.impl.materialToAllIds(m).stream()).collect(Collectors.toSet()); private final Set<Integer> hiddenBlockIds = Config.HiddenBlocks.stream().flatMap(m -> BlockIds.impl.materialToAllIds(m).stream()).collect(Collectors.toSet());
private final int obfuscateWith = BlockIds.impl.materialToId(Material.getMaterial(Config.ObfuscateWith.toUpperCase())); private final int obfuscateWith = BlockIds.impl.materialToId(Config.ObfuscateWith);
private final FreezeWorld freezer = new FreezeWorld(); private final FreezeWorld freezer = new FreezeWorld();
private final REntityServer entityServer = new REntityServer(); private final REntityServer entityServer = new REntityServer();
private final Map<Integer, REntity> entities = new HashMap<>(); private final Map<Integer, REntity> entities = new HashMap<>();

Datei anzeigen

@ -19,16 +19,28 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection;
import de.steamwar.core.VersionDependent; import de.steamwar.core.VersionDependent;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player;
public interface BlockIdWrapper { public interface BlockIdWrapper {
Class<?> worldServer = Reflection.getClass("{nms.server.level}.WorldServer");
Reflection.MethodInvoker getWorldHandle = Reflection.getTypedMethod(Reflection.getClass("{obc}.CraftWorld"), "getHandle", worldServer);
Class<?> craftPlayer = Reflection.getClass("{obc}.entity.CraftPlayer");
Class<?> entityPlayer = Reflection.getClass("{nms.server.level}.EntityPlayer");
Reflection.MethodInvoker getPlayer = Reflection.getTypedMethod(craftPlayer, "getHandle", entityPlayer);
BlockIdWrapper impl = VersionDependent.getVersionImpl(FightSystem.getPlugin()); BlockIdWrapper impl = VersionDependent.getVersionImpl(FightSystem.getPlugin());
Material idToMaterial(int blockState); Material idToMaterial(int blockState);
int blockToId(Block block); int blockToId(Block block);
void setBlock(World world, int x, int y, int z, int blockState); void setBlock(World world, int x, int y, int z, int blockState);
void trackEntity(Player player, int entity);
void untrackEntity(Player player, int entity);
} }

Datei anzeigen

@ -19,10 +19,13 @@
package de.steamwar.fightsystem.utils; package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.TinyProtocol;
import de.steamwar.entity.REntity; import de.steamwar.entity.REntity;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -45,8 +48,9 @@ public class Hull {
private final BitSet occluding; private final BitSet occluding;
private final BitSet visibility; private final BitSet visibility;
private final Map<IntVector, Map<IntVector, BitSet>> blockVisibility = new HashMap<>(); private final Map<IntVector, Map<IntVector, BitSet>> blockVisibility = new HashMap<>();
private final Set<IntVector> uncoveredSurface = new HashSet<>();
private final Set<Player> players = new HashSet<>(); private final HashSet<Player> players = new HashSet<>();
private final Set<Entity> entities = new HashSet<>(); private final Set<Entity> entities = new HashSet<>();
private final Set<REntity> rentities = new HashSet<>(); private final Set<REntity> rentities = new HashSet<>();
@ -90,23 +94,30 @@ 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()));
}
public boolean isLocationHidden(Player player, Location location) { public boolean isLocationHidden(Player player, Location location) {
return players.contains(player) && region.inRegion(location) && !visibility.get(new IntVector(location).toId(region)); return players.contains(player) && region.inRegion(location) && !visibility.get(new IntVector(location).toId(region));
} }
@SuppressWarnings("deprecation")
public void addPlayer(Player player) { public void addPlayer(Player player) {
if(players.add(player)) { if(players.add(player)) {
for(Entity entity : entities) for(Entity entity : entities)
player.hideEntity(FightSystem.getPlugin(), entity); BlockIdWrapper.impl.untrackEntity(player, entity.getEntityId());
} }
} }
@SuppressWarnings("deprecation")
public void removePlayer(Player player, boolean activeRemoval) { public void removePlayer(Player player, boolean activeRemoval) {
if(players.remove(player) && activeRemoval) { if(players.remove(player) && activeRemoval) {
for(Entity entity : entities) for(Entity entity : entities)
player.showEntity(FightSystem.getPlugin(), entity); BlockIdWrapper.impl.trackEntity(player, entity.getEntityId());
// techhider triggers block change sending
} }
} }
@ -115,12 +126,12 @@ public class Hull {
if(region.inRegion(location) && !visibility.get(new IntVector(location).toId(region))) { //TODO more precise if(region.inRegion(location) && !visibility.get(new IntVector(location).toId(region))) { //TODO more precise
if(entities.add(entity)) { if(entities.add(entity)) {
for(Player player : players) for(Player player : players)
player.hideEntity(FightSystem.getPlugin(), entity); BlockIdWrapper.impl.untrackEntity(player, entity.getEntityId());
} }
} else { } else {
if(entities.remove(entity)) { if(entities.remove(entity)) {
for(Player player : players) for(Player player : players)
player.showEntity(FightSystem.getPlugin(), entity); BlockIdWrapper.impl.trackEntity(player, entity.getEntityId());
} }
} }
} }
@ -147,6 +158,7 @@ public class Hull {
public void initialize() { public void initialize() {
visibility.clear(); visibility.clear();
occluding.clear(); occluding.clear();
uncoveredSurface.clear();
for (Map<IntVector, BitSet> direction : blockVisibility.values()) { for (Map<IntVector, BitSet> direction : blockVisibility.values()) {
for (BitSet set : direction.values()) for (BitSet set : direction.values())
set.clear(); set.clear();
@ -166,7 +178,6 @@ public class Hull {
FightSystem.getPlugin().getLogger().log(Level.INFO, () -> "[HullHider] initialisation finished: " + (System.currentTimeMillis() - start) + " ms, visible blocks: " + visibility.cardinality()); FightSystem.getPlugin().getLogger().log(Level.INFO, () -> "[HullHider] initialisation finished: " + (System.currentTimeMillis() - start) + " ms, visible blocks: " + visibility.cardinality());
} }
@SuppressWarnings("deprecation")
public void updateBlockVisibility(Block b, Material changedType) { public void updateBlockVisibility(Block b, Material changedType) {
IntVector root = new IntVector(b.getX(), b.getY(), b.getZ()); IntVector root = new IntVector(b.getX(), b.getY(), b.getZ());
if (root.notInRegion(region)) if (root.notInRegion(region))
@ -197,7 +208,7 @@ public class Hull {
if(uncoveredSet.contains(new IntVector(entity.getLocation()))) { //TODO more precise if(uncoveredSet.contains(new IntVector(entity.getLocation()))) { //TODO more precise
it.remove(); it.remove();
for(Player player : players) for(Player player : players)
player.showEntity(FightSystem.getPlugin(), entity); BlockIdWrapper.impl.trackEntity(player, entity.getEntityId());
} }
} }
@ -209,6 +220,26 @@ public class Hull {
entity.hide(false); entity.hide(false);
} }
} }
uncoveredSurface.addAll(uncoveredSet);
uncoveredSurface.remove(root);
}
public void sendUncoveredBlocks() {
Map<IntVector, List<IntVector>> sectionWise = new HashMap<>();
for(IntVector uncovered : uncoveredSurface) {
sectionWise.computeIfAbsent(new IntVector(uncovered.x >> 4, uncovered.y >> 4, uncovered.z >> 4), section -> new ArrayList<>()).add(uncovered);
}
uncoveredSurface.clear();
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));
}
} }
private void forEachBorder(BiConsumer<IntVector, IntVector> f) { private void forEachBorder(BiConsumer<IntVector, IntVector> f) {
@ -280,17 +311,13 @@ public class Hull {
} }
private static class IntVector { @Getter
@AllArgsConstructor
public static class IntVector {
private final int x; private final int x;
private final int y; private final int y;
private final int z; private final int z;
public IntVector(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public IntVector(Location location) { public IntVector(Location location) {
this.x = location.getBlockX(); this.x = location.getBlockX();
this.y = location.getBlockY(); this.y = location.getBlockY();

Datei anzeigen

@ -56,13 +56,18 @@ import java.util.function.Function;
public class HullHider implements Listener { public class HullHider implements Listener {
private static final boolean ENABLED = TechHiderWrapper.ENABLED && Core.getVersion() >= 18; private final Map<FightTeam, Hull> hullMap = new HashMap<>();
private final Map<FightTeam, Hull> hulls = new HashMap<>(); private final Hull[] hulls;
private final Map<Class<?>, BiFunction<Player, Object, Object>> packetHiders = new HashMap<>(); private final Map<Class<?>, BiFunction<Player, Object, Object>> packetHiders = new HashMap<>();
public HullHider() { public HullHider() {
if(ENABLED) if(!TechHiderWrapper.ENABLED) {
Fight.teams().forEach(team -> hulls.put(team, new Hull(team))); hulls = new Hull[0];
return;
}
Fight.teams().forEach(team -> hullMap.put(team, new Hull(team)));
hulls = hullMap.values().toArray(new Hull[0]);
packetHiders.put(packetPlayOutWorldEvent, this::worldEventHider); packetHiders.put(packetPlayOutWorldEvent, this::worldEventHider);
packetHiders.put(packetPlayOutExplosion, this::explosionHider); packetHiders.put(packetPlayOutExplosion, this::explosionHider);
@ -71,8 +76,8 @@ public class HullHider implements Listener {
if(Core.getVersion() >= 9 && Core.getVersion() < 18) if(Core.getVersion() >= 9 && Core.getVersion() < 18)
posHiderGenerator("{nms.network.protocol.game}.PacketPlayOutCustomSoundEffect", int.class, 8.0); posHiderGenerator("{nms.network.protocol.game}.PacketPlayOutCustomSoundEffect", int.class, 8.0);
new StateDependentListener(ENABLED, FightState.Schem, this); new StateDependentListener(TechHiderWrapper.ENABLED, FightState.Schem, this);
new StateDependent(ENABLED, FightState.Schem) { new StateDependent(TechHiderWrapper.ENABLED, FightState.Schem) {
@Override @Override
public void enable() { public void enable() {
packetHiders.forEach(TinyProtocol.instance::addFilter); packetHiders.forEach(TinyProtocol.instance::addFilter);
@ -85,14 +90,14 @@ public class HullHider implements Listener {
packetHiders.forEach(TinyProtocol.instance::removeFilter); packetHiders.forEach(TinyProtocol.instance::removeFilter);
} }
}.register(); }.register();
new StateDependentTask(ENABLED, FightState.Schem, this::onTick, 0, 1); new StateDependentTask(TechHiderWrapper.ENABLED, FightState.Schem, this::onTick, 0, 1);
} }
public void initialize(FightTeam team) { public void initialize(FightTeam team) {
if(!ENABLED) if(!TechHiderWrapper.ENABLED)
return; return;
hulls.get(team).initialize(); hullMap.get(team).initialize();
} }
@ -107,13 +112,13 @@ public class HullHider implements Listener {
} }
public void updatePlayer(Player player) { public void updatePlayer(Player player) {
if(!ENABLED) if(!TechHiderWrapper.ENABLED)
return; return;
FightTeam team = Fight.getPlayerTeam(player); FightTeam team = Fight.getPlayerTeam(player);
FightPlayer fp = Fight.getFightPlayer(player); FightPlayer fp = Fight.getFightPlayer(player);
for(Map.Entry<FightTeam, Hull> hull : hulls.entrySet()) { for(Map.Entry<FightTeam, Hull> hull : hullMap.entrySet()) {
if(hull.getKey() == team || (fp != null && fp.canEntern())) { if(Config.isReferee(player) || hull.getKey() == team || (fp != null && fp.canEntern())) {
hull.getValue().removePlayer(player, true); hull.getValue().removePlayer(player, true);
} else { } else {
hull.getValue().addPlayer(player); hull.getValue().addPlayer(player);
@ -122,7 +127,8 @@ public class HullHider implements Listener {
} }
private void removePlayer(Player player, boolean activeRemoval) { private void removePlayer(Player player, boolean activeRemoval) {
hulls.values().forEach(hull -> hull.removePlayer(player, activeRemoval)); for (Hull hull : hulls)
hull.removePlayer(player, activeRemoval);
} }
@ -133,34 +139,62 @@ public class HullHider implements Listener {
} }
public void blockUpdate(Block block, Material changedType) { public void blockUpdate(Block block, Material changedType) {
for (Hull hull : hulls.values()) for (Hull hull : hulls)
hull.updateBlockVisibility(block, changedType); hull.updateBlockVisibility(block, changedType);
} }
public boolean isBlockHidden(Player player, int x, int y, int z) {
if(!TechHiderWrapper.ENABLED)
return false;
for (Hull hull : hulls)
if(hull.isBlockHidden(player, x, y, z))
return true;
return false;
}
public boolean blockPrecise(Player player, int chunkX, int chunkY, int chunkZ) {
if(!TechHiderWrapper.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) {
hulls.values().forEach(hull -> hull.checkEntity(e.getEntity())); for (Hull hull : hulls)
hull.checkEntity(e.getEntity());
} }
private void onTick() { private void onTick() {
Recording.iterateOverEntities(Objects::nonNull, entity -> { Recording.iterateOverEntities(Objects::nonNull, entity -> {
for (Hull hull : hulls.values()) for (Hull hull : hulls)
hull.checkEntity(entity); hull.checkEntity(entity);
}); });
for (Hull hull : hulls)
hull.sendUncoveredBlocks();
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onDeath(EntityDeathEvent e) { public void onDeath(EntityDeathEvent e) {
hulls.values().forEach(hull -> hull.removeEntity(e.getEntity())); for(Hull hull : hulls)
hull.removeEntity(e.getEntity());
} }
public void updateREntity(REntity e) { public void updateREntity(REntity e) {
hulls.values().forEach(hull -> hull.checkREntity(e)); for(Hull hull : hulls)
hull.checkREntity(e);
} }
public void despawnREntity(REntity e) { public void despawnREntity(REntity e) {
hulls.values().forEach(hull -> hull.removeREntity(e)); for(Hull hull : hulls)
hull.removeREntity(e);
} }
@ -197,7 +231,7 @@ public class HullHider implements Listener {
} }
private Object packetHider(Player player, Object packet, Location location) { private Object packetHider(Player player, Object packet, Location location) {
for(Hull hull : hulls.values()) { for(Hull hull : hulls) {
if(hull.isLocationHidden(player, location)) if(hull.isLocationHidden(player, location))
return null; return null;
} }

Datei anzeigen

@ -0,0 +1,31 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2024 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.fightsystem.utils;
import de.steamwar.core.VersionDependent;
import de.steamwar.fightsystem.FightSystem;
import java.util.List;
public interface HullHiderWrapper {
HullHiderWrapper impl = VersionDependent.getVersionImpl(FightSystem.getPlugin());
Object generateBlockChangePacket(List<Hull.IntVector> changes);
}

Datei anzeigen

@ -31,6 +31,8 @@ import java.util.function.ObjIntConsumer;
@AllArgsConstructor @AllArgsConstructor
public class Region { public class Region {
public static final Region EMPTY = Region.fromSize(-10000, -10000, -10000, 0, 0, 0);
public static Region withExtension(int minX, int minY, int minZ, int sizeX, int sizeY, int sizeZ, int extendX, int extendY, int extendZ) { public static Region withExtension(int minX, int minY, int minZ, int sizeX, int sizeY, int sizeZ, int extendX, int extendY, int extendZ) {
return Region.fromSize(minX - extendX, minY - extendY, minZ - extendZ, return Region.fromSize(minX - extendX, minY - extendY, minZ - extendZ,
sizeX + extendX * 2, sizeY + extendY * 2, sizeZ + extendZ * 2); sizeX + extendX * 2, sizeY + extendY * 2, sizeZ + extendZ * 2);
@ -80,6 +82,12 @@ public class Region {
getMinChunkZ() > cZ || cZ > getMaxChunkZ(); getMinChunkZ() > cZ || cZ > getMaxChunkZ();
} }
public boolean chunkSectionOutside(int cX, int cY, int cZ) {
return getMinChunkX() > cX || cX > getMaxChunkX() ||
ProtocolUtils.posToChunk(minY) > cY || cY > ProtocolUtils.posToChunk(maxY) ||
getMinChunkZ() > cZ || cZ > getMaxChunkZ();
}
public void forEachChunk(ObjIntConsumer<Integer> executor) { public void forEachChunk(ObjIntConsumer<Integer> executor) {
for(int x = getMinChunkX(); x <= getMaxChunkX(); x++) for(int x = getMinChunkX(); x <= getMaxChunkX(); x++)
for(int z = getMinChunkZ(); z <= getMaxChunkZ(); z++) for(int z = getMinChunkZ(); z <= getMaxChunkZ(); z++)
@ -117,7 +125,7 @@ public class Region {
} }
public boolean playerInRegion(Location location){ public boolean playerInRegion(Location location){
return in2dRegion(location) && minY <= location.getY() && location.getY() + 1.8 < maxY; return in2dRegion(location) && minY <= location.getY() && location.getY() < maxY;
} }
public boolean in2dRegion(Block block){ public boolean in2dRegion(Block block){

Datei anzeigen

@ -22,29 +22,34 @@ package de.steamwar.fightsystem.utils;
import de.steamwar.core.CraftbukkitWrapper; import de.steamwar.core.CraftbukkitWrapper;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.events.BoardingEvent;
import de.steamwar.fightsystem.events.TeamLeaveEvent;
import de.steamwar.fightsystem.events.TeamSpawnEvent;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent; import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.techhider.ProtocolUtils; import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.techhider.TechHider; import de.steamwar.techhider.TechHider;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.ArrayList; import java.util.concurrent.ConcurrentHashMap;
import java.util.Collections;
import java.util.List;
public class TechHiderWrapper extends StateDependent { public class TechHiderWrapper extends StateDependent implements TechHider.LocationEvaluator, Listener {
public static final boolean ENABLED = !Config.OnlyPublicSchematics && !Config.test() && Config.TechhiderActive; public static final boolean ENABLED = !Config.OnlyPublicSchematics && !Config.test() && Config.TechhiderActive;
private final ConcurrentHashMap<Player, Region> hiddenRegion = new ConcurrentHashMap<>();
private final TechHider techHider; private final TechHider techHider;
public TechHiderWrapper() { public TechHiderWrapper() {
super(ENABLED, FightState.Schem); super(ENABLED, FightState.Schem);
techHider = new TechHider(this::bypass, 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(); register();
} }
@ -56,43 +61,82 @@ public class TechHiderWrapper extends StateDependent {
@Override @Override
public void disable() { public void disable() {
techHider.disable(); techHider.disable();
hiddenRegion.clear();
} }
public List<ProtocolUtils.ChunkPos> prepareChunkReload(LivingEntity p, boolean hide) { @EventHandler
if(!ENABLED || !(p instanceof Player)) public void teamJoin(TeamSpawnEvent e) {
return Collections.emptyList(); e.getFightPlayer().ifPlayer(player -> hiddenRegion.put(player, getHiddenRegion(player)));
}
List<ProtocolUtils.ChunkPos> chunksToReload = new ArrayList<>(); @EventHandler
Config.ArenaRegion.forEachChunk((x, z) -> { public void boarding(BoardingEvent e) {
if(bypass((Player) p, x, z) == hide) e.getFightPlayer().ifPlayer(player -> hiddenRegion.put(player, getHiddenRegion(player)));
chunksToReload.add(new ProtocolUtils.ChunkPos(x, z)); }
@EventHandler
public void teamLeave(TeamLeaveEvent e) {
e.getFightPlayer().ifPlayer(player -> {
if(player.isOnline())
hiddenRegion.put(player, getHiddenRegion(player));
}); });
return chunksToReload;
} }
public void reloadChunks(Player p, List<ProtocolUtils.ChunkPos> chunksToReload, boolean hide) { @EventHandler
if(!ENABLED || !FightState.Schem.contains(FightState.getFightState())) public void playerQuit(PlayerQuitEvent e) {
Player player = e.getPlayer();
hiddenRegion.remove(player);
}
public void reloadChunks(Player player, Region region, Region exclusion) {
if(!ENABLED || !FightState.Schem.contains(FightState.getFightState()) || !player.isOnline())
return; return;
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> { region.forEachChunk((chunkX, chunkZ) -> {
for(ProtocolUtils.ChunkPos chunk : chunksToReload){ if(exclusion.chunkOutside(chunkX, chunkZ))
if(bypass(p, chunk.x(), chunk.z()) != hide) CraftbukkitWrapper.impl.sendChunk(player, chunkX, chunkZ);
CraftbukkitWrapper.impl.sendChunk(p, chunk.x(), chunk.z()); });
}
}, 40);
} }
private boolean bypass(Player p, int chunkX, int chunkZ){ @Override
if(Config.isReferee(p)) public boolean skipChunk(Player player, int chunkX, int chunkZ) {
return true; return getHiddenRegion(player).chunkOutside(chunkX, chunkZ);
}
FightTeam ft = Fight.getPlayerTeam(p); @Override
if(ft == null){ public boolean skipChunkSection(Player player, int chunkX, int chunkY, int chunkZ) {
return Config.ArenaRegion.chunkOutside(chunkX, chunkZ); return getHiddenRegion(player).chunkSectionOutside(chunkX, chunkY, chunkZ);
}else if(ft.isBlue()){ }
return ft.canPlayerEntern(p) || Config.RedExtendRegion.chunkOutside(chunkX, chunkZ);
}else{ @Override
return ft.canPlayerEntern(p) || Config.BlueExtendRegion.chunkOutside(chunkX, chunkZ); public TechHider.State check(Player player, int x, int y, int z) {
if(hiddenRegion.computeIfAbsent(player, this::getHiddenRegion).inRegion(x, y, z)) {
if(FightSystem.getHullHider().isBlockHidden(player, x, y, z)) {
return TechHider.State.HIDE;
} else {
return TechHider.State.CHECK;
}
} else {
return TechHider.State.SKIP;
} }
} }
@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;
FightTeam team = Fight.getPlayerTeam(player);
if(team == null)
return Config.ArenaRegion;
if(team.canPlayerEntern(player))
return Region.EMPTY;
return Fight.getOpposite(team).getExtendRegion();
}
} }