SteamWar/FightSystem
Archiviert
13
1

Move to FightInfoPacket
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-10-03 20:35:37 +02:00
Ursprung c983b40d9f
Commit c00dd470f1
4 geänderte Dateien mit 65 neuen und 16 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

@ -20,7 +20,6 @@
package de.steamwar.fightsystem.fight; package de.steamwar.fightsystem.fight;
import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard;
import de.steamwar.comms.packets.TablistNamePacket;
import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.FightSystem;
@ -33,7 +32,6 @@ import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.utils.*; import de.steamwar.fightsystem.utils.*;
import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWItem;
import de.steamwar.sql.Schematic; import de.steamwar.sql.Schematic;
import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.chat.BaseComponent; import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.*; import org.bukkit.*;
@ -213,8 +211,6 @@ public class FightTeam {
if(Kit.getAvailableKits(false).size() > 1 || Config.PersonalKits) if(Kit.getAvailableKits(false).size() > 1 || Config.PersonalKits)
player.getInventory().setItem(1, new ItemBuilder(Material.LEATHER_CHESTPLATE).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§eKit wählen").build()); player.getInventory().setItem(1, new ItemBuilder(Material.LEATHER_CHESTPLATE).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§eKit wählen").build());
player.getInventory().setItem(7, new ItemBuilder(Material.BEACON).removeAllAttributs().setDisplayName("§eRespawn").build()); player.getInventory().setItem(7, new ItemBuilder(Material.BEACON).removeAllAttributs().setDisplayName("§eRespawn").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); GlobalRecorder.getInstance().playerJoins(player);
TechHider.reloadChunks(player, chunksToReload, false); TechHider.reloadChunks(player, chunksToReload, false);
@ -243,8 +239,6 @@ public class FightTeam {
player.getInventory().clear(); player.getInventory().clear();
if(player.isOnline()){ 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); TechHider.reloadChunks(player, chunksToReload, true);
} }
} }

Datei anzeigen

@ -19,18 +19,14 @@
package de.steamwar.fightsystem.listener; package de.steamwar.fightsystem.listener;
import de.steamwar.comms.packets.TablistNamePacket;
import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight; import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam; import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.record.REntity; import de.steamwar.fightsystem.record.REntity;
import de.steamwar.fightsystem.states.FightState; import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener; import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -79,8 +75,6 @@ public class Permanent implements Listener {
if (fightTeam == null) { if (fightTeam == null) {
Fight.setPlayerGamemode(player, GameMode.SPECTATOR); Fight.setPlayerGamemode(player, GameMode.SPECTATOR);
player.teleport(Config.SpecSpawn); 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); REntity.playerJoins(player);

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);
}
}