The big refactoring #238
@ -22,8 +22,13 @@ package de.steamwar.fightsystem.fight;
|
|||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||||
|
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||||
import com.sk89q.worldedit.function.operation.Operations;
|
import com.sk89q.worldedit.function.operation.Operations;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
@ -39,14 +44,17 @@ import de.steamwar.sql.Schematic;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.scoreboard.Team;
|
import org.bukkit.scoreboard.Team;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
class FightTeam_14 {
|
public class FightTeam_14 {
|
||||||
private FightTeam_14(){}
|
private FightTeam_14(){}
|
||||||
|
|
||||||
private static final Set<BaseBlock> WOOL_SET = Collections.singleton(Objects.requireNonNull(BlockTypes.PINK_WOOL).getDefaultState().toBaseBlock());
|
private static final Set<BaseBlock> WOOL_SET = Collections.singleton(Objects.requireNonNull(BlockTypes.PINK_WOOL).getDefaultState().toBaseBlock());
|
||||||
@ -78,8 +86,8 @@ class FightTeam_14 {
|
|||||||
e.flushSession();
|
e.flushSession();
|
||||||
}
|
}
|
||||||
|
|
||||||
static EditSession pasteSchematic(Clipboard clipboard, int pX, int pY, int pZ, boolean rotate) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
static EditSession pasteSchematic(Clipboard clipboard, Region region, boolean rotate) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
||||||
BlockVector3 paste = BlockVector3.at(pX, pY, pZ);
|
BlockVector3 paste = BlockVector3.at(region.centerX(), region.getMinY(), region.centerZ());
|
||||||
|
|
||||||
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||||
BlockVector3 dimensions = clipboard.getDimensions();
|
BlockVector3 dimensions = clipboard.getDimensions();
|
||||||
@ -93,7 +101,7 @@ class FightTeam_14 {
|
|||||||
v = paste.subtract(dimensions.getX()/2, 0, dimensions.getZ()/2).subtract(offset);
|
v = paste.subtract(dimensions.getX()/2, 0, dimensions.getZ()/2).subtract(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Config.AlignWater){
|
if(Config.WaterDepth != 0){
|
||||||
BlockVector3 it = clipboard.getMinimumPoint();
|
BlockVector3 it = clipboard.getMinimumPoint();
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
while(!clipboard.getBlock(it).getBlockType().getMaterial().isAir()){
|
while(!clipboard.getBlock(it).getBlockType().getMaterial().isAir()){
|
||||||
@ -110,4 +118,35 @@ class FightTeam_14 {
|
|||||||
e.flushSession();
|
e.flushSession();
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean checkPistonMoving(Block block){
|
||||||
|
return block.getType() == Material.MOVING_PISTON;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveSchem(Schematic schem, Region region) {
|
||||||
|
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||||
|
BlockVector3 min = BlockVector3.at(region.getMinX(), region.getMinY(), region.getMinZ());
|
||||||
|
CuboidRegion cuboidRegion = new CuboidRegion(w, min, BlockVector3.at(region.getMaxX(), region.getMaxY(), region.getMaxZ()));
|
||||||
|
BlockArrayClipboard clipboard = new BlockArrayClipboard(cuboidRegion);
|
||||||
|
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(w, -1);
|
||||||
|
|
||||||
|
ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(editSession, cuboidRegion, clipboard, min);
|
||||||
|
forwardExtentCopy.setCopyingEntities(false);
|
||||||
|
try{
|
||||||
|
Operations.complete(forwardExtentCopy);
|
||||||
|
}catch(WorldEditException e){
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
|
try {
|
||||||
|
ClipboardWriter writer = BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(outputStream);
|
||||||
|
writer.write(clipboard);
|
||||||
|
writer.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
schem.saveFromBytes(outputStream.toByteArray(), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,10 +30,7 @@ import de.steamwar.fightsystem.Config;
|
|||||||
import de.steamwar.fightsystem.IFightSystem;
|
import de.steamwar.fightsystem.IFightSystem;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.UnpooledByteBufAllocator;
|
import io.netty.buffer.UnpooledByteBufAllocator;
|
||||||
import net.minecraft.server.v1_14_R1.Block;
|
import net.minecraft.server.v1_14_R1.*;
|
||||||
import net.minecraft.server.v1_14_R1.IBlockData;
|
|
||||||
import net.minecraft.server.v1_14_R1.IRegistry;
|
|
||||||
import net.minecraft.server.v1_14_R1.MinecraftKey;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
@ -54,6 +51,16 @@ public class TechHider_14 {
|
|||||||
hiddenBlockIds.add(Block.getCombinedId(data));
|
hiddenBlockIds.add(Block.getCombinedId(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Config.HiddenBlocks.contains("water")){
|
||||||
|
Fluid water = FluidTypes.WATER.a(false);
|
||||||
|
for(IBlockData data : Block.REGISTRY_ID){
|
||||||
|
if(data.p() == water){
|
||||||
|
hiddenBlockIds.add(Block.getCombinedId(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return hiddenBlockIds;
|
return hiddenBlockIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,10 +20,7 @@
|
|||||||
package de.steamwar.fightsystem.utils;
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
import de.steamwar.fightsystem.Config;
|
import de.steamwar.fightsystem.Config;
|
||||||
import net.minecraft.server.v1_15_R1.Block;
|
import net.minecraft.server.v1_15_R1.*;
|
||||||
import net.minecraft.server.v1_15_R1.IBlockData;
|
|
||||||
import net.minecraft.server.v1_15_R1.IRegistry;
|
|
||||||
import net.minecraft.server.v1_15_R1.MinecraftKey;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -38,6 +35,16 @@ class TechHider_15 {
|
|||||||
hiddenBlockIds.add(Block.getCombinedId(data));
|
hiddenBlockIds.add(Block.getCombinedId(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Config.HiddenBlocks.contains("water")){
|
||||||
|
Fluid water = FluidTypes.WATER.a(false);
|
||||||
|
for(IBlockData data : Block.REGISTRY_ID){
|
||||||
|
if(data.getFluid() == water){
|
||||||
|
hiddenBlockIds.add(Block.getCombinedId(data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return hiddenBlockIds;
|
return hiddenBlockIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,13 +19,14 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.fight;
|
package de.steamwar.fightsystem.fight;
|
||||||
|
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
|
||||||
import com.sk89q.worldedit.Vector;
|
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
|
||||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat;
|
||||||
|
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||||
|
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||||
import com.sk89q.worldedit.function.operation.Operations;
|
import com.sk89q.worldedit.function.operation.Operations;
|
||||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||||
@ -39,13 +40,15 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.scoreboard.Team;
|
import org.bukkit.scoreboard.Team;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
class FightTeam_8 {
|
public class FightTeam_8 {
|
||||||
private FightTeam_8(){}
|
private FightTeam_8(){}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@ -87,10 +90,10 @@ class FightTeam_8 {
|
|||||||
e.flushQueue();
|
e.flushQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
static EditSession pasteSchematic(Clipboard clipboard, int pasteX, int pasteY, int pasteZ, boolean rotate) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
static EditSession pasteSchematic(Clipboard clipboard, Region paste, boolean rotate) throws Schematic.WrongVersionException, IOException, NoClipboardException {
|
||||||
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||||
Vector dimensions = clipboard.getDimensions();
|
Vector dimensions = clipboard.getDimensions();
|
||||||
Vector v = new Vector(pasteX, pasteY, pasteZ);
|
Vector v = new Vector(paste.centerX(), paste.getMinY(), paste.centerZ());
|
||||||
Vector offset = clipboard.getMinimumPoint().subtract(clipboard.getOrigin());
|
Vector offset = clipboard.getMinimumPoint().subtract(clipboard.getOrigin());
|
||||||
AffineTransform aT = new AffineTransform();
|
AffineTransform aT = new AffineTransform();
|
||||||
if(rotate){
|
if(rotate){
|
||||||
@ -100,7 +103,7 @@ class FightTeam_8 {
|
|||||||
v = v.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()/2 - dimensions.getZ()%2).subtract(offset);
|
v = v.subtract(dimensions.getX()/2 - dimensions.getX()%2, 0, dimensions.getZ()/2 - dimensions.getZ()%2).subtract(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Config.AlignWater){
|
if(Config.WaterDepth != 0){
|
||||||
Vector it = clipboard.getMinimumPoint();
|
Vector it = clipboard.getMinimumPoint();
|
||||||
int depth = 0;
|
int depth = 0;
|
||||||
while(!clipboard.getBlock(it).isAir()){
|
while(!clipboard.getBlock(it).isAir()){
|
||||||
@ -117,4 +120,35 @@ class FightTeam_8 {
|
|||||||
e.flushQueue();
|
e.flushQueue();
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean checkPistonMoving(Block block){
|
||||||
|
return block.getType() == Material.PISTON_MOVING_PIECE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveSchem(Schematic schem, Region region) {
|
||||||
|
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
|
||||||
|
Vector min = new Vector(region.getMinX(), region.getMinY(), region.getMinZ());
|
||||||
|
CuboidRegion cuboidRegion = new CuboidRegion(w, min, new Vector(region.getMaxX(), region.getMaxY(), region.getMaxZ()));
|
||||||
|
BlockArrayClipboard clipboard = new BlockArrayClipboard(cuboidRegion);
|
||||||
|
EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(w, -1);
|
||||||
|
|
||||||
|
ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(editSession, cuboidRegion, clipboard, min);
|
||||||
|
forwardExtentCopy.setCopyingEntities(false);
|
||||||
|
try{
|
||||||
|
Operations.complete(forwardExtentCopy);
|
||||||
|
}catch(WorldEditException e){
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
|
try {
|
||||||
|
ClipboardWriter writer = ClipboardFormat.SCHEMATIC.getWriter(outputStream);
|
||||||
|
writer.write(clipboard, w.getWorldData());
|
||||||
|
writer.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
schem.saveFromBytes(outputStream.toByteArray(), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,12 +61,11 @@ public class Config {
|
|||||||
public static final Location TeamRedSpawn;
|
public static final Location TeamRedSpawn;
|
||||||
public static final Location SpecSpawn;
|
public static final Location SpecSpawn;
|
||||||
|
|
||||||
private static final int TeamBluetoReddistanceX;
|
private static final int BlueToRedX;
|
||||||
private static final int TeamBluetoReddistanceY;
|
private static final int BlueToRedY;
|
||||||
public static final int TeamBluetoReddistanceZ;
|
public static final int BlueToRedZ;
|
||||||
|
|
||||||
public static final int BorderFromSchematic;
|
public static final int PreperationArea;
|
||||||
public static final boolean AlignWater;
|
|
||||||
public static final int WaterDepth;
|
public static final int WaterDepth;
|
||||||
public static final boolean GroundWalkable;
|
public static final boolean GroundWalkable;
|
||||||
|
|
||||||
@ -77,6 +76,7 @@ public class Config {
|
|||||||
public static final de.steamwar.sql.SchematicType SchematicType;
|
public static final de.steamwar.sql.SchematicType SchematicType;
|
||||||
public static final boolean RedRotate;
|
public static final boolean RedRotate;
|
||||||
public static final boolean BlueRotate;
|
public static final boolean BlueRotate;
|
||||||
|
public static final boolean PasteAligned;
|
||||||
public static final boolean ReplaceObsidianBedrock;
|
public static final boolean ReplaceObsidianBedrock;
|
||||||
public static final boolean ReplaceWithBlockupdates;
|
public static final boolean ReplaceWithBlockupdates;
|
||||||
|
|
||||||
@ -134,14 +134,14 @@ public class Config {
|
|||||||
if(!new File(IFightSystem.getPlugin().getDataFolder(), System.getProperty("config", "config.yml")).exists()) {
|
if(!new File(IFightSystem.getPlugin().getDataFolder(), System.getProperty("config", "config.yml")).exists()) {
|
||||||
IFightSystem.getPlugin().saveDefaultConfig();
|
IFightSystem.getPlugin().saveDefaultConfig();
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Arenaconfig fehlt!");
|
Bukkit.getLogger().log(Level.SEVERE, "Arenaconfig fehlt!");
|
||||||
IFightSystem.shutdown(null);
|
Bukkit.shutdown();
|
||||||
}
|
}
|
||||||
FileConfiguration config = IFightSystem.getPlugin().getConfig();
|
FileConfiguration config = IFightSystem.getPlugin().getConfig();
|
||||||
|
|
||||||
File worldConfigFile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), config.getString("Arenaconfig", "config.yml"));
|
File worldConfigFile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), config.getString("Arenaconfig", "config.yml"));
|
||||||
if(!worldConfigFile.exists()) {
|
if(!worldConfigFile.exists()) {
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Weltconfig fehlt!");
|
Bukkit.getLogger().log(Level.SEVERE, "Weltconfig fehlt!");
|
||||||
IFightSystem.shutdown(null);
|
Bukkit.shutdown();
|
||||||
}
|
}
|
||||||
FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile);
|
FileConfiguration worldconfig = YamlConfiguration.loadConfiguration(worldConfigFile);
|
||||||
|
|
||||||
@ -151,30 +151,30 @@ public class Config {
|
|||||||
PreFightDuration = config.getInt("Times.PreFightDuration");
|
PreFightDuration = config.getInt("Times.PreFightDuration");
|
||||||
SpectatorDuration = config.getInt("Times.SpectatorDuration");
|
SpectatorDuration = config.getInt("Times.SpectatorDuration");
|
||||||
|
|
||||||
|
int underBorder = worldconfig.getInt("UnderBorder");
|
||||||
|
int blueCornerX = worldconfig.getInt("BlueCorner.x");
|
||||||
|
int blueCornerY = worldconfig.getInt("BlueCorner.y");
|
||||||
|
int blueCornerZ = worldconfig.getInt("BlueCorner.z");
|
||||||
|
BlueToRedX = worldconfig.getInt("BlueToRed.x");
|
||||||
|
BlueToRedY = worldconfig.getInt("BlueToRed.y");
|
||||||
|
BlueToRedZ = worldconfig.getInt("BlueToRed.z");
|
||||||
|
double teamBlueSpawnOffsetX = worldconfig.getDouble("SpawnOffset.x");
|
||||||
|
double teamBlueSpawnOffsetY = worldconfig.getDouble("SpawnOffset.y");
|
||||||
|
double teamBlueSpawnOffsetZ = worldconfig.getDouble("SpawnOffset.z");
|
||||||
|
WaterDepth = config.getInt("Arena.WaterDepth");
|
||||||
int schemsizeX = config.getInt("Arena.Schemsize.x");
|
int schemsizeX = config.getInt("Arena.Schemsize.x");
|
||||||
int schemsizeY = config.getInt("Arena.Schemsize.y");
|
int schemsizeY = config.getInt("Arena.Schemsize.y");
|
||||||
int schemsizeZ = config.getInt("Arena.Schemsize.z");
|
int schemsizeZ = config.getInt("Arena.Schemsize.z");
|
||||||
int teamBlueCornerX = worldconfig.getInt("Arena.TeamBlueCorner.x");
|
|
||||||
int teamBlueCornerY = worldconfig.getInt("Arena.TeamBlueCorner.y");
|
|
||||||
int teamBlueCornerZ = worldconfig.getInt("Arena.TeamBlueCorner.z");
|
|
||||||
TeamBluetoReddistanceX = worldconfig.getInt("Arena.TeamBluetoReddistance.x");
|
|
||||||
TeamBluetoReddistanceY = worldconfig.getInt("Arena.TeamBluetoReddistance.y");
|
|
||||||
TeamBluetoReddistanceZ = worldconfig.getInt("Arena.TeamBluetoReddistance.z");
|
|
||||||
int schem2BorderX = config.getInt("Arena.Schem2Border.x");
|
int schem2BorderX = config.getInt("Arena.Schem2Border.x");
|
||||||
int schem2BorderZ = config.getInt("Arena.Schem2Border.z");
|
int schem2BorderZ = config.getInt("Arena.Schem2Border.z");
|
||||||
int underArenaBorder = worldconfig.getInt("Arena.underArenaBorder");
|
PreperationArea = config.getInt("Arena.BorderFromSchematic");
|
||||||
BorderFromSchematic = config.getInt("Arena.BorderFromSchematic");
|
|
||||||
AlignWater = worldconfig.getBoolean("Arena.AlignWater");
|
|
||||||
WaterDepth = worldconfig.getInt("Arena.WaterDepth");
|
|
||||||
GroundWalkable = config.getBoolean("Arena.GroundWalkable");
|
GroundWalkable = config.getBoolean("Arena.GroundWalkable");
|
||||||
double teamBlueSpawnOffsetX = worldconfig.getDouble("Arena.SpawnOffset.x");
|
|
||||||
double teamBlueSpawnOffsetY = worldconfig.getDouble("Arena.SpawnOffset.y");
|
|
||||||
double teamBlueSpawnOffsetZ = worldconfig.getDouble("Arena.SpawnOffset.z");
|
|
||||||
|
|
||||||
RanksEnabled = config.getBoolean("Schematic.RanksEnabled");
|
RanksEnabled = config.getBoolean("Schematic.RanksEnabled");
|
||||||
SchematicType = de.steamwar.sql.SchematicType.fromDB(config.getString("Schematic.SchematicType"));
|
SchematicType = de.steamwar.sql.SchematicType.fromDB(config.getString("Schematic.SchematicType"));
|
||||||
IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly");
|
IgnorePublicOnly = config.getBoolean("Schematic.IgnorePublicOnly");
|
||||||
boolean rotate = config.getBoolean("Schematic.Rotate");
|
boolean rotate = config.getBoolean("Schematic.Rotate");
|
||||||
|
PasteAligned = config.getBoolean("Schematic.PasteAligned");
|
||||||
ReplaceObsidianBedrock = config.getBoolean("Schematic.ReplaceObsidianBedrock");
|
ReplaceObsidianBedrock = config.getBoolean("Schematic.ReplaceObsidianBedrock");
|
||||||
ReplaceWithBlockupdates = config.getBoolean("Schematic.ReplaceWithBlockupdates");
|
ReplaceWithBlockupdates = config.getBoolean("Schematic.ReplaceWithBlockupdates");
|
||||||
|
|
||||||
@ -202,32 +202,32 @@ public class Config {
|
|||||||
|
|
||||||
if(schemsizeX < 0){
|
if(schemsizeX < 0){
|
||||||
schemsizeX = -schemsizeX;
|
schemsizeX = -schemsizeX;
|
||||||
teamBlueCornerX = teamBlueCornerX - schemsizeX;
|
blueCornerX = blueCornerX - schemsizeX;
|
||||||
}
|
}
|
||||||
if(schemsizeY < 0){
|
if(schemsizeY < 0){
|
||||||
schemsizeY = -schemsizeY;
|
schemsizeY = -schemsizeY;
|
||||||
teamBlueCornerY = teamBlueCornerY - schemsizeY;
|
blueCornerY = blueCornerY - schemsizeY;
|
||||||
}
|
}
|
||||||
if(schemsizeZ < 0){
|
if(schemsizeZ < 0){
|
||||||
schemsizeZ = -schemsizeZ;
|
schemsizeZ = -schemsizeZ;
|
||||||
teamBlueCornerZ = teamBlueCornerZ - schemsizeZ;
|
blueCornerZ = blueCornerZ - schemsizeZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int teamRedCornerX = TeamBluetoReddistanceX + teamBlueCornerX;
|
int teamRedCornerX = BlueToRedX + blueCornerX;
|
||||||
int teamRedCornerY = TeamBluetoReddistanceY + teamBlueCornerY;
|
int teamRedCornerY = BlueToRedY + blueCornerY;
|
||||||
int teamRedCornerZ = TeamBluetoReddistanceZ + teamBlueCornerZ;
|
int teamRedCornerZ = BlueToRedZ + blueCornerZ;
|
||||||
|
|
||||||
int teamBluePasteX = teamBlueCornerX + schemsizeX / 2;
|
int teamBluePasteX = blueCornerX + schemsizeX / 2;
|
||||||
int teamBluePasteZ = teamBlueCornerZ + schemsizeZ / 2;
|
int teamBluePasteZ = blueCornerZ + schemsizeZ / 2;
|
||||||
int teamRedPasteX = teamBluePasteX + TeamBluetoReddistanceX;
|
int teamRedPasteX = teamBluePasteX + BlueToRedX;
|
||||||
int teamRedPasteZ = teamBluePasteZ + TeamBluetoReddistanceZ;
|
int teamRedPasteZ = teamBluePasteZ + BlueToRedZ;
|
||||||
|
|
||||||
World world = Bukkit.getWorlds().get(0);
|
World world = Bukkit.getWorlds().get(0);
|
||||||
|
|
||||||
TeamBlueSpawn = new Location(world,
|
TeamBlueSpawn = new Location(world,
|
||||||
teamBluePasteX + 0.5 + teamBlueSpawnOffsetX,
|
teamBluePasteX + 0.5 + teamBlueSpawnOffsetX,
|
||||||
teamBlueCornerY + 0.5 + teamBlueSpawnOffsetY,
|
blueCornerY + 0.5 + teamBlueSpawnOffsetY,
|
||||||
teamBluePasteZ + 0.5 + teamBlueSpawnOffsetZ);
|
teamBluePasteZ + 0.5 + teamBlueSpawnOffsetZ);
|
||||||
|
|
||||||
TeamRedSpawn = new Location(world,
|
TeamRedSpawn = new Location(world,
|
||||||
@ -236,9 +236,9 @@ public class Config {
|
|||||||
teamRedPasteZ + 0.5 - teamBlueSpawnOffsetZ);
|
teamRedPasteZ + 0.5 - teamBlueSpawnOffsetZ);
|
||||||
|
|
||||||
SpecSpawn = new Location(world,
|
SpecSpawn = new Location(world,
|
||||||
teamBluePasteX + TeamBluetoReddistanceX/2.0,
|
teamBluePasteX + BlueToRedX /2.0,
|
||||||
teamBlueCornerY + TeamBluetoReddistanceY/2.0 + schemsizeY/2.0,
|
blueCornerY + BlueToRedY /2.0 + schemsizeY/2.0,
|
||||||
teamBluePasteZ + TeamBluetoReddistanceZ/2.0);
|
teamBluePasteZ + BlueToRedZ /2.0);
|
||||||
|
|
||||||
Vector v1 = TeamBlueSpawn.toVector().subtract(TeamRedSpawn.toVector());
|
Vector v1 = TeamBlueSpawn.toVector().subtract(TeamRedSpawn.toVector());
|
||||||
double pitch = Math.toDegrees(v1.angle(v1.clone().setY(0)));
|
double pitch = Math.toDegrees(v1.angle(v1.clone().setY(0)));
|
||||||
@ -257,26 +257,26 @@ public class Config {
|
|||||||
int arenaMaxX;
|
int arenaMaxX;
|
||||||
int arenaMinZ;
|
int arenaMinZ;
|
||||||
int arenaMaxZ;
|
int arenaMaxZ;
|
||||||
if(TeamBluetoReddistanceX > 0){
|
if(BlueToRedX > 0){
|
||||||
arenaMinX = teamBlueCornerX - schem2BorderX;
|
arenaMinX = blueCornerX - schem2BorderX;
|
||||||
arenaMaxX = teamRedCornerX + schemsizeX + schem2BorderX;
|
arenaMaxX = teamRedCornerX + schemsizeX + schem2BorderX;
|
||||||
teamRedRotate = true;
|
teamRedRotate = true;
|
||||||
teamBlueRotate = false;
|
teamBlueRotate = false;
|
||||||
}else{
|
}else{
|
||||||
arenaMinX = teamRedCornerX - schem2BorderX;
|
arenaMinX = teamRedCornerX - schem2BorderX;
|
||||||
arenaMaxX = teamBlueCornerX + schemsizeX + schem2BorderX;
|
arenaMaxX = blueCornerX + schemsizeX + schem2BorderX;
|
||||||
teamRedRotate = false;
|
teamRedRotate = false;
|
||||||
teamBlueRotate = true;
|
teamBlueRotate = true;
|
||||||
}
|
}
|
||||||
if(TeamBluetoReddistanceZ > 0){
|
if(BlueToRedZ > 0){
|
||||||
arenaMinZ = teamBlueCornerZ - schem2BorderZ;
|
arenaMinZ = blueCornerZ - schem2BorderZ;
|
||||||
arenaMaxZ = teamRedCornerZ + schemsizeZ + schem2BorderZ;
|
arenaMaxZ = teamRedCornerZ + schemsizeZ + schem2BorderZ;
|
||||||
teamRedRotate = true;
|
teamRedRotate = true;
|
||||||
teamBlueRotate = false;
|
teamBlueRotate = false;
|
||||||
}else{
|
}else{
|
||||||
arenaMinZ = teamRedCornerZ - schem2BorderZ;
|
arenaMinZ = teamRedCornerZ - schem2BorderZ;
|
||||||
arenaMaxZ = teamBlueCornerZ + schemsizeZ + schem2BorderZ;
|
arenaMaxZ = blueCornerZ + schemsizeZ + schem2BorderZ;
|
||||||
if(TeamBluetoReddistanceZ != 0){
|
if(BlueToRedZ != 0){
|
||||||
teamRedRotate = false;
|
teamRedRotate = false;
|
||||||
teamBlueRotate = true;
|
teamBlueRotate = true;
|
||||||
}
|
}
|
||||||
@ -289,19 +289,19 @@ public class Config {
|
|||||||
BlueRotate = teamBlueRotate;
|
BlueRotate = teamBlueRotate;
|
||||||
|
|
||||||
RedPasteRegion = new Region(teamRedCornerX, teamRedCornerY, teamRedCornerZ, schemsizeX, schemsizeY, schemsizeZ);
|
RedPasteRegion = new Region(teamRedCornerX, teamRedCornerY, teamRedCornerZ, schemsizeX, schemsizeY, schemsizeZ);
|
||||||
BluePasteRegion = new Region(teamBlueCornerX, teamBlueCornerY, teamBlueCornerZ, schemsizeX, schemsizeY, schemsizeZ);
|
BluePasteRegion = new Region(blueCornerX, blueCornerY, blueCornerZ, schemsizeX, schemsizeY, schemsizeZ);
|
||||||
|
|
||||||
RedExtendRegion = new Region(teamRedCornerX, underArenaBorder, teamRedCornerZ, schemsizeX, schemsizeY, schemsizeZ, BorderFromSchematic, BorderFromSchematic);
|
RedExtendRegion = new Region(teamRedCornerX, underBorder, teamRedCornerZ, schemsizeX, schemsizeY, schemsizeZ, PreperationArea, PreperationArea);
|
||||||
BlueExtendRegion = new Region(teamBlueCornerX, underArenaBorder, teamBlueCornerZ, schemsizeX, schemsizeY, schemsizeZ, BorderFromSchematic, BorderFromSchematic);
|
BlueExtendRegion = new Region(blueCornerX, underBorder, blueCornerZ, schemsizeX, schemsizeY, schemsizeZ, PreperationArea, PreperationArea);
|
||||||
int upperArenaBorder = teamBlueCornerY + schemsizeY + BorderFromSchematic;
|
int upperArenaBorder = blueCornerY + schemsizeY + PreperationArea;
|
||||||
ArenaRegion = new Region(arenaMinX, underArenaBorder, arenaMinZ, arenaMaxX - arenaMinX, upperArenaBorder - underArenaBorder, arenaMaxZ - arenaMinZ);
|
ArenaRegion = new Region(arenaMinX, underBorder, arenaMinZ, arenaMaxX - arenaMinX, upperArenaBorder - underBorder, arenaMaxZ - arenaMinZ);
|
||||||
|
|
||||||
EventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
|
EventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
|
||||||
if(EventKampfID >= 1){
|
if(EventKampfID >= 1){
|
||||||
EventFight eventFight = EventFight.get(EventKampfID);
|
EventFight eventFight = EventFight.get(EventKampfID);
|
||||||
if(eventFight == null){
|
if(eventFight == null){
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight");
|
Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight");
|
||||||
IFightSystem.shutdown(null);
|
Bukkit.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
assert eventFight != null;
|
assert eventFight != null;
|
||||||
@ -310,7 +310,7 @@ public class Config {
|
|||||||
|
|
||||||
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");
|
||||||
IFightSystem.shutdown(null);
|
Bukkit.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
assert team1 != null;
|
assert team1 != null;
|
||||||
@ -379,7 +379,7 @@ public class Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean test(){
|
public static boolean test(){
|
||||||
return EventKampfID == -1;
|
return ArenaMode.Test.contains(ArenaMode.TEST);
|
||||||
}
|
}
|
||||||
public static boolean recording(){
|
public static boolean recording(){
|
||||||
return mode == ArenaMode.EVENT;
|
return mode == ArenaMode.EVENT;
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
package de.steamwar.fightsystem;
|
package de.steamwar.fightsystem;
|
||||||
|
|
||||||
import de.steamwar.sql.EventFight;
|
import de.steamwar.sql.EventFight;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
@ -50,21 +49,4 @@ public class IFightSystem {
|
|||||||
public static Player getEventLeiter(){
|
public static Player getEventLeiter(){
|
||||||
return eventLeiter;
|
return eventLeiter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void shutdown(String reason){
|
|
||||||
if(reason != null)
|
|
||||||
Bukkit.broadcastMessage(reason);
|
|
||||||
//Staggered kick to prevent lobby overloading
|
|
||||||
kickNext();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void kickNext(){
|
|
||||||
if(Bukkit.getOnlinePlayers().isEmpty()){
|
|
||||||
Bukkit.shutdown();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bukkit.getOnlinePlayers().iterator().next().kickPlayer(null);
|
|
||||||
Bukkit.getScheduler().runTaskLater(plugin, IFightSystem::kickNext, 10);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package de.steamwar.fightsystem.utils;
|
package de.steamwar.fightsystem.utils;
|
||||||
|
|
||||||
import org.apache.logging.log4j.util.TriConsumer;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
|
||||||
@ -121,4 +120,8 @@ public class Region {
|
|||||||
public boolean inRegion(Block block){
|
public boolean inRegion(Block block){
|
||||||
return in2dRegion(block) && minY <= block.getY() && block.getY() < maxY;
|
return in2dRegion(block) && minY <= block.getY() && block.getY() < maxY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface TriConsumer<T, V, U>{
|
||||||
|
void accept(T x, V y, U z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import de.steamwar.fightsystem.listener.*;
|
|||||||
import de.steamwar.fightsystem.record.RecordSystem;
|
import de.steamwar.fightsystem.record.RecordSystem;
|
||||||
import de.steamwar.fightsystem.record.Recorder;
|
import de.steamwar.fightsystem.record.Recorder;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
|
import de.steamwar.fightsystem.states.OneShotStateDependent;
|
||||||
import de.steamwar.fightsystem.utils.EnterHandler;
|
import de.steamwar.fightsystem.utils.EnterHandler;
|
||||||
import de.steamwar.fightsystem.utils.FightStatistics;
|
import de.steamwar.fightsystem.utils.FightStatistics;
|
||||||
import de.steamwar.fightsystem.utils.TechHider;
|
import de.steamwar.fightsystem.utils.TechHider;
|
||||||
@ -121,6 +122,12 @@ public class FightSystem extends JavaPlugin {
|
|||||||
new AkCommand();
|
new AkCommand();
|
||||||
new LeaderCommand();
|
new LeaderCommand();
|
||||||
new LockschemCommand();
|
new LockschemCommand();
|
||||||
|
new StateCommand();
|
||||||
|
new SkipCommand();
|
||||||
|
|
||||||
|
new OneShotStateDependent(ArenaMode.All, FightState.PreRunning, () -> Bukkit.broadcastMessage(PREFIX + "§aDer Kampf beginnt!"));
|
||||||
|
new OneShotStateDependent(ArenaMode.All, FightState.Running, () -> Bukkit.broadcastMessage(PREFIX + "§aArena freigegeben!"));
|
||||||
|
new OneShotStateDependent(ArenaMode.AntiTest, FightState.Running, FightStatistics::start);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
CommandRemover.removeAll("gamemode");
|
CommandRemover.removeAll("gamemode");
|
||||||
@ -160,15 +167,10 @@ public class FightSystem extends JavaPlugin {
|
|||||||
|
|
||||||
public static void setPreRunningState() {
|
public static void setPreRunningState() {
|
||||||
FightState.setFightState(FightState.PRE_RUNNING);
|
FightState.setFightState(FightState.PRE_RUNNING);
|
||||||
|
|
||||||
Bukkit.broadcastMessage(PREFIX + "§aDer Kampf beginnt!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setRunningState() {
|
public static void setRunningState() {
|
||||||
FightState.setFightState(FightState.RUNNING);
|
FightState.setFightState(FightState.RUNNING);
|
||||||
|
|
||||||
FightStatistics.start();
|
|
||||||
Bukkit.broadcastMessage(PREFIX + "§aArena freigegeben!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setSpectateState(FightTeam winFightTeam, String windescription) {
|
public static void setSpectateState(FightTeam winFightTeam, String windescription) {
|
||||||
@ -211,6 +213,19 @@ public class FightSystem extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void shutdown(String reason){
|
public static void shutdown(String reason){
|
||||||
IFightSystem.shutdown(reason);
|
if(reason != null)
|
||||||
|
Bukkit.broadcastMessage(reason);
|
||||||
|
//Staggered kick to prevent lobby overloading
|
||||||
|
kickNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void kickNext(){
|
||||||
|
if(Bukkit.getOnlinePlayers().isEmpty()){
|
||||||
|
Bukkit.shutdown();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bukkit.getOnlinePlayers().iterator().next().kickPlayer(null);
|
||||||
|
Bukkit.getScheduler().runTaskLater(plugin, FightSystem::kickNext, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,14 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void toggleReady(Player p){
|
static void toggleReady(Player p){
|
||||||
|
FightTeam fightTeam = checkGetTeam(p);
|
||||||
|
if(fightTeam == null || checkGetLeader(p) == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fightTeam.skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void toggleSkip(Player p){
|
||||||
if(checkSetup(p))
|
if(checkSetup(p))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -67,6 +67,20 @@ public class GUI {
|
|||||||
inv.open();
|
inv.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void state(Player p){
|
||||||
|
SWInventory inv = new SWInventory(p, 9, "Kampfstatus");
|
||||||
|
inv.setItem(0, Material.GLASS, "§7PRE_LEADER_SETUP", (ClickType click) -> FightSystem.setPreLeaderState());
|
||||||
|
inv.setItem(1, Material.GLASS, "§7PRE_SCHEM_SETUP", (ClickType click) -> FightSystem.setPreSchemState());
|
||||||
|
inv.setItem(2, Material.GLASS, "§7POST_SCHEM_SETUP", (ClickType click) -> FightSystem.setPostSchemState());
|
||||||
|
inv.setItem(3, Material.GLASS, "§ePRE_RUNNING", (ClickType click) -> FightSystem.setPreRunningState());
|
||||||
|
inv.setItem(4, Material.GLASS, "§eRUNNING", (ClickType click) -> FightSystem.setRunningState());
|
||||||
|
inv.setItem(5, Material.GLASS, "§7SPECTATE Blue", (ClickType click) -> FightSystem.setSpectateState(Fight.getBlueTeam(), "operator"));
|
||||||
|
inv.setItem(6, Material.GLASS, "§7SPECTATE Red", (ClickType click) -> FightSystem.setSpectateState(Fight.getRedTeam(), "operator"));
|
||||||
|
inv.setItem(7, Material.GLASS, "§7SPECTATE Tie", (ClickType click) -> FightSystem.setSpectateState(null, "operator"));
|
||||||
|
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||||
|
inv.open();
|
||||||
|
}
|
||||||
|
|
||||||
public static void chooseInvitation(Player p){
|
public static void chooseInvitation(Player p){
|
||||||
List<SWListInv.SWListEntry<UUID>> players = SWListInv.createPlayerList(p.getUniqueId());
|
List<SWListInv.SWListEntry<UUID>> players = SWListInv.createPlayerList(p.getUniqueId());
|
||||||
players.removeIf(swItemUUIDPair -> Fight.getFightPlayer(Bukkit.getPlayer(swItemUUIDPair.getObject())) != null);
|
players.removeIf(swItemUUIDPair -> Fight.getFightPlayer(Bukkit.getPlayer(swItemUUIDPair.getObject())) != null);
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package de.steamwar.fightsystem.commands;
|
||||||
|
|
||||||
|
import de.steamwar.fightsystem.ArenaMode;
|
||||||
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
|
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class SkipCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
public SkipCommand() {
|
||||||
|
new StateDependentCommand(ArenaMode.AntiPrepare, FightState.Running, "skip", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
if(!(sender instanceof Player)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Player player = (Player) sender;
|
||||||
|
|
||||||
|
Commands.toggleSkip(player);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package de.steamwar.fightsystem.commands;
|
||||||
|
|
||||||
|
import de.steamwar.fightsystem.ArenaMode;
|
||||||
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
|
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class StateCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
public StateCommand() {
|
||||||
|
new StateDependentCommand(ArenaMode.Test, FightState.All, "state", this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
if(!(sender instanceof Player)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI.state((Player) sender);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -31,8 +31,13 @@ import org.bukkit.Sound;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class Countdown {
|
public abstract class Countdown {
|
||||||
|
|
||||||
|
private static final List<Countdown> currentCountdowns = new ArrayList<>();
|
||||||
|
|
||||||
private final int totalTime;
|
private final int totalTime;
|
||||||
private final Sound sound;
|
private final Sound sound;
|
||||||
private final boolean level;
|
private final boolean level;
|
||||||
@ -71,15 +76,35 @@ public abstract class Countdown {
|
|||||||
public void enable() {
|
public void enable() {
|
||||||
time = totalTime;
|
time = totalTime;
|
||||||
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::count, 20, 20);
|
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::count, 20, 20);
|
||||||
|
currentCountdowns.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disable() {
|
public void disable() {
|
||||||
if(task != null){
|
if(task != null){
|
||||||
task.cancel();
|
task.cancel();
|
||||||
|
currentCountdowns.remove(this);
|
||||||
task = null;
|
task = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void skip(){
|
||||||
|
if(currentCountdowns.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
int smallestTime = currentCountdowns.get(0).time;
|
||||||
|
for(Countdown countdown : currentCountdowns){
|
||||||
|
if(countdown.time < smallestTime)
|
||||||
|
smallestTime = countdown.time;
|
||||||
|
}
|
||||||
|
|
||||||
|
smallestTime--;
|
||||||
|
for(Countdown countdown : currentCountdowns){
|
||||||
|
countdown.time -= smallestTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bukkit.broadcastMessage(FightSystem.PREFIX + "§aBeide Teams waren damit einverstanden, zum nächsten Event zu beschleunigen!");
|
||||||
|
}
|
||||||
|
|
||||||
private void broadcast(String message){
|
private void broadcast(String message){
|
||||||
RecordSystem.actionBar(message);
|
RecordSystem.actionBar(message);
|
||||||
BaseComponent[] msg = TextComponent.fromLegacyText(message);
|
BaseComponent[] msg = TextComponent.fromLegacyText(message);
|
||||||
|
@ -115,21 +115,21 @@ public class FightSchematic extends StateDependent {
|
|||||||
try {
|
try {
|
||||||
VersionedRunnable.call(new VersionedRunnable(() -> {
|
VersionedRunnable.call(new VersionedRunnable(() -> {
|
||||||
try {
|
try {
|
||||||
EditSession e = FightTeam_8.pasteSchematic(clipboard, region.centerX(), region.getMinY(), region.centerZ(), rotate);
|
EditSession e = FightTeam_8.pasteSchematic(clipboard, region, rotate);
|
||||||
FightTeam_8.replaceTeamColor(e, c, region);
|
FightTeam_8.replaceTeamColor(e, c, region);
|
||||||
} catch (Schematic.WrongVersionException | IOException | NoClipboardException ex) {
|
} catch (Schematic.WrongVersionException | IOException | NoClipboardException ex) {
|
||||||
throw new SecurityException("Error pasting arena in schematic", ex);
|
throw new SecurityException("Error pasting arena in schematic", ex);
|
||||||
}
|
}
|
||||||
}, 8), new VersionedRunnable(() -> {
|
}, 8), new VersionedRunnable(() -> {
|
||||||
try {
|
try {
|
||||||
EditSession e = FightTeam_8.pasteSchematic(clipboard, region.centerX(), region.getMinY(), region.centerZ(), rotate);
|
EditSession e = FightTeam_8.pasteSchematic(clipboard, region, rotate);
|
||||||
FightTeam_12.replaceTeamColor(e, c, region);
|
FightTeam_12.replaceTeamColor(e, c, region);
|
||||||
} catch (Schematic.WrongVersionException | IOException | NoClipboardException ex) {
|
} catch (Schematic.WrongVersionException | IOException | NoClipboardException ex) {
|
||||||
throw new SecurityException("Error pasting arena in schematic", ex);
|
throw new SecurityException("Error pasting arena in schematic", ex);
|
||||||
}
|
}
|
||||||
}, 12), new VersionedRunnable(() -> {
|
}, 12), new VersionedRunnable(() -> {
|
||||||
try {
|
try {
|
||||||
EditSession e = FightTeam_14.pasteSchematic(clipboard, region.centerX(), region.getMinY(), region.centerZ(), rotate);
|
EditSession e = FightTeam_14.pasteSchematic(clipboard, region, rotate);
|
||||||
FightTeam_14.replaceTeamColor(e, c, region);
|
FightTeam_14.replaceTeamColor(e, c, region);
|
||||||
} catch (Schematic.WrongVersionException | IOException | NoClipboardException ex) {
|
} catch (Schematic.WrongVersionException | IOException | NoClipboardException ex) {
|
||||||
throw new SecurityException("Error pasting arena in schematic", ex);
|
throw new SecurityException("Error pasting arena in schematic", ex);
|
||||||
|
@ -24,6 +24,7 @@ import de.steamwar.core.VersionedRunnable;
|
|||||||
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.FightSystem;
|
||||||
|
import de.steamwar.fightsystem.countdown.Countdown;
|
||||||
import de.steamwar.fightsystem.listener.BasicListener;
|
import de.steamwar.fightsystem.listener.BasicListener;
|
||||||
import de.steamwar.fightsystem.listener.PersonalKitCreator;
|
import de.steamwar.fightsystem.listener.PersonalKitCreator;
|
||||||
import de.steamwar.fightsystem.record.RecordSystem;
|
import de.steamwar.fightsystem.record.RecordSystem;
|
||||||
@ -48,11 +49,11 @@ import java.util.*;
|
|||||||
|
|
||||||
public class FightTeam implements IFightTeam{
|
public class FightTeam implements IFightTeam{
|
||||||
|
|
||||||
private FightPlayer leader;
|
|
||||||
private UUID designatedLeader;
|
private UUID designatedLeader;
|
||||||
|
private FightPlayer leader;
|
||||||
private final Map<Player, FightPlayer> players = new HashMap<>();
|
private final Map<Player, FightPlayer> players = new HashMap<>();
|
||||||
private boolean ready;
|
|
||||||
private final Set<Player> invited = new HashSet<>();
|
private final Set<Player> invited = new HashSet<>();
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String prefix;
|
private final String prefix;
|
||||||
private final ChatColor color;
|
private final ChatColor color;
|
||||||
@ -60,6 +61,9 @@ public class FightTeam implements IFightTeam{
|
|||||||
private final Team team;
|
private final Team team;
|
||||||
private final boolean blue;
|
private final boolean blue;
|
||||||
|
|
||||||
|
private boolean ready;
|
||||||
|
private boolean skip;
|
||||||
|
|
||||||
private final Location spawn;
|
private final Location spawn;
|
||||||
private final Region schemRegion;
|
private final Region schemRegion;
|
||||||
private final Region extendRegion;
|
private final Region extendRegion;
|
||||||
@ -71,6 +75,7 @@ public class FightTeam implements IFightTeam{
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.prefix = prefix;
|
this.prefix = prefix;
|
||||||
this.ready = false;
|
this.ready = false;
|
||||||
|
this.skip = false;
|
||||||
this.blue = blue;
|
this.blue = blue;
|
||||||
this.designatedLeader = designatedLeader;
|
this.designatedLeader = designatedLeader;
|
||||||
this.color = ChatColor.getByChar(ChatColor.getLastColors(prefix).replace("§", ""));
|
this.color = ChatColor.getByChar(ChatColor.getLastColors(prefix).replace("§", ""));
|
||||||
@ -315,6 +320,18 @@ public class FightTeam implements IFightTeam{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void skip(){
|
||||||
|
this.skip = !skip;
|
||||||
|
if(skip){
|
||||||
|
broadcast(FightSystem.PREFIX + "§aEuer Team ist nun bereit, zum nächsten Event zu beschleunigen!");
|
||||||
|
if(Fight.getOpposite(this).skip || Config.test()){
|
||||||
|
Countdown.skip();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
broadcast(FightSystem.PREFIX + "§cEuer Team ist nicht mehr bereit, zum nächsten Event zu beschleunigen!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Set<Player> getInvited() {
|
public Set<Player> getInvited() {
|
||||||
return invited;
|
return invited;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
public class EventJoin implements Listener {
|
public class EventJoin implements Listener {
|
||||||
|
|
||||||
public EventJoin() {
|
public EventJoin() {
|
||||||
new StateDependentListener(ArenaMode.Event, FightState.Setup, this);
|
new StateDependentListener(ArenaMode.Event, FightState.All, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -58,29 +58,32 @@ public class EventJoin implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void handlePlayerJoin(PlayerJoinEvent event) {
|
public void handlePlayerJoin(PlayerJoinEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
//player.setResourcePack("https://steamwar.de/antixray.zip");
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||||
|
|
||||||
FightTeam team = null;
|
if(FightState.Setup.contains(FightState.getFightState())){
|
||||||
if(user.getTeam() == Config.EventTeamBlueID)
|
FightTeam team = null;
|
||||||
team = Fight.getBlueTeam();
|
if(user.getTeam() == Config.EventTeamBlueID)
|
||||||
else if(user.getTeam() == Config.EventTeamRedID)
|
|
||||||
team = Fight.getRedTeam();
|
|
||||||
|
|
||||||
if(Config.BothTeamsPublic){
|
|
||||||
if(Fight.getRedTeam().getPlayers().size() < Fight.getBlueTeam().getPlayers().size())
|
|
||||||
team = Fight.getRedTeam();
|
|
||||||
else
|
|
||||||
team = Fight.getBlueTeam();
|
team = Fight.getBlueTeam();
|
||||||
}else if(team == null){
|
else if(user.getTeam() == Config.EventTeamRedID)
|
||||||
if(Config.EventTeamRedID == 0)
|
|
||||||
team = Fight.getRedTeam();
|
team = Fight.getRedTeam();
|
||||||
else if(Config.EventTeamBlueID == 0)
|
|
||||||
team = Fight.getBlueTeam();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(team != null && team.getPlayers().size() < Config.MaximumTeamMembers){
|
if(Config.BothTeamsPublic){
|
||||||
team.addMember(player);
|
if(Fight.getRedTeam().getPlayers().size() < Fight.getBlueTeam().getPlayers().size())
|
||||||
return;
|
team = Fight.getRedTeam();
|
||||||
|
else
|
||||||
|
team = Fight.getBlueTeam();
|
||||||
|
}else if(team == null){
|
||||||
|
if(Config.EventTeamRedID == 0)
|
||||||
|
team = Fight.getRedTeam();
|
||||||
|
else if(Config.EventTeamBlueID == 0)
|
||||||
|
team = Fight.getBlueTeam();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(team != null && team.getPlayers().size() < Config.MaximumTeamMembers){
|
||||||
|
team.addMember(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(user.getId() == FightSystem.getEventFight().getKampfleiter()){
|
if(user.getId() == FightSystem.getEventFight().getKampfleiter()){
|
||||||
@ -98,4 +101,14 @@ public class EventJoin implements Listener {
|
|||||||
if(player == FightSystem.getEventLeiter())
|
if(player == FightSystem.getEventLeiter())
|
||||||
FightSystem.setEventLeiter(null);
|
FightSystem.setEventLeiter(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*@EventHandler
|
||||||
|
public void onResourcepack(PlayerResourcePackStatusEvent e){
|
||||||
|
if(e.getStatus() == PlayerResourcePackStatusEvent.Status.ACCEPTED || e.getStatus() == PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = e.getPlayer();
|
||||||
|
player.sendMessage(FightSystem.PREFIX + "§cAuf Eventserver kann nur mit dem SteamWar-Resourcepack beigetreten werden");
|
||||||
|
player.kickPlayer(null);
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,21 @@
|
|||||||
|
|
||||||
package de.steamwar.fightsystem.listener;
|
package de.steamwar.fightsystem.listener;
|
||||||
|
|
||||||
|
import de.steamwar.core.VersionedCallable;
|
||||||
|
import de.steamwar.core.VersionedRunnable;
|
||||||
import de.steamwar.fightsystem.ArenaMode;
|
import de.steamwar.fightsystem.ArenaMode;
|
||||||
|
import de.steamwar.fightsystem.Config;
|
||||||
import de.steamwar.fightsystem.FightSystem;
|
import de.steamwar.fightsystem.FightSystem;
|
||||||
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.fight.FightTeam_14;
|
||||||
|
import de.steamwar.fightsystem.fight.FightTeam_8;
|
||||||
import de.steamwar.fightsystem.states.FightState;
|
import de.steamwar.fightsystem.states.FightState;
|
||||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||||
|
import de.steamwar.fightsystem.utils.Region;
|
||||||
|
import de.steamwar.sql.Schematic;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
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;
|
||||||
@ -37,7 +46,38 @@ public class PrepareSchem implements Listener {
|
|||||||
@Override
|
@Override
|
||||||
public void disable() {
|
public void disable() {
|
||||||
super.disable();
|
super.disable();
|
||||||
//TODO
|
Region region = Fight.getBlueTeam().getExtendRegion();
|
||||||
|
World world = Bukkit.getWorlds().get(0);
|
||||||
|
|
||||||
|
Schematic schem;
|
||||||
|
try{
|
||||||
|
schem = Schematic.getSchemFromDB(Config.PrepareSchemID);
|
||||||
|
}catch(SecurityException e){
|
||||||
|
FightSystem.shutdown(FightSystem.PREFIX + "§cAnscheinend wurde die auszufahrende Schematic gelöscht, Einsenden wird abgebrochen.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
region.forEach((x, y, z) -> {
|
||||||
|
if(VersionedCallable.call(
|
||||||
|
new VersionedCallable<>(() -> FightTeam_8.checkPistonMoving(world.getBlockAt(x, y, z)), 8),
|
||||||
|
new VersionedCallable<>(() -> FightTeam_14.checkPistonMoving(world.getBlockAt(x, y, z)), 14))){
|
||||||
|
FightSystem.shutdown(FightSystem.PREFIX + "§cIm Teambereich wurden sich noch bewegende Pistons gefunden, Einsenden wird abgebrochen.");
|
||||||
|
throw new IllegalStateException();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}catch (IllegalStateException e){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
VersionedRunnable.call(
|
||||||
|
new VersionedRunnable(() -> FightTeam_8.saveSchem(schem, region), 8),
|
||||||
|
new VersionedRunnable(() -> FightTeam_14.saveSchem(schem, region), 14));
|
||||||
|
}catch(IllegalStateException e){
|
||||||
|
FightSystem.shutdown(FightSystem.PREFIX + "§cDie Schematic konnte nicht gespeichert werden, Einsenden wird abgebrochen.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public class TeamArea implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkInInnerArea(Player player, Location to, FightTeam team){
|
private void checkInInnerArea(Player player, Location to, FightTeam team){
|
||||||
if(team.getSchemRegion().playerInRegion(to) && Config.BorderFromSchematic >= 5){ // Preventing false positives due to small extension
|
if(team.getSchemRegion().playerInRegion(to) && Config.PreperationArea >= 5){ // Preventing false positives due to small extension
|
||||||
player.kickPlayer(null);
|
player.kickPlayer(null);
|
||||||
Bukkit.getLogger().log(Level.SEVERE, player.getName() + " ist in einen Teambereich eingedrungen.");
|
Bukkit.getLogger().log(Level.SEVERE, player.getName() + " ist in einen Teambereich eingedrungen.");
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ import org.bukkit.event.entity.EntityExplodeEvent;
|
|||||||
|
|
||||||
public class WaterRemover implements Listener {
|
public class WaterRemover implements Listener {
|
||||||
|
|
||||||
private static final int MIN_Y = Config.BluePasteRegion.getMinY() + (Config.AlignWater ? Config.WaterDepth : 0);
|
private static final int MIN_Y = Config.BluePasteRegion.getMinY() + Config.WaterDepth;
|
||||||
|
|
||||||
public WaterRemover() {
|
public WaterRemover() {
|
||||||
new StateDependentListener(ArenaMode.All, FightState.Running, this);
|
new StateDependentListener(ArenaMode.All, FightState.Running, this);
|
||||||
|
@ -0,0 +1,25 @@
|
|||||||
|
package de.steamwar.fightsystem.states;
|
||||||
|
|
||||||
|
import de.steamwar.fightsystem.ArenaMode;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class OneShotStateDependent extends StateDependent{
|
||||||
|
|
||||||
|
private final Runnable runnable;
|
||||||
|
|
||||||
|
public OneShotStateDependent(Set<ArenaMode> mode, Set<FightState> states, Runnable runnable) {
|
||||||
|
super(mode, states);
|
||||||
|
this.runnable = runnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enable() {
|
||||||
|
runnable.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disable() {
|
||||||
|
//Do nothing, oneshot
|
||||||
|
}
|
||||||
|
}
|
@ -126,6 +126,9 @@ public class TechHider implements IStateDependent {
|
|||||||
if(Core.getVersion() > 8) {
|
if(Core.getVersion() > 8) {
|
||||||
protocolManager.addPacketListener(updateBlockEntity);
|
protocolManager.addPacketListener(updateBlockEntity);
|
||||||
}
|
}
|
||||||
|
if(Core.getVersion() > 12) {
|
||||||
|
protocolManager.addPacketListener(blockBreakHider);
|
||||||
|
}
|
||||||
if(chunkHider != null) {
|
if(chunkHider != null) {
|
||||||
protocolManager.getAsynchronousManager().registerAsyncHandler(chunkHider).start(threadMultiplier * 4);
|
protocolManager.getAsynchronousManager().registerAsyncHandler(chunkHider).start(threadMultiplier * 4);
|
||||||
}
|
}
|
||||||
@ -139,6 +142,9 @@ public class TechHider implements IStateDependent {
|
|||||||
if(Core.getVersion() > 8) {
|
if(Core.getVersion() > 8) {
|
||||||
protocolManager.removePacketListener(updateBlockEntity);
|
protocolManager.removePacketListener(updateBlockEntity);
|
||||||
}
|
}
|
||||||
|
if(Core.getVersion() > 12) {
|
||||||
|
protocolManager.removePacketListener(blockBreakHider);
|
||||||
|
}
|
||||||
if(chunkHider != null) {
|
if(chunkHider != null) {
|
||||||
protocolManager.getAsynchronousManager().unregisterAsyncHandler(chunkHider);
|
protocolManager.getAsynchronousManager().unregisterAsyncHandler(chunkHider);
|
||||||
}
|
}
|
||||||
@ -223,6 +229,35 @@ public class TechHider implements IStateDependent {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private final PacketAdapter blockBreakHider = new PacketAdapter(IFightSystem.getPlugin(), PacketType.Play.Server.BLOCK_BREAK) {
|
||||||
|
@Override
|
||||||
|
public void onPacketSending(PacketEvent e) {
|
||||||
|
PacketContainer packet = e.getPacket();
|
||||||
|
BlockPosition pos = packet.getBlockPositionModifier().read(0);
|
||||||
|
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
if(bypass(p, ITechHider.posToChunk(pos.getX()), ITechHider.posToChunk(pos.getZ())))
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
PacketContainer cached = packetCache.get(packet);
|
||||||
|
if(cached != null){
|
||||||
|
e.setPacket(cached);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cached = packet.deepClone();
|
||||||
|
packetCache.put(packet, cached);
|
||||||
|
e.setPacket(cached);
|
||||||
|
StructureModifier<WrappedBlockData> blockStructure = cached.getBlockData();
|
||||||
|
WrappedBlockData block = blockStructure.read(0);
|
||||||
|
if(Config.HiddenBlocks.contains(block.getType().name())){
|
||||||
|
block.setType(obfuscateMaterial);
|
||||||
|
blockStructure.write(0, block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private final PacketAdapter updateBlockEntity = new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.TILE_ENTITY_DATA) {
|
private final PacketAdapter updateBlockEntity = new PacketAdapter(FightSystem.getPlugin(), PacketType.Play.Server.TILE_ENTITY_DATA) {
|
||||||
@Override
|
@Override
|
||||||
public void onPacketSending(PacketEvent event) {
|
public void onPacketSending(PacketEvent event) {
|
||||||
|
@ -51,7 +51,7 @@ public class WinconditionTimeTechKO extends Wincondition {
|
|||||||
public WinconditionTimeTechKO(){
|
public WinconditionTimeTechKO(){
|
||||||
super("TechKO", "", " §chat den Gegner Tech K.O. gesetzt!");
|
super("TechKO", "", " §chat den Gegner Tech K.O. gesetzt!");
|
||||||
|
|
||||||
if(Config.TeamBluetoReddistanceZ > 0) {
|
if(Config.BlueToRedZ > 0) {
|
||||||
smallerZteam = Fight.getBlueTeam();
|
smallerZteam = Fight.getBlueTeam();
|
||||||
biggerZteam = Fight.getRedTeam();
|
biggerZteam = Fight.getRedTeam();
|
||||||
}else{
|
}else{
|
||||||
|
@ -17,4 +17,6 @@ commands:
|
|||||||
kit:
|
kit:
|
||||||
remove:
|
remove:
|
||||||
leader:
|
leader:
|
||||||
lockschem:
|
lockschem:
|
||||||
|
state:
|
||||||
|
skip:
|
In neuem Issue referenzieren
Einen Benutzer sperren