forked from SteamWar/SteamWar
Merge branch 'main' into update/1.21.5
# Conflicts: # VelocityCore/src/de/steamwar/velocitycore/ServerVersion.java
This commit is contained in:
@@ -23,10 +23,7 @@ import com.comphenix.tinyprotocol.TinyProtocol;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.fightsystem.commands.*;
|
||||
import de.steamwar.fightsystem.countdown.*;
|
||||
import de.steamwar.fightsystem.event.HellsBells;
|
||||
import de.steamwar.fightsystem.event.Meteor;
|
||||
import de.steamwar.fightsystem.event.PersistentDamage;
|
||||
import de.steamwar.fightsystem.event.TNTDistributor;
|
||||
import de.steamwar.fightsystem.event.*;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.fight.FightWorld;
|
||||
@@ -136,6 +133,7 @@ public class FightSystem extends JavaPlugin {
|
||||
new PersistentDamage();
|
||||
new TNTDistributor();
|
||||
new WinconditionAmongUs();
|
||||
new NoGravity();
|
||||
|
||||
new NoPlayersOnlineCountdown();
|
||||
new PreSchemCountdown();
|
||||
|
||||
@@ -76,6 +76,7 @@ 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}
|
||||
|
||||
@@ -70,6 +70,7 @@ 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}
|
||||
|
||||
@@ -24,15 +24,14 @@ import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.ai.AIManager;
|
||||
import de.steamwar.fightsystem.fight.*;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightPlayer;
|
||||
import de.steamwar.fightsystem.listener.PersonalKitCreator;
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.utils.ColorConverter;
|
||||
import de.steamwar.inventory.*;
|
||||
import de.steamwar.message.Message;
|
||||
import de.steamwar.sql.PersonalKit;
|
||||
import de.steamwar.sql.SchematicNode;
|
||||
import de.steamwar.sql.SchematicType;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import de.steamwar.sql.*;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@@ -40,7 +39,10 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
import java.util.*;
|
||||
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 {
|
||||
@@ -206,6 +208,14 @@ public class GUI {
|
||||
for (int i = 0; i < Config.SubTypes.size(); i++) {
|
||||
setupSchemTypeRow(p, inv, Config.SubTypes.get(i), i + 1);
|
||||
}
|
||||
if (!Config.test() && SteamwarUser.get(p.getUniqueId()).hasPerm(UserPerm.TEAM)) {
|
||||
SchematicNode node = SchematicNode.getSchematicNode(-1, Config.GameName, (Integer) null);
|
||||
if (node != null) {
|
||||
inv.setItem(2, new SWItem(SWItem.getMaterial(node.getItem()), msg.parse("SCHEM_DIRT", p), click -> {
|
||||
schemSelect(p, node);
|
||||
}));
|
||||
}
|
||||
}
|
||||
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
|
||||
inv.open();
|
||||
}
|
||||
@@ -241,14 +251,18 @@ public class GUI {
|
||||
|
||||
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 -> {
|
||||
FightTeam fightTeam = Fight.getPlayerTeam(p);
|
||||
if(fightTeam == null)
|
||||
return;
|
||||
if(Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP)
|
||||
fightTeam.pasteSchem(node);
|
||||
p.closeInventory();
|
||||
schemSelect(p, node);
|
||||
});
|
||||
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)
|
||||
fightTeam.pasteSchem(node);
|
||||
p.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
+24
-15
@@ -34,6 +34,7 @@ import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.util.Arrays;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class TechhiderbugCommand implements CommandExecutor {
|
||||
|
||||
@@ -45,25 +46,33 @@ public class TechhiderbugCommand implements CommandExecutor {
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args) {
|
||||
StringWriter writer = new StringWriter();
|
||||
|
||||
writer.append("ArenaMode: ").append(Config.mode.name()).append('\n');
|
||||
writer.append("FightState: ").append(FightState.getFightState().name()).append('\n');
|
||||
writer.append("TechHider enabled: ").append(FightState.getStateDependentFeatures().get(FightSystem.getTechHider()).toString()).append('\n');
|
||||
try {
|
||||
writer.append("ArenaMode: ").append(Config.mode.name()).append('\n');
|
||||
writer.append("FightState: ").append(FightState.getFightState().name()).append('\n');
|
||||
writer.append("TechHider enabled: ").append(FightState.getStateDependentFeatures().get(FightSystem.getTechHider()).toString()).append('\n');
|
||||
|
||||
writer.append("Arena region: ").append(Config.ArenaRegion.toString()).append('\n');
|
||||
writer.append("Team regions: ");
|
||||
Fight.teams().forEach(t -> writer.append(t.getName()).append(':').append(t.getExtendRegion().toString()).append(' '));
|
||||
writer.append('\n');
|
||||
writer.append("Arena region: ").append(Config.ArenaRegion.toString()).append('\n');
|
||||
writer.append("Team regions: ");
|
||||
Fight.teams().forEach(t -> writer.append(t.getName()).append(':').append(t.getExtendRegion().toString()).append(' '));
|
||||
writer.append('\n');
|
||||
|
||||
writer.append("HullHider regions: ");
|
||||
FightSystem.getHullHider().getHullMap().forEach((t, h) -> writer.append(t.getName()).append(':').append(h.getRegion().toString()).append(' '));
|
||||
writer.append('\n');
|
||||
writer.append("HullHider regions: ");
|
||||
FightSystem.getHullHider().getHullMap().forEach((t, h) -> writer.append(t.getName()).append(':').append(h.getRegion().toString()).append(' '));
|
||||
writer.append('\n');
|
||||
|
||||
writer.append("Hidden regions: ");
|
||||
FightSystem.getTechHider().getHiddenRegion().forEach((p, r) -> writer.append(p.getName()).append(':').append(r.toString()).append(' '));
|
||||
writer.append('\n');
|
||||
writer.append("Hidden regions: ");
|
||||
FightSystem.getTechHider().getHiddenRegion().forEach((p, r) -> writer.append(p.getName()).append(':').append(r.toString()).append(' '));
|
||||
writer.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'));
|
||||
writer.append("TinyProtocol: ");
|
||||
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'));
|
||||
} 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);
|
||||
}
|
||||
|
||||
SWException.log("Techhider-Bug reported by " + sender.getName() + ": " + Arrays.toString(args), writer.toString());
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2020 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.event;
|
||||
|
||||
import de.steamwar.fightsystem.states.FightState;
|
||||
import de.steamwar.fightsystem.states.StateDependentListener;
|
||||
import de.steamwar.fightsystem.winconditions.Winconditions;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||
|
||||
public class NoGravity implements Listener {
|
||||
|
||||
public NoGravity() {
|
||||
new StateDependentListener(Winconditions.NO_GRAVITY, FightState.All, this);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntitySpawn(EntitySpawnEvent event) {
|
||||
if (event.getEntityType() == EntityType.PLAYER) return;
|
||||
event.getEntity().setGravity(false);
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.EquipmentSlot;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@@ -120,9 +121,6 @@ public class HotbarKit extends Kit {
|
||||
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
click(player, slot, event);
|
||||
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> {
|
||||
player.setItemOnCursor(null);
|
||||
}, 1);
|
||||
}
|
||||
|
||||
private void click(Player player, int slot, Cancellable event) {
|
||||
|
||||
@@ -86,7 +86,10 @@ public class PrepareSchem implements Listener {
|
||||
if(schemExists(schem))
|
||||
return;
|
||||
|
||||
SchematicNode old = schem;
|
||||
schem = SchematicNode.createSchematicNode(schem.getOwner(), preparedName(schem), schem.getParent(), Config.SchematicType.checkType().toDB(), schem.getItem());
|
||||
schem.setReplaceColor(old.replaceColor());
|
||||
schem.setAllowReplay(old.allowReplay());
|
||||
|
||||
try{
|
||||
WorldeditWrapper.impl.saveSchem(schem, region, minY);
|
||||
|
||||
+3
@@ -84,6 +84,9 @@ public class WinconditionBlocks extends Wincondition implements PrintableWincond
|
||||
}
|
||||
|
||||
private void check() {
|
||||
// Edge Case for DirtBlock
|
||||
if (blocks.isEmpty()) return;
|
||||
|
||||
blocks.removeIf(block -> !isOfType.test(block));
|
||||
if(blocks.isEmpty())
|
||||
win(Fight.getOpposite(team), "WIN_TECHKO", team.getColoredName());
|
||||
|
||||
+8
-1
@@ -78,6 +78,7 @@ public class WinconditionPercent extends Wincondition implements PrintableWincon
|
||||
|
||||
private int totalBlocks = 0;
|
||||
private int currentBlocks = 0;
|
||||
private boolean countAnyBlock = false;
|
||||
|
||||
private TeamPercent(FightTeam team, Winconditions wincondition) {
|
||||
this.team = team;
|
||||
@@ -98,7 +99,7 @@ public class WinconditionPercent extends Wincondition implements PrintableWincon
|
||||
}
|
||||
|
||||
event.blockList().forEach(block -> {
|
||||
if (Config.PercentBlocks.contains(block.getType()) == Config.PercentBlocksWhitelist) {
|
||||
if (countAnyBlock || Config.PercentBlocks.contains(block.getType()) == Config.PercentBlocksWhitelist) {
|
||||
currentBlocks--;
|
||||
}
|
||||
});
|
||||
@@ -108,10 +109,16 @@ public class WinconditionPercent extends Wincondition implements PrintableWincon
|
||||
|
||||
private void enable() {
|
||||
totalBlocks = 0;
|
||||
countAnyBlock = false;
|
||||
team.getSchemRegion().forEach((x, y, z) -> {
|
||||
if (Config.PercentBlocks.contains(Config.world.getBlockAt(x, y, z).getType()) == Config.PercentBlocksWhitelist)
|
||||
totalBlocks++;
|
||||
});
|
||||
// Edge Case for DirtBlock
|
||||
if (totalBlocks == 0) {
|
||||
totalBlocks = team.getSchemRegion().volume();
|
||||
countAnyBlock = true;
|
||||
}
|
||||
currentBlocks = totalBlocks;
|
||||
postEnable.accept(team);
|
||||
}
|
||||
|
||||
+2
-1
@@ -39,5 +39,6 @@ public enum Winconditions {
|
||||
METEOR,
|
||||
AMONG_US,
|
||||
PERSISTENT_DAMAGE,
|
||||
TNT_DISTRIBUTION
|
||||
TNT_DISTRIBUTION,
|
||||
NO_GRAVITY,
|
||||
}
|
||||
|
||||
@@ -39,3 +39,13 @@ dependencies {
|
||||
implementation(project(":FightSystem:FightSystem_20"))
|
||||
implementation(project(":FightSystem:FightSystem_21"))
|
||||
}
|
||||
|
||||
tasks.register<FightServer>("WarGear20") {
|
||||
group = "run"
|
||||
description = "Run a WarGear 1.20 Fight Server"
|
||||
dependsOn(":SpigotCore:shadowJar")
|
||||
dependsOn(":FightSystem:shadowJar")
|
||||
template = "WarGear20"
|
||||
worldName = "arenas/Pentraki"
|
||||
config = "WarGear20.yml"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user