SteamWar/FightSystem
Archiviert
13
1

Multiling (nur Multling) #294

Zusammengeführt
Lixfel hat 10 Commits von multiling nach master 2021-10-24 19:38:35 +02:00 zusammengeführt
9 geänderte Dateien mit 79 neuen und 20 gelöschten Zeilen
Nur Änderungen aus Commit 4fc9a6cd8e werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -125,7 +125,7 @@ public class WorldeditWrapper14 implements WorldeditWrapper.IWorldeditWrapper {
public void saveSchem(Schematic schem, Region region, int minY) throws WorldEditException {
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
BlockVector3 min = BlockVector3.at(region.getMinX(), minY, region.getMinZ());
CuboidRegion cuboidRegion = new CuboidRegion(w, min, BlockVector3.at(region.getMaxX(), region.getMaxY(), region.getMaxZ()));
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(

Datei anzeigen

@ -124,7 +124,7 @@ public class WorldeditWrapper8 implements WorldeditWrapper.IWorldeditWrapper {
public void saveSchem(Schematic schem, Region region, int minY) throws WorldEditException {
World w = new BukkitWorld(Bukkit.getWorlds().get(0));
Vector min = new Vector(region.getMinX(), minY, region.getMinZ());
CuboidRegion cuboidRegion = new CuboidRegion(w, min, new Vector(region.getMaxX(), region.getMaxY(), region.getMaxZ()));
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(

Datei anzeigen

@ -31,10 +31,7 @@ import de.steamwar.fightsystem.listener.*;
import de.steamwar.fightsystem.record.*;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.OneShotStateDependent;
import de.steamwar.fightsystem.utils.EnterHandler;
import de.steamwar.fightsystem.utils.FightStatistics;
import de.steamwar.fightsystem.utils.FightUI;
import de.steamwar.fightsystem.utils.TechHider;
import de.steamwar.fightsystem.utils.*;
import de.steamwar.fightsystem.winconditions.*;
import de.steamwar.message.Message;
import de.steamwar.sql.EventFight;
@ -93,6 +90,7 @@ public class FightSystem extends JavaPlugin {
new TechHider();
new FightWorld();
new FightUI();
new BungeeFightInfo();
new WinconditionAllDead();
new WinconditionCaptainDead();

Datei anzeigen

@ -20,7 +20,6 @@
package de.steamwar.fightsystem.fight;
import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.comms.packets.TablistNamePacket;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
@ -33,7 +32,6 @@ import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.utils.*;
import de.steamwar.inventory.SWItem;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.*;
import org.bukkit.enchantments.Enchantment;
@ -212,8 +210,6 @@ public class FightTeam {
if(Kit.getAvailableKits(false).size() > 1 || Config.PersonalKits)
player.getInventory().setItem(1, new ItemBuilder(Material.LEATHER_CHESTPLATE).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName(FightSystem.getMessage().parse("CHOOSE_KIT", player)).build());
player.getInventory().setItem(7, new ItemBuilder(Material.BEACON).removeAllAttributs().setDisplayName(FightSystem.getMessage().parse("RESPAWN", player)).build());
if(ArenaMode.NotOnBau.contains(Config.mode))
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), prefix + player.getName()).send(player), 5);
GlobalRecorder.getInstance().playerJoins(player);
TechHider.reloadChunks(player, chunksToReload, false);
@ -242,8 +238,6 @@ public class FightTeam {
player.getInventory().clear();
if(player.isOnline()){
if(ArenaMode.NotOnBau.contains(Config.mode))
new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), "§7" + player.getName()).send(player);
TechHider.reloadChunks(player, chunksToReload, true);
}
}

Datei anzeigen

@ -19,18 +19,14 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.comms.packets.TablistNamePacket;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.record.REntity;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -79,8 +75,6 @@ public class Permanent implements Listener {
if (fightTeam == null) {
Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
player.teleport(Config.SpecSpawn);
if(ArenaMode.NotOnBau.contains(Config.mode))
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> new TablistNamePacket(SteamwarUser.get(player.getUniqueId()).getId(), "§7" + player.getName()).send(player), 5);
}
REntity.playerJoins(player);

Datei anzeigen

@ -54,6 +54,10 @@ public class WaterRemover implements Listener {
}
private void checkBlock(Block b) {
//do not remove outside teamareas
if(!Config.BlueExtendRegion.inRegion(b) && !Config.RedExtendRegion.inRegion(b))
return;
//checks for water and removes it, if present
if(!FlatteningWrapper.impl.removeWater(b))
return;

Datei anzeigen

@ -29,8 +29,14 @@ import java.util.zip.GZIPInputStream;
public class FileSource extends PacketSource {
public static void startReplay() {
if(Config.replayserver())
if(Config.replayserver()) {
try {
new LiveServer();
} catch (IOException e) {
throw new SecurityException("Could not start replayserver", e);
}
return;
}
InputStream input = de.steamwar.sql.Fight.getReplay(Config.ReplayID);
try {

Datei anzeigen

@ -0,0 +1,63 @@
/*
This file is a part of the SteamWar software.
Copyright (C) 2021 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.comms.packets.FightInfoPacket;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentTask;
import de.steamwar.sql.SteamwarUser;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.stream.Collectors;
public class BungeeFightInfo {
public BungeeFightInfo() {
new StateDependentTask(ArenaMode.NotOnBau, FightState.All, this::send, 20, 20);
}
private void send() {
Player player = Bukkit.getOnlinePlayers().stream().findAny().orElse(null);
if(player == null)
return;
new FightInfoPacket(
Bukkit.getWorlds().get(0).getName(),
Config.SchematicType.toDB(),
"",
Fight.getBlueTeam().getColoredName(),
Fight.getRedTeam().getColoredName(),
FightState.getFightState().name(),
StateDependentCountdown.getMainCountdown() != null ? StateDependentCountdown.getMainCountdown().getTimeLeft() : 0,
Fight.getBlueTeam().getLeader() != null ? SteamwarUser.get(Fight.getBlueTeam().getLeader().getPlayer().getUniqueId()).getId() : 0,
Fight.getRedTeam().getLeader() != null ? SteamwarUser.get(Fight.getRedTeam().getLeader().getPlayer().getUniqueId()).getId() : 0,
Fight.getBlueTeam().getSchematic(),
Fight.getRedTeam().getSchematic(),
Fight.getBlueTeam().getPlayers().stream().map(p -> SteamwarUser.get(p.getPlayer().getUniqueId()).getId()).collect(Collectors.toList()),
Fight.getRedTeam().getPlayers().stream().map(p -> SteamwarUser.get(p.getPlayer().getUniqueId()).getId()).collect(Collectors.toList()),
Bukkit.getOnlinePlayers().stream().filter(p -> Fight.getPlayerTeam(p) == null).map(p -> SteamwarUser.get(p.getUniqueId()).getId()).collect(Collectors.toList())
).send(player);
}
}

Datei anzeigen

@ -160,7 +160,7 @@ public class FightUI {
angle = ((angle % 360) + 360) % 360;
for(BossBarType type : values()) {
if(type.minAngle < type.maxAngle ? type.minAngle <= angle && angle < type.maxAngle : type.minAngle < angle || angle <= type.maxAngle)
if(type.minAngle < type.maxAngle ? type.minAngle <= angle && angle < type.maxAngle : type.minAngle <= angle || angle < type.maxAngle)
return type;
}