forked from SteamWar/SteamWar
Merge branch 'main' into FightSystem/fix-tech-and-hull-hider
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
steamwar.java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_Core", "default"))
|
||||
|
||||
compileOnly(libs.nms10)
|
||||
}
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.fight.FightWorld;
|
||||
import net.minecraft.server.v1_10_R1.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class CraftbukkitWrapper10 implements CraftbukkitWrapper {
|
||||
@Override
|
||||
public void resetChunk(World world, World backup, int x, int z) {
|
||||
net.minecraft.server.v1_10_R1.World w = ((CraftWorld) world).getHandle();
|
||||
Chunk chunk = w.getChunkAt(x, z);
|
||||
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
||||
|
||||
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||
System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length);
|
||||
w.tileEntityListTick.removeAll(chunk.tileEntities.values());
|
||||
if (!FightWorld.isPAPER()) {
|
||||
w.tileEntityList.removeAll(chunk.tileEntities.values());
|
||||
}
|
||||
chunk.tileEntities.clear();
|
||||
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float headRotation(Entity e) {
|
||||
return ((CraftEntity)e).getHandle().getHeadRotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<?> entityIterator() {
|
||||
return ((CraftWorld) Config.world).getHandle().entityList.stream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupGamerule() { }
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
steamwar.java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_Core", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_8", "default"))
|
||||
|
||||
compileOnly(libs.nms12)
|
||||
compileOnly(libs.worldedit12)
|
||||
}
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.fight.FightWorld;
|
||||
import net.minecraft.server.v1_12_R1.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class CraftbukkitWrapper12 implements CraftbukkitWrapper {
|
||||
@Override
|
||||
public void resetChunk(World world, World backup, int x, int z) {
|
||||
net.minecraft.server.v1_12_R1.World w = ((CraftWorld) world).getHandle();
|
||||
Chunk chunk = w.getChunkAt(x, z);
|
||||
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
||||
|
||||
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||
System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length);
|
||||
w.tileEntityListTick.removeAll(chunk.tileEntities.values());
|
||||
if (!FightWorld.isPAPER()) {
|
||||
w.tileEntityList.removeAll(chunk.tileEntities.values());
|
||||
}
|
||||
chunk.tileEntities.clear();
|
||||
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float headRotation(Entity e) {
|
||||
return ((CraftEntity)e).getHandle().getHeadRotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<?> entityIterator() {
|
||||
return ((CraftWorld) Config.world).getHandle().entityList.stream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupGamerule() { }
|
||||
}
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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 org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.SoundCategory;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
public class WorldOfColorWrapper12 implements WorldOfColorWrapper {
|
||||
@Override
|
||||
public void setTeamColor(Team team, ChatColor color) {
|
||||
team.setColor(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInBlock(Projectile e) {
|
||||
if(e instanceof Arrow)
|
||||
return ((Arrow) e).isInBlock();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(Location location, Sound sound, String soundCategory, float volume, float pitch) {
|
||||
location.getWorld().playSound(location, sound, SoundCategory.valueOf(soundCategory), volume, pitch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTitle(Player player, String title, String subtitle, int start, int hold, int stop) {
|
||||
player.sendTitle(title, subtitle, start, hold, stop);
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.sk89q.worldedit.blocks.BaseBlock;
|
||||
import org.bukkit.Material;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class WorldeditWrapper12 extends WorldeditWrapper8 {
|
||||
|
||||
static {
|
||||
colorBlocks.add(new BaseBlock(Material.CONCRETE.getId(), COLOR_TO_REPLACE));
|
||||
colorBlocks.add(new BaseBlock(Material.CONCRETE_POWDER.getId(), COLOR_TO_REPLACE));
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
steamwar.java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_Core", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_8", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_9", "default"))
|
||||
|
||||
compileOnly(libs.nms14)
|
||||
compileOnly(libs.worldedit15)
|
||||
|
||||
compileOnly(libs.fastutil)
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.Reflection;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class BlockIdWrapper14 implements BlockIdWrapper {
|
||||
|
||||
private static final Class<?> chunkProviderServer = Reflection.getClass("net.minecraft.server.level.ServerChunkCache");
|
||||
private static final Reflection.Method getChunkProvider = Reflection.getTypedMethod(worldServer, null, chunkProviderServer);
|
||||
private static final Class<?> playerChunkMap = Reflection.getClass("net.minecraft.server.level.ChunkMap");
|
||||
private static final Reflection.Field<?> getPlayerChunkMap = Reflection.getField(chunkProviderServer, playerChunkMap, 0);
|
||||
private static final Reflection.Field<? 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("net.minecraft.world.level.block.Block");
|
||||
private static final Class<?> iBlockData = Reflection.getClass("net.minecraft.world.level.block.state.BlockState");
|
||||
private static final Class<?> blockPosition = Reflection.getClass("net.minecraft.core.BlockPos");
|
||||
|
||||
private final Map trackers;
|
||||
public BlockIdWrapper14() {
|
||||
trackers = entityTrackers.get(getPlayerChunkMap.get(getChunkProvider.invoke(getWorldHandle.invoke(Config.world))));
|
||||
}
|
||||
|
||||
private static final Reflection.Method getCombinedId = Reflection.getTypedMethod(block, null, int.class, iBlockData);
|
||||
private static final Reflection.Method getNMS = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.block.CraftBlock"), "getNMS", iBlockData);
|
||||
@Override
|
||||
public int blockToId(Block block) {
|
||||
return (int) getCombinedId.invoke(null, getNMS.invoke(block));
|
||||
}
|
||||
|
||||
private static final Reflection.Method getByCombinedId = Reflection.getTypedMethod(block, null, iBlockData, int.class);
|
||||
private static final Reflection.Constructor newBlockPosition = Reflection.getConstructor(blockPosition, int.class, int.class, int.class);
|
||||
private static final Reflection.Method getTypeAndData = Reflection.getMethod(worldServer, null, blockPosition, iBlockData, int.class);
|
||||
private static final Reflection.Method removeTileEntity = Reflection.getMethod(worldServer, Core.getVersion() > 15 ? "m" : "removeTileEntity", blockPosition);
|
||||
private static final Reflection.Method flagDirty = Reflection.getMethod(chunkProviderServer, null, blockPosition);
|
||||
@Override
|
||||
public void setBlock(World world, int x, int y, int z, int blockState) {
|
||||
Object blockData = getByCombinedId.invoke(null, blockState);
|
||||
Object nworld = getWorldHandle.invoke(world);
|
||||
Object pos = newBlockPosition.invoke(x, y, z);
|
||||
|
||||
removeTileEntity.invoke(nworld, pos);
|
||||
getTypeAndData.invoke(nworld, pos, blockData, 1042);
|
||||
flagDirty.invoke(getChunkProvider.invoke(nworld), pos);
|
||||
}
|
||||
|
||||
private static final Class<?> entityTracker = Reflection.getClass("net.minecraft.server.level.ChunkMap$TrackedEntity");
|
||||
private static final Reflection.Method updatePlayer = Reflection.getMethod(entityTracker, Core.getVersion() > 15 ? "b" : "updatePlayer", entityPlayer);
|
||||
@Override
|
||||
public void trackEntity(Player player, Entity entity) {
|
||||
Object tracker = trackers.get(entity.getEntityId());
|
||||
if(tracker != null)
|
||||
updatePlayer.invoke(tracker, getPlayer.invoke(player));
|
||||
}
|
||||
|
||||
private static final Reflection.Method clearPlayer = Reflection.getMethod(entityTracker, Core.getVersion() > 15 ? "a" : "clear", entityPlayer);
|
||||
@Override
|
||||
public void untrackEntity(Player player, Entity entity) {
|
||||
Object tracker = trackers.get(entity.getEntityId());
|
||||
if(tracker != null)
|
||||
clearPlayer.invoke(tracker, getPlayer.invoke(player));
|
||||
}
|
||||
|
||||
private static final Reflection.Method getMaterialByBlock = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.util.CraftMagicNumbers"), "getMaterial", Material.class, block);
|
||||
private static final Reflection.Method getBlockByBlockData = Reflection.getTypedMethod(iBlockData, null, block);
|
||||
@Override
|
||||
public Material idToMaterial(int blockState) {
|
||||
return (Material)getMaterialByBlock.invoke(null, getBlockByBlockData.invoke(getByCombinedId.invoke(null, blockState)));
|
||||
}
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.fight.FightWorld;
|
||||
import net.minecraft.server.v1_14_R1.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class CraftbukkitWrapper14 implements CraftbukkitWrapper {
|
||||
@Override
|
||||
public void resetChunk(World world, World backup, int x, int z) {
|
||||
net.minecraft.server.v1_14_R1.World w = ((CraftWorld) world).getHandle();
|
||||
Chunk chunk = w.getChunkAt(x, z);
|
||||
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
||||
|
||||
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||
w.tileEntityListTick.removeAll(chunk.tileEntities.values());
|
||||
if (!FightWorld.isPAPER()) {
|
||||
w.tileEntityList.removeAll(chunk.tileEntities.values());
|
||||
}
|
||||
chunk.tileEntities.clear();
|
||||
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||
chunk.heightMap.clear();
|
||||
chunk.heightMap.putAll(backupChunk.heightMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float headRotation(Entity e) {
|
||||
return ((CraftEntity)e).getHandle().getHeadRotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<?> entityIterator() {
|
||||
return ((CraftWorld) Config.world).getHandle().entitiesById.values().stream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupGamerule() { }
|
||||
}
|
||||
-116
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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 org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Waterlogged;
|
||||
import org.bukkit.block.data.type.Dispenser;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Pose;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BlockDataMeta;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class FlatteningWrapper14 implements FlatteningWrapper {
|
||||
@Override
|
||||
public DyeColor getSilver() {
|
||||
return DyeColor.LIGHT_GRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWater(Block block) {
|
||||
if(block.getType() == Material.WATER)
|
||||
return true;
|
||||
|
||||
BlockData data = block.getBlockData();
|
||||
if(!(data instanceof Waterlogged))
|
||||
return false;
|
||||
|
||||
return ((Waterlogged) data).isWaterlogged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeWater(Block block) {
|
||||
Material type = block.getType();
|
||||
if(type == Material.WATER || type == Material.LAVA){
|
||||
block.setType(Material.AIR);
|
||||
return true;
|
||||
}
|
||||
|
||||
BlockData data = block.getBlockData();
|
||||
if(!(data instanceof Waterlogged))
|
||||
return false;
|
||||
|
||||
Waterlogged waterlogged = (Waterlogged) data;
|
||||
if(waterlogged.isWaterlogged()){
|
||||
block.setType(Material.AIR);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsBlockMeta(ItemMeta meta) {
|
||||
return meta instanceof BlockDataMeta && ((BlockDataMeta)meta).hasBlockData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAttributeModifier(ItemStack stack) {
|
||||
return stack.hasItemMeta() && Objects.requireNonNull(stack.getItemMeta()).hasAttributeModifiers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doRecord(BlockPhysicsEvent e) {
|
||||
return e.getBlock() == e.getSourceBlock() || e.getChangedType() == Material.AIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceLoadChunk(World world, int cX, int cZ) {
|
||||
world.setChunkForceLoaded(cX, cZ, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkPistonMoving(Block block) {
|
||||
return block.getType() == Material.MOVING_PISTON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFacingWater(Block dispenser) {
|
||||
return dispenser.getRelative(((Dispenser) dispenser.getBlockData()).getFacing()).isLiquid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCrouching(Player player) {
|
||||
return player.getPose() == Pose.SWIMMING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBlockChange(Player player, Block block, Material type) {
|
||||
player.sendBlockChange(block.getLocation(), type.createBlockData());
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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 org.bukkit.Sound;
|
||||
|
||||
public class SWSound14 implements SWSound.ISWSound {
|
||||
@Override
|
||||
public Sound getSound(SWSound sound) {
|
||||
switch(sound){
|
||||
case ENTITY_WITHER_DEATH:
|
||||
return Sound.ENTITY_WITHER_DEATH;
|
||||
case BLOCK_NOTE_BASS:
|
||||
return Sound.BLOCK_NOTE_BLOCK_BASS;
|
||||
case BLOCK_NOTE_PLING:
|
||||
return Sound.BLOCK_NOTE_BLOCK_PLING;
|
||||
case ENTITY_GENERIC_EXPLODE:
|
||||
return Sound.ENTITY_GENERIC_EXPLODE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
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.io.*;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.sql.NodeData;
|
||||
import de.steamwar.sql.SchematicData;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
public class WorldeditWrapper14 implements WorldeditWrapper {
|
||||
|
||||
private static final Map<BaseBlock, String> colorBlocks = new HashMap<>();
|
||||
|
||||
static {
|
||||
colorBlocks.put(Objects.requireNonNull(BlockTypes.PINK_WOOL).getDefaultState().toBaseBlock(), "_wool");
|
||||
colorBlocks.put(Objects.requireNonNull(BlockTypes.PINK_TERRACOTTA).getDefaultState().toBaseBlock(), "_terracotta");
|
||||
colorBlocks.put(Objects.requireNonNull(BlockTypes.PINK_STAINED_GLASS).getDefaultState().toBaseBlock(), "_stained_glass");
|
||||
colorBlocks.put(Objects.requireNonNull(BlockTypes.PINK_STAINED_GLASS_PANE).getDefaultState().toBaseBlock(), "_stained_glass_pane");
|
||||
colorBlocks.put(Objects.requireNonNull(BlockTypes.PINK_CONCRETE).getDefaultState().toBaseBlock(), "_concrete");
|
||||
colorBlocks.put(Objects.requireNonNull(BlockTypes.PINK_CONCRETE_POWDER).getDefaultState().toBaseBlock(), "_concrete_powder");
|
||||
colorBlocks.put(Objects.requireNonNull(BlockTypes.PINK_CARPET).getDefaultState().toBaseBlock(), "_carpet");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceTeamColor(Clipboard clipboard, DyeColor c) throws WorldEditException {
|
||||
BlockVector3 minimum = clipboard.getRegion().getMinimumPoint();
|
||||
Map<BaseBlock, BaseBlock> replaceMap = new HashMap<>();
|
||||
colorBlocks.forEach((base, postfix) -> replaceMap.put(base, Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + postfix)).getDefaultState().toBaseBlock()));
|
||||
|
||||
for(int x = 0; x < clipboard.getDimensions().getX(); x++){
|
||||
for(int y = 0; y < clipboard.getDimensions().getY(); y++){
|
||||
for(int z = 0; z < clipboard.getDimensions().getZ(); z++){
|
||||
BlockVector3 pos = minimum.add(x, y, z);
|
||||
BaseBlock replacement = replaceMap.get(clipboard.getFullBlock(pos));
|
||||
if(replacement != null)
|
||||
clipboard.setBlock(pos, replacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWaterDepth(Clipboard clipboard) {
|
||||
BlockVector3 it = clipboard.getMinimumPoint().add(0, 0, 1);
|
||||
int depth = 0;
|
||||
while(!clipboard.getBlock(it).getBlockType().getMaterial().isAir()){
|
||||
depth++;
|
||||
it = it.add(0, 1, 0);
|
||||
}
|
||||
return depth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteClipboard(Clipboard clipboard, Location position, Vector offset, AffineTransform aT) {
|
||||
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(new BukkitWorld(position.getWorld()), -1);
|
||||
ClipboardHolder ch = new ClipboardHolder(clipboard);
|
||||
ch.setTransform(aT);
|
||||
Operations.completeBlindly(ch.createPaste(e).to(BukkitAdapter.asVector(position).add(
|
||||
aT.apply(Vector3.at(offset.getX(), offset.getY(), offset.getZ()).add(clipboard.getOrigin().toVector3()).subtract(clipboard.getMinimumPoint().toVector3()))
|
||||
).toBlockPoint()).build());
|
||||
e.flushSession();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vector getDimensions(Clipboard clipboard) {
|
||||
BlockVector3 dims = clipboard.getDimensions();
|
||||
return new Vector(dims.getX(), dims.getY(), dims.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Clipboard loadChar(String charName) throws IOException {
|
||||
File file = new File(FightSystem.getPlugin().getDataFolder(), "text/" + charName + ".schem");
|
||||
Clipboard clipboard;
|
||||
try (ClipboardReader reader = Objects.requireNonNull(ClipboardFormats.findByFile(file)).getReader(new FileInputStream(file))) {
|
||||
clipboard = reader.read();
|
||||
}
|
||||
return clipboard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveSchem(SchematicNode schem, Region region, int minY) throws WorldEditException {
|
||||
World w = new BukkitWorld(Config.world);
|
||||
BlockVector3 min = BlockVector3.at(region.getMinX(), minY, region.getMinZ());
|
||||
CuboidRegion cuboidRegion = new CuboidRegion(w, min, BlockVector3.at(region.getMaxX(), region.getMaxY(), region.getMaxZ()).subtract(BlockVector3.ONE));
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(cuboidRegion);
|
||||
|
||||
ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(
|
||||
WorldEdit.getInstance().getEditSessionFactory().getEditSession(w, -1), cuboidRegion, clipboard, min
|
||||
);
|
||||
forwardExtentCopy.setCopyingEntities(false);
|
||||
Operations.complete(forwardExtentCopy);
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
try {
|
||||
ClipboardWriter writer = BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(outputStream);
|
||||
writer.write(clipboard);
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
throw new SecurityException(e);
|
||||
}
|
||||
|
||||
SchematicData.saveFromBytes(schem, outputStream.toByteArray(), NodeData.SchematicFormat.SPONGE_V2);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
steamwar.java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_Core", "default"))
|
||||
|
||||
compileOnly(libs.nms15)
|
||||
compileOnly(libs.worldedit15)
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.fight.FightWorld;
|
||||
import net.minecraft.server.v1_15_R1.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class CraftbukkitWrapper15 implements CraftbukkitWrapper {
|
||||
@Override
|
||||
public void resetChunk(World world, World backup, int x, int z) {
|
||||
net.minecraft.server.v1_15_R1.World w = ((CraftWorld) world).getHandle();
|
||||
Chunk chunk = w.getChunkAt(x, z);
|
||||
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
||||
|
||||
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||
w.tileEntityListTick.removeAll(chunk.tileEntities.values());
|
||||
if (!FightWorld.isPAPER()) {
|
||||
w.tileEntityList.removeAll(chunk.tileEntities.values());
|
||||
}
|
||||
chunk.tileEntities.clear();
|
||||
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||
chunk.heightMap.clear();
|
||||
chunk.heightMap.putAll(backupChunk.heightMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float headRotation(Entity e) {
|
||||
return ((CraftEntity)e).getHandle().getHeadRotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<?> entityIterator() {
|
||||
return ((CraftWorld) Config.world).getHandle().entitiesById.values().stream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupGamerule() { }
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
steamwar.java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_Core", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_14", "default"))
|
||||
|
||||
compileOnly(libs.spigotapi)
|
||||
|
||||
compileOnly(libs.nms18)
|
||||
compileOnly(libs.fawe18)
|
||||
|
||||
compileOnly(libs.authlib)
|
||||
compileOnly(libs.fastutil)
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.TinyProtocol;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import de.steamwar.core.ProtocolWrapper;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BlockIdWrapper18 extends BlockIdWrapper14 {
|
||||
|
||||
@Override
|
||||
public void trackEntity(Player player, Entity entity) {
|
||||
if(entity instanceof Player)
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE));
|
||||
|
||||
player.showEntity(FightSystem.getPlugin(), entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void untrackEntity(Player player, Entity entity) {
|
||||
player.hideEntity(FightSystem.getPlugin(), entity);
|
||||
|
||||
if(entity instanceof Player)
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE));
|
||||
}
|
||||
}
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.Reflection;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import net.minecraft.server.level.WorldServer;
|
||||
import net.minecraft.world.level.chunk.Chunk;
|
||||
import net.minecraft.world.level.chunk.ChunkSection;
|
||||
import net.minecraft.world.level.entity.LevelEntityGetter;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
public class CraftbukkitWrapper18 implements CraftbukkitWrapper {
|
||||
|
||||
private static final Reflection.Method getWorld = Reflection.getMethod(Reflection.getClass("org.bukkit.craftbukkit.CraftWorld"), "getHandle");
|
||||
private static final Reflection.Method getChunk = Reflection.getTypedMethod(net.minecraft.world.level.World.class, null, Chunk.class, int.class, int.class);
|
||||
private static final Reflection.Method getChunkSections = Reflection.getTypedMethod(Chunk.class, null, ChunkSection[].class);
|
||||
private ChunkSection[] getChunkSections(World world, int x, int z) {
|
||||
return (ChunkSection[]) getChunkSections.invoke(getChunk.invoke(getWorld.invoke(world), x, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetChunk(World world, World backup, int x, int z) {
|
||||
ChunkSection[] sections = getChunkSections(world, x, z);
|
||||
System.arraycopy(getChunkSections(backup, x, z), 0, sections, 0, sections.length);
|
||||
}
|
||||
|
||||
private static final Reflection.Method getEntity = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.entity.CraftEntity"), "getHandle", net.minecraft.world.entity.Entity.class);
|
||||
protected net.minecraft.world.entity.Entity getEntity(Entity e) {
|
||||
return (net.minecraft.world.entity.Entity) getEntity.invoke(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float headRotation(Entity e) {
|
||||
return getEntity(e).ce();
|
||||
}
|
||||
|
||||
private static final Reflection.Method getWorldEntities = Reflection.getTypedMethod(WorldServer.class, null, LevelEntityGetter.class);
|
||||
private static final Reflection.Method getIterable = Reflection.getTypedMethod(LevelEntityGetter.class, null, Iterable.class);
|
||||
@Override
|
||||
public Stream<?> entityIterator() {
|
||||
return StreamSupport.stream(((Iterable<?>) getIterable.invoke(getWorldEntities.invoke(getWorld.invoke(Config.world)))).spliterator(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupGamerule() { }
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.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 java.util.List;
|
||||
|
||||
|
||||
public class HullHiderWrapper18 implements HullHiderWrapper {
|
||||
|
||||
private static final Reflection.Method getState = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.block.data.CraftBlockData"), "getState", IBlockData.class);
|
||||
@Override
|
||||
public Object generateBlockChangePacket(List<Hull.IntVector> changes) {
|
||||
Object[] blockdata = new Object[changes.size()];
|
||||
for(int i = 0; i < blockdata.length; i++) {
|
||||
Hull.IntVector change = changes.get(i);
|
||||
blockdata[i] = getState.invoke(Config.world.getBlockData(change.getX(), change.getY(), change.getZ()));
|
||||
}
|
||||
|
||||
return generateBlockChangePacket(changes, blockdata);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
steamwar.java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":FightSystem:FightSystem_Core", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_18", "default"))
|
||||
|
||||
compileOnly(libs.spigotapi)
|
||||
|
||||
compileOnly(libs.nms19)
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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 org.bukkit.entity.Entity;
|
||||
|
||||
public class CraftbukkitWrapper19 extends CraftbukkitWrapper18 {
|
||||
|
||||
@Override
|
||||
public float headRotation(Entity e) {
|
||||
return getEntity(e).ck();
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
steamwar.java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":FightSystem:FightSystem_Core", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_18", "default"))
|
||||
|
||||
compileOnly(libs.spigotapi)
|
||||
|
||||
compileOnly(libs.nms20)
|
||||
|
||||
compileOnly(libs.fastutil)
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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 org.bukkit.entity.Entity;
|
||||
|
||||
public class CraftbukkitWrapper20 extends CraftbukkitWrapper18 {
|
||||
|
||||
@Override
|
||||
public float headRotation(Entity e) {
|
||||
return getEntity(e).cm();
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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));
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
steamwar.java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":FightSystem:FightSystem_Core", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_18", "default"))
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
|
||||
compileOnly(libs.paperapi21) {
|
||||
attributes {
|
||||
// Very Hacky, but it works
|
||||
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21)
|
||||
}
|
||||
}
|
||||
|
||||
compileOnly(libs.nms21) {
|
||||
attributes {
|
||||
// Very Hacky, but it works
|
||||
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 21)
|
||||
}
|
||||
}
|
||||
|
||||
compileOnly(libs.fastutil)
|
||||
compileOnly(libs.authlib)
|
||||
compileOnly(project(":FightSystem:FightSystem_14"))
|
||||
}
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.listener;
|
||||
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentTask;
|
||||
import net.minecraft.world.entity.projectile.windcharge.WindCharge;
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class WindchargeStopper21 implements WindchargeStopper.IWindchargeStopper {
|
||||
|
||||
public WindchargeStopper21() {
|
||||
new StateDependentTask(true, FightState.Running, this::run, 1, 1);
|
||||
}
|
||||
|
||||
private static final int middleLine = Config.SpecSpawn.getBlockZ();
|
||||
|
||||
private static final Class<?> windChargeClass = WindCharge.class;
|
||||
|
||||
private void run() {
|
||||
Recording.iterateOverEntities(windChargeClass::isInstance, entity -> {
|
||||
Location location = entity.getLocation();
|
||||
Location prevLocation = location.clone().subtract(entity.getVelocity());
|
||||
|
||||
boolean passedMiddle = location.getBlockZ() > middleLine && prevLocation.getBlockZ() > middleLine ||
|
||||
location.getBlockZ() < middleLine && prevLocation.getBlockZ() < middleLine;
|
||||
|
||||
if(!passedMiddle) {
|
||||
entity.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.TinyProtocol;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import de.steamwar.core.ProtocolWrapper;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.craftbukkit.block.CraftBlockState;
|
||||
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BlockIdWrapper21 implements BlockIdWrapper {
|
||||
|
||||
@Override
|
||||
public Material idToMaterial(int blockState) {
|
||||
return CraftMagicNumbers.getMaterial(net.minecraft.world.level.block.Block.stateById(blockState)).getItemType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int blockToId(Block block) {
|
||||
return net.minecraft.world.level.block.Block.getId(((CraftBlockState) block.getState()).getHandle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(World world, int x, int y, int z, int blockState) {
|
||||
BlockState blockData = net.minecraft.world.level.block.Block.stateById(blockState);
|
||||
ServerLevel level = ((CraftWorld) world).getHandle();
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
level.removeBlockEntity(pos);
|
||||
level.setBlock(pos, blockData, blockState);
|
||||
level.getChunkSource().blockChanged(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void trackEntity(Player player, Entity entity) {
|
||||
if(entity instanceof Player)
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE));
|
||||
|
||||
player.showEntity(FightSystem.getPlugin(), entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void untrackEntity(Player player, Entity entity) {
|
||||
player.hideEntity(FightSystem.getPlugin(), entity);
|
||||
|
||||
if(entity instanceof Player)
|
||||
TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE));
|
||||
}
|
||||
}
|
||||
-61
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.fightsystem.Config;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.world.level.chunk.LevelChunkSection;
|
||||
import org.bukkit.GameRule;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class CraftbukkitWrapper21 extends CraftbukkitWrapper18 {
|
||||
|
||||
@Override
|
||||
public float headRotation(Entity e) {
|
||||
return getEntity(e).getYHeadRot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupGamerule() {
|
||||
Config.world.setGameRule(GameRule.LOCATOR_BAR, false);
|
||||
}
|
||||
|
||||
private LevelChunk getChunk(World world, int x, int z) {
|
||||
return ((CraftWorld) world).getHandle().getChunk(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetChunk(World world, World backup, int x, int z) {
|
||||
LevelChunk worldChunk = getChunk(world, x, z);
|
||||
LevelChunk backupChunk = getChunk(backup, x, z);
|
||||
LevelChunkSection[] sections = worldChunk.getSections();
|
||||
System.arraycopy(backupChunk.getSections(), 0, sections, 0, sections.length);
|
||||
Set<BlockPos> blocks = new HashSet<>(worldChunk.blockEntities.keySet());
|
||||
blocks.stream().filter(key -> !backupChunk.blockEntities.containsKey(key)).forEach(worldChunk::removeBlockEntity);
|
||||
worldChunk.heightmaps.clear();
|
||||
worldChunk.heightmaps.putAll(backupChunk.heightmaps);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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 org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class FlatteningWrapper21 extends FlatteningWrapper14 {
|
||||
@Override
|
||||
public boolean hasAttributeModifier(ItemStack stack) {
|
||||
return stack.hasItemMeta() && stack.getItemMeta() != null && stack.getItemMeta().hasAttributeModifiers();
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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 io.papermc.paper.datacomponent.DataComponentType;
|
||||
import io.papermc.paper.datacomponent.DataComponentTypes;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ReflectionWrapper21 implements ReflectionWrapper {
|
||||
private static final Set<DataComponentType> FORBIDDEN_TYPES = new HashSet<>();
|
||||
|
||||
static {
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.CUSTOM_NAME);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.PROFILE);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.UNBREAKABLE);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.BLOCK_DATA);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.BLOCKS_ATTACKS);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.BUNDLE_CONTENTS);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.CUSTOM_MODEL_DATA);
|
||||
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.ATTRIBUTE_MODIFIERS);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.TOOL);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.WEAPON);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.FOOD);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.CONSUMABLE);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.POTION_CONTENTS);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.STORED_ENCHANTMENTS);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.CAN_BREAK);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.CAN_PLACE_ON);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.MAX_DAMAGE);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.USE_REMAINDER);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.USE_COOLDOWN);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.SUSPICIOUS_STEW_EFFECTS);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.CHARGED_PROJECTILES);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.INTANGIBLE_PROJECTILE);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.FIREWORKS);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.FIREWORK_EXPLOSION);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.EQUIPPABLE);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.REPAIR_COST);
|
||||
FORBIDDEN_TYPES.add(DataComponentTypes.ENCHANTABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object explosionHider(Player player, Object packet, PacketHiderFunction packetHiderFunction) {
|
||||
return packet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasItems(ItemStack stack) {
|
||||
FORBIDDEN_TYPES.forEach(stack::resetData);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
public class TpsWarper21 implements TpsWarper {
|
||||
|
||||
@Override
|
||||
public void warp(float tps) {
|
||||
MinecraftServer.getServer().tickRateManager().setTickRate(tps);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
steamwar.java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_Core", "default"))
|
||||
|
||||
compileOnly(libs.nms8)
|
||||
compileOnly(libs.worldedit12)
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.listener;
|
||||
|
||||
public class WindchargeStopper8 implements WindchargeStopper.IWindchargeStopper {
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.Reflection;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BlockIdWrapper8 implements BlockIdWrapper {
|
||||
|
||||
private static final Class<?> entityTracker = Reflection.getClass("net.minecraft.EntityTracker");
|
||||
private static final Reflection.Field<?> getEntityTracker = Reflection.getField(worldServer, entityTracker, 0);
|
||||
private static final Class<?> intHashMap = Reflection.getClass("net.minecraft.IntHashMap");
|
||||
private static final Reflection.Field<?> getTrackedEntities = Reflection.getField(entityTracker, intHashMap, 0);
|
||||
|
||||
private final Object trackers;
|
||||
public BlockIdWrapper8() {
|
||||
trackers = getTrackedEntities.get(getEntityTracker.get(getWorldHandle.invoke(Config.world)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public int blockToId(Block block) {
|
||||
return block.getTypeId() << 4 + block.getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void setBlock(World world, int x, int y, int z, int blockState) {
|
||||
if((blockState >> 4) > 256) // Illegal blockstate / corrupted replay
|
||||
blockState = 0;
|
||||
|
||||
world.getBlockAt(x, y, z).setTypeIdAndData(blockState >> 4, (byte)(blockState & 0b1111), false);
|
||||
}
|
||||
|
||||
private static final Class<?> entityTrackerEntry = Reflection.getClass("net.minecraft.EntityTrackerEntry");
|
||||
private static final Reflection.Method get = Reflection.getTypedMethod(intHashMap, "get", Object.class, int.class);
|
||||
private static final Reflection.Method updatePlayer = Reflection.getMethod(entityTrackerEntry, "updatePlayer", entityPlayer);
|
||||
@Override
|
||||
public void trackEntity(Player player, Entity entity) {
|
||||
Object tracker = get.invoke(trackers, entity.getEntityId());
|
||||
if(tracker != null)
|
||||
updatePlayer.invoke(tracker, getPlayer.invoke(player));
|
||||
}
|
||||
|
||||
private static final Reflection.Method clearPlayer = Reflection.getMethod(entityTrackerEntry, "a", entityPlayer);
|
||||
@Override
|
||||
public void untrackEntity(Player player, Entity entity) {
|
||||
Object tracker = get.invoke(trackers, entity.getEntityId());
|
||||
if(tracker != null)
|
||||
clearPlayer.invoke(tracker, getPlayer.invoke(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public Material idToMaterial(int blockState) {
|
||||
if((blockState >> 4) > 256) // Illegal blockstate / corrupted replay
|
||||
blockState = 0;
|
||||
|
||||
return Material.getMaterial(blockState >> 4);
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.listener.Recording;
|
||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_8_R3.EntityEnderDragon;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class BountifulWrapper8 implements BountifulWrapper {
|
||||
|
||||
public BountifulWrapper8() {
|
||||
EntityEnderDragon dragon = new EntityEnderDragon(null);
|
||||
dragon.setLocation(Config.ArenaRegion.centerX(), -100, Config.ArenaRegion.centerZ(), 0, 0);
|
||||
this.spawnDragonId = dragon.getId();
|
||||
this.spawnDragon = new PacketPlayOutSpawnEntityLiving(dragon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mainHand(Object packet) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bowInHand(boolean mainHand, Player p) {
|
||||
return p.getInventory().getItemInHand().getType() == Material.BOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttackSpeed(Player player) {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNametagVisibility(Team team) {
|
||||
//nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener newDenyArrowPickupListener() {
|
||||
return new Listener() {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener newDenyHandSwapListener() {
|
||||
return new Listener() {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordHandItems(Player player) {
|
||||
GlobalRecorder.getInstance().item(player, Recording.disarmNull(player.getInventory().getItemInHand()), "MAINHAND");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener newHandSwapRecorder() {
|
||||
return new Listener() {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(World world, String particleName, double x, double y, double z) {
|
||||
world.playEffect(new Location(world, x, y, z), Effect.valueOf(particleName), 1);
|
||||
}
|
||||
|
||||
private final Set<Player> seesDragon = new HashSet<>();
|
||||
private final PacketPlayOutSpawnEntityLiving spawnDragon;
|
||||
private final int spawnDragonId;
|
||||
@Override
|
||||
public void sendBar(Player player, FightTeam team, double progress, String text) {
|
||||
seesDragon.removeIf(p -> !p.isOnline());
|
||||
|
||||
if(!seesDragon.contains(player)) {
|
||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(spawnDragon);
|
||||
seesDragon.add(player);
|
||||
}
|
||||
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(0, (byte) 0x20);
|
||||
watcher.a(2, text);
|
||||
watcher.a(3, (byte) 1);
|
||||
watcher.a(4, (byte) 1);
|
||||
watcher.a(6, (float)(progress * 200));
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(spawnDragonId, watcher, true));
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.fightsystem.Config;
|
||||
import net.minecraft.server.v1_8_R3.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class CraftbukkitWrapper8 implements CraftbukkitWrapper {
|
||||
@Override
|
||||
public void resetChunk(World world, World backup, int x, int z) {
|
||||
net.minecraft.server.v1_8_R3.World w = ((CraftWorld) world).getHandle();
|
||||
Chunk chunk = w.getChunkAt(x, z);
|
||||
((CraftWorld) backup).getHandle().chunkProviderServer.forceChunkLoad = true;
|
||||
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
||||
|
||||
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||
System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length);
|
||||
w.tileEntityList.removeAll(chunk.tileEntities.values());
|
||||
chunk.tileEntities.clear();
|
||||
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float headRotation(Entity e) {
|
||||
return ((CraftEntity)e).getHandle().getHeadRotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<?> entityIterator() {
|
||||
return ((CraftWorld) Config.world).getHandle().entityList.stream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupGamerule() { }
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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 org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public class FlatteningWrapper8 implements FlatteningWrapper {
|
||||
@Override
|
||||
public DyeColor getSilver() {
|
||||
return DyeColor.SILVER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWater(Block block) {
|
||||
Material type = block.getType();
|
||||
return type == Material.WATER || type == Material.STATIONARY_WATER || type == Material.LAVA || type == Material.STATIONARY_LAVA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeWater(Block block) {
|
||||
if(isWater(block)){
|
||||
block.setType(Material.AIR);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsBlockMeta(ItemMeta meta) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAttributeModifier(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doRecord(BlockPhysicsEvent e) {
|
||||
return e.getChangedType() != e.getBlock().getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceLoadChunk(World world, int cX, int cZ) {
|
||||
world.setKeepSpawnInMemory(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkPistonMoving(Block block) {
|
||||
return block.getType() == Material.PISTON_MOVING_PIECE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFacingWater(Block dispenser) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCrouching(Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void sendBlockChange(Player player, Block block, Material type) {
|
||||
player.sendBlockChange(block.getLocation(), type, (byte)0);
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.Reflection;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class HullHiderWrapper8 implements HullHiderWrapper {
|
||||
|
||||
private static final Reflection.Constructor newMultiBlockChange = Reflection.getConstructor("net.minecraft.PacketPlayOutMultiBlockChange", int.class, short[].class, Reflection.getClass("net.minecraft.Chunk"));
|
||||
private static final Reflection.Method getHandle = Reflection.getMethod("org.bukkit.craftbukkit.CraftChunk", "getHandle");
|
||||
@Override
|
||||
public Object generateBlockChangePacket(List<Hull.IntVector> changes) {
|
||||
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())));
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.Reflection;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class ReflectionWrapper8 implements ReflectionWrapper {
|
||||
|
||||
private static final Class<?> packetPlayOutExplosion = Reflection.getClass("net.minecraft.network.protocol.game.ClientboundExplodePacket");
|
||||
private static final Reflection.Field<List> explosionBlocks = Reflection.getField(packetPlayOutExplosion, List.class, 0);
|
||||
private static final Function<Object, Location> explosionLocation = HullHider.posPacketToLocation(packetPlayOutExplosion, double.class, 1.0);
|
||||
|
||||
@Override
|
||||
public Object explosionHider(Player player, Object packet, PacketHiderFunction packetHiderFunction) {
|
||||
if(explosionBlocks.get(packet).isEmpty())
|
||||
return packetHiderFunction.hide(player, packet, explosionLocation.apply(packet));
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
|
||||
private static final Class<?> itemStack = Reflection.getClass("net.minecraft.world.item.ItemStack");
|
||||
private static final Reflection.Method asNMSCopy = Reflection.getTypedMethod(Reflection.getClass("org.bukkit.craftbukkit.inventory.CraftItemStack"), "asNMSCopy", itemStack, ItemStack.class);
|
||||
private static final Class<?> nbtTagCompound = Reflection.getClass("net.minecraft.nbt.CompoundTag");
|
||||
private static final Reflection.Method getTag = Reflection.getTypedMethod(itemStack, null, nbtTagCompound);
|
||||
private static final Reflection.Method getKeys = Reflection.getTypedMethod(nbtTagCompound, null, Set.class);
|
||||
@Override
|
||||
public boolean hasItems(ItemStack stack) {
|
||||
Set<String> keys = new HashSet<>((Set<String>) getKeys.invoke(getTag.invoke(asNMSCopy.invoke(null, stack))));
|
||||
keys.remove("Enchantments");
|
||||
keys.remove("Damage");
|
||||
return !keys.isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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 org.bukkit.Sound;
|
||||
|
||||
public class SWSound8 implements SWSound.ISWSound {
|
||||
@Override
|
||||
public Sound getSound(SWSound sound) {
|
||||
switch(sound){
|
||||
case ENTITY_WITHER_DEATH:
|
||||
return Sound.WITHER_DEATH;
|
||||
case BLOCK_NOTE_BASS:
|
||||
return Sound.NOTE_BASS;
|
||||
case BLOCK_NOTE_PLING:
|
||||
return Sound.NOTE_PLING;
|
||||
case ENTITY_GENERIC_EXPLODE:
|
||||
return Sound.EXPLODE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package de.steamwar.fightsystem.utils;
|
||||
|
||||
import de.steamwar.core.TPSWarpUtils;
|
||||
|
||||
public class TpsWarper8 implements TpsWarper {
|
||||
|
||||
@Override
|
||||
public void warp(float tps) {
|
||||
TPSWarpUtils.warp(tps);
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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 org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
public class WorldOfColorWrapper8 implements WorldOfColorWrapper {
|
||||
@Override
|
||||
public void setTeamColor(Team team, ChatColor color) {
|
||||
team.setPrefix("§" + color.getChar());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInBlock(Projectile e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playSound(Location location, Sound sound, String soundCategory, float volume, float pitch) {
|
||||
location.getWorld().playSound(location, sound, volume, pitch);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void sendTitle(Player player, String title, String subtitle, int start, int hold, int stop) {
|
||||
player.sendTitle(title, subtitle);
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.sk89q.jnbt.NBTInputStream;
|
||||
import com.sk89q.worldedit.*;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
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.io.ClipboardFormat;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter;
|
||||
import com.sk89q.worldedit.extent.clipboard.io.SchematicReader;
|
||||
import com.sk89q.worldedit.function.operation.ForwardExtentCopy;
|
||||
import com.sk89q.worldedit.function.operation.Operations;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.regions.CuboidRegion;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.sql.NodeData;
|
||||
import de.steamwar.sql.SchematicData;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class WorldeditWrapper8 implements WorldeditWrapper {
|
||||
|
||||
protected static final int COLOR_TO_REPLACE = DyeColor.PINK.getWoolData();
|
||||
protected static final Set<BaseBlock> colorBlocks = new HashSet<>();
|
||||
|
||||
static {
|
||||
colorBlocks.add(new BaseBlock(Material.WOOL.getId(), COLOR_TO_REPLACE));
|
||||
colorBlocks.add(new BaseBlock(Material.STAINED_GLASS.getId(), COLOR_TO_REPLACE));
|
||||
colorBlocks.add(new BaseBlock(Material.CLAY.getId(), COLOR_TO_REPLACE));
|
||||
colorBlocks.add(new BaseBlock(Material.STAINED_GLASS_PANE.getId(), COLOR_TO_REPLACE));
|
||||
colorBlocks.add(new BaseBlock(Material.CARPET.getId(), COLOR_TO_REPLACE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replaceTeamColor(Clipboard clipboard, DyeColor c) throws WorldEditException {
|
||||
Vector minimum = clipboard.getRegion().getMinimumPoint();
|
||||
Map<BaseBlock, BaseBlock> replaceMap = new HashMap<>();
|
||||
colorBlocks.forEach(base -> replaceMap.put(base, new BaseBlock(base.getId(), c.getWoolData())));
|
||||
|
||||
for(int x = 0; x < clipboard.getDimensions().getX(); x++){
|
||||
for(int y = 0; y < clipboard.getDimensions().getY(); y++){
|
||||
for(int z = 0; z < clipboard.getDimensions().getZ(); z++){
|
||||
Vector pos = minimum.add(x, y, z);
|
||||
BaseBlock replacement = replaceMap.get(clipboard.getBlock(pos));
|
||||
if(replacement != null)
|
||||
clipboard.setBlock(pos, replacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWaterDepth(Clipboard clipboard) {
|
||||
Vector it = clipboard.getMinimumPoint().add(0, 0, 1);
|
||||
int depth = 0;
|
||||
while(!clipboard.getBlock(it).isAir()) {
|
||||
depth++;
|
||||
it = it.add(0, 1, 0);
|
||||
}
|
||||
return depth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteClipboard(Clipboard clipboard, Location position, org.bukkit.util.Vector offset, AffineTransform aT) {
|
||||
World w = new BukkitWorld(position.getWorld());
|
||||
EditSession e = WorldEdit.getInstance().getEditSessionFactory().getEditSession(w, -1);
|
||||
ClipboardHolder ch = new ClipboardHolder(clipboard, w.getWorldData());
|
||||
ch.setTransform(aT);
|
||||
Operations.completeBlindly(ch.createPaste(e, w.getWorldData()).to(new Vector(position.getX(), position.getY(), position.getZ()).add(
|
||||
aT.apply(new Vector(offset.getX(), offset.getY(), offset.getZ()).add(clipboard.getOrigin()).subtract(clipboard.getMinimumPoint()))
|
||||
).toBlockPoint()).build());
|
||||
e.flushQueue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.util.Vector getDimensions(Clipboard clipboard) {
|
||||
Vector dims = clipboard.getDimensions();
|
||||
return new org.bukkit.util.Vector(dims.getBlockX(), dims.getBlockY(), dims.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Clipboard loadChar(String charName) throws IOException {
|
||||
return new SchematicReader(new NBTInputStream(new GZIPInputStream(new FileInputStream(new File(FightSystem.getPlugin().getDataFolder(), "text/" + charName + ".schematic"))))).read(new BukkitWorld(Config.world).getWorldData());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveSchem(SchematicNode schem, Region region, int minY) throws WorldEditException {
|
||||
World w = new BukkitWorld(Config.world);
|
||||
Vector min = new Vector(region.getMinX(), minY, region.getMinZ());
|
||||
CuboidRegion cuboidRegion = new CuboidRegion(w, min, new Vector(region.getMaxX(), region.getMaxY(), region.getMaxZ()).subtract(Vector.ONE));
|
||||
BlockArrayClipboard clipboard = new BlockArrayClipboard(cuboidRegion);
|
||||
|
||||
ForwardExtentCopy forwardExtentCopy = new ForwardExtentCopy(
|
||||
WorldEdit.getInstance().getEditSessionFactory().getEditSession(w, -1), cuboidRegion, clipboard, min
|
||||
);
|
||||
Operations.complete(forwardExtentCopy);
|
||||
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
try {
|
||||
ClipboardWriter writer = ClipboardFormat.SCHEMATIC.getWriter(outputStream);
|
||||
writer.write(clipboard, w.getWorldData());
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
throw new SecurityException(e);
|
||||
}
|
||||
|
||||
SchematicData.saveFromBytes(schem, outputStream.toByteArray(), NodeData.SchematicFormat.MCEDIT);
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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/>.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
steamwar.java
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_Core", "default"))
|
||||
compileOnly(project(":FightSystem:FightSystem_8", "default"))
|
||||
|
||||
compileOnly(libs.nms9)
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.Reflection;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.listener.Recording;
|
||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerPickupArrowEvent;
|
||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||
import org.bukkit.scoreboard.Team;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class BountifulWrapper9 implements BountifulWrapper {
|
||||
|
||||
private static final Class<?> enumHand = Reflection.getClass("net.minecraft.world.InteractionHand");
|
||||
private static final Object mainHand = enumHand.getEnumConstants()[0];
|
||||
private static final Reflection.Field<?> blockPlaceHand = Reflection.getField(Recording.blockPlacePacket, enumHand, 0);
|
||||
|
||||
@Override
|
||||
public boolean mainHand(Object packet) {
|
||||
return blockPlaceHand.get(packet) == mainHand;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean bowInHand(boolean mainHand, Player p) {
|
||||
return (mainHand ? p.getInventory().getItemInMainHand() : p.getInventory().getItemInOffHand()).getType() == Material.BOW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttackSpeed(Player player) {
|
||||
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
|
||||
attribute.setBaseValue(16);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNametagVisibility(Team team) {
|
||||
team.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.FOR_OWN_TEAM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener newDenyArrowPickupListener() {
|
||||
return new Listener() {
|
||||
@EventHandler
|
||||
public void onArrowPickup(PlayerPickupArrowEvent e){
|
||||
if(Fight.fighting(e.getPlayer()))
|
||||
e.setCancelled(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener newDenyHandSwapListener() {
|
||||
return new Listener() {
|
||||
@EventHandler
|
||||
public void onSwapItems(PlayerSwapHandItemsEvent event) {
|
||||
if(Fight.fighting(event.getPlayer()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recordHandItems(Player player) {
|
||||
GlobalRecorder.getInstance().item(player, Recording.disarmNull(player.getInventory().getItemInMainHand()), "MAINHAND");
|
||||
GlobalRecorder.getInstance().item(player, Recording.disarmNull(player.getInventory().getItemInOffHand()), "OFFHAND");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Listener newHandSwapRecorder() {
|
||||
return new Listener() {
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onItemSwap(PlayerSwapHandItemsEvent e){
|
||||
if(Recording.isNotSent(e.getPlayer()))
|
||||
return;
|
||||
|
||||
Player player = e.getPlayer();
|
||||
GlobalRecorder.getInstance().item(player, Recording.disarmNull(e.getMainHandItem()), "MAINHAND");
|
||||
GlobalRecorder.getInstance().item(player, Recording.disarmNull(e.getOffHandItem()), "OFFHAND");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(World world, String particleName, double x, double y, double z) {
|
||||
world.spawnParticle(Particle.valueOf(particleName), x, y, z, 1);
|
||||
}
|
||||
|
||||
private final Map<Player, BossBar> barMap = new HashMap<>();
|
||||
@Override
|
||||
public void sendBar(Player player, FightTeam team, double progress, String text) {
|
||||
barMap.keySet().removeIf(p -> !p.isOnline());
|
||||
|
||||
if(!barMap.containsKey(player)) {
|
||||
BossBar bar = Bukkit.createBossBar(player.getName(), BarColor.WHITE, BarStyle.SOLID);
|
||||
barMap.put(player, bar);
|
||||
bar.addPlayer(player);
|
||||
}
|
||||
|
||||
BossBar bar = barMap.get(player);
|
||||
BarColor color = chat2bar(team.getColor());
|
||||
if(bar.getColor() != color)
|
||||
bar.setColor(color);
|
||||
|
||||
if(bar.getProgress() != progress)
|
||||
bar.setProgress(progress);
|
||||
|
||||
if(!bar.getTitle().equals(text))
|
||||
bar.setTitle(text);
|
||||
}
|
||||
|
||||
private BarColor chat2bar(ChatColor color) {
|
||||
switch(color) {
|
||||
case DARK_BLUE:
|
||||
case DARK_AQUA:
|
||||
case BLUE:
|
||||
case AQUA:
|
||||
return BarColor.BLUE;
|
||||
case GREEN:
|
||||
case DARK_GREEN:
|
||||
return BarColor.GREEN;
|
||||
case DARK_RED:
|
||||
case RED:
|
||||
return BarColor.RED;
|
||||
case DARK_PURPLE:
|
||||
return BarColor.PURPLE;
|
||||
case GOLD:
|
||||
case YELLOW:
|
||||
return BarColor.YELLOW;
|
||||
case LIGHT_PURPLE:
|
||||
return BarColor.PINK;
|
||||
case BLACK:
|
||||
case WHITE:
|
||||
case GRAY:
|
||||
case DARK_GRAY:
|
||||
default:
|
||||
return BarColor.WHITE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.fight.FightWorld;
|
||||
import net.minecraft.server.v1_9_R2.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class CraftbukkitWrapper9 implements CraftbukkitWrapper {
|
||||
@Override
|
||||
public void resetChunk(World world, World backup, int x, int z) {
|
||||
net.minecraft.server.v1_9_R2.World w = ((CraftWorld) world).getHandle();
|
||||
Chunk chunk = w.getChunkAt(x, z);
|
||||
Chunk backupChunk = ((CraftWorld) backup).getHandle().getChunkAt(x, z);
|
||||
|
||||
System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length);
|
||||
System.arraycopy(backupChunk.heightMap, 0, chunk.heightMap, 0, chunk.heightMap.length);
|
||||
w.tileEntityListTick.removeAll(chunk.tileEntities.values());
|
||||
if (!FightWorld.isPAPER()) {
|
||||
w.tileEntityList.removeAll(chunk.tileEntities.values());
|
||||
}
|
||||
chunk.tileEntities.clear();
|
||||
chunk.tileEntities.putAll(backupChunk.tileEntities);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float headRotation(Entity e) {
|
||||
return ((CraftEntity)e).getHandle().getHeadRotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<?> entityIterator() {
|
||||
return ((CraftWorld) Config.world).getHandle().entityList.stream();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupGamerule() { }
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2025 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 org.bukkit.Sound;
|
||||
|
||||
public class SWSound9 implements SWSound.ISWSound {
|
||||
@Override
|
||||
public Sound getSound(SWSound sound){
|
||||
switch(sound){
|
||||
case ENTITY_WITHER_DEATH:
|
||||
return Sound.ENTITY_WITHER_DEATH;
|
||||
case BLOCK_NOTE_BASS:
|
||||
return Sound.BLOCK_NOTE_BASS;
|
||||
case BLOCK_NOTE_PLING:
|
||||
return Sound.BLOCK_NOTE_PLING;
|
||||
case ENTITY_GENERIC_EXPLODE:
|
||||
return Sound.ENTITY_GENERIC_EXPLODE;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,15 +21,20 @@ plugins {
|
||||
steamwar.java
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.classindex)
|
||||
annotationProcessor(libs.classindex)
|
||||
compileOnly(project(":SpigotCore", "default"))
|
||||
|
||||
compileOnly(libs.spigotapi)
|
||||
|
||||
compileOnly(libs.worldedit15)
|
||||
compileOnly(libs.netty)
|
||||
compileOnly(libs.paperapi)
|
||||
compileOnly(libs.fastutil)
|
||||
compileOnly(libs.authlib)
|
||||
compileOnly(libs.netty)
|
||||
compileOnly(libs.nms)
|
||||
compileOnly(libs.fawe)
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ Server:
|
||||
# Server java archive
|
||||
ServerJar: ""
|
||||
# Available arenas
|
||||
Maps: []
|
||||
Maps: [ ]
|
||||
# Names to address the game mode in the chat interface
|
||||
ChatNames: []
|
||||
ChatNames: [ ]
|
||||
# If the game mode should be marked as a historic game mode
|
||||
Historic: false # defaults to false if missing
|
||||
# If ranked matches should be available for the game mode
|
||||
@@ -16,7 +16,7 @@ Server:
|
||||
Deadline: null # defaults to null if missing
|
||||
|
||||
# The questions that have to be answered to accept the schematic
|
||||
CheckQuestions: [] # Disables check schem type if missing
|
||||
CheckQuestions: [ ] # Disables check schem type if missing
|
||||
|
||||
Times:
|
||||
# Time in seconds the server stops after starting if nobody joins
|
||||
@@ -70,7 +70,7 @@ Schematic:
|
||||
# The schematic type that can be chosen in this arena
|
||||
Type: Normal # defaults to Normal if missing
|
||||
# The schematic types that are also allowed to be chosen in this arena
|
||||
SubTypes: [] # defaults to empty List
|
||||
SubTypes: [ ] # defaults to empty List
|
||||
# Shortcut of the schematic type
|
||||
Shortcut: "" # defaults to "" if missing
|
||||
# Spigot (1.8) material for GUIs
|
||||
@@ -100,14 +100,14 @@ Schematic:
|
||||
# List of limited material (combinations)
|
||||
# List contains tags Amount (integer) and Materials (List of material names in Spigot 1.12 AND Spigot 1.15 format)
|
||||
Limited:
|
||||
- Materials: []
|
||||
- Materials: [ ]
|
||||
Amount: 0
|
||||
|
||||
# The name of the game mode presented to the players
|
||||
GameName: WarGear # defaults to WarGear if missing
|
||||
# The months this game mode should be active and playable
|
||||
# The empty List means all of them
|
||||
ActiveMonths: [] # defaults to none if missing
|
||||
ActiveMonths: [ ] # defaults to none if missing
|
||||
# The prefix used for team chats
|
||||
TeamChatPrefix: + # defaults to + if missing
|
||||
Blue:
|
||||
@@ -149,7 +149,7 @@ WinConditionParams:
|
||||
# Is Blocks a whitelist (true) or blacklist (false)
|
||||
BlocksWhitelist: false # defaults to false if missing
|
||||
# Special Blocks (Valid spigot material values) used by the percent win conditions
|
||||
Blocks: [] # defaults to none if missing
|
||||
Blocks: [ ] # defaults to none if missing
|
||||
# Time for being declared TechKo without a shot given.
|
||||
TechKoTime: 90 # defaults to 90 if missing
|
||||
|
||||
@@ -163,10 +163,10 @@ Kits:
|
||||
# If the personal kit system is active
|
||||
PersonalKits: false # defaults to false if missing
|
||||
# Items (Valid spigot material values) that are not allowed in the personal kit
|
||||
ForbiddenItems: [] # defaults to none if missing
|
||||
ForbiddenItems: [ ] # defaults to none if missing
|
||||
|
||||
# A list of integers containing the waiting time of this enter stage in the fight
|
||||
EnterStages: [] # defaults to no enter stages (empty list) if missing
|
||||
EnterStages: [ ] # defaults to no enter stages (empty list) if missing
|
||||
|
||||
Techhider:
|
||||
# The tech hider blocks/materials have to be valid lowercase minecraft material names
|
||||
@@ -175,9 +175,9 @@ Techhider:
|
||||
# Which block the tech hider replaces to.
|
||||
ObfuscateWith: end_stone # defaults to end_stone if missing
|
||||
# A list of all hidden blocks. "water" results in the hiding of all waterlogged blocks as well.
|
||||
HiddenBlocks: [] # defaults to none if missing
|
||||
HiddenBlocks: [ ] # defaults to none if missing
|
||||
# The block entity contents that are hidden (here with minecraft:nametag)
|
||||
HiddenBlockEntites: [] # defaults to none if missing
|
||||
HiddenBlockEntites: [ ] # defaults to none if missing
|
||||
|
||||
# The following configuration must be in the world folder/config.yml
|
||||
#
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.fightsystem;
|
||||
|
||||
import de.steamwar.sql.GameModeConfig;
|
||||
import de.steamwar.data.GameModeConfigUtils;
|
||||
import de.steamwar.fightsystem.utils.Region;
|
||||
import de.steamwar.fightsystem.winconditions.Winconditions;
|
||||
@@ -41,7 +40,8 @@ import java.util.logging.Level;
|
||||
|
||||
public class Config {
|
||||
|
||||
private Config(){}
|
||||
private Config() {
|
||||
}
|
||||
|
||||
public static final World world = Bukkit.getWorlds().get(0);
|
||||
|
||||
@@ -98,13 +98,13 @@ public class Config {
|
||||
public static final int SpectatePort;
|
||||
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");
|
||||
if(!new File(FightSystem.getPlugin().getDataFolder(), configFile).exists()) {
|
||||
if (!new File(FightSystem.getPlugin().getDataFolder(), configFile).exists()) {
|
||||
FightSystem.getPlugin().saveDefaultConfig();
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Arenaconfig fehlt!");
|
||||
Bukkit.shutdown();
|
||||
@@ -112,7 +112,7 @@ public class Config {
|
||||
GameModeConfig = new GameModeConfig<>(new File(FightSystem.getPlugin().getDataFolder(), configFile), GameModeConfigUtils.ToMaterial, Winconditions::valueOf, de.steamwar.sql.GameModeConfig.ToStaticWarGear, false);
|
||||
|
||||
File worldConfigFile = new File(world.getWorldFolder(), "config.yml");
|
||||
if(!worldConfigFile.exists()) {
|
||||
if (!worldConfigFile.exists()) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Weltconfig fehlt!");
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
@@ -147,9 +147,9 @@ public class Config {
|
||||
teamRedPasteZ + 0.5 - GameModeConfig.Arena.SpawnOffset.z);
|
||||
|
||||
SpecSpawn = new Location(world,
|
||||
teamBluePasteX + BlueToRedX /2.0,
|
||||
blueCornerY + BlueToRedY /2.0 + GameModeConfig.Schematic.Size.y/2.0,
|
||||
teamBluePasteZ + BlueToRedZ /2.0);
|
||||
teamBluePasteX + BlueToRedX / 2.0,
|
||||
blueCornerY + BlueToRedY / 2.0 + GameModeConfig.Schematic.Size.y / 2.0,
|
||||
teamBluePasteZ + BlueToRedZ / 2.0);
|
||||
|
||||
Vector v1 = TeamBlueSpawn.toVector().subtract(TeamRedSpawn.toVector());
|
||||
double pitch = Math.toDegrees(v1.angle(v1.clone().setY(0)));
|
||||
@@ -168,31 +168,31 @@ public class Config {
|
||||
int arenaMaxX;
|
||||
int arenaMinZ;
|
||||
int arenaMaxZ;
|
||||
if(BlueToRedX > 0){
|
||||
if (BlueToRedX > 0) {
|
||||
arenaMinX = blueCornerX - GameModeConfig.Arena.Schem2Border.x;
|
||||
arenaMaxX = teamRedCornerX + GameModeConfig.Schematic.Size.x + GameModeConfig.Arena.Schem2Border.x;
|
||||
teamRedRotate = true;
|
||||
teamBlueRotate = false;
|
||||
}else{
|
||||
} else {
|
||||
arenaMinX = teamRedCornerX - GameModeConfig.Arena.Schem2Border.x;
|
||||
arenaMaxX = blueCornerX + GameModeConfig.Schematic.Size.x + GameModeConfig.Arena.Schem2Border.x;
|
||||
teamRedRotate = false;
|
||||
teamBlueRotate = true;
|
||||
}
|
||||
if(BlueToRedZ > 0){
|
||||
if (BlueToRedZ > 0) {
|
||||
arenaMinZ = blueCornerZ - GameModeConfig.Arena.Schem2Border.z;
|
||||
arenaMaxZ = teamRedCornerZ + GameModeConfig.Schematic.Size.z + GameModeConfig.Arena.Schem2Border.z;
|
||||
teamRedRotate = true;
|
||||
teamBlueRotate = false;
|
||||
}else{
|
||||
} else {
|
||||
arenaMinZ = teamRedCornerZ - GameModeConfig.Arena.Schem2Border.z;
|
||||
arenaMaxZ = blueCornerZ + GameModeConfig.Schematic.Size.z + GameModeConfig.Arena.Schem2Border.z;
|
||||
if(BlueToRedZ != 0){
|
||||
if (BlueToRedZ != 0) {
|
||||
teamRedRotate = false;
|
||||
teamBlueRotate = true;
|
||||
}
|
||||
}
|
||||
if(!GameModeConfig.Schematic.Rotate){
|
||||
if (!GameModeConfig.Schematic.Rotate) {
|
||||
teamRedRotate = false;
|
||||
teamBlueRotate = false;
|
||||
}
|
||||
@@ -210,9 +210,9 @@ public class Config {
|
||||
BlueInsetRegion = new Region(BluePasteRegion.getMinX() + GameModeConfig.Schematic.Inset.x, BluePasteRegion.getMinY() + GameModeConfig.Schematic.Inset.bottom, BluePasteRegion.getMinZ() + GameModeConfig.Schematic.Inset.z, BluePasteRegion.getMaxX() - GameModeConfig.Schematic.Inset.x, BluePasteRegion.getMaxY() - GameModeConfig.Schematic.Inset.top, BluePasteRegion.getMaxZ() - GameModeConfig.Schematic.Inset.z);
|
||||
|
||||
int eventKampfID = Integer.parseInt(System.getProperty("fightID", "0"));
|
||||
if(eventKampfID >= 1){
|
||||
if (eventKampfID >= 1) {
|
||||
EventKampf = EventFight.byId(eventKampfID);
|
||||
if(EventKampf == null){
|
||||
if (EventKampf == null) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to load EventFight");
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
@@ -221,7 +221,7 @@ public class Config {
|
||||
Team team1 = Team.byId(EventKampf.getTeamBlue());
|
||||
Team team2 = Team.byId(EventKampf.getTeamRed());
|
||||
|
||||
if(team1 == null || team2 == null){
|
||||
if (team1 == null || team2 == null) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Failed to load Team");
|
||||
Bukkit.shutdown();
|
||||
}
|
||||
@@ -240,14 +240,14 @@ public class Config {
|
||||
Referees = Referee.get(Config.EventKampf.getEventID());
|
||||
|
||||
Event event = Event.byId(EventKampf.getEventID());
|
||||
if(BothTeamsPublic) {
|
||||
if (BothTeamsPublic) {
|
||||
OnlyPublicSchematics = true;
|
||||
MaximumTeamMembers = Integer.MAX_VALUE;
|
||||
}else{
|
||||
} else {
|
||||
OnlyPublicSchematics = event.publicSchemsOnly();
|
||||
MaximumTeamMembers = event.getMaximumTeamMembers();
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
//No event
|
||||
TeamRedColor = GameModeConfig.Red.Prefix;
|
||||
TeamBlueColor = GameModeConfig.Blue.Prefix;
|
||||
@@ -266,37 +266,41 @@ public class Config {
|
||||
|
||||
String blueLeader = System.getProperty("blueLeader", null);
|
||||
String redLeader = System.getProperty("redLeader", null);
|
||||
if(blueLeader != null)
|
||||
if (blueLeader != null) {
|
||||
BlueLeader = UUID.fromString(blueLeader);
|
||||
else
|
||||
} else {
|
||||
BlueLeader = null;
|
||||
if(redLeader != null)
|
||||
}
|
||||
if (redLeader != null) {
|
||||
RedLeader = UUID.fromString(redLeader);
|
||||
else
|
||||
} else {
|
||||
RedLeader = null;
|
||||
}
|
||||
|
||||
if(CheckSchemID != 0){
|
||||
if (CheckSchemID != 0) {
|
||||
mode = ArenaMode.CHECK;
|
||||
}else if(PrepareSchemID != 0){
|
||||
} else if (PrepareSchemID != 0) {
|
||||
mode = ArenaMode.PREPARE;
|
||||
}else if(eventKampfID >= 1){
|
||||
} else if (eventKampfID >= 1) {
|
||||
mode = ArenaMode.EVENT;
|
||||
}else if(eventKampfID == -1){
|
||||
} else if (eventKampfID == -1) {
|
||||
mode = ArenaMode.TEST;
|
||||
}else if(ReplayID != 0){
|
||||
} else if (ReplayID != 0) {
|
||||
mode = ArenaMode.REPLAY;
|
||||
}else{
|
||||
} else {
|
||||
mode = ArenaMode.NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean test(){
|
||||
public static boolean test() {
|
||||
return ArenaMode.Test.contains(mode);
|
||||
}
|
||||
public static boolean replayserver(){
|
||||
|
||||
public static boolean replayserver() {
|
||||
return ReplayID < 0;
|
||||
}
|
||||
public static boolean blueNegZ(){
|
||||
|
||||
public static boolean blueNegZ() {
|
||||
return BlueToRedZ > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public class FightSystem extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
if(Core.getInstance() == null) {
|
||||
if (Core.getInstance() == null) {
|
||||
Core.setInstance(this);
|
||||
TinyProtocol.init();
|
||||
}
|
||||
@@ -98,22 +98,16 @@ public class FightSystem extends JavaPlugin {
|
||||
new StateDependentListener(ArenaMode.All, FightState.All, BountifulWrapper.impl.newDenyArrowPickupListener());
|
||||
new OneShotStateDependent(ArenaMode.All, FightState.PreSchemSetup, () -> Fight.playSound(SWSound.BLOCK_NOTE_PLING.getSound(), 100.0f, 2.0f));
|
||||
new OneShotStateDependent(ArenaMode.Test, FightState.All, WorldEditRendererCUIEditor::new);
|
||||
if (Core.getVersion() >= 19) {
|
||||
try {
|
||||
Bukkit.getWorlds().get(0).setGameRule(GameRule.REDUCED_DEBUG_INFO, ArenaMode.AntiTest.contains(Config.mode));
|
||||
} catch (Exception e) {
|
||||
// Ignore if failed!
|
||||
}
|
||||
}
|
||||
Config.world.setGameRule(GameRule.REDUCED_DEBUG_INFO, ArenaMode.AntiTest.contains(Config.mode));
|
||||
|
||||
techHider = new TechHiderWrapper();
|
||||
hullHider = new HullHider();
|
||||
|
||||
FileSource.startReplay();
|
||||
|
||||
if(Config.mode == ArenaMode.EVENT) {
|
||||
if (Config.mode == ArenaMode.EVENT) {
|
||||
FightState.setFightState(FightState.PRE_SCHEM_SETUP);
|
||||
}else if(Config.mode == ArenaMode.CHECK){
|
||||
} else if (Config.mode == ArenaMode.CHECK) {
|
||||
SchematicNode checkSchematicNode = SchematicNode.getSchematicNode(Config.CheckSchemID);
|
||||
Fight.getBlueTeam().setSchem(checkSchematicNode);
|
||||
|
||||
@@ -122,7 +116,7 @@ public class FightSystem extends JavaPlugin {
|
||||
}
|
||||
|
||||
new TechareaCommand();
|
||||
}else if(Config.mode == ArenaMode.PREPARE) {
|
||||
} else if (Config.mode == ArenaMode.PREPARE) {
|
||||
Fight.getUnrotated().setSchem(SchematicNode.getSchematicNode(Config.PrepareSchemID));
|
||||
}
|
||||
|
||||
@@ -166,7 +160,7 @@ public class FightSystem extends JavaPlugin {
|
||||
|
||||
public static void shutdown() {
|
||||
//Staggered kick to prevent lobby overloading
|
||||
if(Bukkit.getOnlinePlayers().isEmpty()){
|
||||
if (Bukkit.getOnlinePlayers().isEmpty()) {
|
||||
Bukkit.shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,164 +17,164 @@
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
PREFIX=§eArena§8»
|
||||
PREFIX = §eArena§8»
|
||||
|
||||
# Commands
|
||||
NO_TEAM=§cYou are in no team
|
||||
FIGHT_ALREADY_STARTED=§cThe fight already started
|
||||
NOT_LEADER=§cYou aren't a leader
|
||||
PLAYER_UNAVAILABLE=§cThe player is not in an arena
|
||||
NO_TEAM = §cYou are in no team
|
||||
FIGHT_ALREADY_STARTED = §cThe fight already started
|
||||
NOT_LEADER = §cYou aren't a leader
|
||||
PLAYER_UNAVAILABLE = §cThe player is not in an arena
|
||||
|
||||
NOT_IN_TEAM=§e{0} §cis not in your team
|
||||
NOT_IN_TEAM = §e{0} §cis not in your team
|
||||
|
||||
KIT_UNAVAILABLE=§cThis kit does not exist
|
||||
KIT_CHOSEN=§7Selected kit §e{0}
|
||||
KIT_UNAVAILABLE = §cThis kit does not exist
|
||||
KIT_CHOSEN = §7Selected kit §e{0}
|
||||
|
||||
GAMEMODE_NOT_ALLOWED=§cChanging gamemode is not permitted
|
||||
GAMEMODE_UNKNOWN=§cUnknown gamemode {0}
|
||||
GAMEMODE_HELP=§8/§7gm §8[§egamemode§8]
|
||||
GAMEMODE_NOT_ALLOWED = §cChanging gamemode is not permitted
|
||||
GAMEMODE_UNKNOWN = §cUnknown gamemode {0}
|
||||
GAMEMODE_HELP = §8/§7gm §8[§egamemode§8]
|
||||
|
||||
LOCKSCHEM_HELP=§8/§7lockschem §8[§eteam§8]
|
||||
UNKNOWN_TEAM=§cThis team does not exist
|
||||
LOCKSCHEM_LOCKED=§7Schematic locked
|
||||
LOCKSCHEM_LOCKED_BY=§cThe schematic was locked by §e{0}
|
||||
LOCKSCHEM_HELP = §8/§7lockschem §8[§eteam§8]
|
||||
UNKNOWN_TEAM = §cThis team does not exist
|
||||
LOCKSCHEM_LOCKED = §7Schematic locked
|
||||
LOCKSCHEM_LOCKED_BY = §cThe schematic was locked by §e{0}
|
||||
|
||||
REMOVE_HELP=§8/§eremove §8[§eplayer§8]
|
||||
REMOVE_HELP = §8/§eremove §8[§eplayer§8]
|
||||
|
||||
NOT_FIGHTLEADER=§cYou are not the fight leader
|
||||
WIN_HELP=§8/§7win §8[§eteam §8or §etie§8]
|
||||
NOT_FIGHTLEADER = §cYou are not the fight leader
|
||||
WIN_HELP = §8/§7win §8[§eteam §8or §etie§8]
|
||||
|
||||
INFO_LEADER=§7Leader {0}§8: {1}
|
||||
INFO_SCHEMATIC=§7Schematic {0}§8: §e{1} §7from {2}, Rank: {3}
|
||||
INFO_LEADER = §7Leader {0}§8: {1}
|
||||
INFO_SCHEMATIC = §7Schematic {0}§8: §e{1} §7from {2}, Rank: {3}
|
||||
|
||||
TPSWARP_HELP=§8/§7tpswarp §8[§eticks per second§8]
|
||||
TPSWARP_SET=§7TPS set to §e{0}
|
||||
TPSWARP_HELP = §8/§7tpswarp §8[§eticks per second§8]
|
||||
TPSWARP_SET = §7TPS set to §e{0}
|
||||
|
||||
|
||||
# GUI
|
||||
STATE_TITLE=Fight state
|
||||
STATE_PRE_LEADER_SETUP=§7Team leader waiting phase
|
||||
STATE_PRE_SCHEM_SETUP=§7Schematic selection phase
|
||||
STATE_POST_SCHEM_SETUP=§7Preparation phase
|
||||
STATE_PRE_RUNNING=§eKit distribution
|
||||
STATE_RUNNING=§eFighting phase
|
||||
STATE_SPECTATE_WIN=§7Victory {0}
|
||||
STATE_SPECTATE_TIE=§7Draw
|
||||
STATE_TITLE = Fight state
|
||||
STATE_PRE_LEADER_SETUP = §7Team leader waiting phase
|
||||
STATE_PRE_SCHEM_SETUP = §7Schematic selection phase
|
||||
STATE_POST_SCHEM_SETUP = §7Preparation phase
|
||||
STATE_PRE_RUNNING = §eKit distribution
|
||||
STATE_RUNNING = §eFighting phase
|
||||
STATE_SPECTATE_WIN = §7Victory {0}
|
||||
STATE_SPECTATE_TIE = §7Draw
|
||||
|
||||
MANAGE_TITLE=Manage players
|
||||
MANAGE_LORE1=§eLeft §7click§8: §ekick
|
||||
MANAGE_LORE2=§eRight §7click§8: §epromote
|
||||
MANAGE_TITLE = Manage players
|
||||
MANAGE_LORE1 = §eLeft §7click§8: §ekick
|
||||
MANAGE_LORE2 = §eRight §7click§8: §epromote
|
||||
|
||||
KIT_SELECTION_TITLE=Kit selection
|
||||
KIT_NO_KITS=§cNo kits found
|
||||
KIT_CREATE=§eNew kit
|
||||
KITNAME_TITLE=Input kit name
|
||||
KITNAME_IN_USE=§cThis kit name is already in use
|
||||
KIT_SEARCH=§eSearch
|
||||
KITSEARCH_TITLE=Search for kit
|
||||
KIT_SELECTION_TITLE = Kit selection
|
||||
KIT_NO_KITS = §cNo kits found
|
||||
KIT_CREATE = §eNew kit
|
||||
KITNAME_TITLE = Input kit name
|
||||
KITNAME_IN_USE = §cThis kit name is already in use
|
||||
KIT_SEARCH = §eSearch
|
||||
KITSEARCH_TITLE = Search for kit
|
||||
|
||||
SCHEM_NO_ENEMY=§cNo schematic selection without an opponent
|
||||
SCHEM_TITLE={0} selection
|
||||
SCHEM_DIRT=§eDirt Block
|
||||
SCHEM_PUBLIC=§ePublic {0}
|
||||
SCHEM_UNCHECKED=§eUnchecked {0}
|
||||
SCHEM_PRIVATE=§ePrivate {0}
|
||||
SCHEM_NO_PRIVATE=§7No private {0} present
|
||||
SCHEM_PRIVATE_FORBIDDEN=§7No private {0} allowed
|
||||
SCHEM_NO_ENEMY = §cNo schematic selection without an opponent
|
||||
SCHEM_TITLE = {0} selection
|
||||
SCHEM_DIRT = §eDirt Block
|
||||
SCHEM_PUBLIC = §ePublic {0}
|
||||
SCHEM_UNCHECKED = §eUnchecked {0}
|
||||
SCHEM_PRIVATE = §ePrivate {0}
|
||||
SCHEM_NO_PRIVATE = §7No private {0} present
|
||||
SCHEM_PRIVATE_FORBIDDEN = §7No private {0} allowed
|
||||
|
||||
ADD_AI_TITLE=Add AI
|
||||
ADD_AI_TITLE = Add AI
|
||||
|
||||
|
||||
# Countdowns
|
||||
COUNTDOWN_MINUTES=§e{0} §7Minutes {1}
|
||||
COUNTDOWN_SECONDS=§e{0} §7Seconds {1}
|
||||
COUNTDOWN_SECOND=§eOne §7second {1}
|
||||
COUNTDOWN_MINUTES = §e{0} §7Minutes {1}
|
||||
COUNTDOWN_SECONDS = §e{0} §7Seconds {1}
|
||||
COUNTDOWN_SECOND = §eOne §7second {1}
|
||||
|
||||
ENTERN_COUNTDOWN=until boarding is allowed
|
||||
ENTERN_ALLOWED=§eBoarding §7is now allowed
|
||||
ENTERN_COUNTDOWN = until boarding is allowed
|
||||
ENTERN_ALLOWED = §eBoarding §7is now allowed
|
||||
|
||||
SHUTDOWN_COUNTDOWN=until the server is stopped
|
||||
PRE_SCHEM_COUNTDOWN=until a public schematic is chosen
|
||||
POST_SCHEM_COUNTDOWN=until the kits are distributed
|
||||
PRE_RUNNING_COUNTDOWN=until the fight starts
|
||||
RUNNING_COUNTDOWN=until the fight ends
|
||||
SPECTATE_COUNTDOWN=until the arena is reset
|
||||
SHUTDOWN_COUNTDOWN = until the server is stopped
|
||||
PRE_SCHEM_COUNTDOWN = until a public schematic is chosen
|
||||
POST_SCHEM_COUNTDOWN = until the kits are distributed
|
||||
PRE_RUNNING_COUNTDOWN = until the fight starts
|
||||
RUNNING_COUNTDOWN = until the fight ends
|
||||
SPECTATE_COUNTDOWN = until the arena is reset
|
||||
|
||||
|
||||
# Fight
|
||||
SCHEMATIC_UNLOADABLE=§cUnable to load schematic
|
||||
SCHEMATIC_CHOSEN=§7{0} §e{1} §7chosen
|
||||
SCHEMATIC_UNCHECKED=§7Team {0} §7has chosen an §eunchecked §7schematic§8!
|
||||
TEAM_READY=§aTeam ready
|
||||
TEAM_NOT_READY=§c§mTeam ready
|
||||
SKIP_READY=§aSkipping to next event
|
||||
SKIP_NOT_READY=§c§mSkipping to next event
|
||||
TEAM_CHAT={0}{1}§8» {0}{2}
|
||||
CHOOSE_KIT=§eChoose kit
|
||||
RESPAWN=§eRespawn
|
||||
MANAGE_PLAYERS=§cManage players
|
||||
CHOOSE_SCHEMATIC=§eChoose {0}
|
||||
SCHEMATIC_REQUIRED=§cChoose a schematic first
|
||||
ADD_AI=§eAdd AI
|
||||
SCHEMATIC_UNLOADABLE = §cUnable to load schematic
|
||||
SCHEMATIC_CHOSEN = §7{0} §e{1} §7chosen
|
||||
SCHEMATIC_UNCHECKED = §7Team {0} §7has chosen an §eunchecked §7schematic§8!
|
||||
TEAM_READY = §aTeam ready
|
||||
TEAM_NOT_READY = §c§mTeam ready
|
||||
SKIP_READY = §aSkipping to next event
|
||||
SKIP_NOT_READY = §c§mSkipping to next event
|
||||
TEAM_CHAT = {0}{1}§8» {0}{2}
|
||||
CHOOSE_KIT = §eChoose kit
|
||||
RESPAWN = §eRespawn
|
||||
MANAGE_PLAYERS = §cManage players
|
||||
CHOOSE_SCHEMATIC = §eChoose {0}
|
||||
SCHEMATIC_REQUIRED = §cChoose a schematic first
|
||||
ADD_AI = §eAdd AI
|
||||
|
||||
KIT_PREVIEW_EDIT=§7Edit kit
|
||||
KIT_PREVIEW_CHOOSE=§aSelect kit
|
||||
KIT_PREVIEW_BACK=§cBack
|
||||
KIT_PREVIEW_DELETE=§cDelete kit
|
||||
KIT_DELETION_CONFIRMATION=Are you sure you want to delete the kit?
|
||||
KIT_DELETION_ABORT=§cCancel
|
||||
KIT_DELETION_DELETE=§aDelete
|
||||
KIT_PREVIEW_EDIT = §7Edit kit
|
||||
KIT_PREVIEW_CHOOSE = §aSelect kit
|
||||
KIT_PREVIEW_BACK = §cBack
|
||||
KIT_PREVIEW_DELETE = §cDelete kit
|
||||
KIT_DELETION_CONFIRMATION = Are you sure you want to delete the kit?
|
||||
KIT_DELETION_ABORT = §cCancel
|
||||
KIT_DELETION_DELETE = §aDelete
|
||||
|
||||
|
||||
# Listener
|
||||
NO_ARENA_LEAVING=§cYou may not leave the arena
|
||||
CHECK_JOIN_DENIED=§cThere is a schematic in review on this server!
|
||||
CHECK_COMMAND_LOCKED=§cThis command is locked during review! Admin will be notified.
|
||||
NO_BLOCK_BREAK=§cYou are currently not allowed to break blocks here
|
||||
NO_BLOCK_PLACE=§cYou are currently not allowed to place blocks here
|
||||
NO_BOW_USAGE=§cYou can only use your bow after the fight has started
|
||||
NO_PARTICIPANT=§cYou are no fight participant
|
||||
NO_FRIENDLY_FIRE=§cNo friendly fire allowed
|
||||
NO_TNT_PLACE=§cYou are not allowed to place tnt
|
||||
NO_TELEPORT=§cYou are not allowed to use this teleport function
|
||||
OPEN_INVENTORY_TO_CUSTOMIZE=§eOpen inventory to customize your kit
|
||||
NO_ENTERN=§cYou may not board
|
||||
NO_TEAMAREA=§cYou are not allowed in the team area
|
||||
PREPARE_SCHEM_DELETED=§cApparently the schematic to be submitted was deleted. submission aborted.
|
||||
PREPARE_SCHEM_EXISTS=§cThere is already a schematic with the suffix -prepared, please rename or delete it, submission aborted.
|
||||
PREPARE_ACTIVE_PISTON=§cMoving pistons were found in the team area, submission aborted.
|
||||
PREPARE_FAILED_SAVING=§cThe schematic could not be saved, submission aborted.
|
||||
PREPARE_SENT_IN=§aA team member will review the schematic soon
|
||||
PARTICIPANT_CHAT={0} {1}§8» §7{2}
|
||||
FIGHTLEADER_CHAT=§e{0}§8» §e{1}
|
||||
SPECTATOR_CHAT=§7{0}§8» §7{1}
|
||||
PISTON_PUSHED_OUTSIDE=§cA piston pushed a block outside the allowed area!
|
||||
NO_ARENA_LEAVING = §cYou may not leave the arena
|
||||
CHECK_JOIN_DENIED = §cThere is a schematic in review on this server!
|
||||
CHECK_COMMAND_LOCKED = §cThis command is locked during review! Admin will be notified.
|
||||
NO_BLOCK_BREAK = §cYou are currently not allowed to break blocks here
|
||||
NO_BLOCK_PLACE = §cYou are currently not allowed to place blocks here
|
||||
NO_BOW_USAGE = §cYou can only use your bow after the fight has started
|
||||
NO_PARTICIPANT = §cYou are no fight participant
|
||||
NO_FRIENDLY_FIRE = §cNo friendly fire allowed
|
||||
NO_TNT_PLACE = §cYou are not allowed to place tnt
|
||||
NO_TELEPORT = §cYou are not allowed to use this teleport function
|
||||
OPEN_INVENTORY_TO_CUSTOMIZE = §eOpen inventory to customize your kit
|
||||
NO_ENTERN = §cYou may not board
|
||||
NO_TEAMAREA = §cYou are not allowed in the team area
|
||||
PREPARE_SCHEM_DELETED = §cApparently the schematic to be submitted was deleted. submission aborted.
|
||||
PREPARE_SCHEM_EXISTS = §cThere is already a schematic with the suffix -prepared, please rename or delete it, submission aborted.
|
||||
PREPARE_ACTIVE_PISTON = §cMoving pistons were found in the team area, submission aborted.
|
||||
PREPARE_FAILED_SAVING = §cThe schematic could not be saved, submission aborted.
|
||||
PREPARE_SENT_IN = §aA team member will review the schematic soon
|
||||
PARTICIPANT_CHAT = {0} {1}§8» §7{2}
|
||||
FIGHTLEADER_CHAT = §e{0}§8» §e{1}
|
||||
SPECTATOR_CHAT = §7{0}§8» §7{1}
|
||||
PISTON_PUSHED_OUTSIDE = §cA piston pushed a block outside the allowed area!
|
||||
|
||||
|
||||
# Replay
|
||||
REPLAY_ENDS=§cReplay ended
|
||||
OLD_STRING={0}
|
||||
REPLAY_ENDS = §cReplay ended
|
||||
OLD_STRING = {0}
|
||||
|
||||
|
||||
# States
|
||||
COMMAND_CURRENTLY_UNAVAILABLE=§cThis command is unavailable at this time of the fight
|
||||
COMMAND_CURRENTLY_UNAVAILABLE = §cThis command is unavailable at this time of the fight
|
||||
|
||||
|
||||
# Utils
|
||||
TPS_WARNING=§c{0} §7TPS
|
||||
TPS_WARNING = §c{0} §7TPS
|
||||
|
||||
UI_PRE_RUNNING=§7Kits distributed
|
||||
UI_RUNNING=§aFight started
|
||||
UI_SKIP=§7Skipping to next event
|
||||
UI_PLAYER_JOINS=§a§l» {0}{1}
|
||||
UI_PLAYER_LEAVES=§c§l« {0}{1}
|
||||
UI_LEADER_JOINS=§a§l» {0}Leader {1}
|
||||
UI_PLAYER_DEATH={0}{1} §7died
|
||||
UI_PLAYER_LEAVE={0}{1} §7left the fight
|
||||
UI_WIN={0}Victory {1}
|
||||
UI_DRAW=§7Draw
|
||||
UI_PRE_RUNNING = §7Kits distributed
|
||||
UI_RUNNING = §aFight started
|
||||
UI_SKIP = §7Skipping to next event
|
||||
UI_PLAYER_JOINS = §a§l» {0}{1}
|
||||
UI_PLAYER_LEAVES = §c§l« {0}{1}
|
||||
UI_LEADER_JOINS = §a§l» {0}Leader {1}
|
||||
UI_PLAYER_DEATH = {0}{1} §7died
|
||||
UI_PLAYER_LEAVE = {0}{1} §7left the fight
|
||||
UI_WIN = {0}Victory {1}
|
||||
UI_DRAW = §7Draw
|
||||
|
||||
BAR_PRE_LEADER=§7Waiting for team leader
|
||||
BAR_PRE_LEADER = §7Waiting for team leader
|
||||
BAR_PRE_SCHEM = {1} §7Schematic selection {0} {2}
|
||||
BAR_PREPARE = {1} {3} §7Preparation {0} {4} {2}
|
||||
BAR_PRE_RUNNING = {1} {3} §7Start of fight in {0} {4} {2}
|
||||
@@ -184,74 +184,74 @@ BAR_RUNNING2 = {1} {3} {5} {7} {0} {6} {8} {4} {2}
|
||||
BAR_RUNNING3 = {1} {3} {5} {7} {9} {0} {6} {8} {10} {4} {2}
|
||||
BAR_TIE = {1} §7Draw {0} {2}
|
||||
BAR_WIN = {1} §7Victory {3} {0} {2}
|
||||
BAR_POINTS={0} §8Points
|
||||
BAR_POINTS_OF={0}§8/§7{1} §8Points
|
||||
BAR_PERCENT={0}§8%
|
||||
BAR_CANNONS={0} §8Cannons
|
||||
BAR_WATER={0} §8Water
|
||||
BAR_SECONDS={0}§8s
|
||||
BAR_POINTS = {0} §8Points
|
||||
BAR_POINTS_OF = {0}§8/§7{1} §8Points
|
||||
BAR_PERCENT = {0}§8%
|
||||
BAR_CANNONS = {0} §8Cannons
|
||||
BAR_WATER = {0} §8Water
|
||||
BAR_SECONDS = {0}§8s
|
||||
|
||||
|
||||
# Winconditions
|
||||
HELLS_BELLS_COUNTDOWN=until the bombs start dropping
|
||||
HELLS_BELLS_START_1=§c!!Careful!! Bombers arriving in about a minute.
|
||||
HELLS_BELLS_START_2=§cBombers approaching, arrival in about a minute.
|
||||
HELLS_BELLS_START_3=§cBombers spotted on the radar, ETA: one minute.
|
||||
HELLS_BELLS_START_4=§cUnknown flying object spotted, arriving in about a minute.
|
||||
HELLS_BELLS_START_5=§cFlying object spotted. ETA: one minute.
|
||||
HELLS_BELLS_START_6=§cWild bombers appeared, arrival in about a minute.
|
||||
HELLS_BELLS_SWAP_1=§aThe bombs are starting to fall more quickly.
|
||||
HELLS_BELLS_SWAP_2=§aMore bombers arriving.
|
||||
HELLS_BELLS_SWAP_3=§aAdditional bombers sighted.
|
||||
HELLS_BELLS_SWAP_4=§aThe bombardement is increasing.
|
||||
HELLS_BELLS_COUNTDOWN = until the bombs start dropping
|
||||
HELLS_BELLS_START_1 = §c!!Careful!! Bombers arriving in about a minute.
|
||||
HELLS_BELLS_START_2 = §cBombers approaching, arrival in about a minute.
|
||||
HELLS_BELLS_START_3 = §cBombers spotted on the radar, ETA: one minute.
|
||||
HELLS_BELLS_START_4 = §cUnknown flying object spotted, arriving in about a minute.
|
||||
HELLS_BELLS_START_5 = §cFlying object spotted. ETA: one minute.
|
||||
HELLS_BELLS_START_6 = §cWild bombers appeared, arrival in about a minute.
|
||||
HELLS_BELLS_SWAP_1 = §aThe bombs are starting to fall more quickly.
|
||||
HELLS_BELLS_SWAP_2 = §aMore bombers arriving.
|
||||
HELLS_BELLS_SWAP_3 = §aAdditional bombers sighted.
|
||||
HELLS_BELLS_SWAP_4 = §aThe bombardement is increasing.
|
||||
|
||||
METEOR_COUNTDOWN=until meteors start falling
|
||||
METEOR_START_1=§cA meteor shower was detected
|
||||
METEOR_START_2=§cShooting starts are 100% more likely to appear during this fight
|
||||
METEOR_START_3=§cMeteors sighted, seek shelter immediately!
|
||||
METEOR_START_4=§cThe end is near! The meteors will hit us in about a minute.
|
||||
METEOR_START_5=§fNEWS §cThere will be multiple meteor showers this afternoon!
|
||||
METEOR_START_6=§cAirships still flying are doomed to crash.
|
||||
METEOR_SWAP_1=§aIt doesn't stop, the meteors appear to be increasing.
|
||||
METEOR_SWAP_2=§aThis was only the beginning, the meteors are arriving faster and more powerful.
|
||||
METEOR_SWAP_3=§aIt seems like it won't stop, the meteors are starting to arrive more quickly!
|
||||
METEOR_SWAP_4=§aAnother shower has been detected, get to safety!
|
||||
METEOR_COUNTDOWN = until meteors start falling
|
||||
METEOR_START_1 = §cA meteor shower was detected
|
||||
METEOR_START_2 = §cShooting starts are 100% more likely to appear during this fight
|
||||
METEOR_START_3 = §cMeteors sighted, seek shelter immediately!
|
||||
METEOR_START_4 = §cThe end is near! The meteors will hit us in about a minute.
|
||||
METEOR_START_5 = §fNEWS §cThere will be multiple meteor showers this afternoon!
|
||||
METEOR_START_6 = §cAirships still flying are doomed to crash.
|
||||
METEOR_SWAP_1 = §aIt doesn't stop, the meteors appear to be increasing.
|
||||
METEOR_SWAP_2 = §aThis was only the beginning, the meteors are arriving faster and more powerful.
|
||||
METEOR_SWAP_3 = §aIt seems like it won't stop, the meteors are starting to arrive more quickly!
|
||||
METEOR_SWAP_4 = §aAnother shower has been detected, get to safety!
|
||||
|
||||
TECHKO_COUNTDOWN=must have fired a shot by {0}
|
||||
TECHKO_COUNTDOWN = must have fired a shot by {0}
|
||||
|
||||
WIN_FIGHTLEADER=§7Referee decision
|
||||
WIN_PERCENT={0} §7is too badly damaged
|
||||
WIN_OFFLINE_BOTH=§7Both teams offline
|
||||
WIN_OFFLINE={0} §7offline
|
||||
WIN_ALL_DEAD={0}All players neutralised
|
||||
WIN_LEADER_DEAD={0} neutralised
|
||||
WIN_TIME_OVER=§7Time is up!
|
||||
WIN_MORE_HEALTH={0} with more remaining health
|
||||
WIN_LESS_DAMAGE={0} §7less damaged
|
||||
WIN_POINTS={0} has more points
|
||||
WIN_POINTS_EQUAL=§7Equal points
|
||||
WIN_TECHKO={0} §7is tech K.O.
|
||||
WIN_IMPOSTER_DEAD={0} §7killed the imposter
|
||||
WIN_CREWMATE_DEAD={0} §7killed all team mates
|
||||
WIN_FIGHTLEADER = §7Referee decision
|
||||
WIN_PERCENT = {0} §7is too badly damaged
|
||||
WIN_OFFLINE_BOTH = §7Both teams offline
|
||||
WIN_OFFLINE = {0} §7offline
|
||||
WIN_ALL_DEAD = {0}All players neutralised
|
||||
WIN_LEADER_DEAD = {0} neutralised
|
||||
WIN_TIME_OVER = §7Time is up!
|
||||
WIN_MORE_HEALTH = {0} with more remaining health
|
||||
WIN_LESS_DAMAGE = {0} §7less damaged
|
||||
WIN_POINTS = {0} has more points
|
||||
WIN_POINTS_EQUAL = §7Equal points
|
||||
WIN_TECHKO = {0} §7is tech K.O.
|
||||
WIN_IMPOSTER_DEAD = {0} §7killed the imposter
|
||||
WIN_CREWMATE_DEAD = {0} §7killed all team mates
|
||||
|
||||
AMONG_US_IMPOSTER_MESSAGE = §4You are the Imposter§8! §7Kill all your team mates to win the game!
|
||||
AMONG_US_IMPOSTER_AMONG_MESSAGE = §4There is an Imposter among us§8! §7Kill him to win the game!
|
||||
|
||||
|
||||
# Invites
|
||||
JOIN_REQUEST=§7Request join
|
||||
JOIN_REQUEST_TITLE=Request join
|
||||
JOIN_REQUEST_ALREADY=§cYou have already sent a join request
|
||||
JOIN_REQUEST_TEAM=§7Join {0}
|
||||
JOIN_REQUEST_CONFIRMATION=§7Join request submitted
|
||||
JOIN_REQUEST_NOTIFICATION=§e{0} §7requests joining team {1}§8. §7Accept or decline using §8/§erequests
|
||||
JOIN_REQUEST = §7Request join
|
||||
JOIN_REQUEST_TITLE = Request join
|
||||
JOIN_REQUEST_ALREADY = §cYou have already sent a join request
|
||||
JOIN_REQUEST_TEAM = §7Join {0}
|
||||
JOIN_REQUEST_CONFIRMATION = §7Join request submitted
|
||||
JOIN_REQUEST_NOTIFICATION = §e{0} §7requests joining team {1}§8. §7Accept or decline using §8/§erequests
|
||||
|
||||
REQUESTS=§7Open join requests
|
||||
REQUESTS_TITLE=Open join requests
|
||||
REQUEST_DECLINED=§cJoin of {0} declined
|
||||
REQUEST_YOUR_DECLINED=§cYour join request was declined
|
||||
REQUESTS_LEFT_CLICK=§eLeft click §7to §eaccept§8!
|
||||
REQUESTS_RIGHT_CLICK=§eRight click §7to §edecline§8!
|
||||
REQUESTS = §7Open join requests
|
||||
REQUESTS_TITLE = Open join requests
|
||||
REQUEST_DECLINED = §cJoin of {0} declined
|
||||
REQUEST_YOUR_DECLINED = §cYour join request was declined
|
||||
REQUESTS_LEFT_CLICK = §eLeft click §7to §eaccept§8!
|
||||
REQUESTS_RIGHT_CLICK = §eRight click §7to §edecline§8!
|
||||
|
||||
NO_JOIN_REQUEST=§cThe player did not request joining
|
||||
NO_CONFIRMATION=§cNo confirmation necessary
|
||||
NO_JOIN_REQUEST = §cThe player did not request joining
|
||||
NO_CONFIRMATION = §cNo confirmation necessary
|
||||
+163
-163
@@ -18,220 +18,220 @@
|
||||
#
|
||||
|
||||
# Commands
|
||||
NO_TEAM=§cDu bist in keinem Team
|
||||
FIGHT_ALREADY_STARTED=§cDer Kampf hat bereits begonnen
|
||||
NOT_LEADER=§cDu bist kein Leader
|
||||
PLAYER_UNAVAILABLE=§cDer Spieler ist nicht in der Arena
|
||||
NO_TEAM = §cDu bist in keinem Team
|
||||
FIGHT_ALREADY_STARTED = §cDer Kampf hat bereits begonnen
|
||||
NOT_LEADER = §cDu bist kein Leader
|
||||
PLAYER_UNAVAILABLE = §cDer Spieler ist nicht in der Arena
|
||||
|
||||
NOT_IN_TEAM=§e{0} §cist nicht in deinem Team
|
||||
NOT_IN_TEAM = §e{0} §cist nicht in deinem Team
|
||||
|
||||
KIT_UNAVAILABLE=§cDieses Kit gibt es nicht
|
||||
KIT_CHOSEN=§7Kit §e{0} §7gew§hlt
|
||||
KIT_UNAVAILABLE = §cDieses Kit gibt es nicht
|
||||
KIT_CHOSEN = §7Kit §e{0} §7gew§hlt
|
||||
|
||||
GAMEMODE_NOT_ALLOWED=§cSpielmodusänderung verboten
|
||||
GAMEMODE_UNKNOWN=§cUnbekannter Spielmodus {0}
|
||||
GAMEMODE_HELP=§8/§7gm §8[§eSpielmodus§8]
|
||||
GAMEMODE_NOT_ALLOWED = §cSpielmodusänderung verboten
|
||||
GAMEMODE_UNKNOWN = §cUnbekannter Spielmodus {0}
|
||||
GAMEMODE_HELP = §8/§7gm §8[§eSpielmodus§8]
|
||||
|
||||
LOCKSCHEM_HELP=§8/§7lockschem §8[§eTeam§8]
|
||||
UNKNOWN_TEAM=§cDieses Team existiert nicht
|
||||
LOCKSCHEM_LOCKED=§7Schematic gesperrt
|
||||
LOCKSCHEM_LOCKED_BY=§cDie Schematic wurde von §e{0} §cgesperrt
|
||||
LOCKSCHEM_HELP = §8/§7lockschem §8[§eTeam§8]
|
||||
UNKNOWN_TEAM = §cDieses Team existiert nicht
|
||||
LOCKSCHEM_LOCKED = §7Schematic gesperrt
|
||||
LOCKSCHEM_LOCKED_BY = §cDie Schematic wurde von §e{0} §cgesperrt
|
||||
|
||||
REMOVE_HELP=§8/§eremove §8[§eSpieler§8]
|
||||
REMOVE_HELP = §8/§eremove §8[§eSpieler§8]
|
||||
|
||||
NOT_FIGHTLEADER=§cDu bist nicht Kampfleiter
|
||||
WIN_HELP=§8/§7win §8[§eTeam §8oder §etie§8]
|
||||
NOT_FIGHTLEADER = §cDu bist nicht Kampfleiter
|
||||
WIN_HELP = §8/§7win §8[§eTeam §8oder §etie§8]
|
||||
|
||||
TPSWARP_HELP=§8/§7tpswarp §8[§eTicks pro Sekunde§8]
|
||||
TPSWARP_SET=§7TPS auf §e{0} §7gesetzt
|
||||
TPSWARP_HELP = §8/§7tpswarp §8[§eTicks pro Sekunde§8]
|
||||
TPSWARP_SET = §7TPS auf §e{0} §7gesetzt
|
||||
|
||||
|
||||
# GUI
|
||||
STATE_TITLE=Kampfstatus
|
||||
STATE_PRE_LEADER_SETUP=§7Teamleaderwartephase
|
||||
STATE_PRE_SCHEM_SETUP=§7Schemauswahlphase
|
||||
STATE_POST_SCHEM_SETUP=§7Vorbereitungsphase
|
||||
STATE_PRE_RUNNING=§eKitausgabe
|
||||
STATE_RUNNING=§eKampfphase
|
||||
STATE_SPECTATE_WIN=§7Sieg {0}
|
||||
STATE_SPECTATE_TIE=§7Unentschieden
|
||||
STATE_TITLE = Kampfstatus
|
||||
STATE_PRE_LEADER_SETUP = §7Teamleaderwartephase
|
||||
STATE_PRE_SCHEM_SETUP = §7Schemauswahlphase
|
||||
STATE_POST_SCHEM_SETUP = §7Vorbereitungsphase
|
||||
STATE_PRE_RUNNING = §eKitausgabe
|
||||
STATE_RUNNING = §eKampfphase
|
||||
STATE_SPECTATE_WIN = §7Sieg {0}
|
||||
STATE_SPECTATE_TIE = §7Unentschieden
|
||||
|
||||
MANAGE_TITLE=Mitspieler verwalten
|
||||
MANAGE_LORE1=§eLinksklick§8: §eRauswurf
|
||||
MANAGE_LORE2=§eRechtsklick§8: §eBefördern
|
||||
MANAGE_TITLE = Mitspieler verwalten
|
||||
MANAGE_LORE1 = §eLinksklick§8: §eRauswurf
|
||||
MANAGE_LORE2 = §eRechtsklick§8: §eBefördern
|
||||
|
||||
KIT_SELECTION_TITLE=Kitauswahl
|
||||
KIT_NO_KITS=§cKeine Kits gefunden
|
||||
KIT_CREATE=§eNeues Kit
|
||||
KITNAME_TITLE=Kitname eingeben
|
||||
KITNAME_IN_USE=§cDieser Kitname wird bereits genutzt
|
||||
KIT_SEARCH=§eSuchen
|
||||
KITSEARCH_TITLE=Nach Kit suchen
|
||||
KIT_SELECTION_TITLE = Kitauswahl
|
||||
KIT_NO_KITS = §cKeine Kits gefunden
|
||||
KIT_CREATE = §eNeues Kit
|
||||
KITNAME_TITLE = Kitname eingeben
|
||||
KITNAME_IN_USE = §cDieser Kitname wird bereits genutzt
|
||||
KIT_SEARCH = §eSuchen
|
||||
KITSEARCH_TITLE = Nach Kit suchen
|
||||
|
||||
SCHEM_NO_ENEMY=§cKeine Schematicwahl ohne Gegner
|
||||
SCHEM_TITLE={0}-Auswahl
|
||||
SCHEM_DIRT=§eErdblock
|
||||
SCHEM_PUBLIC=§eÖffentliches {0}
|
||||
SCHEM_UNCHECKED=§eUngeprüftes {0}
|
||||
SCHEM_PRIVATE=§ePrivates {0}
|
||||
SCHEM_NO_PRIVATE=§7Kein privates {0} vorhanden
|
||||
SCHEM_PRIVATE_FORBIDDEN=§7Kein privates {0} erlaubt
|
||||
SCHEM_NO_ENEMY = §cKeine Schematicwahl ohne Gegner
|
||||
SCHEM_TITLE = {0}-Auswahl
|
||||
SCHEM_DIRT = §eErdblock
|
||||
SCHEM_PUBLIC = §eÖffentliches {0}
|
||||
SCHEM_UNCHECKED = §eUngeprüftes {0}
|
||||
SCHEM_PRIVATE = §ePrivates {0}
|
||||
SCHEM_NO_PRIVATE = §7Kein privates {0} vorhanden
|
||||
SCHEM_PRIVATE_FORBIDDEN = §7Kein privates {0} erlaubt
|
||||
|
||||
ADD_AI_TITLE=KI hinzufügen
|
||||
ADD_AI_TITLE = KI hinzufügen
|
||||
|
||||
|
||||
# Countdowns
|
||||
COUNTDOWN_MINUTES=§e{0} §7Minuten {1}
|
||||
COUNTDOWN_SECONDS=§e{0} §7Sekunden {1}
|
||||
COUNTDOWN_SECOND=§eEine §7Sekunde {1}
|
||||
COUNTDOWN_MINUTES = §e{0} §7Minuten {1}
|
||||
COUNTDOWN_SECONDS = §e{0} §7Sekunden {1}
|
||||
COUNTDOWN_SECOND = §eEine §7Sekunde {1}
|
||||
|
||||
ENTERN_COUNTDOWN=bis Entern erlaubt ist
|
||||
ENTERN_ALLOWED=§eEntern §7ist nun erlaubt
|
||||
ENTERN_COUNTDOWN = bis Entern erlaubt ist
|
||||
ENTERN_ALLOWED = §eEntern §7ist nun erlaubt
|
||||
|
||||
SHUTDOWN_COUNTDOWN=bis der Server gestoppt wird
|
||||
PRE_SCHEM_COUNTDOWN=bis eine Public-Schematic gewählt wird
|
||||
POST_SCHEM_COUNTDOWN=bis die Kits verteilt werden
|
||||
PRE_RUNNING_COUNTDOWN=bis die Arena freigegeben ist
|
||||
RUNNING_COUNTDOWN=bis der Kampf vorbei ist
|
||||
SPECTATE_COUNTDOWN=bis die Arena zurückgesetzt wird
|
||||
SHUTDOWN_COUNTDOWN = bis der Server gestoppt wird
|
||||
PRE_SCHEM_COUNTDOWN = bis eine Public-Schematic gewählt wird
|
||||
POST_SCHEM_COUNTDOWN = bis die Kits verteilt werden
|
||||
PRE_RUNNING_COUNTDOWN = bis die Arena freigegeben ist
|
||||
RUNNING_COUNTDOWN = bis der Kampf vorbei ist
|
||||
SPECTATE_COUNTDOWN = bis die Arena zurückgesetzt wird
|
||||
|
||||
|
||||
# Fight
|
||||
SCHEMATIC_UNLOADABLE=§cSchematic konnte nicht geladen werden
|
||||
SCHEMATIC_CHOSEN=§7{0} §e{1} §7gewählt
|
||||
SCHEMATIC_UNCHECKED=§7Team {0} §7hat eine §eungeprüfte §7Schematic gewählt§8!
|
||||
TEAM_READY=§aTeam bereit
|
||||
TEAM_NOT_READY=§c§mTeam bereit
|
||||
SKIP_READY=§aBeschleunigung zum nächsten Event
|
||||
SKIP_NOT_READY=§c§mBeschleunigung zum nächsten Event
|
||||
CHOOSE_KIT=§eKit wählen
|
||||
RESPAWN=§eRespawn
|
||||
MANAGE_PLAYERS=§cMitspieler verwalten
|
||||
CHOOSE_SCHEMATIC=§e{0} wählen
|
||||
SCHEMATIC_REQUIRED=§cZuerst muss eine Schematic gewählt sein
|
||||
ADD_AI=§eKI hinzufügen
|
||||
SCHEMATIC_UNLOADABLE = §cSchematic konnte nicht geladen werden
|
||||
SCHEMATIC_CHOSEN = §7{0} §e{1} §7gewählt
|
||||
SCHEMATIC_UNCHECKED = §7Team {0} §7hat eine §eungeprüfte §7Schematic gewählt§8!
|
||||
TEAM_READY = §aTeam bereit
|
||||
TEAM_NOT_READY = §c§mTeam bereit
|
||||
SKIP_READY = §aBeschleunigung zum nächsten Event
|
||||
SKIP_NOT_READY = §c§mBeschleunigung zum nächsten Event
|
||||
CHOOSE_KIT = §eKit wählen
|
||||
RESPAWN = §eRespawn
|
||||
MANAGE_PLAYERS = §cMitspieler verwalten
|
||||
CHOOSE_SCHEMATIC = §e{0} wählen
|
||||
SCHEMATIC_REQUIRED = §cZuerst muss eine Schematic gewählt sein
|
||||
ADD_AI = §eKI hinzufügen
|
||||
|
||||
KIT_PREVIEW_EDIT=§7Kit bearbeiten
|
||||
KIT_PREVIEW_CHOOSE=§aKit wählen
|
||||
KIT_PREVIEW_BACK=§cZurück
|
||||
KIT_PREVIEW_DELETE=§cKit löschen
|
||||
KIT_DELETION_CONFIRMATION=Kit wirklich löschen?
|
||||
KIT_DELETION_ABORT=§cAbbrechen
|
||||
KIT_DELETION_DELETE=§aLöschen
|
||||
KIT_PREVIEW_EDIT = §7Kit bearbeiten
|
||||
KIT_PREVIEW_CHOOSE = §aKit wählen
|
||||
KIT_PREVIEW_BACK = §cZurück
|
||||
KIT_PREVIEW_DELETE = §cKit löschen
|
||||
KIT_DELETION_CONFIRMATION = Kit wirklich löschen?
|
||||
KIT_DELETION_ABORT = §cAbbrechen
|
||||
KIT_DELETION_DELETE = §aLöschen
|
||||
|
||||
|
||||
# Listener
|
||||
NO_ARENA_LEAVING=§cDu darfst die Arena nicht verlassen
|
||||
CHECK_JOIN_DENIED=§cAuf diesem Server wird momentan eine Schematic geprüft!
|
||||
CHECK_COMMAND_LOCKED=§cDieser Befehl ist beim Prüfen gesperrt! Admin wird benachrichtigt.
|
||||
NO_BLOCK_BREAK=§cDu darfst hier derzeit keine Blöcke abbauen
|
||||
NO_BLOCK_PLACE=§cDu darfst hier derzeit keine Blöcke setzen
|
||||
NO_BOW_USAGE=§cDu darfst den Bogen erst nach Kampfbeginn nutzen
|
||||
NO_PARTICIPANT=§cDu bist kein Kampfteilnehmer
|
||||
NO_FRIENDLY_FIRE=§cDu darfst deinen Teamkollegen keinen Schaden zufügen
|
||||
NO_TNT_PLACE=§cDu darfst kein TNT setzen
|
||||
NO_TELEPORT=§cDu darfst diese Teleportfunktion nicht benutzen
|
||||
OPEN_INVENTORY_TO_CUSTOMIZE=§eInventar zum Anpassen des Kits öffnen
|
||||
NO_ENTERN=§cDu darfst nicht entern
|
||||
NO_TEAMAREA=§cDu darfst nicht zu den Teams
|
||||
PREPARE_SCHEM_DELETED=§cAnscheinend wurde die auszufahrende Schematic gelöscht, Einsenden wird abgebrochen.
|
||||
PREPARE_SCHEM_EXISTS=§cEs existiert bereits eine Schem mit Namenszusatz -prepared, diese bitte umbenennen oder löschen, Einsenden wird abgebrochen.
|
||||
PREPARE_ACTIVE_PISTON=§cIm Teambereich wurden sich noch bewegende Pistons gefunden, Einsenden wird abgebrochen.
|
||||
PREPARE_FAILED_SAVING=§cDie Schematic konnte nicht gespeichert werden, Einsenden wird abgebrochen.
|
||||
PREPARE_SENT_IN=§aDie Schematic wird nun zeitnah von einem Teammitglied überprüft
|
||||
PISTON_PUSHED_OUTSIDE=§cEin Kolben hat einen Block aus dem erlaubten Bereich geschoben!
|
||||
NO_ARENA_LEAVING = §cDu darfst die Arena nicht verlassen
|
||||
CHECK_JOIN_DENIED = §cAuf diesem Server wird momentan eine Schematic geprüft!
|
||||
CHECK_COMMAND_LOCKED = §cDieser Befehl ist beim Prüfen gesperrt! Admin wird benachrichtigt.
|
||||
NO_BLOCK_BREAK = §cDu darfst hier derzeit keine Blöcke abbauen
|
||||
NO_BLOCK_PLACE = §cDu darfst hier derzeit keine Blöcke setzen
|
||||
NO_BOW_USAGE = §cDu darfst den Bogen erst nach Kampfbeginn nutzen
|
||||
NO_PARTICIPANT = §cDu bist kein Kampfteilnehmer
|
||||
NO_FRIENDLY_FIRE = §cDu darfst deinen Teamkollegen keinen Schaden zufügen
|
||||
NO_TNT_PLACE = §cDu darfst kein TNT setzen
|
||||
NO_TELEPORT = §cDu darfst diese Teleportfunktion nicht benutzen
|
||||
OPEN_INVENTORY_TO_CUSTOMIZE = §eInventar zum Anpassen des Kits öffnen
|
||||
NO_ENTERN = §cDu darfst nicht entern
|
||||
NO_TEAMAREA = §cDu darfst nicht zu den Teams
|
||||
PREPARE_SCHEM_DELETED = §cAnscheinend wurde die auszufahrende Schematic gelöscht, Einsenden wird abgebrochen.
|
||||
PREPARE_SCHEM_EXISTS = §cEs existiert bereits eine Schem mit Namenszusatz -prepared, diese bitte umbenennen oder löschen, Einsenden wird abgebrochen.
|
||||
PREPARE_ACTIVE_PISTON = §cIm Teambereich wurden sich noch bewegende Pistons gefunden, Einsenden wird abgebrochen.
|
||||
PREPARE_FAILED_SAVING = §cDie Schematic konnte nicht gespeichert werden, Einsenden wird abgebrochen.
|
||||
PREPARE_SENT_IN = §aDie Schematic wird nun zeitnah von einem Teammitglied überprüft
|
||||
PISTON_PUSHED_OUTSIDE = §cEin Kolben hat einen Block aus dem erlaubten Bereich geschoben!
|
||||
|
||||
|
||||
# Replay
|
||||
REPLAY_ENDS=§cReplay beendet
|
||||
REPLAY_ENDS = §cReplay beendet
|
||||
|
||||
|
||||
# States
|
||||
COMMAND_CURRENTLY_UNAVAILABLE=§cDieser Befehl ist zu diesem Kampfzeitpunkt nicht verfügbar
|
||||
COMMAND_CURRENTLY_UNAVAILABLE = §cDieser Befehl ist zu diesem Kampfzeitpunkt nicht verfügbar
|
||||
|
||||
|
||||
# Utils
|
||||
UI_PRE_RUNNING=§7Kits verteilt
|
||||
UI_RUNNING=§aArena freigegeben
|
||||
UI_SKIP=§7Sprung zum nächsten Ereignis
|
||||
UI_LEADER_JOINS=§a§l» {0}Leader {1}
|
||||
UI_PLAYER_DEATH={0}{1} §7ist gestorben
|
||||
UI_PLAYER_LEAVE={0}{1} §7hat den Kampf verlassen
|
||||
UI_WIN={0}Sieg {1}
|
||||
UI_DRAW=§7Unentschieden
|
||||
UI_PRE_RUNNING = §7Kits verteilt
|
||||
UI_RUNNING = §aArena freigegeben
|
||||
UI_SKIP = §7Sprung zum nächsten Ereignis
|
||||
UI_LEADER_JOINS = §a§l» {0}Leader {1}
|
||||
UI_PLAYER_DEATH = {0}{1} §7ist gestorben
|
||||
UI_PLAYER_LEAVE = {0}{1} §7hat den Kampf verlassen
|
||||
UI_WIN = {0}Sieg {1}
|
||||
UI_DRAW = §7Unentschieden
|
||||
|
||||
BAR_PRE_LEADER=§7Warten auf Teamleader
|
||||
BAR_PRE_LEADER = §7Warten auf Teamleader
|
||||
BAR_PRE_SCHEM = {1} §7Schemauswahl {0} {2}
|
||||
BAR_PREPARE = {1} {3} §7Vorbereitung {0} {4} {2}
|
||||
BAR_PRE_RUNNING = {1} {3} §7Kampfbeginn in {0} {4} {2}
|
||||
BAR_TIE = {1} §7Unentschieden {0} {2}
|
||||
BAR_WIN = {1} §7Sieg {3} {0} {2}
|
||||
BAR_POINTS={0} §8Punkte
|
||||
BAR_POINTS_OF={0}§8/§7{1} §8Punkte
|
||||
BAR_PERCENT={0}§8%
|
||||
BAR_CANNONS={0} §8Kanonen
|
||||
BAR_WATER={0} §8Wasser
|
||||
BAR_POINTS = {0} §8Punkte
|
||||
BAR_POINTS_OF = {0}§8/§7{1} §8Punkte
|
||||
BAR_PERCENT = {0}§8%
|
||||
BAR_CANNONS = {0} §8Kanonen
|
||||
BAR_WATER = {0} §8Wasser
|
||||
|
||||
|
||||
# Winconditions
|
||||
HELLS_BELLS_COUNTDOWN=bis die Bomben fallen
|
||||
HELLS_BELLS_START_1=§c!!Achtung!! Bomber im Anflug, noch ca. eine Minute bis zur Ankunft.
|
||||
HELLS_BELLS_START_2=§cBomber im Anflug, ca. eine Minute bis zur Ankunft.
|
||||
HELLS_BELLS_START_3=§cBomber auf dem Radar gesichtet, geschätzte Ankunftszeit: eine Minute.
|
||||
HELLS_BELLS_START_4=§cUnbekanntes Flugobjekt gesichtet, trifft in ca. einer Minute ein.
|
||||
HELLS_BELLS_START_5=§cFlugobjekt gesichtet. Ankunft in ca. einer Minute.
|
||||
HELLS_BELLS_START_6=§cBomber erschienen, Ankunft ca. eine Minute.
|
||||
HELLS_BELLS_SWAP_1=§aDie Bomben fallen nun schneller.
|
||||
HELLS_BELLS_SWAP_2=§aMehr Bomber im Anflug.
|
||||
HELLS_BELLS_SWAP_3=§aZusätzliche Bomber gesichtet.
|
||||
HELLS_BELLS_SWAP_4=§aDas Bombardement scheint sich zu erhöhen.
|
||||
HELLS_BELLS_COUNTDOWN = bis die Bomben fallen
|
||||
HELLS_BELLS_START_1 = §c!!Achtung!! Bomber im Anflug, noch ca. eine Minute bis zur Ankunft.
|
||||
HELLS_BELLS_START_2 = §cBomber im Anflug, ca. eine Minute bis zur Ankunft.
|
||||
HELLS_BELLS_START_3 = §cBomber auf dem Radar gesichtet, geschätzte Ankunftszeit: eine Minute.
|
||||
HELLS_BELLS_START_4 = §cUnbekanntes Flugobjekt gesichtet, trifft in ca. einer Minute ein.
|
||||
HELLS_BELLS_START_5 = §cFlugobjekt gesichtet. Ankunft in ca. einer Minute.
|
||||
HELLS_BELLS_START_6 = §cBomber erschienen, Ankunft ca. eine Minute.
|
||||
HELLS_BELLS_SWAP_1 = §aDie Bomben fallen nun schneller.
|
||||
HELLS_BELLS_SWAP_2 = §aMehr Bomber im Anflug.
|
||||
HELLS_BELLS_SWAP_3 = §aZusätzliche Bomber gesichtet.
|
||||
HELLS_BELLS_SWAP_4 = §aDas Bombardement scheint sich zu erhöhen.
|
||||
|
||||
METEOR_COUNTDOWN=bis es Meteore regnet
|
||||
METEOR_START_1=§cEin Meteorschauer wurden am Himmel entdeckt
|
||||
METEOR_START_2=§cSternschnuppen sind diesen Fight 100% wahrscheinlicher
|
||||
METEOR_START_3=§cEs wurden Meteoriten am Himmel entdeckt, begeben sie sich umgehend in Sicherheit!
|
||||
METEOR_START_4=§cDer Untergang steht nahe! Die Meteoriten werden uns in etwa einer Minute treffen.
|
||||
METEOR_START_5=§fNEWS §cHeute Nachmittag wird es größere Meteoriten Schauer geben!
|
||||
METEOR_START_6=§cNoch fliegende Airships sind dem Absturz geweiht.
|
||||
METEOR_SWAP_1=§aEs hört nicht auf, die Meteoriten scheinen mehr zu werden.
|
||||
METEOR_SWAP_2=§aDas war erst der Anfang, die Meteoriten kommen immer schneller und machen mehr Schaden.
|
||||
METEOR_SWAP_3=§aEs scheint als würde es nicht aufhören, die Meteoriten kommen nur schneller!
|
||||
METEOR_SWAP_4=§aEin weiterer Schauer ist entdeckt worden, begebt euch in Sicherheit!
|
||||
METEOR_COUNTDOWN = bis es Meteore regnet
|
||||
METEOR_START_1 = §cEin Meteorschauer wurden am Himmel entdeckt
|
||||
METEOR_START_2 = §cSternschnuppen sind diesen Fight 100% wahrscheinlicher
|
||||
METEOR_START_3 = §cEs wurden Meteoriten am Himmel entdeckt, begeben sie sich umgehend in Sicherheit!
|
||||
METEOR_START_4 = §cDer Untergang steht nahe! Die Meteoriten werden uns in etwa einer Minute treffen.
|
||||
METEOR_START_5 = §fNEWS §cHeute Nachmittag wird es größere Meteoriten Schauer geben!
|
||||
METEOR_START_6 = §cNoch fliegende Airships sind dem Absturz geweiht.
|
||||
METEOR_SWAP_1 = §aEs hört nicht auf, die Meteoriten scheinen mehr zu werden.
|
||||
METEOR_SWAP_2 = §aDas war erst der Anfang, die Meteoriten kommen immer schneller und machen mehr Schaden.
|
||||
METEOR_SWAP_3 = §aEs scheint als würde es nicht aufhören, die Meteoriten kommen nur schneller!
|
||||
METEOR_SWAP_4 = §aEin weiterer Schauer ist entdeckt worden, begebt euch in Sicherheit!
|
||||
|
||||
TECHKO_COUNTDOWN=bis {0} §7einen Schuss abgegeben haben muss
|
||||
TECHKO_COUNTDOWN = bis {0} §7einen Schuss abgegeben haben muss
|
||||
|
||||
WIN_FIGHTLEADER=§7Kampfleiterentscheidung
|
||||
WIN_PERCENT={0} §7zu beschädigt
|
||||
WIN_OFFLINE_BOTH=§7Beide Teams offline
|
||||
WIN_OFFLINE={0} §7offline
|
||||
WIN_ALL_DEAD={0}Alle Spieler kampfunfähig
|
||||
WIN_LEADER_DEAD={0} kampfunfähig
|
||||
WIN_TIME_OVER=§7Zeit abgelaufen
|
||||
WIN_MORE_HEALTH={0} mit mehr verbleibenden Leben
|
||||
WIN_LESS_DAMAGE={0} §7weniger beschädigt
|
||||
WIN_POINTS={0} hat mehr Punkte
|
||||
WIN_POINTS_EQUAL=§7Gleicher Punktestand
|
||||
WIN_TECHKO={0} §7ist Tech K.O.
|
||||
WIN_IMPOSTER_DEAD={0} §7 hat den Imposter getötet
|
||||
WIN_CREWMATE_DEAD={0} §7 hat alle Kameraden getötet
|
||||
WIN_FIGHTLEADER = §7Kampfleiterentscheidung
|
||||
WIN_PERCENT = {0} §7zu beschädigt
|
||||
WIN_OFFLINE_BOTH = §7Beide Teams offline
|
||||
WIN_OFFLINE = {0} §7offline
|
||||
WIN_ALL_DEAD = {0}Alle Spieler kampfunfähig
|
||||
WIN_LEADER_DEAD = {0} kampfunfähig
|
||||
WIN_TIME_OVER = §7Zeit abgelaufen
|
||||
WIN_MORE_HEALTH = {0} mit mehr verbleibenden Leben
|
||||
WIN_LESS_DAMAGE = {0} §7weniger beschädigt
|
||||
WIN_POINTS = {0} hat mehr Punkte
|
||||
WIN_POINTS_EQUAL = §7Gleicher Punktestand
|
||||
WIN_TECHKO = {0} §7ist Tech K.O.
|
||||
WIN_IMPOSTER_DEAD = {0} §7 hat den Imposter getötet
|
||||
WIN_CREWMATE_DEAD = {0} §7 hat alle Kameraden getötet
|
||||
|
||||
AMONG_US_IMPOSTER_MESSAGE = §4Du bist ein Imposter§8! §7Du musst alle Kameraden töten, um zu gewinnen.
|
||||
AMONG_US_IMPOSTER_AMONG_MESSAGE = §4Es ist ein Imposter unter uns§8! §7Tötet ihn, um das Spiel zu gewinnen!
|
||||
|
||||
# Invites
|
||||
JOIN_REQUEST=§7Teambeitritt anfragen
|
||||
JOIN_REQUEST_TITLE=Teambeitritt anfragen
|
||||
JOIN_REQUEST_ALREADY=§cDu hast bereits ein Team um Beitritt angefragt
|
||||
JOIN_REQUEST_TEAM={0} §7beitreten
|
||||
JOIN_REQUEST_CONFIRMATION=§7Teambeitritt angefragt
|
||||
JOIN_REQUEST_NOTIFICATION=§e{0} §7möchte Team {1} §7beitreten§8. §7Akzeptiere oder lehne ab mit §8/§erequests
|
||||
JOIN_REQUEST = §7Teambeitritt anfragen
|
||||
JOIN_REQUEST_TITLE = Teambeitritt anfragen
|
||||
JOIN_REQUEST_ALREADY = §cDu hast bereits ein Team um Beitritt angefragt
|
||||
JOIN_REQUEST_TEAM = {0} §7beitreten
|
||||
JOIN_REQUEST_CONFIRMATION = §7Teambeitritt angefragt
|
||||
JOIN_REQUEST_NOTIFICATION = §e{0} §7möchte Team {1} §7beitreten§8. §7Akzeptiere oder lehne ab mit §8/§erequests
|
||||
|
||||
REQUESTS=§7Offene Beitrittsanfragen
|
||||
REQUESTS_TITLE=Offene Beitrittsanfragen
|
||||
REQUEST_DECLINED=§cBeitritt von {0} abgelehnt
|
||||
REQUEST_YOUR_DECLINED=§cDeine Betrittsanfrage wurde abgelehnt
|
||||
REQUESTS_LEFT_CLICK=§eLinksklick §7um §eanzunehmen§8!
|
||||
REQUESTS_RIGHT_CLICK=§eRechtsklick §7um §eabzulehnen§8!
|
||||
REQUESTS = §7Offene Beitrittsanfragen
|
||||
REQUESTS_TITLE = Offene Beitrittsanfragen
|
||||
REQUEST_DECLINED = §cBeitritt von {0} abgelehnt
|
||||
REQUEST_YOUR_DECLINED = §cDeine Betrittsanfrage wurde abgelehnt
|
||||
REQUESTS_LEFT_CLICK = §eLinksklick §7um §eanzunehmen§8!
|
||||
REQUESTS_RIGHT_CLICK = §eRechtsklick §7um §eabzulehnen§8!
|
||||
|
||||
NO_JOIN_REQUEST=§cDer Spieler hat noch keinen Beitritt angefragt
|
||||
NO_CONFIRMATION=§cKeine Zustimmung nötig
|
||||
NO_JOIN_REQUEST = §cDer Spieler hat noch keinen Beitritt angefragt
|
||||
NO_CONFIRMATION = §cKeine Zustimmung nötig
|
||||
|
||||
@@ -65,6 +65,7 @@ public abstract class AI {
|
||||
public static final double INTERACTION_RANGE = 5.0;
|
||||
|
||||
private static final Map<UUID, AI> ais = new HashMap<>();
|
||||
|
||||
public static void printPos() {
|
||||
ais.values().forEach(ai -> ai.chat(ai.entity.isValid() + " " + ai.entity.isDead() + " " + ai.entity.getLocation()));
|
||||
}
|
||||
@@ -92,17 +93,19 @@ public abstract class AI {
|
||||
|
||||
entity = (LivingEntity) Config.world.spawnEntity(Config.SpecSpawn, EntityType.VILLAGER);
|
||||
entity.setCustomName(user.getUserName());
|
||||
((Villager)entity).setAware(false);
|
||||
((Villager) entity).setAware(false);
|
||||
|
||||
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::run, 1, 1);
|
||||
ais.put(entity.getUniqueId(), this);
|
||||
team.addMember(entity, user);
|
||||
|
||||
if(FightState.Schem.contains(FightState.getFightState()))
|
||||
if (FightState.Schem.contains(FightState.getFightState())) {
|
||||
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> schematic(team.getClipboard()));
|
||||
}
|
||||
}
|
||||
|
||||
public abstract SchematicNode chooseSchematic();
|
||||
|
||||
public abstract void schematic(Clipboard clipboard);
|
||||
|
||||
public boolean acceptJoinRequest(JoinRequest.Enquirer enquirer, FightTeam team) {
|
||||
@@ -112,20 +115,13 @@ public abstract class AI {
|
||||
protected abstract void plan();
|
||||
|
||||
public void stop() {
|
||||
if(!entity.isDead())
|
||||
entity.remove();
|
||||
|
||||
if(!task.isCancelled())
|
||||
task.cancel();
|
||||
if (!entity.isDead()) entity.remove();
|
||||
if (!task.isCancelled()) task.cancel();
|
||||
}
|
||||
|
||||
public void setReady() {
|
||||
if(FightState.getFightState() != FightState.POST_SCHEM_SETUP)
|
||||
return;
|
||||
|
||||
if(team.getLeader().getEntity() != entity)
|
||||
return;
|
||||
|
||||
if (FightState.getFightState() != FightState.POST_SCHEM_SETUP) return;
|
||||
if (team.getLeader().getEntity() != entity) return;
|
||||
team.setReady(true);
|
||||
}
|
||||
|
||||
@@ -137,18 +133,19 @@ public abstract class AI {
|
||||
public Vector getPosition() {
|
||||
Location location = entity.getLocation();
|
||||
Region extend = team.getExtendRegion();
|
||||
if(Fight.getUnrotated() == team)
|
||||
if (Fight.getUnrotated() == team) {
|
||||
return new Vector(
|
||||
location.getX() - extend.getMinX(),
|
||||
location.getY() - team.getSchemRegion().getMinY(),
|
||||
location.getZ() - extend.getMinZ()
|
||||
);
|
||||
else
|
||||
} else {
|
||||
return new Vector(
|
||||
extend.getMaxX() - location.getX(),
|
||||
location.getY() - team.getSchemRegion().getMinY(),
|
||||
extend.getMaxZ() - location.getZ()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public Material getBlock(Vector pos) {
|
||||
@@ -165,18 +162,16 @@ public abstract class AI {
|
||||
queue.add(new Action(1) {
|
||||
@Override
|
||||
public void run() {
|
||||
if(FightState.getFightState() != FightState.RUNNING)
|
||||
return;
|
||||
if (FightState.getFightState() != FightState.RUNNING) return;
|
||||
|
||||
Location location = translate(pos);
|
||||
if(interactionDistanceViolation(location)) {
|
||||
if (interactionDistanceViolation(location)) {
|
||||
chat("InteractionDistanceViolation: setTNT");
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = location.getBlock();
|
||||
if(block.getType() == Material.AIR)
|
||||
block.setType(Material.TNT);
|
||||
if (block.getType() == Material.AIR) block.setType(Material.TNT);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -186,7 +181,7 @@ public abstract class AI {
|
||||
@Override
|
||||
public void run() {
|
||||
Location location = translate(pos);
|
||||
if(interactionDistanceViolation(location)) {
|
||||
if (interactionDistanceViolation(location)) {
|
||||
chat("InteractionDistanceViolation: interact");
|
||||
return;
|
||||
}
|
||||
@@ -198,22 +193,21 @@ public abstract class AI {
|
||||
|
||||
public void interact(Vector pos, int n) {
|
||||
queue.add(new Action(1) {
|
||||
@Override
|
||||
public void run() {
|
||||
Location location = translate(pos);
|
||||
if (interactionDistanceViolation(location))
|
||||
return;
|
||||
Block block = location.getBlock();
|
||||
BlockData data = block.getBlockData();
|
||||
if (data instanceof Repeater) {
|
||||
Repeater repeater = (Repeater) data;
|
||||
repeater.setDelay(n);
|
||||
} else if (data instanceof Lectern) {
|
||||
Lectern lectern = (Lectern) data;
|
||||
lectern.setPage(n);
|
||||
}
|
||||
block.setBlockData(data);
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
Location location = translate(pos);
|
||||
if (interactionDistanceViolation(location)) return;
|
||||
Block block = location.getBlock();
|
||||
BlockData data = block.getBlockData();
|
||||
if (data instanceof Repeater) {
|
||||
Repeater repeater = (Repeater) data;
|
||||
repeater.setDelay(n);
|
||||
} else if (data instanceof Lectern) {
|
||||
Lectern lectern = (Lectern) data;
|
||||
lectern.setPage(n);
|
||||
}
|
||||
block.setBlockData(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -222,22 +216,23 @@ public abstract class AI {
|
||||
@Override
|
||||
public void run() {
|
||||
Location location = entity.getLocation();
|
||||
if(!entity.isOnGround() && location.getBlock().getType() != Material.LADDER) {
|
||||
if (!entity.isOnGround() && location.getBlock().getType() != Material.LADDER) {
|
||||
FightSystem.getPlugin().getLogger().log(Level.INFO, "Entity falling");
|
||||
return;
|
||||
}
|
||||
|
||||
Location target = translate(pos);
|
||||
if(Math.abs(location.getX() - target.getX()) > 1.0 || Math.abs(location.getY() - target.getY()) > 1.5 || Math.abs(location.getZ() - target.getZ()) > 1.0) {
|
||||
if (Math.abs(location.getX() - target.getX()) > 1.0 || Math.abs(location.getY() - target.getY()) > 1.5 || Math.abs(location.getZ() - target.getZ()) > 1.0) {
|
||||
FightSystem.getPlugin().getLogger().log(Level.INFO, () -> entity.getName() + ": Overdistance movement " + location.toVector() + " " + target.toVector());
|
||||
return;
|
||||
}
|
||||
|
||||
if(!team.getFightPlayer(entity).canEntern() && !team.getExtendRegion().inRegion(target))
|
||||
if (!team.getFightPlayer(entity).canEntern() && !team.getExtendRegion().inRegion(target))
|
||||
return;
|
||||
|
||||
if(!entity.teleport(target, PlayerTeleportEvent.TeleportCause.PLUGIN))
|
||||
if (!entity.teleport(target, PlayerTeleportEvent.TeleportCause.PLUGIN)) {
|
||||
FightSystem.getPlugin().getLogger().log(Level.INFO, "Entity not teleported: " + entity.isValid());
|
||||
}
|
||||
|
||||
GlobalRecorder.getInstance().entityMoves(entity);
|
||||
}
|
||||
@@ -265,13 +260,11 @@ public abstract class AI {
|
||||
Powerable powerable = (Powerable) data;
|
||||
boolean isPowered = powerable.isPowered();
|
||||
|
||||
if(type.name().endsWith("BUTTON")) {
|
||||
if(isPowered)
|
||||
return;
|
||||
if (type.name().endsWith("BUTTON")) {
|
||||
if (isPowered) return;
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
|
||||
if(!block.getType().name().endsWith("BUTTON"))
|
||||
return;
|
||||
if (!block.getType().name().endsWith("BUTTON")) return;
|
||||
|
||||
powerable.setPowered(false);
|
||||
block.setBlockData(powerable);
|
||||
@@ -282,7 +275,7 @@ public abstract class AI {
|
||||
powerable.setPowered(!isPowered);
|
||||
}
|
||||
block.setBlockData(data);
|
||||
if(data instanceof Switch) {
|
||||
if (data instanceof Switch) {
|
||||
updateButton(block);
|
||||
}
|
||||
}
|
||||
@@ -306,7 +299,7 @@ public abstract class AI {
|
||||
}
|
||||
|
||||
private void run() {
|
||||
if(queue.isEmpty()) {
|
||||
if (queue.isEmpty()) {
|
||||
try {
|
||||
plan();
|
||||
} catch (Throwable t) {
|
||||
@@ -315,34 +308,36 @@ public abstract class AI {
|
||||
}
|
||||
}
|
||||
|
||||
if(!queue.isEmpty() && --queue.peek().delay == 0)
|
||||
queue.poll().run();
|
||||
if (!queue.isEmpty() && --queue.peek().delay == 0) queue.poll().run();
|
||||
}
|
||||
|
||||
public Location translate(Vector pos) {
|
||||
Region extend = team.getExtendRegion();
|
||||
if(Fight.getUnrotated() == team)
|
||||
if (Fight.getUnrotated() == team) {
|
||||
return new Location(
|
||||
Config.world,
|
||||
pos.getX() + extend.getMinX(),
|
||||
pos.getY() + team.getSchemRegion().getMinY(),
|
||||
pos.getZ() + extend.getMinZ()
|
||||
);
|
||||
else
|
||||
} else {
|
||||
return new Location(
|
||||
Config.world,
|
||||
extend.getMaxX() - pos.getX(),
|
||||
pos.getY() + team.getSchemRegion().getMinY(),
|
||||
extend.getMaxZ() - pos.getZ()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Action {
|
||||
private int delay;
|
||||
|
||||
public Action(int delay) {
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
public void run() {}
|
||||
public void run() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.fightsystem.ai;
|
||||
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
@@ -30,28 +29,30 @@ import org.bukkit.Material;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@AllArgsConstructor
|
||||
public class AIManager {
|
||||
private static final List<AIManager> AIs = Arrays.asList(
|
||||
new AIManager(DummyAI.class, Material.STONE, () -> ArenaMode.Test.contains(Config.mode))
|
||||
new AIManager("DummyAI", DummyAI::new, Material.STONE, () -> ArenaMode.Test.contains(Config.mode))
|
||||
);
|
||||
|
||||
public static List<AIManager> availableAIs() {
|
||||
return AIs.stream().filter(manager -> manager.available.getAsBoolean()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private final Class<? extends AI> aiClass;
|
||||
private final String name;
|
||||
private final Function<FightTeam, AI> constructor;
|
||||
@Getter
|
||||
private final Material icon;
|
||||
private final BooleanSupplier available;
|
||||
|
||||
public String name() {
|
||||
return aiClass.getSimpleName();
|
||||
return name;
|
||||
}
|
||||
|
||||
public void join(FightTeam team) {
|
||||
Reflection.getConstructor(aiClass, FightTeam.class).invoke(team);
|
||||
constructor.apply(team);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.utils.FightStatistics;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
|
||||
@@ -53,7 +52,6 @@ public class DummyAI extends AI {
|
||||
|
||||
@Override
|
||||
protected void plan() {
|
||||
if(FightState.getFightState() == FightState.POST_SCHEM_SETUP)
|
||||
setReady();
|
||||
if (FightState.getFightState() == FightState.POST_SCHEM_SETUP) setReady();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,14 +42,13 @@ public class AkCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
if(!player.isOp())
|
||||
return false;
|
||||
if (!player.isOp()) return false;
|
||||
|
||||
if(!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.ADMINISTRATION) && Core.getInstance() != FightSystem.getPlugin()){
|
||||
if (!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.ADMINISTRATION) && Core.getInstance() != FightSystem.getPlugin()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
@@ -33,106 +32,97 @@ import lombok.experimental.UtilityClass;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.SimpleCommandMap;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@UtilityClass
|
||||
public class Commands {
|
||||
|
||||
private static final Reflection.Field<SimpleCommandMap> commandMap = Reflection.getField("org.bukkit.craftbukkit.CraftServer", "commandMap", SimpleCommandMap.class);
|
||||
public static void injectCommand(Command cmd) {
|
||||
commandMap.get(Bukkit.getServer()).register("FightSystem", cmd);
|
||||
((CraftServer) Bukkit.getServer()).getCommandMap().register("FightSystem", cmd);
|
||||
}
|
||||
|
||||
private static void errNoTeam(Player p){
|
||||
private static void errNoTeam(Player p) {
|
||||
FightSystem.getMessage().sendPrefixless("NO_TEAM", p, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
|
||||
static boolean checkSetup(Player p){
|
||||
if(!FightState.setup()){
|
||||
static boolean checkSetup(Player p) {
|
||||
if (!FightState.setup()) {
|
||||
FightSystem.getMessage().sendPrefixless("FIGHT_ALREADY_STARTED", p, ChatMessageType.ACTION_BAR);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static FightPlayer checkGetPlayer(Player p){
|
||||
private static FightPlayer checkGetPlayer(Player p) {
|
||||
FightPlayer fightPlayer = Fight.getFightPlayer(p);
|
||||
if(fightPlayer == null){
|
||||
if (fightPlayer == null) {
|
||||
errNoTeam(p);
|
||||
}
|
||||
return fightPlayer;
|
||||
}
|
||||
|
||||
public static FightPlayer checkGetLeader(Player p){
|
||||
public static FightPlayer checkGetLeader(Player p) {
|
||||
FightPlayer fightPlayer = checkGetPlayer(p);
|
||||
if(fightPlayer != null && !fightPlayer.isLeader()){
|
||||
if (fightPlayer != null && !fightPlayer.isLeader()) {
|
||||
FightSystem.getMessage().sendPrefixless("NOT_LEADER", p, ChatMessageType.ACTION_BAR);
|
||||
fightPlayer = null;
|
||||
}
|
||||
return fightPlayer;
|
||||
}
|
||||
|
||||
public static FightTeam checkGetTeam(Player p){
|
||||
public static FightTeam checkGetTeam(Player p) {
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||
if(fightTeam == null){
|
||||
if (fightTeam == null) {
|
||||
errNoTeam(p);
|
||||
}
|
||||
return fightTeam;
|
||||
}
|
||||
|
||||
private static Player checkGetPlayer(Player p, String t){
|
||||
private static Player checkGetPlayer(Player p, String t) {
|
||||
Player target = Bukkit.getPlayer(t);
|
||||
if(target == null) {
|
||||
if (target == null) {
|
||||
FightSystem.getMessage().sendPrefixless("PLAYER_UNAVAILABLE", p, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
static void toggleReady(Player p){
|
||||
static void toggleReady(Player p) {
|
||||
FightTeam fightTeam = checkGetTeam(p);
|
||||
if(fightTeam == null || checkGetLeader(p) == null)
|
||||
return;
|
||||
if (fightTeam == null || checkGetLeader(p) == null) return;
|
||||
|
||||
fightTeam.setReady(!fightTeam.isReady());
|
||||
}
|
||||
|
||||
static void toggleSkip(Player p){
|
||||
static void toggleSkip(Player p) {
|
||||
FightTeam fightTeam = checkGetTeam(p);
|
||||
if(fightTeam == null || checkGetLeader(p) == null)
|
||||
return;
|
||||
if (fightTeam == null || checkGetLeader(p) == null) return;
|
||||
|
||||
fightTeam.skip();
|
||||
}
|
||||
|
||||
static void leaveTeam(Player p){
|
||||
if(checkSetup(p))
|
||||
return;
|
||||
static void leaveTeam(Player p) {
|
||||
if (checkSetup(p)) return;
|
||||
|
||||
FightTeam fightTeam = checkGetTeam(p);
|
||||
if(fightTeam == null)
|
||||
return;
|
||||
if (fightTeam == null) return;
|
||||
|
||||
fightTeam.removePlayer(p);
|
||||
}
|
||||
|
||||
static void kick(Player p, String kicked){
|
||||
if(checkSetup(p))
|
||||
return;
|
||||
static void kick(Player p, String kicked) {
|
||||
if (checkSetup(p)) return;
|
||||
|
||||
FightTeam fightTeam = checkGetTeam(p);
|
||||
if(fightTeam == null)
|
||||
return;
|
||||
if (fightTeam == null) return;
|
||||
|
||||
FightPlayer fightPlayer = checkGetLeader(p);
|
||||
if(fightPlayer == null)
|
||||
return;
|
||||
if (fightPlayer == null) return;
|
||||
|
||||
Player target = checkGetPlayer(p, kicked);
|
||||
if(target == null)
|
||||
return;
|
||||
if (target == null) return;
|
||||
|
||||
if(!fightTeam.isPlayerInTeam(target)){
|
||||
if (!fightTeam.isPlayerInTeam(target)) {
|
||||
FightSystem.getMessage().sendPrefixless("NOT_IN_TEAM", p, ChatMessageType.ACTION_BAR, target.getName());
|
||||
return;
|
||||
}
|
||||
@@ -140,26 +130,24 @@ public class Commands {
|
||||
fightTeam.removePlayer(target);
|
||||
}
|
||||
|
||||
public static void kit(Player p, String kitName){
|
||||
if(checkSetup(p))
|
||||
return;
|
||||
public static void kit(Player p, String kitName) {
|
||||
if (checkSetup(p)) return;
|
||||
|
||||
FightPlayer fightPlayer = checkGetPlayer(p);
|
||||
if(fightPlayer == null)
|
||||
return;
|
||||
if (fightPlayer == null) return;
|
||||
|
||||
Kit k = null;
|
||||
if(Config.GameModeConfig.Kits.PersonalKits){
|
||||
if (Config.GameModeConfig.Kits.PersonalKits) {
|
||||
PersonalKit kit = PersonalKit.get(SteamwarUser.get(p.getUniqueId()).getId(), Config.GameModeConfig.Schematic.Type.toDB(), kitName);
|
||||
if(kit != null){
|
||||
if (kit != null) {
|
||||
kit.setInUse();
|
||||
k = new Kit(kit);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
k = Kit.getKitByName(kitName);
|
||||
}
|
||||
|
||||
if(k == null || !k.canUseKit(fightPlayer.isLeader())){
|
||||
if (k == null || !k.canUseKit(fightPlayer.isLeader())) {
|
||||
FightSystem.getMessage().sendPrefixless("KIT_UNAVAILABLE", p, ChatMessageType.ACTION_BAR);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,53 +42,54 @@ import org.bukkit.event.inventory.ClickType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GUI {
|
||||
private GUI(){}
|
||||
private GUI() {
|
||||
}
|
||||
|
||||
private static final Message msg = FightSystem.getMessage();
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static void addTeamRequest(Player p, SWInventory inv, int pos, FightTeam team) {
|
||||
byte colorCode = ColorConverter.chat2dye(team.getColor()).getDyeData();
|
||||
String name = team.getLeader() != null ? team.getLeader().getEntity().getName() : team.getName();
|
||||
inv.setItem(pos, SWItem.getDye(colorCode), colorCode, msg.parse("JOIN_REQUEST_TEAM", p, team.getColor() + name), click -> {
|
||||
inv.setItem(pos, ColorConverter.chat2dye(team.getColor()), msg.parse("JOIN_REQUEST_TEAM", p, team.getColor() + name), click -> {
|
||||
p.closeInventory();
|
||||
|
||||
if(ArenaMode.ManualTeams.contains(Config.mode) && team.canbeLeader(p))
|
||||
if (ArenaMode.ManualTeams.contains(Config.mode) && team.canbeLeader(p)) {
|
||||
team.addMember(p);
|
||||
else
|
||||
} else {
|
||||
JoinRequest.forPlayer(p, team);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void joinRequest(Player p) {
|
||||
if(JoinRequest.get(p) != null) {
|
||||
if (JoinRequest.get(p) != null) {
|
||||
msg.sendPrefixless("JOIN_REQUEST_ALREADY", p, ChatMessageType.ACTION_BAR);
|
||||
return;
|
||||
}
|
||||
|
||||
SWInventory inv = new SWInventory(p, 9, msg.parse("JOIN_REQUEST_TITLE", p));
|
||||
FightTeam team = Fight.getPlayerTeam(p);
|
||||
if(team != Fight.getRedTeam())
|
||||
if (team != Fight.getRedTeam()) {
|
||||
addTeamRequest(p, inv, team == null ? 0 : 4, Fight.getBlueTeam());
|
||||
if(team != Fight.getBlueTeam())
|
||||
}
|
||||
if (team != Fight.getBlueTeam()) {
|
||||
addTeamRequest(p, inv, team == null ? 8 : 4, Fight.getRedTeam());
|
||||
}
|
||||
inv.open();
|
||||
}
|
||||
|
||||
public static void state(Player p){
|
||||
public static void state(Player p) {
|
||||
SWInventory inv = new SWInventory(p, 9, msg.parse("STATE_TITLE", p));
|
||||
int i = 0;
|
||||
for(FightState state : FightState.values()) {
|
||||
if(state == FightState.SPECTATE)
|
||||
continue;
|
||||
for (FightState state : FightState.values()) {
|
||||
if (state == FightState.SPECTATE) continue;
|
||||
|
||||
inv.setItem(i++, Material.GLASS, msg.parse("STATE_" + state.name(), p), click -> FightState.setFightState(state));
|
||||
}
|
||||
for(FightTeam team : Fight.teams()) {
|
||||
for (FightTeam team : Fight.teams()) {
|
||||
inv.setItem(i++, Material.GLASS, msg.parse("STATE_SPECTATE_WIN", p, team.getColoredName()), click -> FightSystem.setSpectateState(team, "operator", "WIN_FIGHTLEADER"));
|
||||
}
|
||||
inv.setItem(i, Material.GLASS, msg.parse("STATE_SPECTATE_TIE", p), click -> FightSystem.setSpectateState(null, "operator", "WIN_FIGHTLEADER"));
|
||||
@@ -102,7 +103,7 @@ public class GUI {
|
||||
AIManager.availableAIs().stream().map(manager -> new SWListInv.SWListEntry<>(new SWItem(manager.getIcon(), manager.name()), manager)).collect(Collectors.toList()),
|
||||
(click, manager) -> {
|
||||
FightTeam team = Fight.getPlayerTeam(p);
|
||||
if(FightState.PreLeaderSetup.contains(FightState.getFightState())) {
|
||||
if (FightState.PreLeaderSetup.contains(FightState.getFightState())) {
|
||||
manager.join(Fight.getOpposite(team));
|
||||
} else {
|
||||
JoinRequest.forAI(manager, team);
|
||||
@@ -114,7 +115,7 @@ public class GUI {
|
||||
inv.open();
|
||||
}
|
||||
|
||||
public static void chooseJoinRequests(Player p){
|
||||
public static void chooseJoinRequests(Player p) {
|
||||
List<SWListInv.SWListEntry<JoinRequest>> players = JoinRequest.openRequests(p, Fight.getPlayerTeam(p));
|
||||
SWListInv<JoinRequest> inv = new SWListInv<>(p, msg.parse("REQUESTS_TITLE", p), players, (ClickType click, JoinRequest request) -> {
|
||||
p.closeInventory();
|
||||
@@ -124,20 +125,20 @@ public class GUI {
|
||||
inv.open();
|
||||
}
|
||||
|
||||
public static void managePlayers(Player p){
|
||||
public static void managePlayers(Player p) {
|
||||
List<SWListInv.SWListEntry<UUID>> players = SWListInv.createPlayerList(p.getUniqueId());
|
||||
FightTeam team = Fight.getPlayerTeam(p);
|
||||
if(team == null)
|
||||
return;
|
||||
if (team == null) return;
|
||||
players.removeIf(listEntry -> !team.equals(Fight.getPlayerTeam(Bukkit.getPlayer(listEntry.getObject()))));
|
||||
players.forEach(listEntry -> listEntry.getItem().setLore(msg.parse("MANAGE_LORE1", p), msg.parse("MANAGE_LORE2", p)));
|
||||
SWListInv<UUID> inv = new SWListInv<>(p, msg.parse("MANAGE_TITLE", p), players, (ClickType click, UUID player) -> {
|
||||
if(click.isLeftClick()) {
|
||||
if (click.isLeftClick()) {
|
||||
Commands.kick(p, SteamwarUser.get(player).getUserName());
|
||||
} else if(click.isRightClick()) {
|
||||
} else if (click.isRightClick()) {
|
||||
LivingEntity target = (LivingEntity) Bukkit.getEntity(player);
|
||||
if(target != null)
|
||||
if (target != null) {
|
||||
team.setLeader(team.getFightPlayer(target), false);
|
||||
}
|
||||
}
|
||||
p.closeInventory();
|
||||
});
|
||||
@@ -145,19 +146,19 @@ public class GUI {
|
||||
inv.open();
|
||||
}
|
||||
|
||||
public static void kitSelection(Player p, String query){
|
||||
public static void kitSelection(Player p, String query) {
|
||||
FightPlayer fightPlayer = Fight.getFightPlayer(p);
|
||||
if(fightPlayer == null)
|
||||
return;
|
||||
if (fightPlayer == null) return;
|
||||
|
||||
List<SWListInv.SWListEntry<Kit>> entries = new ArrayList<>();
|
||||
|
||||
if(Config.GameModeConfig.Kits.PersonalKits){
|
||||
if (Config.GameModeConfig.Kits.PersonalKits) {
|
||||
List<PersonalKit> kits = PersonalKit.get(SteamwarUser.get(p.getUniqueId()).getId(), Config.GameModeConfig.Schematic.Type.toDB());
|
||||
kits.forEach(kit -> entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.LEATHER_CHESTPLATE, "§e" + kit.getName(), new ArrayList<>(), kit.isInUse(), clickType -> {}), new Kit(kit))));
|
||||
}else{
|
||||
kits.forEach(kit -> entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.LEATHER_CHESTPLATE, "§e" + kit.getName(), new ArrayList<>(), kit.isInUse(), clickType -> {
|
||||
}), new Kit(kit))));
|
||||
} else {
|
||||
List<Kit> kitList = Kit.getAvailableKits(fightPlayer.isLeader());
|
||||
for(Kit k : kitList){
|
||||
for (Kit k : kitList) {
|
||||
entries.add(new SWListInv.SWListEntry<>(new SWItem(Material.LEATHER_CHESTPLATE, k.getName(), null, k.leaderExclusive(), null), k));
|
||||
}
|
||||
}
|
||||
@@ -166,16 +167,16 @@ public class GUI {
|
||||
|
||||
SWListInv<Kit> inv = new SWListInv<>(p, msg.parse("KIT_SELECTION_TITLE", p), false, entries, (clickType, kit) -> kit.preview(p));
|
||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||
if(entries.isEmpty()) {
|
||||
if (entries.isEmpty()) {
|
||||
inv.setItem(22, new SWItem(Material.BARRIER, msg.parse("KIT_NO_KITS", p)));
|
||||
}
|
||||
if(Config.GameModeConfig.Kits.PersonalKits){
|
||||
if (Config.GameModeConfig.Kits.PersonalKits) {
|
||||
inv.setItem(48, Material.NETHER_STAR, msg.parse("KIT_CREATE", p), clickType -> {
|
||||
SWAnvilInv anvilInv = new SWAnvilInv(p, msg.parse("KITNAME_TITLE", p));
|
||||
anvilInv.setItem(Material.LEATHER_CHESTPLATE);
|
||||
anvilInv.setCallback(s -> {
|
||||
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
|
||||
if(PersonalKit.get(user.getId(), Config.GameModeConfig.Schematic.Type.toDB(), s) != null) {
|
||||
if (PersonalKit.get(user.getId(), Config.GameModeConfig.Schematic.Type.toDB(), s) != null) {
|
||||
msg.sendPrefixless("KITNAME_IN_USE", p, ChatMessageType.ACTION_BAR);
|
||||
p.closeInventory();
|
||||
return;
|
||||
@@ -196,8 +197,8 @@ public class GUI {
|
||||
inv.open();
|
||||
}
|
||||
|
||||
public static void preSchemDialog(Player p){
|
||||
if(!Config.test() && FightState.getFightState() != FightState.PRE_SCHEM_SETUP){
|
||||
public static void preSchemDialog(Player p) {
|
||||
if (!Config.test() && FightState.getFightState() != FightState.PRE_SCHEM_SETUP) {
|
||||
msg.sendPrefixless("SCHEM_NO_ENEMY", p, ChatMessageType.ACTION_BAR);
|
||||
return;
|
||||
}
|
||||
@@ -227,7 +228,8 @@ public class GUI {
|
||||
});
|
||||
|
||||
if (Fight.publicOnly()) {
|
||||
inv.setItem(row * 9, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_PRIVATE_FORBIDDEN", p, type.name()), (ClickType click)->{});
|
||||
inv.setItem(row * 9, Material.GRAY_DYE, (byte) 8, msg.parse("SCHEM_PRIVATE_FORBIDDEN", p, type.name()), (ClickType click) -> {
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -239,30 +241,31 @@ public class GUI {
|
||||
}
|
||||
|
||||
if (SchematicNode.getAllAccessibleSchematicsOfType(SteamwarUser.get(p.getUniqueId()).getId(), type.toDB()).isEmpty() && !Config.test()) {
|
||||
inv.setItem(row * 9, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_NO_PRIVATE", p, type.name()), (ClickType click)->{});
|
||||
inv.setItem(row * 9, Material.GRAY_DYE, (byte) 8, msg.parse("SCHEM_NO_PRIVATE", p, type.name()), (ClickType click) -> {
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
inv.setItem(row * 9, SWItem.getMaterial("CAULDRON_ITEM"), msg.parse("SCHEM_PRIVATE", p, type.name()), (ClickType click) -> {
|
||||
inv.setItem(row * 9, Material.CAULDRON, msg.parse("SCHEM_PRIVATE", p, type.name()), (ClickType click) -> {
|
||||
p.closeInventory();
|
||||
schemDialog(p, type, false, false);
|
||||
});
|
||||
}
|
||||
|
||||
private static void schemDialog(Player p, SchematicType type, boolean publicSchems, boolean unchecked){
|
||||
private static void schemDialog(Player p, SchematicType type, boolean publicSchems, boolean unchecked) {
|
||||
SchematicSelector selector = new SchematicSelector(p, Config.test() ? SchematicSelector.selectSchematic() : SchematicSelector.selectSchematicType(unchecked ? type.checkType() : type), node -> {
|
||||
schemSelect(p, node);
|
||||
});
|
||||
selector.setPublicMode(publicSchems?SchematicSelector.PublicMode.PUBLIC_ONLY:SchematicSelector.PublicMode.PRIVATE_ONLY);
|
||||
selector.setPublicMode(publicSchems ? SchematicSelector.PublicMode.PUBLIC_ONLY : SchematicSelector.PublicMode.PRIVATE_ONLY);
|
||||
selector.open();
|
||||
}
|
||||
|
||||
private static void schemSelect(Player p, SchematicNode node) {
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||
if(fightTeam == null)
|
||||
return;
|
||||
if(Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP)
|
||||
if (fightTeam == null) return;
|
||||
if (Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP) {
|
||||
fightTeam.pasteSchem(node);
|
||||
}
|
||||
p.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
+16
-15
@@ -20,20 +20,22 @@
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import de.steamwar.core.CommandRemover;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.defaults.BukkitCommand;
|
||||
import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.Map;
|
||||
|
||||
@Linked
|
||||
public class GamemodeCommand extends BukkitCommand {
|
||||
@@ -47,11 +49,8 @@ public class GamemodeCommand extends BukkitCommand {
|
||||
aliases.add("gm");
|
||||
this.setAliases(aliases);
|
||||
|
||||
try {
|
||||
CommandRemover.removeAll("gamemode");
|
||||
} catch (Exception e) {
|
||||
FightSystem.getPlugin().getLogger().log(Level.SEVERE, "Failed to replace commands", e);
|
||||
}
|
||||
Map<String, Command> knownCommands = ((CraftServer) Bukkit.getServer()).getCommandMap().getKnownCommands();
|
||||
knownCommands.remove("gamemode");
|
||||
Commands.injectCommand(this);
|
||||
}
|
||||
|
||||
@@ -59,7 +58,7 @@ public class GamemodeCommand extends BukkitCommand {
|
||||
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}else if (args.length == 0) {
|
||||
} else if (args.length == 0) {
|
||||
FightSystem.getMessage().sendPrefixless("GAMEMODE_HELP", sender);
|
||||
return false;
|
||||
}
|
||||
@@ -73,7 +72,7 @@ public class GamemodeCommand extends BukkitCommand {
|
||||
|
||||
GameMode mode = createMode(args[0]);
|
||||
|
||||
if(mode == null){
|
||||
if (mode == null) {
|
||||
FightSystem.getMessage().sendPrefixless("GAMEMODE_UNKNOWN", p, ChatMessageType.ACTION_BAR, args[0]);
|
||||
return false;
|
||||
}
|
||||
@@ -83,26 +82,28 @@ public class GamemodeCommand extends BukkitCommand {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private GameMode createMode(String modeArg){
|
||||
private GameMode createMode(String modeArg) {
|
||||
try {
|
||||
return GameMode.getByValue(Integer.parseInt(modeArg));
|
||||
} catch (NumberFormatException ignored) {
|
||||
if ((modeArg.equalsIgnoreCase("creative")) || (modeArg.equalsIgnoreCase("c")))
|
||||
if ((modeArg.equalsIgnoreCase("creative")) || (modeArg.equalsIgnoreCase("c"))) {
|
||||
return GameMode.CREATIVE;
|
||||
else if ((modeArg.equalsIgnoreCase("adventure")) || (modeArg.equalsIgnoreCase("a")))
|
||||
} else if ((modeArg.equalsIgnoreCase("adventure")) || (modeArg.equalsIgnoreCase("a"))) {
|
||||
return GameMode.ADVENTURE;
|
||||
else if ((modeArg.equalsIgnoreCase("spectator")) || (modeArg.equalsIgnoreCase("sp")))
|
||||
} else if ((modeArg.equalsIgnoreCase("spectator")) || (modeArg.equalsIgnoreCase("sp"))) {
|
||||
return GameMode.SPECTATOR;
|
||||
else if ((modeArg.equalsIgnoreCase("survival")) || (modeArg.equalsIgnoreCase("s")))
|
||||
} else if ((modeArg.equalsIgnoreCase("survival")) || (modeArg.equalsIgnoreCase("s"))) {
|
||||
return GameMode.SURVIVAL;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tabComplete(CommandSender sender, String alias, String[] args) {
|
||||
if (args.length == 1)
|
||||
if (args.length == 1) {
|
||||
return StringUtil.copyPartialMatches(args[0], GAMEMODE_NAMES, new ArrayList<>(GAMEMODE_NAMES.size()));
|
||||
}
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||
import de.steamwar.fightsystem.utils.FightStatistics;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
@@ -44,18 +43,17 @@ public class InfoCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player))
|
||||
return false;
|
||||
if (!(sender instanceof Player)) return false;
|
||||
|
||||
Player player = (Player) sender;
|
||||
if(!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.CHECK))
|
||||
return false;
|
||||
if (!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.CHECK)) return false;
|
||||
|
||||
for(FightTeam team : Fight.teams()) {
|
||||
if(!team.isLeaderless())
|
||||
for (FightTeam team : Fight.teams()) {
|
||||
if (!team.isLeaderless()) {
|
||||
FightSystem.getMessage().send("INFO_LEADER", player, team.getColoredName(), team.getLeader().getEntity().getName());
|
||||
}
|
||||
|
||||
if(team.getSchematic() != 0) {
|
||||
if (team.getSchematic() != 0) {
|
||||
SchematicNode schematic = SchematicNode.getSchematicNode(team.getSchematic());
|
||||
FightSystem.getMessage().send("INFO_SCHEMATIC", player, team.getColoredName(), schematic.getName(), SteamwarUser.byId(schematic.getOwner()).getUserName(), schematic.getRank());
|
||||
}
|
||||
|
||||
@@ -37,14 +37,14 @@ public class KitCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(args.length != 1)
|
||||
if (args.length != 1) {
|
||||
GUI.kitSelection(player, "");
|
||||
else{
|
||||
} else {
|
||||
Commands.kit(player, args[0]);
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -37,7 +37,7 @@ public class LeaveCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
|
||||
+8
-7
@@ -26,7 +26,10 @@ import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentCommand;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import de.steamwar.sql.*;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.UserPerm;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
@@ -42,14 +45,12 @@ public class LockschemCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player))
|
||||
return false;
|
||||
if (!(sender instanceof Player)) return false;
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.CHECK))
|
||||
return false;
|
||||
if (!SteamwarUser.get(player.getUniqueId()).hasPerm(UserPerm.CHECK)) return false;
|
||||
|
||||
if(args.length != 1) {
|
||||
if (args.length != 1) {
|
||||
FightSystem.getMessage().sendPrefixless("LOCKSCHEM_HELP", player);
|
||||
return false;
|
||||
}
|
||||
@@ -57,7 +58,7 @@ public class LockschemCommand implements CommandExecutor {
|
||||
String teamName = args[0];
|
||||
FightTeam fightTeam = Fight.getTeamByName(teamName);
|
||||
|
||||
if(fightTeam == null) {
|
||||
if (fightTeam == null) {
|
||||
FightSystem.getMessage().sendPrefixless("UNKNOWN_TEAM", player, ChatMessageType.ACTION_BAR);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ReadyCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
|
||||
+2
-2
@@ -38,12 +38,12 @@ public class RemoveCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(args.length != 1){
|
||||
if (args.length != 1) {
|
||||
FightSystem.getMessage().sendPrefixless("REMOVE_HELP", player);
|
||||
return false;
|
||||
}
|
||||
|
||||
+4
-6
@@ -45,17 +45,15 @@ public class RequestsCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player))
|
||||
return false;
|
||||
if (!(sender instanceof Player)) return false;
|
||||
Player player = (Player) sender;
|
||||
FightPlayer fp = Fight.getFightPlayer(player);
|
||||
if(fp == null || !(fp.isLeader() || fp.isLiving())) {
|
||||
if (fp == null || !(fp.isLeader() || fp.isLiving())) {
|
||||
GUI.joinRequest(player);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(Commands.checkGetLeader(player) == null)
|
||||
return false;
|
||||
if (Commands.checkGetLeader(player) == null) return false;
|
||||
|
||||
GUI.chooseJoinRequests(player);
|
||||
return false;
|
||||
@@ -63,7 +61,7 @@ public class RequestsCommand implements CommandExecutor {
|
||||
|
||||
public static void onJoinRequest(Player player, JoinRequest request, BiConsumer<JoinRequest, FightTeam> handleJoinRequest) {
|
||||
FightTeam team = Fight.getPlayerTeam(player);
|
||||
if(!request.required(team)) {
|
||||
if (!request.required(team)) {
|
||||
FightSystem.getMessage().send("NO_CONFIRMATION", player);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,12 +40,12 @@ public class SkipCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player player = (Player) sender;
|
||||
|
||||
if(PacketProcessor.isReplaying() && player.getUniqueId().equals(Fight.getBlueTeam().getDesignatedLeader())) {
|
||||
if (PacketProcessor.isReplaying() && player.getUniqueId().equals(Fight.getBlueTeam().getDesignatedLeader())) {
|
||||
PacketProcessor.currentReplay().skipToSubtitle();
|
||||
} else {
|
||||
Commands.toggleSkip(player);
|
||||
|
||||
@@ -37,7 +37,7 @@ public class StateCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TBCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Fight.getRedTeam().pasteSchem();
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
package de.steamwar.fightsystem.commands;
|
||||
|
||||
import de.steamwar.core.TPSWarpUtils;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public class TechhiderbugCommand implements CommandExecutor {
|
||||
writer.append(TinyProtocol.instance.toString()).append('\n');
|
||||
|
||||
writer.append('\n').append("Netty pipelines:\n");
|
||||
Bukkit.getOnlinePlayers().forEach(p -> writer.append(p.getName()).append(": ").append(String.join(" ", TinyProtocol.instance.getPlayerInterceptors().get(p).getChannel().pipeline().names())).append('\n'));
|
||||
Bukkit.getOnlinePlayers().forEach(p -> writer.append(p.getName()).append(": ").append(String.join(" ", TinyProtocol.instance.getChannel(p).pipeline().names())).append('\n'));
|
||||
} catch (Exception e) {
|
||||
writer.append("Error while generating bug report: ").append(e.getMessage()).append('\n');
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Error while generating bug report", e);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class WGCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
FightWorld.resetWorld();
|
||||
|
||||
@@ -42,7 +42,7 @@ public class WinCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if(!(sender instanceof Player)) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
Player p = (Player) sender;
|
||||
@@ -52,18 +52,18 @@ public class WinCommand implements CommandExecutor {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(args.length == 0){
|
||||
if (args.length == 0) {
|
||||
FightSystem.getMessage().sendPrefixless("WIN_HELP", p);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(args[0].equalsIgnoreCase("tie")){
|
||||
if (args[0].equalsIgnoreCase("tie")) {
|
||||
FightSystem.setSpectateState(null, "Referee", "WIN_FIGHTLEADER");
|
||||
return false;
|
||||
}
|
||||
|
||||
for(FightTeam team : Fight.teams()) {
|
||||
if(args[0].equalsIgnoreCase(team.getName())){
|
||||
for (FightTeam team : Fight.teams()) {
|
||||
if (args[0].equalsIgnoreCase(team.getName())) {
|
||||
FightSystem.setSpectateState(team, "Referee", "WIN_FIGHTLEADER");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,24 +65,22 @@ public abstract class Countdown {
|
||||
}
|
||||
|
||||
public void disable() {
|
||||
if(task != null){
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
currentCountdowns.remove(this);
|
||||
task = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void skip(){
|
||||
if(currentCountdowns.isEmpty())
|
||||
return;
|
||||
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;
|
||||
for (Countdown countdown : currentCountdowns) {
|
||||
if (countdown.time < smallestTime) smallestTime = countdown.time;
|
||||
}
|
||||
|
||||
for(Countdown countdown : new ArrayList<>(currentCountdowns)) {
|
||||
for (Countdown countdown : new ArrayList<>(currentCountdowns)) {
|
||||
countdown.time -= smallestTime;
|
||||
countdown.show();
|
||||
}
|
||||
@@ -94,15 +92,16 @@ public abstract class Countdown {
|
||||
FightSystem.getMessage().sendPrefixless(message, p, ChatMessageType.ACTION_BAR, displaytime, FightSystem.getMessage().parse(appendix.getMsg(), p, appendix.getParams()));
|
||||
}
|
||||
|
||||
protected void broadcast(String message, int divisor){
|
||||
if(this.sound != null && divisor == 1)
|
||||
protected void broadcast(String message, int divisor) {
|
||||
if (this.sound != null && divisor == 1) {
|
||||
Fight.playSound(this.sound, 100.0F, 1.0F);
|
||||
}
|
||||
|
||||
GlobalRecorder.getInstance().countdown(message, time / divisor, appendix);
|
||||
Bukkit.getOnlinePlayers().forEach(p -> sendCountdownMessage(p, message, time / divisor, appendix));
|
||||
}
|
||||
|
||||
public int getTimeLeft(){
|
||||
public int getTimeLeft() {
|
||||
return time;
|
||||
}
|
||||
|
||||
@@ -111,20 +110,33 @@ public abstract class Countdown {
|
||||
show();
|
||||
}
|
||||
|
||||
private void show(){
|
||||
private void show() {
|
||||
switch (time) {
|
||||
case 900: case 600: case 300: case 180: case 120:
|
||||
case 900:
|
||||
case 600:
|
||||
case 300:
|
||||
case 180:
|
||||
case 120:
|
||||
broadcast("COUNTDOWN_MINUTES", 60);
|
||||
break;
|
||||
case 60: case 30: case 20: case 15: case 10: case 5: case 4: case 3: case 2:
|
||||
case 60:
|
||||
case 30:
|
||||
case 20:
|
||||
case 15:
|
||||
case 10:
|
||||
case 5:
|
||||
case 4:
|
||||
case 3:
|
||||
case 2:
|
||||
broadcast("COUNTDOWN_SECONDS", 1);
|
||||
break;
|
||||
case 1:
|
||||
broadcast("COUNTDOWN_SECOND", 1);
|
||||
break;
|
||||
case 0:
|
||||
if(this.sound != null)
|
||||
if (this.sound != null) {
|
||||
Fight.playSound(this.sound, 100.0F, 2.0F);
|
||||
}
|
||||
|
||||
disable();
|
||||
countdownFinished();
|
||||
@@ -132,7 +144,8 @@ public abstract class Countdown {
|
||||
default:
|
||||
}
|
||||
|
||||
if(this.level)
|
||||
if (this.level) {
|
||||
Bukkit.getServer().getOnlinePlayers().forEach(player -> player.setLevel(time));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-4
@@ -38,11 +38,9 @@ public class EnternCountdown extends Countdown {
|
||||
private static int calcTime(FightPlayer fp, Countdown countdown) {
|
||||
int time = Config.GameModeConfig.EnterStages.get(fp.getKit().getEnterStage());
|
||||
|
||||
if(countdown != null) {
|
||||
if (countdown != null) {
|
||||
time -= Config.GameModeConfig.WinConditionParams.TimeoutTime - countdown.getTimeLeft();
|
||||
|
||||
if(time < 0)
|
||||
time = 0;
|
||||
if (time < 0) time = 0;
|
||||
}
|
||||
|
||||
return time;
|
||||
|
||||
+2
-1
@@ -33,8 +33,9 @@ public class NoPlayersOnlineCountdown extends Countdown {
|
||||
public NoPlayersOnlineCountdown() {
|
||||
super(Config.GameModeConfig.Times.NoPlayersOnlineDuration, new Message("SHUTDOWN_COUNTDOWN"), null, false);
|
||||
|
||||
if (!Config.GameModeConfig.Arena.Leaveable)
|
||||
if (!Config.GameModeConfig.Arena.Leaveable) {
|
||||
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -31,8 +31,9 @@ public class PostSchemCountdown extends Countdown {
|
||||
|
||||
public PostSchemCountdown() {
|
||||
super(Config.GameModeConfig.Times.SetupDuration, new Message("POST_SCHEM_COUNTDOWN"), null, false);
|
||||
if(Config.mode == ArenaMode.PREPARE && Config.GameModeConfig.Schematic.UnlimitedPrepare)
|
||||
if (Config.mode == ArenaMode.PREPARE && Config.GameModeConfig.Schematic.UnlimitedPrepare) {
|
||||
return;
|
||||
}
|
||||
|
||||
new StateDependentCountdown(ArenaMode.SeriousFight, FightState.PostSchemSetup, this);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.fightsystem.event;
|
||||
|
||||
import de.steamwar.core.TrickyTrialsWrapper;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.countdown.Countdown;
|
||||
@@ -31,6 +30,7 @@ import de.steamwar.fightsystem.utils.SWSound;
|
||||
import de.steamwar.fightsystem.winconditions.Winconditions;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -42,202 +42,202 @@ import java.util.logging.Level;
|
||||
@Linked
|
||||
public class HellsBells {
|
||||
|
||||
public static final Random random = new Random();
|
||||
public static final Random random = new Random();
|
||||
|
||||
private final int xLength = Config.BlueExtendRegion.getSizeX();
|
||||
private final int zLength = Config.BlueExtendRegion.getSizeZ();
|
||||
private State current = State.PRE;
|
||||
private int currentDrops = 0;
|
||||
private HellsBellsCountdown currentCountdown;
|
||||
private BukkitTask currentDropping;
|
||||
private final int xLength = Config.BlueExtendRegion.getSizeX();
|
||||
private final int zLength = Config.BlueExtendRegion.getSizeZ();
|
||||
private State current = State.PRE;
|
||||
private int currentDrops = 0;
|
||||
private HellsBellsCountdown currentCountdown;
|
||||
private BukkitTask currentDropping;
|
||||
|
||||
private final List<String> startMessages = Arrays.asList("HELLS_BELLS_START_1", "HELLS_BELLS_START_2",
|
||||
"HELLS_BELLS_START_3", "HELLS_BELLS_START_4", "HELLS_BELLS_START_5", "HELLS_BELLS_START_6");
|
||||
private final List<String> stateSwapMessages = Arrays.asList("HELLS_BELLS_SWAP_1", "HELLS_BELLS_SWAP_2",
|
||||
"HELLS_BELLS_SWAP_3", "HELLS_BELLS_SWAP_4");
|
||||
private final List<String> startMessages = Arrays.asList("HELLS_BELLS_START_1", "HELLS_BELLS_START_2",
|
||||
"HELLS_BELLS_START_3", "HELLS_BELLS_START_4", "HELLS_BELLS_START_5", "HELLS_BELLS_START_6");
|
||||
private final List<String> stateSwapMessages = Arrays.asList("HELLS_BELLS_SWAP_1", "HELLS_BELLS_SWAP_2",
|
||||
"HELLS_BELLS_SWAP_3", "HELLS_BELLS_SWAP_4");
|
||||
|
||||
public void startCountdown() {
|
||||
if (current == HellsBells.State.PRE || current == HellsBells.State.FIRST) {
|
||||
String startMessage = startMessages.get(random.nextInt(startMessages.size()));
|
||||
GlobalRecorder.getInstance().system(startMessage);
|
||||
FightSystem.getMessage().broadcast(startMessage);
|
||||
current = current.getNext();
|
||||
} else if (current != HellsBells.State.LAST && currentDrops >= current.SWITCH_AFTER) {
|
||||
String stateSwapMessage = stateSwapMessages.get(random.nextInt(stateSwapMessages.size()));
|
||||
GlobalRecorder.getInstance().system(stateSwapMessage);
|
||||
FightSystem.getMessage().broadcast(stateSwapMessage);
|
||||
currentDrops = 0;
|
||||
current = current.getNext();
|
||||
}
|
||||
public void startCountdown() {
|
||||
if (current == HellsBells.State.PRE || current == HellsBells.State.FIRST) {
|
||||
String startMessage = startMessages.get(random.nextInt(startMessages.size()));
|
||||
GlobalRecorder.getInstance().system(startMessage);
|
||||
FightSystem.getMessage().broadcast(startMessage);
|
||||
current = current.getNext();
|
||||
} else if (current != HellsBells.State.LAST && currentDrops >= current.SWITCH_AFTER) {
|
||||
String stateSwapMessage = stateSwapMessages.get(random.nextInt(stateSwapMessages.size()));
|
||||
GlobalRecorder.getInstance().system(stateSwapMessage);
|
||||
FightSystem.getMessage().broadcast(stateSwapMessage);
|
||||
currentDrops = 0;
|
||||
current = current.getNext();
|
||||
}
|
||||
|
||||
currentDrops++;
|
||||
currentCountdown = new HellsBellsCountdown(current.MIN_TIME + random.nextInt(current.MAX_TIME - current.MIN_TIME));
|
||||
currentCountdown.enable();
|
||||
}
|
||||
currentDrops++;
|
||||
currentCountdown = new HellsBellsCountdown(current.MIN_TIME + random.nextInt(current.MAX_TIME - current.MIN_TIME));
|
||||
currentCountdown.enable();
|
||||
}
|
||||
|
||||
public void drop() {
|
||||
Direction direction = Direction.getRandom();
|
||||
public void drop() {
|
||||
Direction direction = Direction.getRandom();
|
||||
|
||||
AtomicInteger length = new AtomicInteger(20 + random.nextInt(direction.getLength(zLength, xLength) - 20));
|
||||
int width = 5 + random.nextInt(5);
|
||||
int xOffset = getStart(direction.getLength(xLength, zLength), direction.getLength(length.get(), width));
|
||||
int zOffset = getStart(direction.getLength(zLength, xLength), direction.getLength(width, length.get()));
|
||||
int yOffset = getHeightStart();
|
||||
AtomicInteger length = new AtomicInteger(20 + random.nextInt(direction.getLength(zLength, xLength) - 20));
|
||||
int width = 5 + random.nextInt(5);
|
||||
int xOffset = getStart(direction.getLength(xLength, zLength), direction.getLength(length.get(), width));
|
||||
int zOffset = getStart(direction.getLength(zLength, xLength), direction.getLength(width, length.get()));
|
||||
int yOffset = getHeightStart();
|
||||
|
||||
Point redStart;
|
||||
Point blueStart;
|
||||
Point redStart;
|
||||
Point blueStart;
|
||||
|
||||
if (direction.isNorthOrWest()) {
|
||||
redStart = new Point(Config.RedExtendRegion.getMaxX() - xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMaxZ() - zOffset);
|
||||
blueStart = new Point(Config.BlueExtendRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMinZ() + zOffset);
|
||||
} else {
|
||||
redStart = new Point(Config.RedExtendRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMinZ() + zOffset);
|
||||
blueStart = new Point(Config.BlueExtendRegion.getMaxX() - xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMaxZ() - zOffset);
|
||||
}
|
||||
if (direction.isNorthOrWest()) {
|
||||
redStart = new Point(Config.RedExtendRegion.getMaxX() - xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMaxZ() - zOffset);
|
||||
blueStart = new Point(Config.BlueExtendRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMinZ() + zOffset);
|
||||
} else {
|
||||
redStart = new Point(Config.RedExtendRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMinZ() + zOffset);
|
||||
blueStart = new Point(Config.BlueExtendRegion.getMaxX() - xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMaxZ() - zOffset);
|
||||
}
|
||||
|
||||
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
|
||||
for (int w = 0; w < width; w++) {
|
||||
if (direction.isNorthOrWest()) {
|
||||
Config.world.spawnEntity(redStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), TrickyTrialsWrapper.impl.getTntEntityType());
|
||||
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
|
||||
for (int w = 0; w < width; w++) {
|
||||
if (direction.isNorthOrWest()) {
|
||||
Config.world.spawnEntity(redStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), EntityType.TNT);
|
||||
|
||||
Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), TrickyTrialsWrapper.impl.getTntEntityType());
|
||||
} else {
|
||||
Config.world.spawnEntity(redStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), TrickyTrialsWrapper.impl.getTntEntityType());
|
||||
Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.TNT);
|
||||
} else {
|
||||
Config.world.spawnEntity(redStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.TNT);
|
||||
|
||||
Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), TrickyTrialsWrapper.impl.getTntEntityType());
|
||||
}
|
||||
}
|
||||
if (length.addAndGet(-2) <= 0) {
|
||||
currentDropping.cancel();
|
||||
}
|
||||
}, 0L, 4L);
|
||||
}
|
||||
Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), EntityType.TNT);
|
||||
}
|
||||
}
|
||||
if (length.addAndGet(-2) <= 0) {
|
||||
currentDropping.cancel();
|
||||
}
|
||||
}, 0L, 4L);
|
||||
}
|
||||
|
||||
private int getStart(int regionSize, int length) {
|
||||
double randomNumber = (Math.max(Math.min(random.nextGaussian(), -2), 2) + 2) / 4;
|
||||
Bukkit.getLogger().log(Level.INFO, "Calculated Start: " + (int) (randomNumber * (regionSize - length)));
|
||||
return Math.max(Math.min((int) (randomNumber * (regionSize - length)), regionSize - length), 0);
|
||||
}
|
||||
private int getStart(int regionSize, int length) {
|
||||
double randomNumber = (Math.max(Math.min(random.nextGaussian(), -2), 2) + 2) / 4;
|
||||
Bukkit.getLogger().log(Level.INFO, "Calculated Start: " + (int) (randomNumber * (regionSize - length)));
|
||||
return Math.max(Math.min((int) (randomNumber * (regionSize - length)), regionSize - length), 0);
|
||||
}
|
||||
|
||||
private int getHeightStart() {
|
||||
return 5 + random.nextInt(15);
|
||||
}
|
||||
private int getHeightStart() {
|
||||
return 5 + random.nextInt(15);
|
||||
}
|
||||
|
||||
public HellsBells() {
|
||||
new StateDependent(Winconditions.HELLS_BELLS, FightState.Running) {
|
||||
@Override
|
||||
public void enable() {
|
||||
current = State.PRE;
|
||||
currentDrops = 0;
|
||||
startCountdown();
|
||||
}
|
||||
public HellsBells() {
|
||||
new StateDependent(Winconditions.HELLS_BELLS, FightState.Running) {
|
||||
@Override
|
||||
public void enable() {
|
||||
current = State.PRE;
|
||||
currentDrops = 0;
|
||||
startCountdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
currentCountdown.disable();
|
||||
}
|
||||
}.register();
|
||||
}
|
||||
@Override
|
||||
public void disable() {
|
||||
currentCountdown.disable();
|
||||
}
|
||||
}.register();
|
||||
}
|
||||
|
||||
private class HellsBellsCountdown extends Countdown {
|
||||
private class HellsBellsCountdown extends Countdown {
|
||||
|
||||
public HellsBellsCountdown(int time) {
|
||||
super(time, new Message("HELLS_BELLS_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
|
||||
}
|
||||
public HellsBellsCountdown(int time) {
|
||||
super(time, new Message("HELLS_BELLS_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
drop();
|
||||
startCountdown();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
drop();
|
||||
startCountdown();
|
||||
}
|
||||
}
|
||||
|
||||
private enum State {
|
||||
private enum State {
|
||||
|
||||
PRE(60, 80, 1),
|
||||
FIRST(40, 60, 3),
|
||||
SECOND(30, 40, 4),
|
||||
THIRD(20, 30, 4),
|
||||
FOURTH(10, 20, 5),
|
||||
LAST(5, 10, 0);
|
||||
PRE(60, 80, 1),
|
||||
FIRST(40, 60, 3),
|
||||
SECOND(30, 40, 4),
|
||||
THIRD(20, 30, 4),
|
||||
FOURTH(10, 20, 5),
|
||||
LAST(5, 10, 0);
|
||||
|
||||
|
||||
State(int minTime, int maxTime, int switchAfter) {
|
||||
this.MIN_TIME = minTime;
|
||||
this.MAX_TIME = maxTime;
|
||||
this.SWITCH_AFTER = switchAfter;
|
||||
}
|
||||
State(int minTime, int maxTime, int switchAfter) {
|
||||
this.MIN_TIME = minTime;
|
||||
this.MAX_TIME = maxTime;
|
||||
this.SWITCH_AFTER = switchAfter;
|
||||
}
|
||||
|
||||
private final int MIN_TIME; //NOSONAR
|
||||
private final int MAX_TIME; //NOSONAR
|
||||
private final int SWITCH_AFTER; //NOSONAR
|
||||
private final int MIN_TIME; //NOSONAR
|
||||
private final int MAX_TIME; //NOSONAR
|
||||
private final int SWITCH_AFTER; //NOSONAR
|
||||
|
||||
|
||||
public State getNext() {
|
||||
switch (this) {
|
||||
case PRE:
|
||||
return FIRST;
|
||||
case FIRST:
|
||||
return SECOND;
|
||||
case SECOND:
|
||||
return THIRD;
|
||||
case THIRD:
|
||||
return FOURTH;
|
||||
case FOURTH:
|
||||
case LAST:
|
||||
return LAST;
|
||||
default:
|
||||
return PRE;
|
||||
}
|
||||
}
|
||||
}
|
||||
public State getNext() {
|
||||
switch (this) {
|
||||
case PRE:
|
||||
return FIRST;
|
||||
case FIRST:
|
||||
return SECOND;
|
||||
case SECOND:
|
||||
return THIRD;
|
||||
case THIRD:
|
||||
return FOURTH;
|
||||
case FOURTH:
|
||||
case LAST:
|
||||
return LAST;
|
||||
default:
|
||||
return PRE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum Direction {
|
||||
NORTH(0, 0, 1),
|
||||
SOUTH(0, 0, -1),
|
||||
EAST(1, 0, 0),
|
||||
WEST(-1, 0, 0);
|
||||
private enum Direction {
|
||||
NORTH(0, 0, 1),
|
||||
SOUTH(0, 0, -1),
|
||||
EAST(1, 0, 0),
|
||||
WEST(-1, 0, 0);
|
||||
|
||||
|
||||
int dx;
|
||||
int dy;
|
||||
int dz;
|
||||
int dx;
|
||||
int dy;
|
||||
int dz;
|
||||
|
||||
Direction(int dx, int dy, int dz) {
|
||||
this.dx = dx;
|
||||
this.dy = dy;
|
||||
this.dz = dz;
|
||||
}
|
||||
Direction(int dx, int dy, int dz) {
|
||||
this.dx = dx;
|
||||
this.dy = dy;
|
||||
this.dz = dz;
|
||||
}
|
||||
|
||||
public static Direction getRandom() {
|
||||
return Direction.values()[random.nextInt(Direction.values().length)];
|
||||
}
|
||||
public static Direction getRandom() {
|
||||
return Direction.values()[random.nextInt(Direction.values().length)];
|
||||
}
|
||||
|
||||
Direction other() {
|
||||
switch (this) {
|
||||
case NORTH:
|
||||
return EAST;
|
||||
case SOUTH:
|
||||
return WEST;
|
||||
case EAST:
|
||||
return NORTH;
|
||||
case WEST:
|
||||
return SOUTH;
|
||||
default:
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Direction other() {
|
||||
switch (this) {
|
||||
case NORTH:
|
||||
return EAST;
|
||||
case SOUTH:
|
||||
return WEST;
|
||||
case EAST:
|
||||
return NORTH;
|
||||
case WEST:
|
||||
return SOUTH;
|
||||
default:
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public int getLength(int length1, int length2) {
|
||||
return isNorthOrSouth() ? length1 : length2;
|
||||
}
|
||||
public int getLength(int length1, int length2) {
|
||||
return isNorthOrSouth() ? length1 : length2;
|
||||
}
|
||||
|
||||
public boolean isNorthOrSouth() {
|
||||
return this == NORTH || this == SOUTH;
|
||||
}
|
||||
public boolean isNorthOrSouth() {
|
||||
return this == NORTH || this == SOUTH;
|
||||
}
|
||||
|
||||
public boolean isNorthOrWest() {
|
||||
return this == NORTH || this == WEST;
|
||||
}
|
||||
}
|
||||
public boolean isNorthOrWest() {
|
||||
return this == NORTH || this == WEST;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,170 +48,168 @@ import java.util.logging.Level;
|
||||
@Linked
|
||||
public class Meteor implements Listener {
|
||||
|
||||
public static final Random random = new Random();
|
||||
public static final Random random = new Random();
|
||||
|
||||
private final Vector vector = new Vector(0, -1, 0);
|
||||
private final int xLength = Config.RedExtendRegion.getMaxX() - Config.RedExtendRegion.getMinX();
|
||||
private final int zLength = Config.RedExtendRegion.getMaxZ() - Config.RedExtendRegion.getMinZ();
|
||||
private Meteor.State current = Meteor.State.PRE;
|
||||
private int currentDrops = 0;
|
||||
private Meteor.MeteorCountdown currentCountdown;
|
||||
private final AtomicInteger amount = new AtomicInteger(0);
|
||||
private BukkitTask currentDropping;
|
||||
private final Vector vector = new Vector(0, -1, 0);
|
||||
private final int xLength = Config.RedExtendRegion.getMaxX() - Config.RedExtendRegion.getMinX();
|
||||
private final int zLength = Config.RedExtendRegion.getMaxZ() - Config.RedExtendRegion.getMinZ();
|
||||
private Meteor.State current = Meteor.State.PRE;
|
||||
private int currentDrops = 0;
|
||||
private Meteor.MeteorCountdown currentCountdown;
|
||||
private final AtomicInteger amount = new AtomicInteger(0);
|
||||
private BukkitTask currentDropping;
|
||||
|
||||
private final List<String> startMessages = Arrays.asList("METEOR_START_1", "METEOR_START_2", "METEOR_START_3", "METEOR_START_4", "METEOR_START_5", "METEOR_START_6");
|
||||
private final List<String> stateSwapMessages = Arrays.asList("METEOR_SWAP_1", "METEOR_SWAP_2", "METEOR_SWAP_3", "METEOR_SWAP_4");
|
||||
private final List<String> startMessages = Arrays.asList("METEOR_START_1", "METEOR_START_2", "METEOR_START_3", "METEOR_START_4", "METEOR_START_5", "METEOR_START_6");
|
||||
private final List<String> stateSwapMessages = Arrays.asList("METEOR_SWAP_1", "METEOR_SWAP_2", "METEOR_SWAP_3", "METEOR_SWAP_4");
|
||||
|
||||
public void startCountdown() {
|
||||
if (current == Meteor.State.PRE || current == Meteor.State.FIRST) {
|
||||
String startMessage = startMessages.get(random.nextInt(startMessages.size()));
|
||||
GlobalRecorder.getInstance().system(startMessage);
|
||||
FightSystem.getMessage().broadcast(startMessage);
|
||||
current = current.getNext();
|
||||
} else if (current != Meteor.State.LAST && currentDrops >= current.SWITCH_AFTER) {
|
||||
String stateSwapMessage = stateSwapMessages.get(random.nextInt(stateSwapMessages.size()));
|
||||
GlobalRecorder.getInstance().system(stateSwapMessage);
|
||||
FightSystem.getMessage().broadcast(stateSwapMessage);
|
||||
currentDrops = 0;
|
||||
current = current.getNext();
|
||||
}
|
||||
public void startCountdown() {
|
||||
if (current == Meteor.State.PRE || current == Meteor.State.FIRST) {
|
||||
String startMessage = startMessages.get(random.nextInt(startMessages.size()));
|
||||
GlobalRecorder.getInstance().system(startMessage);
|
||||
FightSystem.getMessage().broadcast(startMessage);
|
||||
current = current.getNext();
|
||||
} else if (current != Meteor.State.LAST && currentDrops >= current.SWITCH_AFTER) {
|
||||
String stateSwapMessage = stateSwapMessages.get(random.nextInt(stateSwapMessages.size()));
|
||||
GlobalRecorder.getInstance().system(stateSwapMessage);
|
||||
FightSystem.getMessage().broadcast(stateSwapMessage);
|
||||
currentDrops = 0;
|
||||
current = current.getNext();
|
||||
}
|
||||
|
||||
currentDrops++;
|
||||
currentCountdown = new Meteor.MeteorCountdown(current.MIN_TIME + random.nextInt(current.MAX_TIME - current.MIN_TIME));
|
||||
currentCountdown.enable();
|
||||
}
|
||||
currentDrops++;
|
||||
currentCountdown = new Meteor.MeteorCountdown(current.MIN_TIME + random.nextInt(current.MAX_TIME - current.MIN_TIME));
|
||||
currentCountdown.enable();
|
||||
}
|
||||
|
||||
//@EventHandler
|
||||
public void explode(ProjectileHitEvent event) {
|
||||
if (event.getEntity() instanceof Fireball) {
|
||||
TNTPrimed tnt = Config.world.spawn(event.getEntity().getLocation(), TNTPrimed.class);
|
||||
tnt.setVelocity(new Vector(0, 0, 0));
|
||||
tnt.setFuseTicks(0);
|
||||
tnt.setYield(((Fireball) event.getEntity()).getYield());
|
||||
event.getEntity().remove();
|
||||
}
|
||||
}
|
||||
//@EventHandler
|
||||
public void explode(ProjectileHitEvent event) {
|
||||
if (event.getEntity() instanceof Fireball) {
|
||||
TNTPrimed tnt = Config.world.spawn(event.getEntity().getLocation(), TNTPrimed.class);
|
||||
tnt.setVelocity(new Vector(0, 0, 0));
|
||||
tnt.setFuseTicks(0);
|
||||
tnt.setYield(((Fireball) event.getEntity()).getYield());
|
||||
event.getEntity().remove();
|
||||
}
|
||||
}
|
||||
|
||||
public void drop() {
|
||||
int randomAmount = current.minAmount + random.nextInt(current.maxAmount - current.minAmount);
|
||||
if (amount.get() > 0) {
|
||||
amount.set(amount.get() + randomAmount);
|
||||
return;
|
||||
}
|
||||
amount.set(randomAmount);
|
||||
public void drop() {
|
||||
int randomAmount = current.minAmount + random.nextInt(current.maxAmount - current.minAmount);
|
||||
if (amount.get() > 0) {
|
||||
amount.set(amount.get() + randomAmount);
|
||||
return;
|
||||
}
|
||||
amount.set(randomAmount);
|
||||
|
||||
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
|
||||
int xOffset = getStart(xLength);
|
||||
int zOffset = getStart(zLength);
|
||||
int yOffset = getHeightStart();
|
||||
currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> {
|
||||
int xOffset = getStart(xLength);
|
||||
int zOffset = getStart(zLength);
|
||||
int yOffset = getHeightStart();
|
||||
|
||||
Point redStart = new Point(Config.RedExtendRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMaxZ() - zOffset);
|
||||
Point blueStart = new Point(Config.BlueExtendRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMinZ() + zOffset);
|
||||
Point redStart = new Point(Config.RedExtendRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMaxZ() - zOffset);
|
||||
Point blueStart = new Point(Config.BlueExtendRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMinZ() + zOffset);
|
||||
|
||||
vector.setX(random.nextDouble() - 0.5);
|
||||
vector.setZ(random.nextDouble() - 0.5);
|
||||
vector.setX(random.nextDouble() - 0.5);
|
||||
vector.setZ(random.nextDouble() - 0.5);
|
||||
|
||||
LargeFireball fireballRed = Config.world.spawn(redStart.toLocation(Config.world), LargeFireball.class);
|
||||
fireballRed.setDirection(vector);
|
||||
fireballRed.setBounce(false);
|
||||
fireballRed.setIsIncendiary(false);
|
||||
fireballRed.setYield(current.explosionSize);
|
||||
LargeFireball fireballRed = Config.world.spawn(redStart.toLocation(Config.world), LargeFireball.class);
|
||||
fireballRed.setDirection(vector);
|
||||
fireballRed.setIsIncendiary(false);
|
||||
fireballRed.setYield(current.explosionSize);
|
||||
|
||||
LargeFireball fireballBlue = Config.world.spawn(blueStart.toLocation(Config.world), LargeFireball.class);
|
||||
vector.setZ(vector.getZ() * -1);
|
||||
fireballBlue.setDirection(vector);
|
||||
fireballBlue.setBounce(false);
|
||||
fireballBlue.setIsIncendiary(false);
|
||||
fireballBlue.setYield(current.explosionSize);
|
||||
LargeFireball fireballBlue = Config.world.spawn(blueStart.toLocation(Config.world), LargeFireball.class);
|
||||
vector.setZ(vector.getZ() * -1);
|
||||
fireballBlue.setDirection(vector);
|
||||
fireballBlue.setIsIncendiary(false);
|
||||
fireballBlue.setYield(current.explosionSize);
|
||||
|
||||
if (amount.decrementAndGet() <= 0) {
|
||||
currentDropping.cancel();
|
||||
}
|
||||
}, 0L, 4L);
|
||||
}
|
||||
if (amount.decrementAndGet() <= 0) {
|
||||
currentDropping.cancel();
|
||||
}
|
||||
}, 0L, 4L);
|
||||
}
|
||||
|
||||
private int getStart(int regionSize) {
|
||||
double randomNumber = (random.nextDouble() - random.nextDouble()) / 2 + 0.5;
|
||||
Bukkit.getLogger().log(Level.INFO, "Calculated Start: " + (int) (randomNumber * (regionSize - 1)));
|
||||
return Math.max(Math.min((int) (randomNumber * (regionSize - 1)), regionSize - 1), 0);
|
||||
}
|
||||
private int getStart(int regionSize) {
|
||||
double randomNumber = (random.nextDouble() - random.nextDouble()) / 2 + 0.5;
|
||||
Bukkit.getLogger().log(Level.INFO, "Calculated Start: " + (int) (randomNumber * (regionSize - 1)));
|
||||
return Math.max(Math.min((int) (randomNumber * (regionSize - 1)), regionSize - 1), 0);
|
||||
}
|
||||
|
||||
private int getHeightStart() {
|
||||
return 5 + random.nextInt(15);
|
||||
}
|
||||
private int getHeightStart() {
|
||||
return 5 + random.nextInt(15);
|
||||
}
|
||||
|
||||
public Meteor() {
|
||||
new StateDependentListener(Winconditions.METEOR, FightState.Running, this);
|
||||
public Meteor() {
|
||||
new StateDependentListener(Winconditions.METEOR, FightState.Running, this);
|
||||
|
||||
new StateDependent(Winconditions.METEOR, FightState.Running) {
|
||||
@Override
|
||||
public void enable() {
|
||||
startCountdown();
|
||||
}
|
||||
new StateDependent(Winconditions.METEOR, FightState.Running) {
|
||||
@Override
|
||||
public void enable() {
|
||||
startCountdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
currentCountdown.disable();
|
||||
}
|
||||
}.register();
|
||||
}
|
||||
@Override
|
||||
public void disable() {
|
||||
currentCountdown.disable();
|
||||
}
|
||||
}.register();
|
||||
}
|
||||
|
||||
private class MeteorCountdown extends Countdown {
|
||||
private class MeteorCountdown extends Countdown {
|
||||
|
||||
public MeteorCountdown(int time) {
|
||||
super(time, new Message("METEOR_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
|
||||
}
|
||||
public MeteorCountdown(int time) {
|
||||
super(time, new Message("METEOR_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
drop();
|
||||
startCountdown();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
drop();
|
||||
startCountdown();
|
||||
}
|
||||
}
|
||||
|
||||
private enum State {
|
||||
private enum State {
|
||||
|
||||
PRE(60, 80, 1, 0, 0, 0),
|
||||
FIRST(25, 35, 6, 2, 3, 6),
|
||||
SECOND(20, 30, 7, 4, 4, 8),
|
||||
THIRD(15, 25, 7, 4, 5, 10),
|
||||
FOURTH(10, 20, 8, 6, 7, 14),
|
||||
LAST(5, 10, 0, 6, 9, 18);
|
||||
PRE(60, 80, 1, 0, 0, 0),
|
||||
FIRST(25, 35, 6, 2, 3, 6),
|
||||
SECOND(20, 30, 7, 4, 4, 8),
|
||||
THIRD(15, 25, 7, 4, 5, 10),
|
||||
FOURTH(10, 20, 8, 6, 7, 14),
|
||||
LAST(5, 10, 0, 6, 9, 18);
|
||||
|
||||
|
||||
State(int minTime, int maxTime, int switchAfter, int explosionSize, int minAmount, int maxAmount) {
|
||||
this.MIN_TIME = minTime;
|
||||
this.MAX_TIME = maxTime;
|
||||
this.SWITCH_AFTER = switchAfter;
|
||||
this.explosionSize = explosionSize;
|
||||
this.minAmount = minAmount;
|
||||
this.maxAmount = maxAmount;
|
||||
}
|
||||
State(int minTime, int maxTime, int switchAfter, int explosionSize, int minAmount, int maxAmount) {
|
||||
this.MIN_TIME = minTime;
|
||||
this.MAX_TIME = maxTime;
|
||||
this.SWITCH_AFTER = switchAfter;
|
||||
this.explosionSize = explosionSize;
|
||||
this.minAmount = minAmount;
|
||||
this.maxAmount = maxAmount;
|
||||
}
|
||||
|
||||
private final int MIN_TIME; //NOSONAR
|
||||
private final int MAX_TIME; //NOSONAR
|
||||
private final int SWITCH_AFTER; //NOSONAR
|
||||
private final int explosionSize; //NOSONAR
|
||||
private final int minAmount;
|
||||
private final int maxAmount;
|
||||
private final int MIN_TIME; //NOSONAR
|
||||
private final int MAX_TIME; //NOSONAR
|
||||
private final int SWITCH_AFTER; //NOSONAR
|
||||
private final int explosionSize; //NOSONAR
|
||||
private final int minAmount;
|
||||
private final int maxAmount;
|
||||
|
||||
|
||||
public Meteor.State getNext() {
|
||||
switch (this) {
|
||||
case PRE:
|
||||
return FIRST;
|
||||
case FIRST:
|
||||
return SECOND;
|
||||
case SECOND:
|
||||
return THIRD;
|
||||
case THIRD:
|
||||
return FOURTH;
|
||||
case FOURTH:
|
||||
case LAST:
|
||||
return LAST;
|
||||
default:
|
||||
return PRE;
|
||||
}
|
||||
}
|
||||
}
|
||||
public Meteor.State getNext() {
|
||||
switch (this) {
|
||||
case PRE:
|
||||
return FIRST;
|
||||
case FIRST:
|
||||
return SECOND;
|
||||
case SECOND:
|
||||
return THIRD;
|
||||
case THIRD:
|
||||
return FOURTH;
|
||||
case FOURTH:
|
||||
case LAST:
|
||||
return LAST;
|
||||
default:
|
||||
return PRE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -37,13 +37,12 @@ import java.util.logging.Level;
|
||||
public class PersistentDamage {
|
||||
|
||||
public PersistentDamage() {
|
||||
if(!ArenaMode.SeriousFight.contains(Config.mode))
|
||||
return;
|
||||
if (!ArenaMode.SeriousFight.contains(Config.mode)) return;
|
||||
|
||||
new OneShotStateDependent(Winconditions.PERSISTENT_DAMAGE, FightState.Spectate, () -> Fight.teams().forEach(team -> {
|
||||
try{
|
||||
try {
|
||||
WorldeditWrapper.impl.saveSchem(SchematicNode.getSchematicNode(team.getSchematic()), team.getExtendRegion(), team.getSchemRegion().getMinY());
|
||||
}catch(WorldEditException e){
|
||||
} catch (WorldEditException e) {
|
||||
FightSystem.getPlugin().getLogger().log(Level.SEVERE, "Could not persist schematic state", e);
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -32,9 +32,7 @@ public class TNTDistributor {
|
||||
|
||||
public TNTDistributor() {
|
||||
new StateDependentTask(Winconditions.TNT_DISTRIBUTION, FightState.Running, () -> Fight.teams().forEach(team -> team.getPlayers().forEach(fp -> {
|
||||
if (!fp.isLiving())
|
||||
return;
|
||||
|
||||
if (!fp.isLiving()) return;
|
||||
fp.ifPlayer(player -> player.getInventory().addItem(new ItemStack(Material.TNT, 1)));
|
||||
})), 20, 20);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.record.GlobalRecorder;
|
||||
@@ -32,40 +31,47 @@ import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class Fight {
|
||||
private Fight(){}
|
||||
private Fight() {
|
||||
}
|
||||
|
||||
@Getter
|
||||
private static final FightTeam redTeam = new FightTeam(Config.TeamRedName, Config.TeamRedColor, Config.TeamRedSpawn, Config.RedPasteRegion, Config.RedExtendRegion, Config.RedRotate, false, Config.RedLeader);
|
||||
@Getter
|
||||
private static final FightTeam blueTeam = new FightTeam(Config.TeamBlueName, Config.TeamBlueColor, Config.TeamBlueSpawn, Config.BluePasteRegion, Config.BlueExtendRegion, Config.BlueRotate, true, Config.BlueLeader);
|
||||
private static final Collection<FightTeam> teams = new HashSet<>();
|
||||
|
||||
static {
|
||||
teams.add(redTeam);
|
||||
teams.add(blueTeam);
|
||||
}
|
||||
|
||||
public static FightTeam getPlayerTeam(LivingEntity player) {
|
||||
if(redTeam.isPlayerInTeam(player))
|
||||
if (redTeam.isPlayerInTeam(player)) {
|
||||
return redTeam;
|
||||
if(blueTeam.isPlayerInTeam(player))
|
||||
}
|
||||
if (blueTeam.isPlayerInTeam(player)) {
|
||||
return blueTeam;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static FightTeam getOpposite(FightTeam fightTeam) {
|
||||
if(fightTeam == redTeam)
|
||||
if (fightTeam == redTeam) {
|
||||
return blueTeam;
|
||||
else if(fightTeam == blueTeam)
|
||||
} else if (fightTeam == blueTeam) {
|
||||
return redTeam;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
public static FightPlayer getFightPlayer(LivingEntity player) {
|
||||
if(redTeam.isPlayerInTeam(player))
|
||||
if (redTeam.isPlayerInTeam(player)) {
|
||||
return redTeam.getFightPlayer(player);
|
||||
if(blueTeam.isPlayerInTeam(player))
|
||||
}
|
||||
if (blueTeam.isPlayerInTeam(player)) {
|
||||
return blueTeam.getFightPlayer(player);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -84,17 +90,16 @@ public class Fight {
|
||||
public static void playSound(Sound sound, float volume, float pitch) {
|
||||
GlobalRecorder.getInstance().soundAtPlayer(sound.name(), volume, pitch);
|
||||
//volume: max. 100, pitch: max. 2
|
||||
if(Core.getVersion() >= 18)
|
||||
Bukkit.getServer().getOnlinePlayers().forEach(player -> player.playSound(player, sound, volume, pitch));
|
||||
else
|
||||
Bukkit.getServer().getOnlinePlayers().forEach(player -> player.playSound(player.getLocation(), sound, volume, pitch));
|
||||
Bukkit.getServer().getOnlinePlayers().forEach(player -> player.playSound(player, sound, volume, pitch));
|
||||
}
|
||||
|
||||
public static FightTeam getTeamByName(String name) {
|
||||
if(redTeam.getName().equalsIgnoreCase(name))
|
||||
if (redTeam.getName().equalsIgnoreCase(name)) {
|
||||
return redTeam;
|
||||
if(blueTeam.getName().equalsIgnoreCase(name))
|
||||
}
|
||||
if (blueTeam.getName().equalsIgnoreCase(name)) {
|
||||
return blueTeam;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,9 +54,9 @@ public class FightPlayer {
|
||||
this.team = team;
|
||||
this.isOut = false;
|
||||
kit = Kit.getKitByName(Config.GameModeConfig.Kits.MemberDefault);
|
||||
if(Config.GameModeConfig.Kits.PersonalKits){
|
||||
if (Config.GameModeConfig.Kits.PersonalKits) {
|
||||
PersonalKit personalKit = PersonalKit.getKitInUse(user.getId(), Config.GameModeConfig.Schematic.Type.toDB());
|
||||
if(personalKit != null){
|
||||
if (personalKit != null) {
|
||||
kit = new Kit(personalKit);
|
||||
}
|
||||
}
|
||||
@@ -75,12 +75,13 @@ public class FightPlayer {
|
||||
}
|
||||
|
||||
public void startEnternCountdown(Countdown countdown) {
|
||||
if(Config.GameModeConfig.EnterStages.size() > kit.getEnterStage() && kit.getEnterStage() >= 0)
|
||||
if (Config.GameModeConfig.EnterStages.size() > kit.getEnterStage() && kit.getEnterStage() >= 0) {
|
||||
enternCountdown = new EnternCountdown(this, countdown);
|
||||
}
|
||||
}
|
||||
|
||||
public void stopEnternCountdown(){
|
||||
if(enternCountdown != null){
|
||||
public void stopEnternCountdown() {
|
||||
if (enternCountdown != null) {
|
||||
enternCountdown.disable();
|
||||
}
|
||||
enternCountdown = null;
|
||||
@@ -88,8 +89,7 @@ public class FightPlayer {
|
||||
|
||||
public LivingEntity getEntity() {
|
||||
LivingEntity bukkit = Bukkit.getPlayer(entity.getUniqueId());
|
||||
if(bukkit != null)
|
||||
entity = bukkit;
|
||||
if (bukkit != null) entity = bukkit;
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -98,16 +98,15 @@ public class FightPlayer {
|
||||
}
|
||||
|
||||
public void ifAI(Consumer<AI> function) {
|
||||
if(entity instanceof Player)
|
||||
return;
|
||||
if (entity instanceof Player) return;
|
||||
AI ai = AI.getAI(entity.getUniqueId());
|
||||
if(ai != null)
|
||||
function.accept(ai);
|
||||
if (ai != null) function.accept(ai);
|
||||
}
|
||||
|
||||
public void ifPlayer(Consumer<Player> function) {
|
||||
if(entity instanceof Player)
|
||||
if (entity instanceof Player) {
|
||||
function.accept((Player) entity);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLiving() {
|
||||
@@ -119,13 +118,12 @@ public class FightPlayer {
|
||||
return leader != null && leader.getEntity() == entity;
|
||||
}
|
||||
|
||||
public void addKill(){
|
||||
public void addKill() {
|
||||
kills++;
|
||||
}
|
||||
|
||||
public boolean canEntern(){
|
||||
if(enternCountdown == null)
|
||||
return false;
|
||||
public boolean canEntern() {
|
||||
if (enternCountdown == null) return false;
|
||||
return enternCountdown.getTimeLeft() == 0;
|
||||
}
|
||||
}
|
||||
|
||||
+23
-24
@@ -79,7 +79,7 @@ public class FightSchematic extends StateDependent {
|
||||
return clipboard != null;
|
||||
}
|
||||
|
||||
public int getId(){
|
||||
public int getId() {
|
||||
return schematic;
|
||||
}
|
||||
|
||||
@@ -92,8 +92,7 @@ public class FightSchematic extends StateDependent {
|
||||
try {
|
||||
clipboard = new SchematicData(schem, revision).load();
|
||||
|
||||
if(schem.replaceColor())
|
||||
replaceTeamColor(clipboard);
|
||||
if (schem.replaceColor()) replaceTeamColor(clipboard);
|
||||
} catch (IOException e) {
|
||||
team.broadcastSystem("SCHEMATIC_UNLOADABLE");
|
||||
Bukkit.getLogger().log(Level.SEVERE, e, () -> "Couldn't load Schematic " + schem.getName());
|
||||
@@ -105,19 +104,18 @@ public class FightSchematic extends StateDependent {
|
||||
this.clipboard = clipboard;
|
||||
}
|
||||
|
||||
public void reset(){
|
||||
public void reset() {
|
||||
schematic = 0;
|
||||
clipboard = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
if(FightState.getFightState() == FightState.SPECTATE)
|
||||
return;
|
||||
if (FightState.getFightState() == FightState.SPECTATE) return;
|
||||
|
||||
if(clipboard == null){
|
||||
if (clipboard == null) {
|
||||
List<SchematicNode> publics = SchematicNode.getAllSchematicsOfType(0, Config.GameModeConfig.Schematic.Type.toDB());
|
||||
if(publics.isEmpty()) {
|
||||
if (publics.isEmpty()) {
|
||||
for (SchematicType type : Config.GameModeConfig.Schematic.SubTypes) {
|
||||
publics = SchematicNode.getAllSchematicsOfType(0, type.toDB());
|
||||
if (!publics.isEmpty()) {
|
||||
@@ -132,16 +130,17 @@ public class FightSchematic extends StateDependent {
|
||||
setSchematic(publics.get(new Random().nextInt(publics.size())));
|
||||
}
|
||||
|
||||
if(ArenaMode.AntiReplay.contains(Config.mode)) {
|
||||
if (ArenaMode.AntiReplay.contains(Config.mode)) {
|
||||
boolean changeRotation = false;
|
||||
if (Config.GameModeConfig.WinConditions.contains(Winconditions.RANDOM_ROTATE)) {
|
||||
changeRotation = new Random().nextBoolean();
|
||||
usedRotate = rotate ^ changeRotation;
|
||||
}
|
||||
if(team.isBlue())
|
||||
if (team.isBlue()) {
|
||||
GlobalRecorder.getInstance().blueSchem(schematic, changeRotation);
|
||||
else
|
||||
} else {
|
||||
GlobalRecorder.getInstance().redSchem(schematic, changeRotation);
|
||||
}
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::paste);
|
||||
@@ -149,13 +148,13 @@ public class FightSchematic extends StateDependent {
|
||||
|
||||
private void replaceTeamColor(Clipboard clipboard) {
|
||||
try {
|
||||
WorldeditWrapper.impl.replaceTeamColor(clipboard, ArenaMode.AntiPrepare.contains(Config.mode) ? ColorConverter.chat2dye(team.getColor()) : DyeColor.PINK);
|
||||
WorldeditWrapper.impl.replaceTeamColor(clipboard, ArenaMode.AntiPrepare.contains(Config.mode) ? ColorConverter.chat2dyeColor(team.getColor()) : DyeColor.PINK);
|
||||
} catch (WorldEditException e) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Could not recolor schematic", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void paste(){
|
||||
private void paste() {
|
||||
FreezeWorld freezer = new FreezeWorld();
|
||||
|
||||
team.teleportToSpawn();
|
||||
@@ -164,16 +163,17 @@ public class FightSchematic extends StateDependent {
|
||||
clipboard,
|
||||
new Location(Config.world, region.centerX(), region.getMinY(), region.centerZ()),
|
||||
new Vector(
|
||||
Config.GameModeConfig.Schematic.PasteAligned && Config.BlueToRedX != 0 ? region.getSizeX()/2.0 - dims.getBlockX() : -dims.getBlockX()/2.0,
|
||||
Config.GameModeConfig.Schematic.PasteAligned && Config.BlueToRedX != 0 ? region.getSizeX() / 2.0 - dims.getBlockX() : -dims.getBlockX() / 2.0,
|
||||
Config.GameModeConfig.Arena.WaterDepth != 0 ? Config.GameModeConfig.Arena.WaterDepth - WorldeditWrapper.impl.getWaterDepth(clipboard) : 0,
|
||||
Config.GameModeConfig.Schematic.PasteAligned && Config.BlueToRedZ != 0 ? region.getSizeZ()/2.0 - dims.getBlockZ() : -dims.getBlockZ()/2.0
|
||||
Config.GameModeConfig.Schematic.PasteAligned && Config.BlueToRedZ != 0 ? region.getSizeZ() / 2.0 - dims.getBlockZ() : -dims.getBlockZ() / 2.0
|
||||
).add(new Vector(usedRotate ? 1 : 0, 0, usedRotate ? 1 : 0)),
|
||||
new AffineTransform().rotateY(usedRotate ? 180 : 0)
|
||||
);
|
||||
FightSystem.getHullHider().initialize(team);
|
||||
team.getPlayers().forEach(fightPlayer -> fightPlayer.ifAI(ai -> ai.schematic(clipboard)));
|
||||
if(ArenaMode.Check.contains(Config.mode) && !team.isBlue())
|
||||
if (ArenaMode.Check.contains(Config.mode) && !team.isBlue()) {
|
||||
replaceSync(Material.TNT, Material.RED_WOOL);
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), freezer::disable, 3);
|
||||
}
|
||||
@@ -200,14 +200,14 @@ public class FightSchematic extends StateDependent {
|
||||
}
|
||||
}
|
||||
|
||||
public void pasteTeamName(){
|
||||
public void pasteTeamName() {
|
||||
char[] chars = team.getName().toCharArray();
|
||||
Clipboard[] characters = new Clipboard[chars.length];
|
||||
|
||||
int length = 0;
|
||||
int[] offsets = new int[chars.length];
|
||||
|
||||
for(int i = 0; i < chars.length; i++){
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
Clipboard character;
|
||||
try {
|
||||
if (Character.isLowerCase(chars[i])) {
|
||||
@@ -224,7 +224,7 @@ public class FightSchematic extends StateDependent {
|
||||
Bukkit.getLogger().log(Level.WARNING, "Could not display character {} due to missing file!", chars[i]);
|
||||
try {
|
||||
character = WorldeditWrapper.impl.loadChar("");
|
||||
}catch (IOException exc) {
|
||||
} catch (IOException exc) {
|
||||
throw new SecurityException("Could not load text", exc);
|
||||
}
|
||||
}
|
||||
@@ -240,16 +240,15 @@ public class FightSchematic extends StateDependent {
|
||||
length -= 1;
|
||||
AffineTransform aT = new AffineTransform().rotateY(((team == Fight.getRedTeam()) == (Config.BlueToRedZ > 0)) ? 180 : 0);
|
||||
Location base = new Location(Config.world, region.centerX(), team.getExtendRegion().getMaxY(), region.centerZ());
|
||||
for(int i = 0; i < characters.length; i++){
|
||||
WorldeditWrapper.impl.pasteClipboard(characters[i], base, new Vector(offsets[i] - length/2, 0, -region.getSizeZ()/2), aT);
|
||||
for (int i = 0; i < characters.length; i++) {
|
||||
WorldeditWrapper.impl.pasteClipboard(characters[i], base, new Vector(offsets[i] - length / 2, 0, -region.getSizeZ() / 2), aT);
|
||||
}
|
||||
}
|
||||
|
||||
private void replaceSync(Material target, Material replacement){
|
||||
private void replaceSync(Material target, Material replacement) {
|
||||
region.forEach((x, y, z) -> {
|
||||
Block block = Config.world.getBlockAt(x, y, z);
|
||||
if(block.getType() == target)
|
||||
block.setType(replacement);
|
||||
if (block.getType() == target) block.setType(replacement);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,41 +56,51 @@ import java.util.function.Consumer;
|
||||
public class FightTeam {
|
||||
|
||||
private static void setKitButton(HotbarKit kit, boolean leader) {
|
||||
if (Kit.getAvailableKits(leader).size() > 1 || Config.GameModeConfig.Kits.PersonalKits)
|
||||
if (Kit.getAvailableKits(leader).size() > 1 || Config.GameModeConfig.Kits.PersonalKits) {
|
||||
kit.setItem(1, "CHOOSE_KIT", new ItemBuilder(Material.LEATHER_CHESTPLATE).enchant().build(), player -> GUI.kitSelection(player, ""));
|
||||
else
|
||||
} else {
|
||||
kit.setItem(1, null, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
private static final HotbarKit memberKit = new HotbarKit();
|
||||
|
||||
static {
|
||||
setKitButton(memberKit, false);
|
||||
memberKit.setItem(7, "RESPAWN", new ItemBuilder(Material.BEACON).build(), player -> player.teleport(Objects.requireNonNull(Fight.getPlayerTeam(player)).getSpawn()));
|
||||
}
|
||||
|
||||
private static final HotbarKit notReadyKit = new HotbarKit(memberKit);
|
||||
|
||||
static {
|
||||
setKitButton(notReadyKit, true);
|
||||
|
||||
if(ArenaMode.VariableTeams.contains(Config.mode)){
|
||||
if (ArenaMode.VariableTeams.contains(Config.mode)) {
|
||||
notReadyKit.setItem(2, "REQUESTS", new ItemBuilder(Material.PAPER).build(), GUI::chooseJoinRequests);
|
||||
if(!AIManager.availableAIs().isEmpty())
|
||||
if (!AIManager.availableAIs().isEmpty()) {
|
||||
notReadyKit.setItem(6, "ADD_AI", new ItemBuilder(Material.REDSTONE).build(), GUI::addAI);
|
||||
}
|
||||
}
|
||||
|
||||
if(Config.test())
|
||||
notReadyKit.setItem(5, "CHOOSE_SCHEMATIC", new ItemBuilder(SWItem.getMaterial("CAULDRON_ITEM")).enchant().build(), GUI::preSchemDialog);
|
||||
if (Config.test()) {
|
||||
notReadyKit.setItem(5, "CHOOSE_SCHEMATIC", new ItemBuilder(Material.CAULDRON).enchant().build(), GUI::preSchemDialog);
|
||||
}
|
||||
|
||||
notReadyKit.setItem(3, "MANAGE_PLAYERS", SWItem.getPlayerSkull("AdmiralSeekrank").getItemStack(), GUI::managePlayers);
|
||||
notReadyKit.setItem(4, "TEAM_NOT_READY", new ItemBuilder(SWItem.getDye(10), (short) 10).enchant().build(), player -> Objects.requireNonNull(Fight.getPlayerTeam(player)).setReady(true));
|
||||
notReadyKit.setItem(4, "TEAM_NOT_READY", new ItemBuilder(Material.LIME_DYE, (short) 10).enchant().build(), player -> Objects.requireNonNull(Fight.getPlayerTeam(player)).setReady(true));
|
||||
}
|
||||
|
||||
private static final HotbarKit chooseSchemKit = new HotbarKit(notReadyKit);
|
||||
|
||||
static {
|
||||
chooseSchemKit.setItem(4, "CHOOSE_SCHEMATIC", new ItemBuilder(SWItem.getMaterial("CAULDRON_ITEM")).enchant().build(), GUI::preSchemDialog);
|
||||
chooseSchemKit.setItem(4, "CHOOSE_SCHEMATIC", new ItemBuilder(Material.CAULDRON).enchant().build(), GUI::preSchemDialog);
|
||||
}
|
||||
|
||||
private static final HotbarKit readyKit = new HotbarKit(memberKit);
|
||||
|
||||
static {
|
||||
readyKit.setItem(1, null, null, null);
|
||||
readyKit.setItem(4, "TEAM_READY", new ItemBuilder(SWItem.getDye(8), (short) 8).enchant().build(), player -> Objects.requireNonNull(Fight.getPlayerTeam(player)).setReady(false));
|
||||
readyKit.setItem(4, "TEAM_READY", new ItemBuilder(Material.GRAY_DYE, (short) 8).enchant().build(), player -> Objects.requireNonNull(Fight.getPlayerTeam(player)).setReady(false));
|
||||
}
|
||||
|
||||
@Getter
|
||||
@@ -151,22 +161,21 @@ public class FightTeam {
|
||||
new OneShotStateDependent(ArenaMode.Restartable, FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
|
||||
new OneShotStateDependent(Config.replayserver(), FightState.PreLeaderSetup, () -> Bukkit.getScheduler().runTask(FightSystem.getPlugin(), this::reset));
|
||||
new OneShotStateDependent(ArenaMode.All, FightState.PostSchemSetup, () -> {
|
||||
if(leader != null)
|
||||
leader.ifPlayer(notReadyKit::loadToPlayer);
|
||||
if (leader != null) leader.ifPlayer(notReadyKit::loadToPlayer);
|
||||
});
|
||||
}
|
||||
|
||||
public void setPrefixAndName(String prefix, String name){
|
||||
public void setPrefixAndName(String prefix, String name) {
|
||||
this.name = name;
|
||||
this.prefix = prefix;
|
||||
this.color = ChatColor.getByChar(ChatColor.getLastColors(prefix).replace("§", ""));
|
||||
}
|
||||
|
||||
public boolean canbeLeader(Player p){
|
||||
public boolean canbeLeader(Player p) {
|
||||
return isLeaderless() && (designatedLeader == null || designatedLeader.equals(p.getUniqueId()));
|
||||
}
|
||||
|
||||
public void teleportToSpawn(){
|
||||
public void teleportToSpawn() {
|
||||
players.forEach((player, fp) -> fp.getEntity().teleport(spawn));
|
||||
}
|
||||
|
||||
@@ -175,9 +184,8 @@ public class FightTeam {
|
||||
}
|
||||
|
||||
public boolean allPlayersOut() {
|
||||
for(FightPlayer fightPlayer : players.values()) {
|
||||
if(fightPlayer.isLiving())
|
||||
return false;
|
||||
for (FightPlayer fightPlayer : players.values()) {
|
||||
if (fightPlayer.isLiving()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -191,10 +199,11 @@ public class FightTeam {
|
||||
}
|
||||
|
||||
public boolean isPlayerLeader(LivingEntity player) {
|
||||
if(leader != null)
|
||||
if (leader != null) {
|
||||
return leader.getEntity().equals(player);
|
||||
else
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
@@ -205,7 +214,7 @@ public class FightTeam {
|
||||
Set<UUID> playerSet = new HashSet<>(players.keySet());
|
||||
playerSet.removeIf(uuid -> {
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if(player == null) {
|
||||
if (player == null) {
|
||||
removePlayer(players.get(uuid).getEntity());
|
||||
return true;
|
||||
}
|
||||
@@ -216,18 +225,18 @@ public class FightTeam {
|
||||
players.clear();
|
||||
leader = null;
|
||||
|
||||
if(leaderBackup != null){
|
||||
if (leaderBackup != null) {
|
||||
playerSet.remove(leaderBackup.getEntity().getUniqueId());
|
||||
addMember(leaderBackup.getEntity(), leaderBackup.getUser(), true);
|
||||
}
|
||||
|
||||
playerSet.forEach(uuid -> addMember(Bukkit.getPlayer(uuid), SteamwarUser.get(uuid), true));
|
||||
|
||||
if(ArenaMode.VariableTeams.contains(Config.mode) && isLeaderless()){
|
||||
if (ArenaMode.VariableTeams.contains(Config.mode) && isLeaderless()) {
|
||||
List<Player> onlinePlayers = new ArrayList<>(Bukkit.getOnlinePlayers());
|
||||
Collections.shuffle(onlinePlayers);
|
||||
for(Player player : onlinePlayers) {
|
||||
if(Fight.getPlayerTeam(player) == null && canbeLeader(player)){
|
||||
for (Player player : onlinePlayers) {
|
||||
if (Fight.getPlayerTeam(player) == null && canbeLeader(player)) {
|
||||
addMember(player);
|
||||
break;
|
||||
}
|
||||
@@ -250,8 +259,7 @@ public class FightTeam {
|
||||
private void broadcast(Consumer<Player> f) {
|
||||
players.forEach((uuid, fightPlayer) -> {
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if(player != null)
|
||||
f.accept(player);
|
||||
if (player != null) f.accept(player);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -281,7 +289,7 @@ public class FightTeam {
|
||||
player.getInventory().clear();
|
||||
FightSystem.getHullHider().updatePlayer(player);
|
||||
|
||||
if(FightState.Spectate.contains(FightState.getFightState())) {
|
||||
if (FightState.Spectate.contains(FightState.getFightState())) {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
} else {
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
@@ -289,15 +297,17 @@ public class FightTeam {
|
||||
}
|
||||
});
|
||||
|
||||
if(FightState.Running.contains(FightState.getFightState()))
|
||||
if (FightState.Running.contains(FightState.getFightState())) {
|
||||
fightPlayer.startEnternCountdown(Wincondition.getTimeOverCountdown());
|
||||
}
|
||||
|
||||
fightPlayer.ifPlayer(player -> FightSystem.getTechHider().reloadChunks(player, Config.ArenaRegion, fightPlayer.canEntern() ? Region.EMPTY : Fight.getOpposite(this).getExtendRegion()));
|
||||
|
||||
if(isLeaderless())
|
||||
if (isLeaderless()) {
|
||||
setLeader(fightPlayer, silent);
|
||||
else if(!silent)
|
||||
} else if (!silent) {
|
||||
FightUI.addSubtitle("UI_PLAYER_JOINS", prefix, entity.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public void removePlayer(LivingEntity entity) {
|
||||
@@ -311,8 +321,7 @@ public class FightTeam {
|
||||
|
||||
FightUI.addSubtitle("UI_PLAYER_LEAVES", prefix, entity.getName());
|
||||
|
||||
if(fightPlayer.equals(leader))
|
||||
removeLeader();
|
||||
if (fightPlayer.equals(leader)) removeLeader();
|
||||
|
||||
entity.teleport(Config.SpecSpawn);
|
||||
|
||||
@@ -320,12 +329,13 @@ public class FightTeam {
|
||||
player.setGameMode(GameMode.SPECTATOR);
|
||||
player.getInventory().clear();
|
||||
|
||||
if(player.isOnline()){
|
||||
if (player.isOnline()) {
|
||||
FightSystem.getHullHider().updatePlayer(player);
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -339,9 +349,9 @@ public class FightTeam {
|
||||
this.leader.setKit(Kit.getKitByName(Config.GameModeConfig.Kits.MemberDefault));
|
||||
}
|
||||
this.leader = null;
|
||||
if(!players.isEmpty()) {
|
||||
if (!players.isEmpty()) {
|
||||
setLeader(players.values().iterator().next(), false);
|
||||
}else if(FightState.getFightState() != FightState.PRE_LEADER_SETUP && !ArenaMode.RankedEvent.contains(Config.mode)){
|
||||
} else if (FightState.getFightState() != FightState.PRE_LEADER_SETUP && !ArenaMode.RankedEvent.contains(Config.mode)) {
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> FightState.setFightState(FightState.PRE_LEADER_SETUP), 1);
|
||||
}
|
||||
}
|
||||
@@ -358,25 +368,27 @@ public class FightTeam {
|
||||
|
||||
this.leader = leader;
|
||||
designatedLeader = null;
|
||||
if(ready)
|
||||
setReady(false);
|
||||
if (ready) setReady(false);
|
||||
|
||||
if(!silent)
|
||||
if (!silent) {
|
||||
FightUI.addSubtitle("UI_LEADER_JOINS", prefix, leader.getEntity().getName());
|
||||
}
|
||||
|
||||
publicsOnly = SchematicNode.getAllAccessibleSchematicsOfType(leader.getUser().getId(), Config.GameModeConfig.Schematic.Type.toDB()).isEmpty();
|
||||
|
||||
if(!Config.GameModeConfig.Kits.PersonalKits)
|
||||
if (!Config.GameModeConfig.Kits.PersonalKits) {
|
||||
leader.setKit(Kit.getKitByName(Config.GameModeConfig.Kits.LeaderDefault));
|
||||
}
|
||||
|
||||
leader.ifPlayer(player -> {
|
||||
if(FightState.getFightState() != FightState.POST_SCHEM_SETUP)
|
||||
if (FightState.getFightState() != FightState.POST_SCHEM_SETUP) {
|
||||
chooseSchemKit.loadToPlayer(player);
|
||||
else
|
||||
} else {
|
||||
notReadyKit.loadToPlayer(player);
|
||||
}
|
||||
});
|
||||
|
||||
if(FightState.getFightState() == FightState.PRE_LEADER_SETUP && !Fight.getOpposite(this).isLeaderless()){
|
||||
if (FightState.getFightState() == FightState.PRE_LEADER_SETUP && !Fight.getOpposite(this).isLeaderless()) {
|
||||
FightState.setFightState(FightState.PRE_SCHEM_SETUP);
|
||||
}
|
||||
|
||||
@@ -391,8 +403,8 @@ public class FightTeam {
|
||||
testPasteAction();
|
||||
}
|
||||
|
||||
public void pasteSchem(SchematicNode schematic){
|
||||
if(schematic.getSchemtype().check()) {
|
||||
public void pasteSchem(SchematicNode schematic) {
|
||||
if (schematic.getSchemtype().check()) {
|
||||
FightSystem.getMessage().broadcast("SCHEMATIC_UNCHECKED", getColoredName());
|
||||
}
|
||||
|
||||
@@ -400,28 +412,28 @@ public class FightTeam {
|
||||
testPasteAction();
|
||||
}
|
||||
|
||||
public void pasteSchem(int schemId, Clipboard clipboard){
|
||||
public void pasteSchem(int schemId, Clipboard clipboard) {
|
||||
this.schematic.setSchematic(schemId, clipboard);
|
||||
testPasteAction();
|
||||
}
|
||||
|
||||
private void testPasteAction(){
|
||||
if(Config.test())
|
||||
private void testPasteAction() {
|
||||
if (Config.test()) {
|
||||
this.schematic.enable();
|
||||
else if(Fight.getOpposite(this).schematic.hasSchematic()){
|
||||
} else if (Fight.getOpposite(this).schematic.hasSchematic()) {
|
||||
FightState.setFightState(FightState.POST_SCHEM_SETUP);
|
||||
}
|
||||
}
|
||||
|
||||
public void pasteTeamName(){
|
||||
public void pasteTeamName() {
|
||||
schematic.pasteTeamName();
|
||||
}
|
||||
|
||||
public void setSchem(SchematicNode schematic){
|
||||
public void setSchem(SchematicNode schematic) {
|
||||
setSchem(schematic, -1);
|
||||
}
|
||||
|
||||
public void setSchem(SchematicNode schematic, int revision){
|
||||
public void setSchem(SchematicNode schematic, int revision) {
|
||||
this.schematic.setSchematic(schematic, revision);
|
||||
broadcast("SCHEMATIC_CHOSEN", Config.GameModeConfig.GameName, schematic.getName());
|
||||
}
|
||||
@@ -429,33 +441,34 @@ public class FightTeam {
|
||||
public void setReady(boolean ready) {
|
||||
LivingEntity l = leader.getEntity();
|
||||
|
||||
if(!schematic.hasSchematic()){
|
||||
if (!schematic.hasSchematic()) {
|
||||
FightSystem.getMessage().sendPrefixless("SCHEMATIC_REQUIRED", l, ChatMessageType.ACTION_BAR);
|
||||
return;
|
||||
}
|
||||
|
||||
this.ready = ready;
|
||||
if(ready) {
|
||||
if (ready) {
|
||||
broadcast("TEAM_READY");
|
||||
leader.ifPlayer(readyKit::loadToPlayer);
|
||||
if(Fight.getOpposite(this).isReady() || ArenaMode.SoloLeader.contains(Config.mode))
|
||||
if (Fight.getOpposite(this).isReady() || ArenaMode.SoloLeader.contains(Config.mode)) {
|
||||
FightState.setFightState(FightState.PRE_RUNNING);
|
||||
}
|
||||
} else {
|
||||
broadcast("TEAM_NOT_READY");
|
||||
leader.ifPlayer(notReadyKit::loadToPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
public void skip(){
|
||||
public void skip() {
|
||||
this.skip = !skip;
|
||||
if(skip){
|
||||
if (skip) {
|
||||
broadcast("SKIP_READY");
|
||||
if(Fight.getOpposite(this).skip || Config.test()){
|
||||
if (Fight.getOpposite(this).skip || Config.test()) {
|
||||
skip = false;
|
||||
Fight.getOpposite(this).skip = false;
|
||||
Countdown.skip();
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
broadcast("SKIP_NOT_READY");
|
||||
}
|
||||
}
|
||||
@@ -480,7 +493,7 @@ public class FightTeam {
|
||||
return players.values().stream().filter(FightPlayer::isLiving).mapToDouble(fp -> fp.getEntity().getHealth()).sum();
|
||||
}
|
||||
|
||||
public double getHeartRatio(){
|
||||
public double getHeartRatio() {
|
||||
int maximumHearts = players.size() * 20;
|
||||
return maximumHearts != 0 ? getCurrentHearts() / maximumHearts : 0;
|
||||
}
|
||||
@@ -506,7 +519,7 @@ public class FightTeam {
|
||||
|
||||
@Override
|
||||
public void enable() {
|
||||
for(FightPlayer fightPlayer : players.values()) {
|
||||
for (FightPlayer fightPlayer : players.values()) {
|
||||
fightPlayer.ifPlayer(player -> {
|
||||
PersonalKitCreator.closeIfInKitCreator(player);
|
||||
|
||||
|
||||
@@ -61,18 +61,19 @@ public class FightWorld extends StateDependent {
|
||||
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), FightWorld::resetWorld); //Delay to prevent raceconditions with techhider and hullhider
|
||||
}
|
||||
|
||||
public static void forceLoad(){
|
||||
public static void forceLoad() {
|
||||
Config.ArenaRegion.forEachChunk((cX, cZ) -> {
|
||||
Config.world.loadChunk(cX, cZ);
|
||||
FlatteningWrapper.impl.forceLoadChunk(Config.world, cX, cZ);
|
||||
});
|
||||
}
|
||||
|
||||
public static void resetWorld(){
|
||||
public static void resetWorld() {
|
||||
List<Entity> entities = new ArrayList<>();
|
||||
Recording.iterateOverEntities(Objects::nonNull, entity -> {
|
||||
if(entity.getType() != EntityType.PLAYER && (!Config.GameModeConfig.Arena.Leaveable || Config.ArenaRegion.inRegion(entity.getLocation())))
|
||||
if (entity.getType() != EntityType.PLAYER && (!Config.GameModeConfig.Arena.Leaveable || Config.ArenaRegion.inRegion(entity.getLocation()))) {
|
||||
entities.add(entity);
|
||||
}
|
||||
});
|
||||
entities.forEach(Entity::remove);
|
||||
entities.clear();
|
||||
@@ -81,8 +82,8 @@ public class FightWorld extends StateDependent {
|
||||
assert backup != null;
|
||||
Config.ArenaRegion.forEachChunk((x, z) -> {
|
||||
CraftbukkitWrapper.impl.resetChunk(Config.world, backup, x, z);
|
||||
for(Player p : Bukkit.getOnlinePlayers()) {
|
||||
de.steamwar.core.CraftbukkitWrapper.impl.sendChunk(p, x, z);
|
||||
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
de.steamwar.core.CraftbukkitWrapper.sendChunk(p, x, z);
|
||||
}
|
||||
});
|
||||
Bukkit.unloadWorld(backup, false);
|
||||
|
||||
@@ -35,57 +35,58 @@ public class FreezeWorld implements Listener {
|
||||
|
||||
private final Listener denyHandSwap = BountifulWrapper.impl.newDenyHandSwapListener();
|
||||
|
||||
public FreezeWorld(){
|
||||
public FreezeWorld() {
|
||||
Bukkit.getPluginManager().registerEvents(this, FightSystem.getPlugin());
|
||||
Bukkit.getPluginManager().registerEvents(denyHandSwap, FightSystem.getPlugin());
|
||||
}
|
||||
|
||||
public void disable(){
|
||||
public void disable() {
|
||||
HandlerList.unregisterAll(this);
|
||||
HandlerList.unregisterAll(denyHandSwap);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPhysicsEvent(BlockPhysicsEvent e){
|
||||
public void onBlockPhysicsEvent(BlockPhysicsEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPistonExtend(BlockPistonExtendEvent e){
|
||||
public void onPistonExtend(BlockPistonExtendEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPistonRetract(BlockPistonRetractEvent e){
|
||||
public void onPistonRetract(BlockPistonRetractEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockGrow(BlockGrowEvent e){
|
||||
public void onBlockGrow(BlockGrowEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onRedstoneEvent(BlockRedstoneEvent e){
|
||||
public void onRedstoneEvent(BlockRedstoneEvent e) {
|
||||
e.setNewCurrent(e.getOldCurrent());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockDispense(BlockDispenseEvent e){
|
||||
public void onBlockDispense(BlockDispenseEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryMoveEvent(InventoryMoveItemEvent e){
|
||||
public void onInventoryMoveEvent(InventoryMoveItemEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockExplosion(BlockExplodeEvent e){
|
||||
public void onBlockExplosion(BlockExplodeEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockExplosion(ItemSpawnEvent e){
|
||||
public void onBlockExplosion(ItemSpawnEvent e) {
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,9 +36,11 @@ import java.util.function.Consumer;
|
||||
public class HotbarKit extends Kit {
|
||||
|
||||
public static final HotbarKit SPECTATOR_KIT = new HotbarKit();
|
||||
|
||||
static {
|
||||
for(int i = 0; i < 9; i++)
|
||||
for (int i = 0; i < 9; i++) {
|
||||
SPECTATOR_KIT.setItem(i, "JOIN_REQUEST", new ItemBuilder(Material.PAPER).build(), GUI::joinRequest);
|
||||
}
|
||||
}
|
||||
|
||||
protected static final int HOTBAR_SIZE = 9;
|
||||
@@ -68,8 +70,8 @@ public class HotbarKit extends Kit {
|
||||
|
||||
@Override
|
||||
public synchronized void loadToPlayer(Player player) {
|
||||
for(int i = 0; i < HOTBAR_SIZE; i++) {
|
||||
if(nameTags[i] != null) {
|
||||
for (int i = 0; i < HOTBAR_SIZE; i++) {
|
||||
if (nameTags[i] != null) {
|
||||
ItemMeta meta = Objects.requireNonNull(getInventory()[i].getItemMeta());
|
||||
meta.setDisplayName(FightSystem.getMessage().parse(nameTags[i], player, Config.GameModeConfig.GameName));
|
||||
getInventory()[i].setItemMeta(meta);
|
||||
|
||||
+4
-6
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.listener.PersonalKitCreator;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
@@ -51,8 +50,7 @@ public class HotbarKitListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void handlePlayerInteract(PlayerInteractEvent event) {
|
||||
if (event.getAction() == Action.PHYSICAL || (Core.getVersion() > 8 && event.getHand() != EquipmentSlot.HAND))
|
||||
return;
|
||||
if (event.getAction() == Action.PHYSICAL || event.getHand() != EquipmentSlot.HAND) return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
int slot = player.getInventory().getHeldItemSlot();
|
||||
@@ -71,12 +69,12 @@ public class HotbarKitListener implements Listener {
|
||||
|
||||
private void click(Player player, int slot, Cancellable event) {
|
||||
Kit activeKit = Kit.activeKits.get(player);
|
||||
if (!(activeKit instanceof HotbarKit) || PersonalKitCreator.inKitCreator(player) || activeKit.getInventory()[slot] == null)
|
||||
if (!(activeKit instanceof HotbarKit) || PersonalKitCreator.inKitCreator(player) || activeKit.getInventory()[slot] == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
if (!clicked.add(player))
|
||||
return;
|
||||
if (!clicked.add(player)) return;
|
||||
|
||||
((HotbarKit) activeKit).onClicks[slot].accept(player);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public class JoinRequest {
|
||||
|
||||
private static final Map<Player, JoinRequest> playerRequests = new HashMap<>();
|
||||
private static final List<JoinRequest> activeRequests = new ArrayList<>();
|
||||
|
||||
public static JoinRequest get(Player player) {
|
||||
return playerRequests.get(player);
|
||||
}
|
||||
@@ -63,17 +64,37 @@ public class JoinRequest {
|
||||
|
||||
public static void forPlayer(Player player, FightTeam team) {
|
||||
new JoinRequest(new Enquirer() {
|
||||
@Override public String name() { return player.getName(); }
|
||||
@Override public void ifPlayer(Consumer<Player> function) { function.accept(player); }
|
||||
@Override public void ifAI(Consumer<AIManager> function) {}
|
||||
@Override
|
||||
public String name() {
|
||||
return player.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ifPlayer(Consumer<Player> function) {
|
||||
function.accept(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ifAI(Consumer<AIManager> function) {
|
||||
}
|
||||
}, team, FightState.ingame() ? Fight.teams() : Collections.singleton(team));
|
||||
}
|
||||
|
||||
public static void forAI(AIManager manager, FightTeam team) {
|
||||
new JoinRequest(new Enquirer() {
|
||||
@Override public String name() { return manager.name(); }
|
||||
@Override public void ifPlayer(Consumer<Player> function) {}
|
||||
@Override public void ifAI(Consumer<AIManager> function) { function.accept(manager); }
|
||||
@Override
|
||||
public String name() {
|
||||
return manager.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ifPlayer(Consumer<Player> function) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ifAI(Consumer<AIManager> function) {
|
||||
function.accept(manager);
|
||||
}
|
||||
}, team, Collections.singleton(Fight.getOpposite(team)));
|
||||
}
|
||||
|
||||
@@ -89,18 +110,17 @@ public class JoinRequest {
|
||||
|
||||
enquirer.ifPlayer(player -> playerRequests.put(player, this));
|
||||
activeRequests.add(this);
|
||||
for(FightTeam t : waitOnApproval) {
|
||||
for (FightTeam t : waitOnApproval) {
|
||||
FightPlayer leader = t.getLeader();
|
||||
if(leader == null)
|
||||
continue;
|
||||
if (leader == null) continue;
|
||||
|
||||
if(leader.getEntity() == null)
|
||||
continue;
|
||||
if (leader.getEntity() == null) continue;
|
||||
|
||||
leader.ifPlayer(leaderPlayer -> FightSystem.getMessage().sendPrefixless("JOIN_REQUEST_NOTIFICATION", leaderPlayer, "REQUESTS", new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/requests"), enquirer.name(), team.getColoredName()));
|
||||
leader.ifAI(ai -> {
|
||||
if(ai.acceptJoinRequest(enquirer, team))
|
||||
if (ai.acceptJoinRequest(enquirer, team)) {
|
||||
alreadyAccepted.add(t);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -115,7 +135,7 @@ public class JoinRequest {
|
||||
public void accept(FightTeam acceptor) {
|
||||
waitOnApproval.remove(acceptor);
|
||||
|
||||
if(waitOnApproval.isEmpty()) {
|
||||
if (waitOnApproval.isEmpty()) {
|
||||
enquirer.ifPlayer(team::addMember);
|
||||
enquirer.ifAI(manager -> manager.join(team));
|
||||
close();
|
||||
@@ -135,7 +155,9 @@ public class JoinRequest {
|
||||
|
||||
public interface Enquirer {
|
||||
String name();
|
||||
|
||||
void ifPlayer(Consumer<Player> function);
|
||||
|
||||
void ifAI(Consumer<AIManager> function);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.fightsystem.fight;
|
||||
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.commands.Commands;
|
||||
@@ -59,14 +58,14 @@ public class Kit {
|
||||
}
|
||||
|
||||
static {
|
||||
if(!kits.exists()) {
|
||||
if (!kits.exists()) {
|
||||
Bukkit.getLogger().log(Level.SEVERE, "Kitconfig fehlend!" + kits.getAbsolutePath());
|
||||
}
|
||||
|
||||
FileConfiguration kitData = YamlConfiguration.loadConfiguration(kits);
|
||||
ConfigurationSection kitSection = kitData.getConfigurationSection("Kits");
|
||||
|
||||
for(String key : Objects.requireNonNull(kitSection).getKeys(false)) {
|
||||
for (String key : Objects.requireNonNull(kitSection).getKeys(false)) {
|
||||
loadedKits.add(new Kit(Objects.requireNonNull(kitSection.getConfigurationSection(key))));
|
||||
}
|
||||
}
|
||||
@@ -107,23 +106,25 @@ public class Kit {
|
||||
this(name, player.getInventory().getContents(), player.getInventory().getArmorContents(), player.getActivePotionEffects());
|
||||
}
|
||||
|
||||
public Kit(PersonalKit kit){
|
||||
public Kit(PersonalKit kit) {
|
||||
this(kit.getName(), kit.getInventory(), kit.getArmor(), Collections.emptyList());
|
||||
}
|
||||
|
||||
public Kit(ConfigurationSection kit){
|
||||
public Kit(ConfigurationSection kit) {
|
||||
name = kit.getName();
|
||||
inventory = Objects.requireNonNull(kit.getList("Items")).toArray(new ItemStack[0]);
|
||||
if(kit.isList("Armor"))
|
||||
if (kit.isList("Armor")) {
|
||||
armor = Objects.requireNonNull(kit.getList("Armor")).toArray(new ItemStack[0]);
|
||||
else
|
||||
armor = new ItemStack[]{ null, null, null, null};
|
||||
} else {
|
||||
armor = new ItemStack[]{null, null, null, null};
|
||||
}
|
||||
leaderAllowed = kit.getBoolean("LeaderAllowed");
|
||||
memberAllowed = kit.getBoolean("MemberAllowed");
|
||||
if(kit.isList("Effects"))
|
||||
if (kit.isList("Effects")) {
|
||||
effects = (List<PotionEffect>) kit.getList("Effects");
|
||||
else
|
||||
} else {
|
||||
effects = null;
|
||||
}
|
||||
enterStage = kit.getInt("EnterStage", 0);
|
||||
tnt = kit.getBoolean("TNT", true);
|
||||
}
|
||||
@@ -133,24 +134,23 @@ public class Kit {
|
||||
}
|
||||
|
||||
public static Kit getKitByName(String kitName) {
|
||||
for(Kit kit : loadedKits) {
|
||||
if(kit.getName().equalsIgnoreCase(kitName))
|
||||
return kit;
|
||||
for (Kit kit : loadedKits) {
|
||||
if (kit.getName().equalsIgnoreCase(kitName)) return kit;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Kit> getAvailableKits(boolean leader){
|
||||
public static List<Kit> getAvailableKits(boolean leader) {
|
||||
List<Kit> kits = new ArrayList<>();
|
||||
for (Kit k : loadedKits) {
|
||||
if (k.canUseKit(leader)){
|
||||
if (k.canUseKit(leader)) {
|
||||
kits.add(k);
|
||||
}
|
||||
}
|
||||
return kits;
|
||||
}
|
||||
|
||||
public boolean canUseKit(boolean leader){
|
||||
public boolean canUseKit(boolean leader) {
|
||||
if (leader) {
|
||||
return leaderAllowed;
|
||||
} else {
|
||||
@@ -163,13 +163,11 @@ public class Kit {
|
||||
}
|
||||
|
||||
public boolean contains(ItemStack stack) {
|
||||
for(ItemStack i : inventory) {
|
||||
if(similar(i, stack))
|
||||
return true;
|
||||
for (ItemStack i : inventory) {
|
||||
if (similar(i, stack)) return true;
|
||||
}
|
||||
for(ItemStack i : armor) {
|
||||
if(similar(i, stack))
|
||||
return true;
|
||||
for (ItemStack i : armor) {
|
||||
if (similar(i, stack)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -178,78 +176,66 @@ public class Kit {
|
||||
kit.setContainer(inventory, armor);
|
||||
}
|
||||
|
||||
public void removeBadItems(){
|
||||
public void removeBadItems() {
|
||||
Kit normal = Kit.getKitByName(Config.GameModeConfig.Kits.MemberDefault);
|
||||
assert normal != null;
|
||||
|
||||
for(int i = 0; i < inventory.length; i++){
|
||||
if(isBadItem(inventory[i]))
|
||||
inventory[i] = null;
|
||||
for (int i = 0; i < inventory.length; i++) {
|
||||
if (isBadItem(inventory[i])) inventory[i] = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean isBadItem(ItemStack stack){
|
||||
if(stack == null)
|
||||
return false;
|
||||
public static boolean isBadItem(ItemStack stack) {
|
||||
if (stack == null) return false;
|
||||
|
||||
//Check for forbidden item
|
||||
if(Config.GameModeConfig.Kits.ForbiddenItems.contains(stack.getType()))
|
||||
return true;
|
||||
if (Config.GameModeConfig.Kits.ForbiddenItems.contains(stack.getType())) return true;
|
||||
|
||||
//Check for attribute modifiers
|
||||
if(FlatteningWrapper.impl.hasAttributeModifier(stack)){
|
||||
if (FlatteningWrapper.impl.hasAttributeModifier(stack)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(stack.hasItemMeta()){
|
||||
if (stack.hasItemMeta()) {
|
||||
ItemMeta meta = stack.getItemMeta();
|
||||
if(FlatteningWrapper.impl.containsBlockMeta(meta))
|
||||
return true; //Blocks always upwards slabs etc.
|
||||
|
||||
if(hasItems(stack))
|
||||
return true; //Blocks prefilled inventories
|
||||
if (FlatteningWrapper.impl.containsBlockMeta(meta)) return true; //Blocks always upwards slabs etc.
|
||||
if (hasItems(stack)) return true; //Blocks prefilled inventories
|
||||
}
|
||||
|
||||
Kit normal = Kit.getKitByName(Config.GameModeConfig.Kits.MemberDefault);
|
||||
assert normal != null;
|
||||
return !normal.isEnchantmentInKit(stack) && !stack.getEnchantments().isEmpty();
|
||||
}
|
||||
|
||||
public static boolean hasItems(ItemStack stack) {
|
||||
return ReflectionWrapper.impl.hasItems(stack);
|
||||
}
|
||||
|
||||
private boolean isEnchantmentInKit(ItemStack stack){
|
||||
for(ItemStack is : inventory){
|
||||
if(similar(stack, is))
|
||||
return true;
|
||||
private boolean isEnchantmentInKit(ItemStack stack) {
|
||||
for (ItemStack is : inventory) {
|
||||
if (similar(stack, is)) return true;
|
||||
}
|
||||
if(armor != null){
|
||||
for(ItemStack is : armor){
|
||||
if(similar(stack, is))
|
||||
return true;
|
||||
if (armor != null) {
|
||||
for (ItemStack is : armor) {
|
||||
if (similar(stack, is)) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean similar(ItemStack stack, ItemStack stack2){
|
||||
if(stack == null || stack2 == null)
|
||||
return false;
|
||||
if(stack.getType() != stack2.getType())
|
||||
return false;
|
||||
if(stack.hasItemMeta() != stack2.hasItemMeta())
|
||||
return false;
|
||||
if(stack.getItemMeta() == null || stack2.getItemMeta() == null)
|
||||
return true;
|
||||
private boolean similar(ItemStack stack, ItemStack stack2) {
|
||||
if (stack == null || stack2 == null) return false;
|
||||
if (stack.getType() != stack2.getType()) return false;
|
||||
if (stack.hasItemMeta() != stack2.hasItemMeta()) return false;
|
||||
if (stack.getItemMeta() == null || stack2.getItemMeta() == null) return true;
|
||||
|
||||
//Enchantment Map comparison used for default similarity check does not work
|
||||
Map<Enchantment, Integer> en = stack.getItemMeta().getEnchants();
|
||||
Map<Enchantment, Integer> en2 = new HashMap<>(stack.getItemMeta().getEnchants());
|
||||
|
||||
for(Map.Entry<Enchantment, Integer> e : en.entrySet()){
|
||||
if(!en2.remove(e.getKey(), e.getValue()))
|
||||
return false;
|
||||
for (Map.Entry<Enchantment, Integer> e : en.entrySet()) {
|
||||
if (!en2.remove(e.getKey(), e.getValue())) return false;
|
||||
}
|
||||
return en2.isEmpty();
|
||||
}
|
||||
@@ -259,63 +245,63 @@ public class Kit {
|
||||
|
||||
player.getInventory().clear();
|
||||
player.getInventory().setContents(inventory);
|
||||
if(armor != null)
|
||||
if (armor != null) {
|
||||
player.getInventory().setArmorContents(armor);
|
||||
}
|
||||
player.updateInventory(); //TODO issue in 1.21.6?
|
||||
if(effects != null)
|
||||
if (effects != null) {
|
||||
player.addPotionEffects(effects);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a kit preview with the options to go back to kit selection or to select the kit.
|
||||
*/
|
||||
public void preview(Player player){
|
||||
public void preview(Player player) {
|
||||
SWInventory inv = new SWInventory(player, 54, name);
|
||||
|
||||
//36 = Inventargröße
|
||||
for(int i = 0; i < 36; i++){
|
||||
if(inventory[i] == null)
|
||||
continue;
|
||||
for (int i = 0; i < 36; i++) {
|
||||
if (inventory[i] == null) continue;
|
||||
SWItem item = new SWItem();
|
||||
item.setItemStack(inventory[i]);
|
||||
inv.setItem(i, item);
|
||||
}
|
||||
|
||||
if(armor != null){
|
||||
for(int i = 0; i < 4; i++){
|
||||
if(armor[i] == null)
|
||||
continue;
|
||||
if (armor != null) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (armor[i] == null) continue;
|
||||
SWItem item = new SWItem();
|
||||
item.setItemStack(armor[i]);
|
||||
inv.setItem(36 + i, item);
|
||||
}
|
||||
}
|
||||
|
||||
if(effects != null){
|
||||
if (effects != null) {
|
||||
Iterator<PotionEffect> it = effects.iterator();
|
||||
int pos = 44;
|
||||
while(it.hasNext()){
|
||||
while (it.hasNext()) {
|
||||
PotionEffect effect = it.next();
|
||||
SWItem item = new SWItem(SWItem.getMaterial("POTION"), effect.getType().getName());
|
||||
SWItem item = new SWItem(Material.POTION, effect.getType().getName());
|
||||
inv.setItem(pos, item);
|
||||
pos--;
|
||||
}
|
||||
}
|
||||
|
||||
inv.setCallback(-999, click -> player.closeInventory());
|
||||
if(Config.GameModeConfig.Kits.PersonalKits){
|
||||
inv.setItem(49, SWItem.getMaterial("WOOD_AXE"), FightSystem.getMessage().parse("KIT_PREVIEW_EDIT", player), clickType -> PersonalKitCreator.openKitCreator(player, PersonalKit.get(SteamwarUser.get(player.getUniqueId()).getId(), Config.GameModeConfig.Schematic.Type.toDB(), name)));
|
||||
if (Config.GameModeConfig.Kits.PersonalKits) {
|
||||
inv.setItem(49, Material.WOODEN_AXE, FightSystem.getMessage().parse("KIT_PREVIEW_EDIT", player), clickType -> PersonalKitCreator.openKitCreator(player, PersonalKit.get(SteamwarUser.get(player.getUniqueId()).getId(), Config.GameModeConfig.Schematic.Type.toDB(), name)));
|
||||
inv.setItem(53, Material.BARRIER, FightSystem.getMessage().parse("KIT_PREVIEW_DELETE", player), clickType -> {
|
||||
player.closeInventory();
|
||||
SWInventory conf = new SWInventory(player, 9, FightSystem.getMessage().parse("KIT_DELETION_CONFIRMATION", player));
|
||||
conf.setItem(8, SWItem.getDye(1), FightSystem.getMessage().parse("KIT_DELETION_ABORT", player), click -> player.closeInventory());
|
||||
conf.setItem(0, SWItem.getDye(10), FightSystem.getMessage().parse("KIT_DELETION_DELETE", player), click -> {
|
||||
conf.setItem(8, Material.RED_DYE, FightSystem.getMessage().parse("KIT_DELETION_ABORT", player), click -> player.closeInventory());
|
||||
conf.setItem(0, Material.LIME_DYE, FightSystem.getMessage().parse("KIT_DELETION_DELETE", player), click -> {
|
||||
player.closeInventory();
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
PersonalKit kit = PersonalKit.get(user.getId(), Config.GameModeConfig.Schematic.Type.toDB(), name);
|
||||
if(kit.isInUse()) {
|
||||
if (kit.isInUse()) {
|
||||
List<PersonalKit> kits = PersonalKit.get(user.getId(), Config.GameModeConfig.Schematic.Type.toDB());
|
||||
if(!kits.isEmpty()){
|
||||
if (!kits.isEmpty()) {
|
||||
PersonalKit kit1 = kits.get(0);
|
||||
kit1.setInUse();
|
||||
FightPlayer fightPlayer = Fight.getFightPlayer(player);
|
||||
@@ -328,22 +314,23 @@ public class Kit {
|
||||
conf.open();
|
||||
});
|
||||
}
|
||||
inv.setItem(45, SWItem.getDye(10), (byte)10, FightSystem.getMessage().parse("KIT_PREVIEW_CHOOSE", player), click -> {
|
||||
inv.setItem(45, Material.LIME_DYE, (byte) 10, FightSystem.getMessage().parse("KIT_PREVIEW_CHOOSE", player), click -> {
|
||||
Commands.kit(player, name);
|
||||
player.closeInventory();
|
||||
});
|
||||
inv.setItem(53, SWItem.getDye(1), (byte)1, FightSystem.getMessage().parse("KIT_PREVIEW_BACK", player), click -> GUI.kitSelection(player, ""));
|
||||
inv.setItem(53, Material.RED_DYE, (byte) 1, FightSystem.getMessage().parse("KIT_PREVIEW_BACK", player), click -> GUI.kitSelection(player, ""));
|
||||
inv.open();
|
||||
}
|
||||
|
||||
public static void createKit(String kitName, Player player){
|
||||
public static void createKit(String kitName, Player player) {
|
||||
loadedKits.add(new Kit(kitName, player));
|
||||
YamlConfiguration yamlConfiguration = new YamlConfiguration();
|
||||
for(Kit k : loadedKits){
|
||||
for (Kit k : loadedKits) {
|
||||
ConfigurationSection section = yamlConfiguration.createSection("Kits." + k.getName());
|
||||
section.set("Items", k.inventory);
|
||||
if(k.armor != null)
|
||||
if (k.armor != null) {
|
||||
section.set("Armor", k.armor);
|
||||
}
|
||||
section.set("LeaderAllowed", k.leaderAllowed);
|
||||
section.set("MemberAllowed", k.memberAllowed);
|
||||
section.set("Effects", k.effects);
|
||||
@@ -353,7 +340,7 @@ public class Kit {
|
||||
|
||||
try {
|
||||
yamlConfiguration.save(kits);
|
||||
}catch(IOException e){
|
||||
} catch (IOException e) {
|
||||
throw new SecurityException("Failed to save kits.data", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,8 +51,9 @@ public class ArenaBorder implements Listener {
|
||||
@EventHandler
|
||||
public void onMove(PlayerMoveEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
if(e.getTo().getY() <= Config.PlayerRegion.getMinY() && playerBorder.contains(player))
|
||||
if (e.getTo().getY() <= Config.PlayerRegion.getMinY() && playerBorder.contains(player)) {
|
||||
player.teleport(Fight.getPlayerTeam(player).getSpawn());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -93,18 +94,17 @@ public class ArenaBorder implements Listener {
|
||||
|
||||
private void damage() {
|
||||
Fight.teams().forEach(team -> {
|
||||
for(FightPlayer fp : team.getPlayers()) {
|
||||
for (FightPlayer fp : team.getPlayers()) {
|
||||
LivingEntity entity = fp.getEntity();
|
||||
if(fp.isLiving() && entity.getLocation().getY() <= Config.PlayerRegion.getMinY())
|
||||
if (fp.isLiving() && entity.getLocation().getY() <= Config.PlayerRegion.getMinY()) {
|
||||
entity.damage(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addToSpectator(Player player) {
|
||||
if(Config.GameModeConfig.Arena.Leaveable || !player.isOnline() || playerBorder.contains(player))
|
||||
return;
|
||||
|
||||
if (Config.GameModeConfig.Arena.Leaveable || !player.isOnline() || playerBorder.contains(player)) return;
|
||||
spectatorBorder.addPlayer(player);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-12
@@ -19,12 +19,12 @@
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.Reflection;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentTask;
|
||||
import de.steamwar.fightsystem.utils.WorldOfColorWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import net.minecraft.world.entity.projectile.AbstractArrow;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@@ -43,20 +43,19 @@ public class ArrowStopper {
|
||||
new StateDependentTask(Config.GameModeConfig.Techhider.Active, FightState.Running, this::run, 1, 1);
|
||||
}
|
||||
|
||||
private static final Class<?> entityArrow = Reflection.getClass("net.minecraft.world.entity.projectile.AbstractArrow");
|
||||
private void run() {
|
||||
Recording.iterateOverEntities(entityArrow::isInstance, entity -> {
|
||||
Recording.iterateOverEntities(AbstractArrow.class::isInstance, entity -> {
|
||||
Projectile arrow = (Projectile) entity;
|
||||
if (invalidEntity(arrow))
|
||||
return;
|
||||
if (invalidEntity(arrow)) return;
|
||||
|
||||
Location prevLocation = arrow.getLocation().toVector().subtract(arrow.getVelocity()).toLocation(arrow.getWorld());
|
||||
if (arrow.getTicksLived() == 0){
|
||||
if (arrow.getTicksLived() == 0) {
|
||||
ProjectileSource projSource = arrow.getShooter();
|
||||
if(projSource instanceof Player)
|
||||
if (projSource instanceof Player) {
|
||||
prevLocation = ((Player) arrow.getShooter()).getEyeLocation();
|
||||
else
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (checkBlocks(arrow.getLocation().getBlock(), prevLocation.getBlock())) {
|
||||
arrow.remove();
|
||||
@@ -73,14 +72,13 @@ public class ArrowStopper {
|
||||
for (BlockFace face : BLOCK_FACES) {
|
||||
Block relative = cursor.getRelative(face);
|
||||
double distance = relative.getLocation().distance(end.getLocation());
|
||||
if(distance < nearestDistance) {
|
||||
if (distance < nearestDistance) {
|
||||
nearestDistance = distance;
|
||||
nearest = face;
|
||||
}
|
||||
}
|
||||
cursor = cursor.getRelative(nearest);
|
||||
if(checkBlock(cursor))
|
||||
return true;
|
||||
if (checkBlock(cursor)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -95,7 +93,7 @@ public class ArrowStopper {
|
||||
boolean teamFrom = entity.getVelocity().getZ() > 0;
|
||||
boolean overMid = location.getZ() > Config.SpecSpawn.getZ();
|
||||
boolean otherSide = teamFrom == overMid;
|
||||
return otherSide || !Config.ArenaRegion.inRegion(location) ||
|
||||
return otherSide || !Config.ArenaRegion.inRegion(location) ||
|
||||
WorldOfColorWrapper.impl.isInBlock(entity) ||
|
||||
entity.getVelocity().equals(NULL_VECTOR);
|
||||
}
|
||||
|
||||
+6
-6
@@ -41,8 +41,7 @@ public class BlockPlaceCollision implements Listener {
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
Block block = event.getBlock();
|
||||
if(!block.getType().isSolid())
|
||||
return;
|
||||
if (!block.getType().isSolid()) return;
|
||||
|
||||
// Hitbox size: 0.6xz, 1.8y, 1.5y when sneaking
|
||||
Player player = event.getPlayer();
|
||||
@@ -51,12 +50,13 @@ public class BlockPlaceCollision implements Listener {
|
||||
|
||||
Location blockmin = block.getLocation();
|
||||
Location blockmax = block.getLocation().add(1.0, 1.0, 1.0);
|
||||
if(
|
||||
if (
|
||||
max.getX() <= blockmin.getX() || min.getX() >= blockmax.getX() ||
|
||||
max.getY() <= blockmin.getY() || min.getY() >= blockmax.getY() ||
|
||||
max.getZ() <= blockmin.getZ() || min.getZ() >= blockmax.getZ()
|
||||
)
|
||||
max.getY() <= blockmin.getY() || min.getY() >= blockmax.getY() ||
|
||||
max.getZ() <= blockmin.getZ() || min.getZ() >= blockmax.getZ()
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@@ -53,14 +53,13 @@ public class Border {
|
||||
this.name = name;
|
||||
this.region = region;
|
||||
this.ghostRange = ghostRange;
|
||||
this.ghostSize = 2*ghostRange + 1;
|
||||
this.ghostSize = 2 * ghostRange + 1;
|
||||
|
||||
new StateDependentTask(ArenaMode.All, FightState.All, this::run, 1, 1);
|
||||
}
|
||||
|
||||
public void addPlayer(Player player) {
|
||||
if(ghostBarriers.containsKey(player.getUniqueId()))
|
||||
return;
|
||||
if (ghostBarriers.containsKey(player.getUniqueId())) return;
|
||||
|
||||
ghostBarriers.put(player.getUniqueId(), new HashSet<>());
|
||||
lastLocation.put(player.getUniqueId(), player.getLocation());
|
||||
@@ -73,25 +72,25 @@ public class Border {
|
||||
public void removePlayer(Player player) {
|
||||
lastLocation.remove(player.getUniqueId());
|
||||
Set<Block> blocks = ghostBarriers.remove(player.getUniqueId());
|
||||
if(blocks == null || !player.isOnline())
|
||||
return;
|
||||
if (blocks == null || !player.isOnline()) return;
|
||||
|
||||
for(Block block : blocks)
|
||||
for (Block block : blocks) {
|
||||
sendChange(player, block, Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
private void run() {
|
||||
List<UUID> offline = new ArrayList<>();
|
||||
for(Map.Entry<UUID, Set<Block>> entry : ghostBarriers.entrySet()) {
|
||||
for (Map.Entry<UUID, Set<Block>> entry : ghostBarriers.entrySet()) {
|
||||
UUID uuid = entry.getKey();
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
if(player == null) {
|
||||
if (player == null) {
|
||||
offline.add(uuid);
|
||||
continue;
|
||||
}
|
||||
|
||||
Location location = player.getLocation();
|
||||
if(region.playerInRegion(location) != contain) {
|
||||
if (region.playerInRegion(location) != contain) {
|
||||
player.teleport(lastLocation.get(uuid));
|
||||
FightSystem.getMessage().sendPrefixless(resetMessage, player, ChatMessageType.ACTION_BAR);
|
||||
return;
|
||||
@@ -100,17 +99,17 @@ public class Border {
|
||||
Set<Block> ghostBlocks = entry.getValue();
|
||||
Region ghostRegion = Region.fromSize(location.getBlockX() - ghostRange, location.getBlockY() - ghostRange, location.getBlockZ() - ghostRange, ghostSize, ghostSize, ghostSize);
|
||||
ghostBlocks.removeIf(block -> {
|
||||
if(!ghostRegion.inRegion(block)) {
|
||||
if (!ghostRegion.inRegion(block)) {
|
||||
sendChange(player, block, Material.AIR);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if(contain) {
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX()-1, region.getMinY(), region.getMinZ(), 1, region.getSizeY(), region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY()-1, region.getMinZ(), region.getSizeX(), 1, region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMinZ()-1, region.getSizeX(), region.getSizeY(), 1).intersection(ghostRegion));
|
||||
if (contain) {
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX() - 1, region.getMinY(), region.getMinZ(), 1, region.getSizeY(), region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY() - 1, region.getMinZ(), region.getSizeX(), 1, region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMinZ() - 1, region.getSizeX(), region.getSizeY(), 1).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMaxX(), region.getMinY(), region.getMinZ(), 1, region.getSizeY(), region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMaxY(), region.getMinZ(), region.getSizeX(), 1, region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMaxZ(), region.getSizeX(), region.getSizeY(), 1).intersection(ghostRegion));
|
||||
@@ -118,9 +117,9 @@ public class Border {
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMinZ(), 1, region.getSizeY(), region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMinZ(), region.getSizeX(), 1, region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMinZ(), region.getSizeX(), region.getSizeY(), 1).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMaxX()-1, region.getMinY(), region.getMinZ(), 1, region.getSizeY(), region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMaxY()-1, region.getMinZ(), region.getSizeX(), 1, region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMaxZ()-1, region.getSizeX(), region.getSizeY(), 1).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMaxX() - 1, region.getMinY(), region.getMinZ(), 1, region.getSizeY(), region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMaxY() - 1, region.getMinZ(), region.getSizeX(), 1, region.getSizeZ()).intersection(ghostRegion));
|
||||
borderIteration(player, ghostBlocks, Region.fromSize(region.getMinX(), region.getMinY(), region.getMaxZ() - 1, region.getSizeX(), region.getSizeY(), 1).intersection(ghostRegion));
|
||||
}
|
||||
|
||||
lastLocation.put(entry.getKey(), location);
|
||||
@@ -134,13 +133,15 @@ public class Border {
|
||||
private void borderIteration(Player player, Set<Block> ghostBlocks, Region border) {
|
||||
border.forEach((x, y, z) -> {
|
||||
Block block = Config.world.getBlockAt(x, y, z);
|
||||
if(ghostBlocks.add(block))
|
||||
if (ghostBlocks.add(block)) {
|
||||
sendChange(player, block, Material.BARRIER);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sendChange(Player player, Block block, Material type) {
|
||||
if(block.getType() == Material.AIR)
|
||||
if (block.getType() == Material.AIR) {
|
||||
FlatteningWrapper.impl.sendBlockChange(player, block, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.util.logging.Level;
|
||||
@Linked
|
||||
public class Chat implements Listener {
|
||||
|
||||
public Chat(){
|
||||
public Chat() {
|
||||
new StateDependentListener(ArenaMode.All, FightState.All, this);
|
||||
}
|
||||
|
||||
@@ -49,16 +49,16 @@ public class Chat implements Listener {
|
||||
|
||||
FightSystem.getPlugin().getLogger().log(Level.INFO, player.getName() + "» " + message);
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(player);
|
||||
if(fightTeam != null) {
|
||||
if (fightTeam != null) {
|
||||
String teamName = fightTeam.getColoredName();
|
||||
if(message.startsWith(Config.GameModeConfig.TeamChatPrefix)) {
|
||||
if (message.startsWith(Config.GameModeConfig.TeamChatPrefix)) {
|
||||
fightTeam.broadcastChat(player, message.substring(1));
|
||||
} else {
|
||||
broadcastChat("PARTICIPANT_CHAT", teamName, player.getName(), message);
|
||||
}
|
||||
}else if(Config.isReferee(player)){
|
||||
} else if (Config.isReferee(player)) {
|
||||
broadcastChat("FIGHTLEADER_CHAT", player.getName(), message);
|
||||
}else{
|
||||
} else {
|
||||
broadcastChat("SPECTATOR_CHAT", player.getName(), message);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,16 +45,14 @@ public class Check implements Listener {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e){
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
Player player = e.getPlayer();
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
|
||||
if(user.hasPerm(UserPerm.CHECK))
|
||||
return;
|
||||
if (user.hasPerm(UserPerm.CHECK)) return;
|
||||
|
||||
SchematicNode schem = SchematicNode.getSchematicNode(Config.CheckSchemID);
|
||||
if(user.getId() == schem.getOwner())
|
||||
return;
|
||||
if (user.getId() == schem.getOwner()) return;
|
||||
|
||||
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
|
||||
player.kickPlayer("");
|
||||
@@ -63,8 +61,9 @@ public class Check implements Listener {
|
||||
@EventHandler
|
||||
public void handlePlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(!event.getMessage().contains("copy") && !event.getMessage().contains("cut"))
|
||||
if (!event.getMessage().contains("copy") && !event.getMessage().contains("cut")) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
FightSystem.getMessage().send("CHECK_COMMAND_LOCKED", player);
|
||||
|
||||
+3
-5
@@ -19,12 +19,11 @@
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.Reflection;
|
||||
import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.utils.CraftbukkitWrapper;
|
||||
import de.steamwar.linkage.Linked;
|
||||
import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.*;
|
||||
@@ -44,12 +43,11 @@ public class ClickAnalyzer {
|
||||
|
||||
public ClickAnalyzer() {
|
||||
TinyProtocol.instance.addFilter(Recording.blockPlacePacket, this::onBlockPlace);
|
||||
if(Core.getVersion() > 8)
|
||||
TinyProtocol.instance.addFilter(Reflection.getClass("net.minecraft.network.protocol.game.ServerboundUseItemOnPacket"), this::onBlockPlace);
|
||||
TinyProtocol.instance.addFilter(ServerboundUseItemOnPacket.class, this::onBlockPlace);
|
||||
}
|
||||
|
||||
public Object onBlockPlace(Player player, Object packet) {
|
||||
synchronized(output) {
|
||||
synchronized (output) {
|
||||
output.println(player.getName() + "," + System.nanoTime() + "," + CraftbukkitWrapper.impl.headRotation(player) + "," + player.getLocation().getPitch());
|
||||
}
|
||||
return packet;
|
||||
|
||||
+2
-4
@@ -42,14 +42,12 @@ public class DenyInventoryMovement implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
if(!PersonalKitCreator.inKitCreator(event.getWhoClicked()))
|
||||
event.setCancelled(true);
|
||||
if (!PersonalKitCreator.inKitCreator(event.getWhoClicked())) event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryDrag(InventoryDragEvent event) {
|
||||
if(!PersonalKitCreator.inKitCreator(event.getWhoClicked()))
|
||||
event.setCancelled(true);
|
||||
if (!PersonalKitCreator.inKitCreator(event.getWhoClicked())) event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||
+12
-11
@@ -50,7 +50,7 @@ public class DenyWorldInteraction implements Listener {
|
||||
@EventHandler
|
||||
public void handleBlockBreak(BlockBreakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(Fight.fighting(player)) {
|
||||
if (Fight.fighting(player)) {
|
||||
event.setCancelled(true);
|
||||
FightSystem.getMessage().sendPrefixless("NO_BLOCK_BREAK", player, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
@@ -59,14 +59,14 @@ public class DenyWorldInteraction implements Listener {
|
||||
@EventHandler
|
||||
public void handleItemDrop(PlayerDropItemEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(Fight.fighting(player)) {
|
||||
if (Fight.fighting(player)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handleHangingBreak(HangingBreakEvent event) {
|
||||
if(Config.ArenaRegion.inRegion(event.getEntity().getLocation())) {
|
||||
if (Config.ArenaRegion.inRegion(event.getEntity().getLocation())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class DenyWorldInteraction implements Listener {
|
||||
@EventHandler
|
||||
public void handleBlockPlace(BlockPlaceEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(Fight.fighting(player)) {
|
||||
if (Fight.fighting(player)) {
|
||||
event.setCancelled(true);
|
||||
FightSystem.getMessage().sendPrefixless("NO_BLOCK_PLACE", player, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
@@ -82,27 +82,28 @@ public class DenyWorldInteraction implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void handleEntityExplode(EntityExplodeEvent event) {
|
||||
if(!Config.GameModeConfig.Arena.Leaveable || Config.ArenaRegion.inRegion(event.getLocation()))
|
||||
if (!Config.GameModeConfig.Arena.Leaveable || Config.ArenaRegion.inRegion(event.getLocation())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handleBlockBurn(BlockIgniteEvent event) {
|
||||
if(!Config.GameModeConfig.Arena.Leaveable || Config.ArenaRegion.inRegion(event.getBlock()))
|
||||
if (!Config.GameModeConfig.Arena.Leaveable || Config.ArenaRegion.inRegion(event.getBlock())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handlePlayerKickEvent(PlayerKickEvent e){
|
||||
if(e.getReason().contains("Flying is not enabled"))
|
||||
e.setCancelled(true);
|
||||
public void handlePlayerKickEvent(PlayerKickEvent e) {
|
||||
if (e.getReason().contains("Flying is not enabled")) e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handleProjectileLaunch(ProjectileLaunchEvent event) {
|
||||
if(event.getEntity().getShooter() instanceof Player) {
|
||||
if (event.getEntity().getShooter() instanceof Player) {
|
||||
Player player = (Player) event.getEntity().getShooter();
|
||||
if(Fight.fighting(player)) {
|
||||
if (Fight.fighting(player)) {
|
||||
event.setCancelled(true);
|
||||
FightSystem.getMessage().sendPrefixless("NO_BOW_USAGE", player, ChatMessageType.ACTION_BAR);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user