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
68 geänderte Dateien mit 912 neuen und 663 gelöschten Zeilen

Datei anzeigen

@ -21,14 +21,15 @@ package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.Reflection;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.listener.Recording;
import de.steamwar.fightsystem.record.GlobalRecorder;
import de.steamwar.fightsystem.record.REntity;
import net.md_5.bungee.api.chat.BaseComponent;
import net.minecraft.server.v1_8_R3.*;
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 net.royawesome.jlibnoise.MathHelper;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.*;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
@ -56,18 +57,6 @@ public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper {
return p.getInventory().getItemInHand().getType() == Material.BOW;
}
@Override
public void toActionbar(Player player, BaseComponent... components) {
PacketPlayOutChat packet = new PacketPlayOutChat(new ChatComponentText(BaseComponent.toLegacyText(components)), (byte)2);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
@Override
public void toChat(Player player, BaseComponent... components) {
PacketPlayOutChat packet = new PacketPlayOutChat(new ChatComponentText(BaseComponent.toLegacyText(components)), (byte)0);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
@Override
public void setAttackSpeed(Player player) {
// nothing to do
@ -162,49 +151,24 @@ public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper {
}
}
private final Map<FightUI.BossBarType, PacketPlayOutEntityMetadata> barMap = new HashMap<>();
private final Set<Player> seesDragon = new HashSet<>();
private final PacketPlayOutSpawnEntityLiving spawnDragon;
private final int spawnDragonId;
@Override
public void setBossbar(double leftBlueProgress, double leftRedProgress, String leftBlueText, String leftRedText) {
barMap.clear();
barMap.put(FightUI.BossBarType.BLUE_LEFT, createPacket(leftBlueProgress, leftBlueText));
barMap.put(FightUI.BossBarType.RED_LEFT, createPacket(leftRedProgress, leftRedText));
}
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);
}
private PacketPlayOutEntityMetadata createPacket(double progress, String text) {
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));
//watcher.a(10, text);
//watcher.a(11, (byte) 1);
return new PacketPlayOutEntityMetadata(spawnDragonId, watcher, true);
}
@Override
public void removeFromBar(Player player, FightUI.BossBarType type) {
// not used
}
@Override
public void addToBar(Player player, FightUI.BossBarType type) {
// not used
}
private final Set<Player> seesDragon = new HashSet<>();
private final PacketPlayOutSpawnEntityLiving spawnDragon;
private final int spawnDragonId;
@Override
public void broadcastBossbar() {
seesDragon.removeIf(player -> !player.isOnline());
Bukkit.getOnlinePlayers().forEach(player -> {
if(!seesDragon.contains(player)) {
((CraftPlayer)player).getHandle().playerConnection.sendPacket(spawnDragon);
seesDragon.add(player);
}
((CraftPlayer) player).getHandle().playerConnection.sendPacket(barMap.get(FightUI.getInstance().bossBarType(player)));
});
((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(spawnDragonId, watcher, true));
}
}

Datei anzeigen

@ -20,13 +20,10 @@
package de.steamwar.fightsystem.utils;
import com.comphenix.tinyprotocol.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 de.steamwar.fightsystem.record.REntity;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.*;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeInstance;
@ -53,12 +50,6 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
private static final Object mainHand = enumHand.getEnumConstants()[0];
private static final Reflection.FieldAccessor<?> blockPlaceHand = Reflection.getField(Recording.blockPlacePacket, enumHand, 0);
public BountifulWrapper9() {
for(FightUI.BossBarType type : FightUI.BossBarType.values()) {
barMap.put(type, Bukkit.createBossBar(type.name(), BarColor.WHITE, BarStyle.SOLID));
}
}
@Override
public boolean mainHand(Object packet) {
return blockPlaceHand.get(packet) == mainHand;
@ -69,16 +60,6 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
return (mainHand ? p.getInventory().getItemInMainHand() : p.getInventory().getItemInOffHand()).getType() == Material.BOW;
}
@Override
public void toActionbar(Player player, BaseComponent... components) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, components);
}
@Override
public void toChat(Player player, BaseComponent... components) {
player.spigot().sendMessage(ChatMessageType.CHAT, components);
}
@Override
public void setAttackSpeed(Player player) {
AttributeInstance attribute = player.getAttribute(Attribute.GENERIC_ATTACK_SPEED);
@ -205,14 +186,18 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
}
}
private final Map<FightUI.BossBarType, BossBar> barMap = new HashMap<>();
private final Map<Player, BossBar> barMap = new HashMap<>();
@Override
public void setBossbar(double leftBlueProgress, double leftRedProgress, String leftBlueText, String leftRedText) {
setupTeamBar(Fight.getBlueTeam(), barMap.get(FightUI.BossBarType.BLUE_LEFT), leftBlueProgress, leftBlueText);
setupTeamBar(Fight.getRedTeam(), barMap.get(FightUI.BossBarType.RED_LEFT), leftRedProgress, leftRedText);
}
public void sendBar(Player player, FightTeam team, double progress, String text) {
barMap.keySet().removeIf(p -> !p.isOnline());
private void setupTeamBar(FightTeam team, BossBar bar, double progress, String title) {
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);
@ -220,7 +205,8 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
if(bar.getProgress() != progress)
bar.setProgress(progress);
bar.setTitle(title);
if(!bar.getTitle().equals(text))
bar.setTitle(text);
}
private BarColor chat2bar(ChatColor color) {
@ -251,19 +237,4 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
return BarColor.WHITE;
}
}
@Override
public void removeFromBar(Player player, FightUI.BossBarType type) {
barMap.get(type).removePlayer(player);
}
@Override
public void addToBar(Player player, FightUI.BossBarType type) {
barMap.get(type).addPlayer(player);
}
@Override
public void broadcastBossbar() {
// Handled by Spigot BossBarAPI
}
}

Datei anzeigen

@ -52,4 +52,5 @@ public enum ArenaMode {
public static final Set<ArenaMode> Restartable = Collections.unmodifiableSet(EnumSet.of(NORMAL, RANKED, REPLAY));
public static final Set<ArenaMode> SoloLeader = Collections.unmodifiableSet(EnumSet.of(TEST, CHECK, PREPARE));
public static final Set<ArenaMode> NotOnBau = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK, PREPARE, REPLAY)));
public static final Set<ArenaMode> VariableTime = Collections.unmodifiableSet(EnumSet.complementOf(EnumSet.of(TEST, CHECK, REPLAY)));
}

Datei anzeigen

@ -33,6 +33,7 @@ import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.OneShotStateDependent;
import de.steamwar.fightsystem.utils.*;
import de.steamwar.fightsystem.winconditions.*;
import de.steamwar.message.Message;
import de.steamwar.sql.EventFight;
import de.steamwar.sql.Schematic;
import org.bukkit.Bukkit;
@ -43,11 +44,12 @@ import java.util.logging.Level;
public class FightSystem extends JavaPlugin {
public static final String PREFIX = "§eArena§8» ";
private static FightSystem plugin;
private static EventFight eventFight;
private static Player eventLeiter;
private Message message;
@Override
public void onLoad() {
plugin = this;
@ -55,6 +57,8 @@ public class FightSystem extends JavaPlugin {
@Override
public void onEnable() {
message = new Message("de.steamwar.fightsystem.FightSystem", FightSystem.class.getClassLoader());
new EntityDamage();
new WaterRemover();
new Permanent();
@ -128,8 +132,8 @@ public class FightSystem extends JavaPlugin {
new LiveRecorder();
new FileRecorder();
new OneShotStateDependent(ArenaMode.AntiReplay, FightState.PreRunning, () -> FightUI.addSubtitle("§7Kits verteilt"));
new OneShotStateDependent(ArenaMode.AntiReplay, FightState.Running, () -> FightUI.addSubtitle("§aArena freigegeben"));
new OneShotStateDependent(ArenaMode.AntiReplay, FightState.PreRunning, () -> FightUI.addSubtitle("UI_PRE_RUNNING"));
new OneShotStateDependent(ArenaMode.AntiReplay, FightState.Running, () -> FightUI.addSubtitle("UI_RUNNING"));
new OneShotStateDependent(ArenaMode.AntiTest, FightState.Running, FightStatistics::start);
try {
@ -181,14 +185,8 @@ public class FightSystem extends JavaPlugin {
FightState.setFightState(FightState.RUNNING);
}
public static void setSpectateState(FightTeam winFightTeam, String windescription, String subtitle) {
if(!PacketProcessor.isReplaying()){
if(winFightTeam != null) {
FightUI.printWin(winFightTeam.getPrefix() + "Sieg " + winFightTeam.getName(), subtitle);
} else {
FightUI.printWin("§7Unentschieden", subtitle);
}
}
public static void setSpectateState(FightTeam winFightTeam, String winreason, String subtitle, Object... params) {
FightUI.printWin(winFightTeam, subtitle, params);
FightState.setFightState(FightState.SPECTATE);
@ -202,7 +200,7 @@ public class FightSystem extends JavaPlugin {
getEventFight().setErgebnis(2);
}
FightStatistics.saveStats(winFightTeam, windescription);
FightStatistics.saveStats(winFightTeam, winreason);
}
}
@ -226,25 +224,23 @@ public class FightSystem extends JavaPlugin {
return plugin;
}
public static void shutdown(String reason){
if(reason != null)
FightSystem.broadcast(reason);
public static void broadcast(String msg, Object... params) {
getMessage().broadcast(msg, params);
GlobalRecorder.getInstance().system(msg, params);
}
public static Message getMessage() {
return plugin.message;
}
public static void shutdown() {
//Staggered kick to prevent lobby overloading
kickNext();
}
public static void broadcast(String message) {
Bukkit.broadcastMessage(PREFIX + message);
GlobalRecorder.getInstance().systemChat(PREFIX + message);
}
private static void kickNext(){
if(Bukkit.getOnlinePlayers().isEmpty()){
Bukkit.shutdown();
return;
}
Bukkit.getOnlinePlayers().iterator().next().kickPlayer(null);
Bukkit.getScheduler().runTaskLater(plugin, FightSystem::kickNext, 10);
Bukkit.getScheduler().runTaskLater(plugin, FightSystem::shutdown, 10);
}
}

Datei anzeigen

@ -0,0 +1,218 @@
#
# 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/>.
#
PREFIX=§eArena§8»
# 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_INVITATION=§cDu wurdest von keinem Team eingeladen
INVITATION_DECLINED=§cEinladung abgelehnt
INVITATION_DECLINED_TEAM=§e{0} §chat die Einladung abgelehnt
PLAYER_IN_TEAM=§e{0} §cist bereits in einem Team
ALREADY_INVITED=§e{0} §cwurde bereits eingeladen
INVITATION_SENT=§e{0} §7eingeladen
NOT_IN_TEAM=§e{0} §cist nicht in deinem Team
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]
INVITE_HELP=§8/§einvite §8[§eSpieler§8]
LEADER_FULL=§cAlle Teams haben bereits einen Leader
ALREADY_IN_TEAM=§cDu bist bereits in einem Team
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]
REPLAY_UNAVAILABLE=§cReplay derzeit nicht verfügbar
NOT_FIGHTLEADER=§cDu bist nicht Kampfleiter
WIN_HELP=§8/§7win §8[§eTeam §8or §etie§8]
# GUI
INVITATION_TITLE=Einladung von {0}
INVITATION_ACCEPT=§aAnnehmen
INVITATION_DECLINE=§cAblehnen
INVITATION_CHAT_ACCEPT=§8/§aaccept§8, §7um die Einladung §aanzunehmen
INVITATION_CHAT_DECLINE=§8/§cdecline§8, §7um die Einladung §cabzulehnen
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
INVITE_TITLE=Spieler einladen
REMOVE_TITLE=Spieler rauswerfen
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_PUBLIC=§eÖffentliches {0}
SCHEM_PRIVATE=§ePrivates {0}
SCHEM_NO_PRIVATE=§7Kein privates {0} vorhanden
SCHEM_PRIVATE_FORBIDDEN=§7Kein privates {0} erlaubt
# Countdowns
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
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
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
TEAM_CHAT={0}{1}§8» {0}{2}
CHOOSE_KIT=§eKit wählen
RESPAWN=§eRespawn
INVITE_PLAYERS=§eSpieler einladen
REMOVE_PLAYERS=§cSpieler rauswerfen
CHOOSE_SCHEMATIC=§e{0} wählen
SCHEMATIC_REQUIRED=§cZuerst muss eine Schematic gewählt sein
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 derzeit keine Blöcke abbauen
NO_BLOCK_PLACE=§cDu darfst 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
RESOURCEPACK_REQUIRED=§cAuf Eventserver kann nur mit dem SteamWar-Resourcepack beigetreten werden\n§cDa du abgelehnt hast, musst du nun in der Serverliste erst einmal wieder Ressourcenpakete von SteamWar aktivieren
NO_ENTERN=§cDu darfst nicht entern
NO_TEAMAREA=§cDu darfst nicht zu den Teams
TEST_BECOME_LEADER=§7Werde zum Teamleader mit §8/§eleader
PREPARE_SCHEM_DELETED=§cAnscheinend wurde die auszufahrende Schematic gelöscht, 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
PARTICIPANT_CHAT={0} {1}§8» §7{2}
FIGHTLEADER_CHAT=§e{0}§8» §e{1}
SPECTATOR_CHAT=§7{0}§8» §7{1}
# Replay
REPLAY_ENDS=§cReplay beendet
OLD_STRING={0}
# States
COMMAND_CURRENTLY_UNAVAILABLE=§cDieser Befehl ist zu diesem Kampfzeitpunkt nicht verfügbar
# Utils
TPS_WARNING=§c{0} §7TPS
UI_PRE_RUNNING=§7Kits verteilt
UI_RUNNING=§aArena freigegeben
UI_SKIP=§7Sprung zum nächsten Ereignis
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} §7ist gestorben
UI_PLAYER_LEAVE={0}{1} §7hat den Kampf verlassen
UI_ELO=§7ELO von {0}{1}§8: §7{2}§8»§e{3}
UI_WIN={0}Sieg {1}
UI_DRAW=§7Unentschieden
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_RUNNING0={1} {3} lW {0} rW {4} {2}
BAR_RUNNING1={1} {3} {5} {0} {6} {4} {2}
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_SPECTATE={1} §7Kampf vorbei {0} {2}
BAR_POINTS={0} §8Punkte
BAR_PERCENT={0}§8%
BAR_CANNONS={0} §8Kanonen
BAR_WATER={0} §8Wasser
# Winconditions
HELLS_BELLS_COUNTDOWN=bis die Bomben fallen
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_RANKED_LEFT={0} §7hat den Kampf verlassen
WIN_ALL_DEAD={0}Alle Spieler kampfunfähig
WIN_LEADER_DEAD={0} kampfunfähig
WIN_TIME_OVER=§7Zeit abgelaufen
WIN_MORE_HEALTH={0}Mehr verbleibende 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.

Datei anzeigen

@ -0,0 +1,19 @@
#
# 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/>.
#

Datei anzeigen

@ -44,7 +44,6 @@ public class AkCommand implements CommandExecutor {
Player player = (Player) sender;
if(SteamwarUser.get(player.getUniqueId()).getUserGroup() != UserGroup.Developer){
Commands.sendHelp(player);
return false;
}

Datei anzeigen

@ -28,6 +28,7 @@ import de.steamwar.fightsystem.fight.Kit;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.sql.PersonalKit;
import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -35,12 +36,12 @@ public class Commands {
private Commands(){}
private static void errNoTeam(Player p){
p.sendMessage(FightSystem.PREFIX + "§cDu bist in keinem Team!");
FightSystem.getMessage().sendPrefixless("NO_TEAM", p, ChatMessageType.ACTION_BAR);
}
static boolean checkSetup(Player p){
if(!FightState.setup()){
p.sendMessage(FightSystem.PREFIX + "§cDer Kampf hat bereits begonnen!");
FightSystem.getMessage().sendPrefixless("FIGHT_ALREADY_STARTED", p, ChatMessageType.ACTION_BAR);
return true;
}
return false;
@ -49,7 +50,7 @@ public class Commands {
private static FightTeam checkGetInvitedTeam(Player p){
FightTeam fightTeam = Fight.getInvitedTeam(p);
if(fightTeam == null){
p.sendMessage(FightSystem.PREFIX + "§cDu wurdest von keinem Team eingeladen!");
FightSystem.getMessage().sendPrefixless("NO_INVITATION", p, ChatMessageType.ACTION_BAR);
}
return fightTeam;
}
@ -65,7 +66,7 @@ public class Commands {
private static FightPlayer checkGetLeader(Player p){
FightPlayer fightPlayer = checkGetPlayer(p);
if(fightPlayer != null && !fightPlayer.isLeader()){
p.sendMessage(FightSystem.PREFIX + "§cDu bist kein Leader!");
FightSystem.getMessage().sendPrefixless("NOT_LEADER", p, ChatMessageType.ACTION_BAR);
fightPlayer = null;
}
return fightPlayer;
@ -82,7 +83,7 @@ public class Commands {
private static Player checkGetPlayer(Player p, String t){
Player target = Bukkit.getPlayer(t);
if(target == null) {
p.sendMessage(FightSystem.PREFIX + "§cDer Spieler ist nicht in der Arena!");
FightSystem.getMessage().sendPrefixless("PLAYER_UNAVAILABLE", p, ChatMessageType.ACTION_BAR);
}
return target;
}
@ -111,7 +112,6 @@ public class Commands {
if(team == null)
return;
p.sendMessage(FightSystem.PREFIX + "§aDu bist Team " + team.getColoredName() + " §abeigetreten!");
team.addMember(p);
}
@ -123,8 +123,8 @@ public class Commands {
if(team == null)
return;
p.sendMessage(FightSystem.PREFIX + "§aDu hast die Einladung von " + team.getColoredName() + " §aabgelehnt!");
team.broadcast("§e" + p.getName() + " §chat die Einladung abgelehnt");
FightSystem.getMessage().sendPrefixless("INVITATION_DECLINED", p, ChatMessageType.ACTION_BAR);
team.broadcast("INVITATION_DECLINED_TEAM", p.getName());
team.getInvited().remove(p);
}
@ -136,7 +136,6 @@ public class Commands {
if(fightTeam == null)
return;
p.sendMessage(FightSystem.PREFIX + "§aDu hast das Team " + fightTeam.getColoredName() + " §averlassen!");
fightTeam.removePlayer(p);
}
@ -157,17 +156,16 @@ public class Commands {
return;
if(Fight.getPlayerTeam(target) != null) {
p.sendMessage(FightSystem.PREFIX + "§cDer Spieler §e" + target.getName() + " §cist bereits in einem Team!");
FightSystem.getMessage().sendPrefixless("PLAYER_IN_TEAM", p, ChatMessageType.ACTION_BAR, target.getName());
return;
}
if(Fight.getOpposite(fightTeam).getInvited().contains(target) || fightTeam.getInvited().contains(target)) {
p.sendMessage(FightSystem.PREFIX + "§cDieser Spieler wurde bereits eingeladen!");
FightSystem.getMessage().sendPrefixless("ALREADY_INVITED", p, ChatMessageType.ACTION_BAR, target.getName());
return;
}
target.sendMessage(FightSystem.PREFIX + "§aDu wurdest in das Team von §e" + p.getName() + " §aeingeladen!");
p.sendMessage(FightSystem.PREFIX + "§aDu hast den Spieler §e" + target.getName() + " §ain dein Team eingeladen!");
FightSystem.getMessage().sendPrefixless("INVITATION_SENT", p, ChatMessageType.ACTION_BAR, target.getName());
fightTeam.getInvited().add(target);
GUI.invitation(p, target);
}
@ -189,12 +187,10 @@ public class Commands {
return;
if(!fightTeam.isPlayerInTeam(target)){
p.sendMessage(FightSystem.PREFIX + "§cDer Spieler " + target.getName() + " §cist nicht in deinem Team§c!");
FightSystem.getMessage().sendPrefixless("NOT_IN_TEAM", p, ChatMessageType.ACTION_BAR, target.getName());
return;
}
p.sendMessage(FightSystem.PREFIX + "§aDu hast den Spieler §e" + target.getName() + " §aaus dem Team entfernt!");
target.sendMessage(FightSystem.PREFIX + "§cDu wurdest aus dem Team entfernt!");
fightTeam.removePlayer(target);
}
@ -217,36 +213,12 @@ public class Commands {
k = Kit.getKitByName(kitName);
}
if(k == null){
p.sendMessage(FightSystem.PREFIX + "§cDieses Kit gibt es nicht!");
if(k == null || !k.canUseKit(fightPlayer.isLeader())){
FightSystem.getMessage().sendPrefixless("KIT_UNAVAILABLE", p, ChatMessageType.ACTION_BAR);
return;
}
if(!k.canUseKit(fightPlayer.isLeader())){
p.sendMessage(FightSystem.PREFIX + "§cDu darfst dieses Kit nicht verwenden!");
return;
}
p.sendMessage(FightSystem.PREFIX + "§aDu spielst nun mit dem Kit §e" + kitName + "§a!");
FightSystem.getMessage().sendPrefixless("KIT_CHOSEN", p, ChatMessageType.ACTION_BAR, kitName);
fightPlayer.setKit(k);
}
static void sendHelp(Player p) {
p.sendMessage(FightSystem.PREFIX + "§7Hilfe für das Kampfsystem");
FightPlayer fightPlayer = Fight.getFightPlayer(p);
if(fightPlayer == null){
p.sendMessage("§8/§eaccept §8- §7Einladung annehmen");
p.sendMessage("§8/§edecline §8- §7Einladung ablehnen");
p.sendMessage("§8/§eleader §8- §7Werde der Leader eines Teams");
}else{
if(fightPlayer.isLeader()){
p.sendMessage("§8/§eready §8- §7Setzt das eigene Team auf bereit");
p.sendMessage("§8/§einvite §8<§eSpieler§8> - §7Lade einen Spieler in dein Team ein");
p.sendMessage("§8/§eremove §8<§eSpieler§8> - §7Wirft einen Spieler aus dem Team");
}
p.sendMessage("§8/§ekit §8<§eKit§8> - §7Wähle ein Kit");
p.sendMessage("§8/§eleave §8- §7Team verlassen");
}
}
}

Datei anzeigen

@ -31,9 +31,11 @@ import de.steamwar.inventory.SWAnvilInv;
import de.steamwar.inventory.SWInventory;
import de.steamwar.inventory.SWItem;
import de.steamwar.inventory.SWListInv;
import de.steamwar.message.Message;
import de.steamwar.sql.PersonalKit;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
@ -44,23 +46,24 @@ import java.util.List;
import java.util.UUID;
public class GUI {
private GUI(){}
private static final Message msg = FightSystem.getMessage();
static void invitation(Player p, Player target){
SWInventory inv = new SWInventory(target, 9, "Einladung von " + p.getName());
inv.setItem(0, SWItem.getDye(10), (byte)10, "§aAnnehmen", (ClickType click) ->{
SWInventory inv = new SWInventory(target, 9, msg.parse("INVITATION_TITLE", target, p.getName()));
inv.setItem(0, SWItem.getDye(10), (byte)10, msg.parse("INVITATION_ACCEPT", target), (ClickType click) ->{
Commands.acceptInvitation(target);
target.closeInventory();
});
inv.setItem(8, SWItem.getDye(1), (byte)1, "§cAblehnen", (ClickType click) ->{
inv.setItem(8, SWItem.getDye(1), (byte)1, msg.parse("INVITATION_DECLINE", target), (ClickType click) ->{
Commands.declineInvitation(target);
target.closeInventory();
});
inv.addCloseCallback((ClickType click) ->{
if(Fight.getInvitedTeam(target) != null){
target.sendMessage(FightSystem.PREFIX + "§7Tippe §8/§aaccept§7, um die Einladung §aanzunehmen");
target.sendMessage(FightSystem.PREFIX + "§7Tippe §8/§cdecline§7, um die Einladung §cabzulehnen");
msg.sendPrefixless("INVITATION_CHAT_ACCEPT", target);
msg.sendPrefixless("INVITATION_CHAT_DECLINE", target);
}
});
inv.setCallback(-999, (ClickType click) -> target.closeInventory());
@ -68,15 +71,15 @@ public class GUI {
}
public static void state(Player p){
SWInventory inv = new SWInventory(p, 9, "Kampfstatus");
inv.setItem(0, Material.GLASS, "§7PRE_LEADER_SETUP", (ClickType click) -> FightSystem.setPreLeaderState());
inv.setItem(1, Material.GLASS, "§7PRE_SCHEM_SETUP", (ClickType click) -> FightSystem.setPreSchemState());
inv.setItem(2, Material.GLASS, "§7POST_SCHEM_SETUP", (ClickType click) -> FightSystem.setPostSchemState());
inv.setItem(3, Material.GLASS, "§ePRE_RUNNING", (ClickType click) -> FightSystem.setPreRunningState());
inv.setItem(4, Material.GLASS, "§eRUNNING", (ClickType click) -> FightSystem.setRunningState());
inv.setItem(5, Material.GLASS, "§7SPECTATE Blue", (ClickType click) -> FightSystem.setSpectateState(Fight.getBlueTeam(), "operator", null));
inv.setItem(6, Material.GLASS, "§7SPECTATE Red", (ClickType click) -> FightSystem.setSpectateState(Fight.getRedTeam(), "operator", null));
inv.setItem(7, Material.GLASS, "§7SPECTATE Tie", (ClickType click) -> FightSystem.setSpectateState(null, "operator", null));
SWInventory inv = new SWInventory(p, 9, msg.parse("STATE_TITLE", p));
inv.setItem(0, Material.GLASS, msg.parse("STATE_PRE_LEADER_SETUP", p), (ClickType click) -> FightSystem.setPreLeaderState());
inv.setItem(1, Material.GLASS, msg.parse("STATE_PRE_SCHEM_SETUP", p), (ClickType click) -> FightSystem.setPreSchemState());
inv.setItem(2, Material.GLASS, msg.parse("STATE_POST_SCHEM_SETUP", p), (ClickType click) -> FightSystem.setPostSchemState());
inv.setItem(3, Material.GLASS, msg.parse("STATE_PRE_RUNNING", p), (ClickType click) -> FightSystem.setPreRunningState());
inv.setItem(4, Material.GLASS, msg.parse("STATE_RUNNING", p), (ClickType click) -> FightSystem.setRunningState());
inv.setItem(5, Material.GLASS, msg.parse("STATE_SPECTATE_WIN", p, Fight.getBlueTeam().getColoredName()), (ClickType click) -> FightSystem.setSpectateState(Fight.getBlueTeam(), "operator", "WIN_FIGHTLEADER"));
inv.setItem(6, Material.GLASS, msg.parse("STATE_SPECTATE_WIN", p, Fight.getRedTeam().getColoredName()), (ClickType click) -> FightSystem.setSpectateState(Fight.getRedTeam(), "operator", "WIN_FIGHTLEADER"));
inv.setItem(7, Material.GLASS, msg.parse("STATE_SPECTATE_TIE", p), (ClickType click) -> FightSystem.setSpectateState(null, "operator", "WIN_FIGHTLEADER"));
inv.setCallback(-999, (ClickType click) -> p.closeInventory());
inv.open();
}
@ -84,7 +87,7 @@ public class GUI {
public static void chooseInvitation(Player p){
List<SWListInv.SWListEntry<UUID>> players = SWListInv.createPlayerList(p.getUniqueId());
players.removeIf(swItemUUIDPair -> Fight.getFightPlayer(Bukkit.getPlayer(swItemUUIDPair.getObject())) != null);
SWListInv<UUID> inv = new SWListInv<>(p, "Spieler einladen", players, (ClickType click, UUID player) -> {
SWListInv<UUID> inv = new SWListInv<>(p, msg.parse("INVITE_TITLE", p), players, (ClickType click, UUID player) -> {
Commands.invite(p, SteamwarUser.get(player).getUserName());
p.closeInventory();
});
@ -98,7 +101,7 @@ public class GUI {
if(team == null)
return;
players.removeIf(swItemUUIDPair -> !team.equals(Fight.getPlayerTeam(Bukkit.getPlayer(swItemUUIDPair.getObject()))));
SWListInv<UUID> inv = new SWListInv<>(p, "Spieler rauswerfen", players, (ClickType click, UUID player) -> {
SWListInv<UUID> inv = new SWListInv<>(p, msg.parse("REMOVE_TITLE", p), players, (ClickType click, UUID player) -> {
Commands.kick(p, SteamwarUser.get(player).getUserName());
p.closeInventory();
});
@ -125,19 +128,19 @@ public class GUI {
entries.removeIf(entry -> !entry.getObject().getName().toLowerCase().contains(query.toLowerCase()));
SWListInv<Kit> inv = new SWListInv<>(p, "Kitauswahl", false, entries, (clickType, kit) -> kit.preview(p));
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()) {
inv.setItem(22, new SWItem(Material.BARRIER, "§cKeine Kits gefunden"));
inv.setItem(22, new SWItem(Material.BARRIER, msg.parse("KIT_NO_KITS", p)));
}
if(Config.PersonalKits){
inv.setItem(48, Material.NETHER_STAR, "§eNeues Kit", clickType -> {
SWAnvilInv anvilInv = new SWAnvilInv(p, "Kitname eingeben");
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.nameInUse(user.getId(), Config.SchematicType.toDB(), s)) {
p.sendMessage(FightSystem.PREFIX + "§cDieser Kitname wird bereits genutzt!");
msg.sendPrefixless("KITNAME_IN_USE", p, ChatMessageType.ACTION_BAR);
p.closeInventory();
return;
}
@ -148,8 +151,8 @@ public class GUI {
anvilInv.open();
});
}
inv.setItem(50, Material.NAME_TAG, "§eSuchen", clickType -> {
SWAnvilInv anvilInv = new SWAnvilInv(p, "§eNach Kit suchen");
inv.setItem(50, Material.NAME_TAG, msg.parse("KIT_SEARCH", p), clickType -> {
SWAnvilInv anvilInv = new SWAnvilInv(p, msg.parse("KITSEARCH_TITLE", p));
anvilInv.setItem(Material.PAPER);
anvilInv.setCallback(s -> kitSelection(p, s));
anvilInv.open();
@ -159,21 +162,21 @@ public class GUI {
public static void preSchemDialog(Player p){
if(!Config.test() && FightState.getFightState() != FightState.PRE_SCHEM_SETUP){
p.sendMessage(FightSystem.PREFIX + "§cDu kannst ohne Gegner keine Schematic wählen");
msg.sendPrefixless("SCHEM_NO_ENEMY", p, ChatMessageType.ACTION_BAR);
return;
}
SWInventory inv = new SWInventory(p, 9, Config.GameName + "-Auswahl");
inv.setItem(8, Material.REDSTONE, "§eÖffentliches " + Config.GameName, (ClickType click) -> {
SWInventory inv = new SWInventory(p, 9, msg.parse("SCHEM_TITLE", p, Config.GameName));
inv.setItem(8, Material.REDSTONE, msg.parse("SCHEM_PUBLIC", p, Config.GameName), (ClickType click) -> {
p.closeInventory();
schemDialog(p, true);
});
if(Fight.getMaxRank() == 0){
inv.setItem(0, SWItem.getDye(8), (byte)8, "§7Keine privaten Schematics erlaubt", (ClickType click)->{});
inv.setItem(0, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_PRIVATE_FORBIDDEN", p, Config.GameName), (ClickType click)->{});
}else if(Schematic.getSchemsOfType(p.getUniqueId(), Config.SchematicType).isEmpty() && !Config.test()){
inv.setItem(0, SWItem.getDye(8), (byte)8, "§7Kein privates " + Config.GameName + " vorhanden", (ClickType click)->{});
inv.setItem(0, SWItem.getDye(8), (byte)8, msg.parse("SCHEM_NO_PRIVATE", p, Config.GameName), (ClickType click)->{});
}else{
inv.setItem(0, SWItem.getMaterial("CAULDRON_ITEM"), "§ePrivates " + Config.GameName, (ClickType click) -> {
inv.setItem(0, SWItem.getMaterial("CAULDRON_ITEM"), msg.parse("SCHEM_PRIVATE", p, Config.GameName), (ClickType click) -> {
p.closeInventory();
schemDialog(p, false);
});
@ -193,7 +196,7 @@ public class GUI {
schems.removeIf(schem -> schem.getObject().getRank() > Fight.getMaxRank());
}
SWListInv<Schematic> inv = new SWListInv<>(p, Config.GameName + "-Auswahl", schems, (ClickType click, Schematic s) -> {
SWListInv<Schematic> inv = new SWListInv<>(p, msg.parse("SCHEM_TITLE", p, Config.GameName), schems, (ClickType click, Schematic s) -> {
FightTeam fightTeam = Fight.getPlayerTeam(p);
if(fightTeam == null)
return;

Datei anzeigen

@ -22,7 +22,7 @@ package de.steamwar.fightsystem.commands;
import com.google.common.collect.ImmutableList;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import org.apache.commons.lang.Validate;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.command.defaults.BukkitCommand;
@ -42,29 +42,28 @@ public class GamemodeCommand extends BukkitCommand {
List<String> aliases = new ArrayList<>();
aliases.add("gm");
this.setAliases(aliases);
this.description = "Ändert den Spielmodus eines Spielers";
this.usageMessage = "/gm [Spielmodus]";
}
@Override
public boolean execute(CommandSender sender, String currentAlias, String[] args) {
if (!(sender instanceof Player)) {
return false;
}else if (args.length == 0) {
sender.sendMessage(FightSystem.PREFIX + this.usageMessage);
FightSystem.getMessage().sendPrefixless("GAMEMODE_HELP", sender);
return false;
}
Player p = (Player) sender;
if (!(Config.test() || p == FightSystem.getEventLeiter())) {
p.sendMessage(FightSystem.PREFIX + "§cDu darfst hier deinen Spielmodus nicht ändern");
FightSystem.getMessage().sendPrefixless("GAMEMODE_NOT_ALLOWED", p, ChatMessageType.ACTION_BAR);
return false;
}
GameMode mode = createMode(args[0]);
if(mode == null){
p.sendMessage(FightSystem.PREFIX + "§cUnbekannter Spielmodus");
FightSystem.getMessage().sendPrefixless("GAMEMODE_UNKNOWN", p, ChatMessageType.ACTION_BAR, args[0]);
return false;
}
@ -91,16 +90,8 @@ public class GamemodeCommand extends BukkitCommand {
@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args) {
Validate.notNull(sender, "Sender cannot be null");
Validate.notNull(args, "Arguments cannot be null");
Validate.notNull(alias, "Alias cannot be null");
if (args.length == 1)
return StringUtil.copyPartialMatches(args[0], GAMEMODE_NAMES,
new ArrayList<>(GAMEMODE_NAMES.size()));
if (args.length == 2) {
return super.tabComplete(sender, alias, args);
}
return StringUtil.copyPartialMatches(args[0], GAMEMODE_NAMES, new ArrayList<>(GAMEMODE_NAMES.size()));
return ImmutableList.of();
}

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import org.bukkit.command.Command;
@ -41,7 +42,7 @@ public class InviteCommand implements CommandExecutor {
Player player = (Player) sender;
if(args.length != 1){
Commands.sendHelp(player);
FightSystem.getMessage().sendPrefixless("INVITE_HELP", player);
return false;
}

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -41,18 +42,15 @@ public class LeaderCommand implements CommandExecutor {
return false;
Player player = (Player) sender;
if(args.length == 0){
if(Fight.getFightPlayer(player) == null){
if(Fight.getBlueTeam().isLeaderless())
Fight.getBlueTeam().addMember(player);
else if(Fight.getRedTeam().isLeaderless())
Fight.getRedTeam().addMember(player);
else
player.sendMessage(FightSystem.PREFIX + "§cEs sind bereits 2 Teamleader vorhanden");
}else
player.sendMessage(FightSystem.PREFIX + "§cDu bist bereits in einem Team");
if(Fight.getFightPlayer(player) == null){
if(Fight.getBlueTeam().isLeaderless())
Fight.getBlueTeam().addMember(player);
else if(Fight.getRedTeam().isLeaderless())
Fight.getRedTeam().addMember(player);
else
FightSystem.getMessage().sendPrefixless("LEADER_FULL", player, ChatMessageType.ACTION_BAR);
}else
Commands.sendHelp(player);
FightSystem.getMessage().sendPrefixless("ALREADY_IN_TEAM", player, ChatMessageType.ACTION_BAR);
return false;
}

Datei anzeigen

@ -29,6 +29,7 @@ import de.steamwar.sql.Schematic;
import de.steamwar.sql.SchematicType;
import de.steamwar.sql.SteamwarUser;
import de.steamwar.sql.UserGroup;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -49,15 +50,12 @@ public class LockschemCommand implements CommandExecutor {
SteamwarUser steamwarUser = SteamwarUser.get(player.getUniqueId());
UserGroup userGroup = steamwarUser.getUserGroup();
if(userGroup != UserGroup.Admin &&
userGroup != UserGroup.Developer &&
userGroup != UserGroup.Moderator &&
userGroup != UserGroup.Supporter)
if(!userGroup.isCheckSchematics())
return false;
if(args.length != 1) {
sendHelp(player);
FightSystem.getMessage().sendPrefixless("LOCKSCHEM_HELP", player);
return false;
}
@ -65,16 +63,13 @@ public class LockschemCommand implements CommandExecutor {
FightTeam fightTeam = Fight.getTeamByName(teamName);
if(fightTeam == null) {
player.sendMessage(FightSystem.PREFIX + "§cDieses Team existiert nicht!");
FightSystem.getMessage().sendPrefixless("UNKNOWN_TEAM", player, ChatMessageType.ACTION_BAR);
return false;
}
Schematic.getSchemFromDB(fightTeam.getSchematic()).setSchemType(SchematicType.Normal);
player.sendMessage(FightSystem.PREFIX + "Schematic von " + fightTeam.getColoredName() + " §cgesperrt!");
fightTeam.broadcast("§cDie Schematic wurde von " + player.getName() + " gesperrt");
FightSystem.getMessage().sendPrefixless("LOCKSCHEM_LOCKED", player, ChatMessageType.ACTION_BAR);
fightTeam.broadcastSystem("LOCKSCHEM_LOCKED_BY", player.getName());
return false;
}
private void sendHelp(Player player) {
player.sendMessage(FightSystem.PREFIX + "/lockschem [TEAM]");
}
}

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.fightsystem.commands;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import org.bukkit.command.Command;
@ -41,7 +42,7 @@ public class RemoveCommand implements CommandExecutor {
Player player = (Player) sender;
if(args.length != 1){
Commands.sendHelp(player);
FightSystem.getMessage().sendPrefixless("REMOVE_HELP", player);
return false;
}

Datei anzeigen

@ -27,12 +27,14 @@ import de.steamwar.fightsystem.record.FileSource;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.io.IOException;
import java.util.logging.Level;
public class ReplayCommand implements CommandExecutor {
@ -50,20 +52,21 @@ public class ReplayCommand implements CommandExecutor {
if(!Config.test()){
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
if(!user.getUserGroup().isTeamGroup()){
sender.sendMessage(FightSystem.PREFIX + "§cDieser Befehl ist zu diesem Kampfzeitpunkt nicht verfügbar.");
FightSystem.getMessage().sendPrefixless("REPLAY_UNAVAILABLE", sender, ChatMessageType.ACTION_BAR);
return false;
}
}
if(!FileRecorder.getFile().exists()){
sender.sendMessage(FightSystem.PREFIX + "§cKein Replay vorhanden.");
FightSystem.getMessage().sendPrefixless("REPLAY_UNAVAILABLE", sender, ChatMessageType.ACTION_BAR);
return false;
}
try {
new FileSource(FileRecorder.getFile());
} catch (IOException e) {
sender.sendMessage(FightSystem.PREFIX + "§cDas Replay konnte nicht gestartet werden.");
FightSystem.getMessage().sendPrefixless("REPLAY_UNAVAILABLE", sender, ChatMessageType.ACTION_BAR);
FightSystem.getPlugin().getLogger().log(Level.SEVERE, "Replay could not be started", e);
}
return false;
}

Datei anzeigen

@ -5,6 +5,7 @@ import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCommand;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -24,21 +25,21 @@ public class WinCommand implements CommandExecutor {
Player p = (Player) sender;
if (p != FightSystem.getEventLeiter()) {
p.sendMessage(FightSystem.PREFIX + "§cDu bist kein Kampfleiter!");
FightSystem.getMessage().sendPrefixless("NOT_FIGHTLEADER", p, ChatMessageType.ACTION_BAR);
return false;
}
if(args.length == 0){
p.sendMessage(FightSystem.PREFIX + "/win [Team or Tie]");
FightSystem.getMessage().sendPrefixless("WIN_HELP", p);
return false;
}
if(args[0].equalsIgnoreCase("tie")){
FightSystem.setSpectateState(null, "Referee", "§7Kampfleiterentscheidung");
FightSystem.setSpectateState(null, "Referee", "WIN_FIGHTLEADER");
}else if(args[0].equalsIgnoreCase(Fight.getBlueTeam().getName())){
FightSystem.setSpectateState(Fight.getBlueTeam(), "Referee", "§7Kampfleiterentscheidung");
FightSystem.setSpectateState(Fight.getBlueTeam(), "Referee", "WIN_FIGHTLEADER");
}else if(args[0].equalsIgnoreCase(Fight.getRedTeam().getName())){
FightSystem.setSpectateState(Fight.getRedTeam(), "Referee", "§7Kampfleiterentscheidung");
FightSystem.setSpectateState(Fight.getRedTeam(), "Referee", "WIN_FIGHTLEADER");
}
return false;
}

Datei anzeigen

@ -21,12 +21,11 @@ package de.steamwar.fightsystem.countdown;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.listener.BasicListener;
import de.steamwar.fightsystem.record.GlobalRecorder;
import de.steamwar.fightsystem.utils.FightUI;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -39,6 +38,8 @@ public abstract class Countdown {
private static final List<Countdown> currentCountdowns = new ArrayList<>();
protected final Message appendix;
private final int totalTime;
protected final Sound sound;
private final boolean level;
@ -46,12 +47,12 @@ public abstract class Countdown {
protected int time;
private BukkitTask task = null;
public abstract String countdownCounting();
public abstract void countdownFinished();
protected Countdown(int time, SWSound sound, boolean level) {
protected Countdown(int time, Message appendix, SWSound sound, boolean level) {
this.totalTime = time;
this.time = time;
this.appendix = appendix;
this.sound = sound != null ? sound.getSound() : null;
this.level = level;
}
@ -81,22 +82,30 @@ public abstract class Countdown {
smallestTime = countdown.time;
}
smallestTime--;
for(Countdown countdown : currentCountdowns){
countdown.time -= smallestTime;
if(countdown.time <= 1)
countdown.prepareFinish();
countdown.show();
}
FightUI.addSubtitle("§7Sprung zum nächsten Ereignis");
FightUI.addSubtitle("UI_SKIP");
}
private void broadcast(String message){
GlobalRecorder.getInstance().actionBar(message);
BaseComponent[] msg = TextComponent.fromLegacyText(message);
for(Player p : Bukkit.getOnlinePlayers())
BasicListener.toActionbar(p, msg);
public static void sendCountdownMessage(Player p, String message, int displaytime, Message appendix) {
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)
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));
}
protected void prepareFinish() {}
public int getTimeLeft(){
return time;
}
@ -106,22 +115,17 @@ public abstract class Countdown {
show();
}
void show(){
private void show(){
switch (time) {
case 900: case 600: case 300: case 180: case 120:
broadcast("§rNoch §a" + time / 60 + " §rMinuten " + countdownCounting());
broadcast("COUNTDOWN_MINUTES", 60);
break;
case 60: case 30: case 20: case 15: case 10: case 5: case 4: case 3: case 2:
if(this.sound != null)
Fight.playSound(this.sound, 100.0F, 1.0F);
broadcast("§rNoch §a" + time + " §rSekunden " + countdownCounting());
broadcast("COUNTDOWN_SECONDS", 1);
break;
case 1:
if(this.sound != null)
Fight.playSound(this.sound, 100.0F, 1.0F);
broadcast("§rNoch §aeine §rSekunde " + countdownCounting());
prepareFinish();
broadcast("COUNTDOWN_SECOND", 1);
break;
case 0:
if(this.sound != null)

Datei anzeigen

@ -22,11 +22,10 @@ package de.steamwar.fightsystem.countdown;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.listener.BasicListener;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.fightsystem.utils.TechHider;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player;
import net.md_5.bungee.api.ChatMessageType;
import java.util.List;
@ -36,48 +35,25 @@ public class EnternCountdown extends Countdown {
private List<TechHider.ChunkPos> chunkPos;
public EnternCountdown(FightPlayer fp) {
super(Config.EnterStages.get(fp.getKit().getEnterStage()), SWSound.BLOCK_NOTE_PLING, false);
super(Config.EnterStages.get(fp.getKit().getEnterStage()), new Message("ENTERN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
fightPlayer = fp;
enable();
}
@Override
public String countdownCounting() {
return "bis Entern erlaubt ist!";
}
@Override
public void countdownFinished() {
fightPlayer.getPlayer().sendMessage(FightSystem.PREFIX + "§aEntern ist nun erlaubt!");
FightSystem.getMessage().sendPrefixless("ENTERN_ALLOWED", fightPlayer.getPlayer(), ChatMessageType.ACTION_BAR);
TechHider.reloadChunks(fightPlayer.getPlayer(), chunkPos, false);
}
@Override
void show(){
Player player = fightPlayer.getPlayer();
switch (time) {
case 900: case 600: case 300: case 180: case 120:
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§rNoch §a" + time / 60 + " §rMinuten " + countdownCounting()));
break;
case 60: case 30: case 20: case 15: case 10: case 5: case 4: case 3: case 2:
player.playSound(player.getLocation(), sound, 100.0F, 1.0F);
protected void prepareFinish() {
chunkPos = TechHider.prepareChunkReload(fightPlayer.getPlayer(), false);
}
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§rNoch §a" + time + " §rSekunden " + countdownCounting()));
break;
case 1:
player.playSound(player.getLocation(), sound, 100.0F, 1.0F);
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§rNoch §a1 §rSekunde " + countdownCounting()));
chunkPos = TechHider.prepareChunkReload(player, false);
break;
case 0:
player.playSound(player.getLocation(), sound, 100.0F, 2.0F);
disable();
countdownFinished();
break;
default:
}
@Override
protected void broadcast(String message, int divisor) {
fightPlayer.getPlayer().playSound(fightPlayer.getPlayer().getLocation(), sound, 100.0f, 1.0f);
sendCountdownMessage(fightPlayer.getPlayer(), message, time / divisor, appendix);
}
}

Datei anzeigen

@ -24,22 +24,18 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
public class EventSpectateCountdown extends Countdown {
public EventSpectateCountdown() {
super(Config.SpectatorDuration, SWSound.BLOCK_NOTE_PLING, false);
super(Config.SpectatorDuration, new Message("SHUTDOWN_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
new StateDependentCountdown(ArenaMode.Event, FightState.Spectate, this);
}
@Override
public String countdownCounting() {
return "bis der Server gestoppt wird!";
}
@Override
public void countdownFinished() {
FightSystem.shutdown(null);
FightSystem.shutdown();
}
}

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.Message;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -32,10 +33,10 @@ import org.bukkit.event.player.PlayerJoinEvent;
public class NoPlayersOnlineCountdown extends Countdown implements Listener {
public NoPlayersOnlineCountdown() {
super(Config.NoPlayerOnlineDuration, null, false);
super(Config.NoPlayerOnlineDuration, new Message("SHUTDOWN_COUNTDOWN"), null, false);
new StateDependentListener(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this);
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this){
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreLeaderSetup, this) {
@Override
public void enable() {
if(Bukkit.getOnlinePlayers().isEmpty())
@ -44,11 +45,6 @@ public class NoPlayersOnlineCountdown extends Countdown implements Listener {
};
}
@Override
public String countdownCounting() {
return "bis der Server gestoppt wird!";
}
@EventHandler
public void handlePlayerJoin(PlayerJoinEvent event) {
disable();

Datei anzeigen

@ -24,17 +24,13 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.utils.Message;
public class PostSchemCountdown extends Countdown {
public PostSchemCountdown() {
super(Config.SetupDuration, null, false);
new StateDependentCountdown(ArenaMode.AntiTest, FightState.PostSchemSetup, this);
}
@Override
public String countdownCounting() {
return "bis die Kits verteilt werden!";
super(Config.SetupDuration, new Message("POST_SCHEM_COUNTDOWN"), null, false);
new StateDependentCountdown(ArenaMode.VariableTime, FightState.PostSchemSetup, this);
}
@Override

Datei anzeigen

@ -24,20 +24,16 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
public class PreRunningCountdown extends Countdown {
public PreRunningCountdown() {
super(Config.PreFightDuration, SWSound.BLOCK_NOTE_PLING, true);
super(Config.PreFightDuration, new Message("PRE_RUNNING_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, true);
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreRunning, this);
}
@Override
public String countdownCounting() {
return "bis die Arena freigegeben ist!";
}
@Override
public void countdownFinished() {
FightSystem.setRunningState();

Datei anzeigen

@ -24,20 +24,16 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
public class PreSchemCountdown extends Countdown {
public PreSchemCountdown() {
super(Config.PreSchemPasteDuration, SWSound.BLOCK_NOTE_PLING, false);
super(Config.PreSchemPasteDuration, new Message("PRE_SCHEM_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
new StateDependentCountdown(ArenaMode.AntiReplay, FightState.PreSchemSetup, this);
}
@Override
public String countdownCounting() {
return "bis eine Public-Schematic gewählt wird!";
}
@Override
public void countdownFinished() {
FightSystem.setPostSchemState();

Datei anzeigen

@ -24,20 +24,16 @@ import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
public class SpectateOverCountdown extends Countdown {
public SpectateOverCountdown() {
super(Config.SpectatorDuration, SWSound.BLOCK_NOTE_PLING, false);
super(Config.SpectatorDuration, new Message("SPECTATE_COUNTDOWN"), SWSound.BLOCK_NOTE_PLING, false);
new StateDependentCountdown(ArenaMode.Restartable, FightState.Spectate, this);
}
@Override
public String countdownCounting() {
return "bis die Arena zurückgesetzt wird!";
}
@Override
public void countdownFinished() {
FightSystem.setPreLeaderState();

Datei anzeigen

@ -20,6 +20,7 @@
package de.steamwar.fightsystem.countdown;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
public class TimeOverCountdown extends Countdown {
@ -27,15 +28,10 @@ public class TimeOverCountdown extends Countdown {
private final Runnable timeOver;
public TimeOverCountdown(Runnable timeOver) {
super(Config.TimeoutTime, SWSound.BLOCK_NOTE_BASS, false);
super(Config.TimeoutTime, new Message("RUNNING_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, false);
this.timeOver = timeOver;
}
@Override
public String countdownCounting() {
return "bis der Kampf vorbei ist!";
}
@Override
public void countdownFinished() {
timeOver.run();

Datei anzeigen

@ -22,9 +22,10 @@ package de.steamwar.fightsystem.event;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.fightsystem.winconditions.Winconditions;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -32,8 +33,6 @@ import org.bukkit.World;
import org.bukkit.entity.EntityType;
import org.bukkit.scheduler.BukkitTask;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
@ -50,23 +49,11 @@ public class HellsBells {
private int currentDrops = 0;
private HellsBellsCountdown currentCountdown;
private BukkitTask currentDropping;
private final List<String> startMessages = Arrays.asList("§c!!Achtung!! Bomber im Anflug, noch ca. eine Minute bis zur Ankunft.",
"§cBomber im Anflug, ca. eine Minute bis zur Ankunft.",
"§cBomber auf dem Radar gesichtet, geschätzte Ankunftszeit: eine Minute.",
"§cUnbekanntes Flugobjekt gesichtet, trifft in ca. einer Minute ein.",
"§cFlugobjekt gesichtet. Ankunft in ca. einer Minute.",
"§cBomber erschienen, Ankunft ca. eine Minute.");
private final List<String> stateSwapMessages = Arrays.asList("§aDie Bomben fallen nun schneller.",
"§aMehr Bomber im Anflug.",
"§aZusätzliche Bomber gesichtet.",
"§aDas Bombardement scheint sich zu erhöhen.");
public void startCountdown() {
if (current == State.PRE) {
FightSystem.broadcast(startMessages.get(random.nextInt(startMessages.size())));
current = current.getNext();
} else if (current != State.LAST && currentDrops >= current.SWITCH_AFTER) {
FightSystem.broadcast(stateSwapMessages.get(random.nextInt(stateSwapMessages.size())));
currentDrops = 0;
}
@ -80,7 +67,6 @@ public class HellsBells {
AtomicInteger length = new AtomicInteger(20 + random.nextInt(direction.getLength(zLength, xLength) - 20));
int width = 5 + random.nextInt(5);
Bukkit.getLogger().log(Level.INFO, "Calculating Starts");
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();
@ -139,13 +125,9 @@ public class HellsBells {
}
private class HellsBellsCountdown extends Countdown {
public HellsBellsCountdown(int time) {
super(time, SWSound.BLOCK_NOTE_BASS, true);
}
@Override
public String countdownCounting() {
return "bis die Bomben fallen";
public HellsBellsCountdown(int time) {
super(time, new Message("HELLS_BELLS_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
}
@Override

Datei anzeigen

@ -34,10 +34,6 @@ public class FightPlayer {
private int kills;
private EnternCountdown enternCountdown = null;
public void sendMessage(String message) {
this.player.sendMessage(message);
}
FightPlayer(Player player, FightTeam team) {
this.player = player;
this.team = team;

Datei anzeigen

@ -72,7 +72,7 @@ public class FightSchematic extends StateDependent {
try {
clipboard = schem.load();
} catch (IOException e) {
team.broadcast("§cSchematic konnte nicht geladen werden");
team.broadcastSystem("SCHEMATIC_UNLOADABLE");
Bukkit.getLogger().log(Level.SEVERE, e, () -> "Couldn't load Schematic " + schem.getSchemName());
}
}

Datei anzeigen

@ -32,8 +32,7 @@ import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.utils.*;
import de.steamwar.inventory.SWItem;
import de.steamwar.sql.Schematic;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.*;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
@ -42,7 +41,6 @@ import org.bukkit.scoreboard.NameTagVisibility;
import org.bukkit.scoreboard.Team;
import java.util.*;
import java.util.logging.Level;
public class FightTeam {
@ -184,15 +182,16 @@ public class FightTeam {
}
}
public void broadcast(String message) {
BaseComponent[] msg = TextComponent.fromLegacyText(message);
players.forEach((player, fp) -> BountifulWrapper.impl.toActionbar(player, msg));
public void broadcast(String message, Object... params) {
players.forEach((player, fp) -> FightSystem.getMessage().sendPrefixless(message, player, ChatMessageType.ACTION_BAR, params));
}
public void broadcastChat(String message) {
FightSystem.getPlugin().getLogger().log(Level.INFO, message);
BaseComponent[] msg = TextComponent.fromLegacyText(message);
players.forEach((player, fp) -> BountifulWrapper.impl.toChat(player, msg));
public void broadcastSystem(String message, Object... params) {
players.forEach((player, fp) -> FightSystem.getMessage().send(message, player, params));
}
public void broadcastChat(Player sender, String message) {
players.forEach((player, fp) -> FightSystem.getMessage().sendPrefixless("TEAM_CHAT", player, ChatMessageType.CHAT, prefix, sender.getName(), message));
}
public void addMember(Player player) {
@ -209,15 +208,15 @@ public class FightTeam {
BountifulWrapper.impl.setAttackSpeed(player);
player.teleport(spawn);
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(7, new ItemBuilder(Material.BEACON).removeAllAttributs().setDisplayName("§eRespawn").build());
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());
GlobalRecorder.getInstance().playerJoins(player);
TechHider.reloadChunks(player, chunksToReload, false);
if(isLeaderless())
setLeader(fightPlayer);
else
FightUI.addSubtitle("§a§l» " + prefix + player.getName());
FightUI.addSubtitle("UI_PLAYER_JOINS", prefix, player.getName());
}
public void removePlayer(Player player) {
@ -228,7 +227,7 @@ public class FightTeam {
players.remove(player);
team.removeEntry(player.getName());
FightUI.addSubtitle("§c§l« " + prefix + player.getName());
FightUI.addSubtitle("UI_PLAYER_LEAVES", prefix, player.getName());
if(fightPlayer.equals(leader))
removeLeader();
@ -272,7 +271,7 @@ public class FightTeam {
if(ready)
setReady(false);
FightUI.addSubtitle("§a§l» " + prefix + "Leader " + leader.getPlayer().getName());
FightUI.addSubtitle("UI_LEADER_JOINS", prefix, leader.getPlayer().getName());
Optional<Integer> maxRank = Schematic.getSchemsOfType(leader.getPlayer().getUniqueId(), Config.SchematicType).stream().map(Schematic::getRank).max(Integer::compare);
if(Config.RanksEnabled)
@ -283,23 +282,22 @@ public class FightTeam {
if(!Config.PersonalKits)
leader.setKit(Kit.getKitByName(Config.LeaderDefault));
Player player = leader.getPlayer();
Inventory inventory = leader.getPlayer().getInventory();
if (Kit.getAvailableKits(true).size() > 1)
inventory.setItem(1, new ItemBuilder(Material.LEATHER_CHESTPLATE).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§eKit wählen").build());
else if(Config.PersonalKits)
inventory.setItem(1, new ItemBuilder(Material.LEATHER_CHESTPLATE).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§eKit bearbeiten").build());
if (Kit.getAvailableKits(true).size() > 1 || Config.PersonalKits)
inventory.setItem(1, new ItemBuilder(Material.LEATHER_CHESTPLATE).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName(FightSystem.getMessage().parse("CHOOSE_KIT", player)).build());
else
inventory.setItem(1, new ItemBuilder(Material.AIR).build());
if(!ArenaMode.RankedEvent.contains(Config.mode)){
inventory.setItem(2, new ItemBuilder(Material.PAPER).removeAllAttributs().setDisplayName("§eSpieler einladen").build());
inventory.setItem(3, new ItemBuilder(SWItem.getMaterial("FIREWORK_CHARGE")).removeAllAttributs().setDisplayName("§cSpieler rauswerfen").build());
inventory.setItem(2, new ItemBuilder(Material.PAPER).removeAllAttributs().setDisplayName(FightSystem.getMessage().parse("INVITE_PLAYERS", player)).build());
inventory.setItem(3, new ItemBuilder(SWItem.getMaterial("FIREWORK_CHARGE")).removeAllAttributs().setDisplayName(FightSystem.getMessage().parse("REMOVE_PLAYERS", player)).build());
}
inventory.setItem(4, new ItemBuilder(SWItem.getDye(10), (short) 10).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§cNicht bereit").build());
inventory.setItem(4, new ItemBuilder(SWItem.getDye(10), (short) 10).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName(FightSystem.getMessage().parse("TEAM_NOT_READY", player)).build());
if(Config.test() || FightState.getFightState() != FightState.POST_SCHEM_SETUP)
inventory.setItem(0, new ItemBuilder(SWItem.getMaterial("CAULDRON_ITEM")).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§e" + Config.GameName + " wählen").build());
inventory.setItem(0, new ItemBuilder(SWItem.getMaterial("CAULDRON_ITEM")).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName(FightSystem.getMessage().parse("CHOOSE_SCHEMATIC", player, Config.GameName)).build());
if(FightState.getFightState() == FightState.PRE_LEADER_SETUP && !Fight.getOpposite(this).isLeaderless()){
FightSystem.setPreSchemState();
@ -338,40 +336,40 @@ public class FightTeam {
public void setSchem(Schematic schematic){
this.schematic.setSchematic(schematic);
broadcast("§e" + Config.GameName + " " + schematic.getSchemName() + " §7gewählt");
broadcast("SCHEMATIC_CHOSEN", Config.GameName, schematic.getSchemName());
}
public void setReady(boolean ready) {
Player l = leader.getPlayer();
if(!schematic.hasSchematic()){
BountifulWrapper.impl.toActionbar(l, TextComponent.fromLegacyText("§cZuerst muss eine Schematic gewählt sein!"));
FightSystem.getMessage().sendPrefixless("SCHEMATIC_REQUIRED", l, ChatMessageType.ACTION_BAR);
return;
}
this.ready = ready;
if(ready) {
l.getInventory().setItem(4, new ItemBuilder(SWItem.getDye(8), (short) 8).removeAllAttributs().addEnchantment(Enchantment.DURABILITY,1 ).setDisplayName("§aBereit").build());
broadcast("§aTeam bereit");
l.getInventory().setItem(4, new ItemBuilder(SWItem.getDye(8), (short) 8).removeAllAttributs().addEnchantment(Enchantment.DURABILITY,1 ).setDisplayName(FightSystem.getMessage().parse("TEAM_READY", l)).build());
broadcast("TEAM_READY");
if(Fight.getOpposite(this).isReady() || ArenaMode.SoloLeader.contains(Config.mode))
FightSystem.setPreRunningState();
} else {
l.getInventory().setItem(4, new ItemBuilder(SWItem.getDye(10), (short) 10).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName("§cNicht bereit").build());
broadcast("§c§mTeam bereit");
l.getInventory().setItem(4, new ItemBuilder(SWItem.getDye(10), (short) 10).removeAllAttributs().addEnchantment(Enchantment.DURABILITY, 1).setDisplayName(FightSystem.getMessage().parse("TEAM_NOT_READY", l)).build());
broadcast("TEAM_NOT_READY");
}
}
public void skip(){
this.skip = !skip;
if(skip){
broadcast("§aBeschleunigung zum nächsten Event");
broadcast("SKIP_READY");
if(Fight.getOpposite(this).skip || Config.test()){
skip = false;
Fight.getOpposite(this).skip = false;
Countdown.skip();
}
}else{
broadcast("§c§mBeschleunigung zum nächsten Event");
broadcast("SKIP_NOT_READY");
}
}
@ -420,6 +418,11 @@ public class FightTeam {
return color;
}
@Override
public String toString() {
return name;
}
private class KitLoader extends StateDependent {
private KitLoader() {
super(ArenaMode.AntiReplay, FightState.Ingame);

Datei anzeigen

@ -287,12 +287,12 @@ public class Kit {
inv.setCallback(-999, click -> player.closeInventory());
if(Config.PersonalKits){
inv.setItem(49, SWItem.getMaterial("WOOD_AXE"), "§7Kit bearbeiten", clickType -> PersonalKitCreator.openKitCreator(player, PersonalKit.get(SteamwarUser.get(player.getUniqueId()).getId(), Config.SchematicType.toDB(), name)));
inv.setItem(53, Material.BARRIER, "§cKit löschen", clickType -> {
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.SchematicType.toDB(), name)));
inv.setItem(53, Material.BARRIER, FightSystem.getMessage().parse("KIT_PREVIEW_DELETE", player), clickType -> {
player.closeInventory();
SWInventory conf = new SWInventory(player, 9, "Kit wirklich löchen?");
conf.setItem(8, SWItem.getDye(1), "§cAbbrechen", click -> player.closeInventory());
conf.setItem(0, SWItem.getDye(10), "§aLöschen", click -> {
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 -> {
player.closeInventory();
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
PersonalKit kit = PersonalKit.get(user.getId(), Config.SchematicType.toDB(), name);
@ -311,11 +311,11 @@ public class Kit {
conf.open();
});
}
inv.setItem(45, SWItem.getDye(10), (byte)10, "§aKit wählen", click -> {
inv.setItem(45, SWItem.getDye(10), (byte)10, FightSystem.getMessage().parse("KIT_PREVIEW_CHOOSE", player), click -> {
Commands.kit(player, name);
player.closeInventory();
});
inv.setItem(53, SWItem.getDye(1), (byte)1, "§cZurück", click -> GUI.kitSelection(player, ""));
inv.setItem(53, SWItem.getDye(1), (byte)1, FightSystem.getMessage().parse("KIT_PREVIEW_BACK", player), click -> GUI.kitSelection(player, ""));
inv.open();
}

Datei anzeigen

@ -21,11 +21,12 @@ package de.steamwar.fightsystem.listener;
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.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Player;
@ -70,6 +71,6 @@ public class ArenaBorder implements Listener {
private void reset(PlayerMoveEvent event){
Player player = event.getPlayer();
player.teleport(event.getFrom());
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§cDu darfst die Arena nicht verlassen"));
FightSystem.getMessage().sendPrefixless("NO_ARENA_LEAVING", player, ChatMessageType.ACTION_BAR);
}
}

Datei anzeigen

@ -20,8 +20,6 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.utils.BountifulWrapper;
import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.entity.Player;
public class BasicListener {
@ -30,8 +28,4 @@ public class BasicListener {
public static boolean notFighting(Player p){
return Fight.getFightPlayer(p) == null;
}
public static void toActionbar(Player player, BaseComponent... components){
BountifulWrapper.impl.toActionbar(player, components);
}
}

Datei anzeigen

@ -27,10 +27,6 @@ import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.record.GlobalRecorder;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.BountifulWrapper;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -49,28 +45,26 @@ public class Chat implements Listener {
Player player = event.getPlayer();
String message = event.getMessage();
FightSystem.getPlugin().getLogger().log(Level.INFO, player.getName() + "» " + message);
FightTeam fightTeam = Fight.getPlayerTeam(player);
if(fightTeam != null) {
String teamName = fightTeam.getColoredName();
if(message.startsWith(Config.TeamChatDetection)) {
fightTeam.broadcastChat(teamName + " " + player.getName() + "» " + message.substring(1));
fightTeam.broadcastChat(player, message.substring(1));
} else {
broadcastChat(teamName + " " + player.getName() + "§8» §7" + message);
broadcastChat("PARTICIPANT_CHAT", teamName, player.getName(), message);
}
}else if(player == FightSystem.getEventLeiter()){
broadcastChat("§e" + player.getName() + "§8» §e" + message);
broadcastChat("FIGHTLEADER_CHAT", player.getName(), message);
}else{
broadcastChat("§7" + player.getName() + "§8» §7" + message);
broadcastChat("SPECTATOR_CHAT", player.getName(), message);
}
event.setCancelled(true);
}
private void broadcastChat(String message) {
GlobalRecorder.getInstance().chat(message);
FightSystem.getPlugin().getLogger().log(Level.INFO, message);
BaseComponent[] msg = TextComponent.fromLegacyText(message);
for(Player p : Bukkit.getOnlinePlayers())
BountifulWrapper.impl.toChat(p, msg);
private void broadcastChat(String message, Object... params) {
GlobalRecorder.getInstance().chat(message, params);
FightSystem.getMessage().chat(message, params);
}
}

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.sql.Schematic;
@ -53,7 +54,7 @@ public class Check implements Listener {
if(user.getId() == schem.getSchemOwner())
return;
player.sendMessage("§cAuf diesem Server wird momentan eine Schematic geprüft!");
FightSystem.getMessage().send("CHECK_JOIN_DENIED", player);
player.kickPlayer("");
}
@ -64,7 +65,7 @@ public class Check implements Listener {
return;
event.setCancelled(true);
player.sendMessage("§cDieser Befehl ist beim Prüfen gesperrt! Admin wird benachrichtigt.");
FightSystem.getMessage().send("CHECK_COMMAND_LOCKED", player);
Bukkit.getLogger().log(Level.SEVERE, player.getName() + " tried to use a copy command!");
}

Datei anzeigen

@ -20,10 +20,11 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.BountifulWrapper;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -50,14 +51,14 @@ public class DenyWorldInteraction implements Listener {
public void handleBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
event.setCancelled(true);
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§cDu darfst derzeit keine Blöcke abbauen!"));
FightSystem.getMessage().sendPrefixless("NO_BLOCK_BREAK", player, ChatMessageType.ACTION_BAR);
}
@EventHandler
public void handleBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
event.setCancelled(true);
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§cDu darfst derzeit keine Blöcke setzen!"));
FightSystem.getMessage().sendPrefixless("NO_BLOCK_PLACE", player, ChatMessageType.ACTION_BAR);
}
@EventHandler
@ -88,7 +89,7 @@ public class DenyWorldInteraction implements Listener {
event.setCancelled(true);
if(event.getEntity().getShooter() instanceof Player){
Player player = (Player) event.getEntity().getShooter();
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§cDu darfst den Bogen erst nach Kampfbeginn nutzen!"));
FightSystem.getMessage().sendPrefixless("NO_BOW_USAGE", player, ChatMessageType.ACTION_BAR);
}
}
}

Datei anzeigen

@ -52,7 +52,7 @@ public class EventJoin implements Listener {
user.getId() == FightSystem.getEventFight().getKampfleiter())
return;
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "§cDu bist kein Kampfteilnehmer");
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, FightSystem.getMessage().parse("NO_PARTICIPANT", player));
}
@EventHandler
@ -90,7 +90,7 @@ public class EventJoin implements Listener {
return;
}
if(Config.LiveReplay)
player.kickPlayer("§cDu bist kein Kampfteilnehmer");
player.kickPlayer(FightSystem.getMessage().parse("NO_PARTICIPANT", player));
}
@EventHandler

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.commands.GUI;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
@ -59,32 +60,17 @@ public class HotbarGUI implements Listener {
if(displayName == null)
return;
if(displayName.equals("§e" + Config.GameName + " wählen")){
GUI.preSchemDialog(player);
return;
}
onMatch(player, displayName, "CHOOSE_SCHEMATIC", () -> GUI.preSchemDialog(player), Config.GameName);
onMatch(player, displayName, "INVITE_PLAYERS", () -> GUI.chooseInvitation(player));
onMatch(player, displayName, "REMOVE_PLAYERS", () -> GUI.chooseRemove(player));
onMatch(player, displayName, "TEAM_NOT_READY", () -> fightTeam.setReady(true));
onMatch(player, displayName, "TEAM_READY", () -> fightTeam.setReady(false));
onMatch(player, displayName, "CHOOSE_KIT", () -> GUI.kitSelection(player, ""));
onMatch(player, displayName, "RESPAWN", () -> player.teleport(fightTeam.getSpawn()));
}
switch (displayName) {
case "§cSpieler rauswerfen":
GUI.chooseRemove(player);
break;
case "§eSpieler einladen":
GUI.chooseInvitation(player);
break;
case "§cNicht bereit":
fightTeam.setReady(true);
break;
case "§aBereit":
fightTeam.setReady(false);
break;
case "§eKit bearbeiten":
case "§eKit wählen":
GUI.kitSelection(player, "");
break;
case "§eRespawn":
player.teleport(fightTeam.getSpawn());
break;
}
private void onMatch(Player player, String displayName, String message, Runnable run, Object... params) {
if(displayName.equals(FightSystem.getMessage().parse(message, player, params)))
run.run();
}
}

Datei anzeigen

@ -20,10 +20,11 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -83,7 +84,7 @@ public class InFightDamage implements Listener {
event.getDamager().setFireTicks(0);
player.setFireTicks(0);
}
BasicListener.toActionbar(damager, TextComponent.fromLegacyText("§cDu darfst deinen Teamkollegen keinen Schaden zufügen!"));
FightSystem.getMessage().sendPrefixless("NO_FRIENDLY_FIRE", damager, ChatMessageType.ACTION_BAR);
}
if(player.getHealth() - event.getFinalDamage() <= 0){

Datei anzeigen

@ -20,12 +20,13 @@
package de.steamwar.fightsystem.listener;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightPlayer;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.FlatteningWrapper;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -111,7 +112,7 @@ public class InFightInventory implements Listener {
public void onBlockPlace(BlockPlaceEvent e) {
FightPlayer fp = Fight.getFightPlayer(e.getPlayer());
if(fp != null && !fp.getKit().isTnt() && e.getBlockPlaced().getType() == Material.TNT){
BasicListener.toActionbar(e.getPlayer(), TextComponent.fromLegacyText("§cDu darfst kein TNT setzen!"));
FightSystem.getMessage().sendPrefixless("NO_TNT_PLACE", e.getPlayer(), ChatMessageType.ACTION_BAR);
e.setCancelled(true);
}
}

Datei anzeigen

@ -52,7 +52,7 @@ public class IngameDeath implements Listener {
if(team == null)
return;
FightUI.addSubtitle(team.getPrefix() + player.getName() + " §7ist gestorben");
FightUI.addSubtitle("UI_PLAYER_DEATH", team.getPrefix(), player.getName());
Fight.playSound(SWSound.ENTITY_WITHER_DEATH.getSound(), 100.0F, 1.0F);
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> team.getFightPlayer(player).setOut());
}
@ -70,7 +70,7 @@ public class IngameDeath implements Listener {
if(!fightPlayer.isLiving())
return;
FightUI.addSubtitle(team.getPrefix() + player.getName() + " §7hat den Kampf verlassen");
FightUI.addSubtitle("UI_PLAYER_LEAVE", team.getPrefix(), player.getName());
Bukkit.getScheduler().runTask(FightSystem.getPlugin(), () -> team.getFightPlayer(player).setOut());
}
}

Datei anzeigen

@ -21,12 +21,13 @@ package de.steamwar.fightsystem.listener;
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 net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -60,8 +61,8 @@ public class Permanent implements Listener {
public void onTpGM3(PlayerTeleportEvent e) {
if (e.getCause() == PlayerTeleportEvent.TeleportCause.SPECTATE) {
e.setCancelled(true);
BasicListener.toActionbar(e.getPlayer(), TextComponent.fromLegacyText("§cDu darfst diese Teleportfunktion nicht benutzen!"));
e.getPlayer().kickPlayer("§cDu darfst diese Teleportfunktion nicht benutzen!");
FightSystem.getMessage().sendPrefixless("NO_TELEPORT", e.getPlayer(), ChatMessageType.ACTION_BAR);
e.getPlayer().kickPlayer(null);
}
}

Datei anzeigen

@ -27,7 +27,7 @@ import de.steamwar.fightsystem.fight.Kit;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.sql.PersonalKit;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.HumanEntity;
@ -58,7 +58,7 @@ public class PersonalKitCreator implements Listener {
new InventoryBackup(player, kit);
new Kit(kit).loadToPlayer(player);
player.setGameMode(GameMode.CREATIVE);
BasicListener.toActionbar(player, TextComponent.fromLegacyText("§eInventar zum Anpassen des Kits öffnen§8!"));
FightSystem.getMessage().sendPrefixless("OPEN_INVENTORY_TO_CUSTOMIZE", player, ChatMessageType.ACTION_BAR);
}
public static boolean inKitCreator(HumanEntity player){

Datei anzeigen

@ -53,14 +53,16 @@ public class PrepareSchem implements Listener {
try{
schem = Schematic.getSchemFromDB(Config.PrepareSchemID);
}catch(SecurityException e){
FightSystem.shutdown(FightSystem.PREFIX + "§cAnscheinend wurde die auszufahrende Schematic gelöscht, Einsenden wird abgebrochen.");
FightSystem.getMessage().broadcast("PREPARE_SCHEM_DELETED");
Bukkit.shutdown();
return;
}
try{
region.forEach((x, y, z) -> {
if(FlatteningWrapper.impl.checkPistonMoving(world.getBlockAt(x, y, z))){
FightSystem.shutdown(FightSystem.PREFIX + "§cIm Teambereich wurden sich noch bewegende Pistons gefunden, Einsenden wird abgebrochen.");
FightSystem.getMessage().broadcast("PREPARE_ACTIVE_PISTON");
Bukkit.shutdown();
throw new IllegalStateException();
}
});
@ -71,12 +73,14 @@ public class PrepareSchem implements Listener {
try{
WorldeditWrapper.impl.saveSchem(schem, region, minY);
}catch(WorldEditException e){
FightSystem.shutdown(FightSystem.PREFIX + "§cDie Schematic konnte nicht gespeichert werden, Einsenden wird abgebrochen.");
FightSystem.getMessage().broadcast("PREPARE_FAILED_SAVING");
Bukkit.shutdown();
throw new SecurityException("Could not save schem", e);
}
schem.setSchemType(Config.SchematicType.checkType());
FightSystem.shutdown(FightSystem.PREFIX + "§aDie Schematic wird nun zeitnah von einem Teammitglied überprüft");
FightSystem.getMessage().broadcast("PREPARE_SENT_IN");
Bukkit.shutdown();
}
};
}

Datei anzeigen

@ -29,8 +29,7 @@ public class ResourcePack implements Listener {
return;
Player player = e.getPlayer();
player.sendMessage(FightSystem.PREFIX + "§cAuf Eventserver kann nur mit dem SteamWar-Resourcepack beigetreten werden");
player.sendMessage(FightSystem.PREFIX + "§cDa du abgelehnt hast, musst du nun in der Serverliste erst einmal wieder Ressourcenpakete von SteamWar aktivieren.");
FightSystem.getMessage().sendPrefixless("RESOURCEPACK_REQUIRED", player);
player.kickPlayer(null);
}
}

Datei anzeigen

@ -27,7 +27,7 @@ import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.Region;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
@ -42,9 +42,6 @@ import java.util.logging.Level;
public class TeamArea implements Listener {
private static final String DENY_TEAM = "§cDu darfst nicht zu den Teams";
private static final String DENY_ENTERN = "§cDu darfst nicht entern";
private static final Set<Player> realSpectator = new HashSet<>();
public TeamArea() {
@ -78,16 +75,16 @@ public class TeamArea implements Listener {
if(spectator) {
realSpectator(inRegion, player);
} else if (!playerTeam.canPlayerEntern(player) && !inRegion) {
reset(event, DENY_ENTERN); // Leaving prior to entern
reset(event, "NO_ENTERN"); // Leaving prior to entern
}
return; // Always allowed in own region
}
if(inRegion) {
reset(event, DENY_TEAM); // Not allowed in region
reset(event, "NO_TEAMAREA"); // Not allowed in region
if(team.getSchemRegion().playerInRegion(event.getTo()) && Config.PreperationArea >= 5){ // Preventing false positives due to small extension
player.kickPlayer(null);
Bukkit.getLogger().log(Level.INFO, player.getName() + " ist in einen Teambereich eingedrungen.");
Bukkit.getLogger().log(Level.INFO, player.getName() + " has entered a team area");
}
}
}
@ -105,6 +102,6 @@ public class TeamArea implements Listener {
private void reset(PlayerMoveEvent event, String message){
Player player = event.getPlayer();
player.teleport(event.getFrom());
BasicListener.toActionbar(player, TextComponent.fromLegacyText(message));
FightSystem.getMessage().sendPrefixless(message, player, ChatMessageType.ACTION_BAR);
}
}

Datei anzeigen

@ -42,7 +42,7 @@ public class TestJoin implements Listener {
FightTeam fightTeam = Fight.getPlayerTeam(player);
if (fightTeam == null && (Fight.getRedTeam().isLeaderless() || Fight.getBlueTeam().isLeaderless())) {
player.sendMessage(FightSystem.PREFIX + "§7Werde zum Teamleader mit §8/§eleader");
FightSystem.getMessage().send("TEST_BECOME_LEADER", player);
}
player.setOp(true);

Datei anzeigen

@ -24,12 +24,13 @@ import de.steamwar.core.Core;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.Config;
import de.steamwar.fightsystem.FightSystem;
import de.steamwar.fightsystem.countdown.Countdown;
import de.steamwar.fightsystem.countdown.EventSpectateCountdown;
import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.fight.FreezeWorld;
import de.steamwar.fightsystem.listener.BasicListener;
import de.steamwar.fightsystem.listener.FightScoreboard;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.utils.*;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.Team;
@ -45,7 +46,9 @@ import org.bukkit.scheduler.BukkitTask;
import java.io.EOFException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
@ -102,6 +105,9 @@ public class PacketProcessor {
packetDecoder[0xa0] = () -> send(ChatMessageType.CHAT);
packetDecoder[0xa1] = () -> send(ChatMessageType.ACTION_BAR);
packetDecoder[0xa2] = () -> send(ChatMessageType.SYSTEM);
packetDecoder[0xa3] = this::countdown;
packetDecoder[0xa4] = this::chat;
packetDecoder[0xa5] = this::system;
packetDecoder[0xb0] = () -> pasteSchem(Fight.getBlueTeam());
packetDecoder[0xb1] = () -> pasteSchem(Fight.getRedTeam());
packetDecoder[0xb2] = this::teams;
@ -112,6 +118,9 @@ public class PacketProcessor {
packetDecoder[0xc2] = this::bossBar;
packetDecoder[0xc3] = this::subtitle;
packetDecoder[0xc4] = this::printWin;
packetDecoder[0xc5] = this::messageSubtitle;
packetDecoder[0xc6] = this::winMessage;
packetDecoder[0xc7] = this::bossBarMessage;
packetDecoder[0xef] = source::readUTF;
packetDecoder[0xff] = this::tick;
@ -122,6 +131,41 @@ public class PacketProcessor {
task = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), this::process, 1, 1);
}
private void winMessage() throws IOException {
byte team = source.readByte();
Message message = readMessage();
execSync(() -> {
FightTeam winner = null;
if(team == 0x01)
winner = Fight.getBlueTeam();
else if(team == 0x02)
winner = Fight.getRedTeam();
if(Config.replayserver() || ArenaMode.AntiReplay.contains(Config.mode)) {
FightSystem.setSpectateState(winner, "Replay ends", message.getMsg(), message.getParams());
}else{
FightUI.printWin(winner, message.getMsg(), message.getParams());
new EventSpectateCountdown().enable();
}
});
}
private void system() throws IOException {
Message message = readMessage();
FightSystem.getMessage().broadcast(message.getMsg(), message.getParams());
}
private void messageSubtitle() throws IOException {
Message message = readMessage();
FightUI.addSubtitle(message.getMsg(), message.getParams());
}
private void chat() throws IOException {
Message message = readMessage();
FightSystem.getMessage().chat(message.getMsg(), message.getParams());
}
private void runSync() {
synchronized (syncList) {
for(Runnable runnable : syncList) {
@ -233,19 +277,15 @@ public class PacketProcessor {
String message = source.readUTF();
BaseComponent[] text = TextComponent.fromLegacyText(message);
Bukkit.getOnlinePlayers().forEach(p -> {
switch(type){
case CHAT:
BountifulWrapper.impl.toChat(p, text);
break;
case SYSTEM:
p.spigot().sendMessage(text);
break;
case ACTION_BAR:
BasicListener.toActionbar(p, text);
break;
}
});
Bukkit.getOnlinePlayers().forEach(p -> de.steamwar.core.BountifulWrapper.impl.sendMessage(p, type, text));
}
private void countdown() throws IOException {
String message = source.readUTF();
int displaytime = source.readInt();
Message appendix = readMessage();
Bukkit.getOnlinePlayers().forEach(p -> Countdown.sendCountdownMessage(p, message, displaytime, appendix));
}
private void arenaInfo() throws IOException {
@ -382,28 +422,40 @@ public class PacketProcessor {
FightUI.getInstance().setBossbar(leftBlueProgress, leftRedProgress, leftBlueText, leftRedText);
}
private void bossBarMessage() throws IOException {
double leftBlueProgress = source.readDouble();
double leftRedProgress = source.readDouble();
Message leftBlueText = readMessage();
Message leftRedText = readMessage();
FightUI.getInstance().setBossbar(leftBlueProgress, leftRedProgress, leftBlueText, leftRedText);
}
private void subtitle() throws IOException {
String subtitle = source.readUTF();
FightUI.addSubtitle(subtitle);
FightUI.addSubtitle("OLD_STRING", subtitle);
}
private void printWin() throws IOException {
String title = source.readUTF();
String subtitle = source.readUTF();
FightUI.printWin(title, subtitle);
}
private void endReplay(){
REntity.dieAll();
freezer.disable();
Bukkit.getOnlinePlayers().forEach(p -> {
p.resetTitle();
WorldOfColorWrapper.impl.sendTitle(p, title, subtitle, 5, 40, 5);
});
if(Config.replayserver() || ArenaMode.AntiReplay.contains(Config.mode)) {
FightSystem.setSpectateState(null, "Replay ends", null);
FightState.setFightState(FightState.SPECTATE);
}else{
Bukkit.broadcastMessage(FightSystem.PREFIX + "§cReplay beendet");
new EventSpectateCountdown().enable();
}
}
private void endReplay() {
REntity.dieAll();
freezer.disable();
FightSystem.getMessage().broadcast("REPLAY_ENDS");
replaying = false;
}
@ -461,6 +513,48 @@ public class PacketProcessor {
}
}
private Message readMessage() throws IOException {
String msg = source.readUTF();
List<Object> params = new ArrayList<>();
int type;
do {
type = Byte.toUnsignedInt(source.readByte());
switch(type) {
case 0x00:
break;
case 0x01:
params.add(source.readBoolean());
break;
case 0x02:
params.add(source.readByte());
break;
case 0x03:
params.add(source.readShort());
break;
case 0x04:
params.add(source.readInt());
break;
case 0x05:
params.add(source.readFloat());
break;
case 0x06:
params.add(source.readDouble());
break;
case 0x07:
params.add(source.readUTF());
break;
case 0x08:
params.add(readMessage());
break;
default:
throw new IOException("Unknown message param type " + type);
}
} while(type != 0x00);
return new Message(msg, params.toArray());
}
private interface PacketParser{
void process() throws IOException;
}

Datei anzeigen

@ -27,6 +27,7 @@ import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.utils.BlockIdWrapper;
import de.steamwar.fightsystem.utils.CraftbukkitWrapper;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.SteamwarUser;
@ -93,9 +94,9 @@ public interface Recorder {
* PlayerItemPacket (0x07) + int EntityId + String item + boolean enchanted + String slot
* ArrowSpawnPacket (0x08) + int EntityId
* FireballSpawnPacket (0x09) + int EntityId
* BowSpanPacket (0x0A) + int EntityId + boolean start + hand
* PlayerDamagePacket (0x0B) + int EntityId
* SetOnFire (0x0C) + int EntityId + boolean perma
* BowSpanPacket (0x0a) + int EntityId + boolean start + hand
* PlayerDamagePacket (0x0b) + int EntityId
* SetOnFire (0x0c) + int EntityId + boolean perma
*
* ArenaInfo (0x20) + bool blueNegZ + byte arenaY + int arenaMinX + int arenaMinZ
*
@ -107,24 +108,42 @@ public interface Recorder {
* ShortBlockPacket (0x35) + pos relative to ArenaMinX,BluePasteY,ArenaMinZ byte, byte, byte + short BlockState
*
*
* ChatPacket (0xA0) + String message
* ActionBarPacket (0xA1) + String message
* SystemPacket (0xA2) + String message
* DEPRECATED ChatPacket (0xa0) + String message
* DEPRECATED ActionBarPacket (0xa1) + String message
* DEPRECATED SystemPacket (0xa2) + String message
* CountdownPacket (0xa3) + String message, int displaytime, Message appendix
* ChatPacket (0xa4) + Message
* SystemPacket (0xa5) + Message
*
* BlueSchemPacket (0xB0) + int blueSchemId
* RedSchemPacket (0xB1) + int redSchemId
* TeamIDPacket (0xB2) + int blueTeamId, redTeamId
* BlueEmbeddedSchemPacket (0xB3) + int blueSchemId + gzipt NBT blob
* RedEmbeddedSchemPacket (0xB4) + int redSchemId + gzipt NBT blob
* BlueSchemPacket (0xb0) + int blueSchemId
* RedSchemPacket (0xb1) + int redSchemId
* TeamIDPacket (0xb2) + int blueTeamId, redTeamId
* BlueEmbeddedSchemPacket (0xb3) + int blueSchemId + gzipt NBT blob
* RedEmbeddedSchemPacket (0xb4) + int redSchemId + gzipt NBT blob
*
* DEPRECATED ScoreboardTitlePacket (0xC0) + String scoreboardTitle
* DEPRECATED ScoreboardDataPacket (0xC1) + String key + int value
* BossBarPacket (0xC2) + double leftBlueProgress, leftRedProgress + String leftBlueText, leftRedText
* SubtitlePacket (0xC3) + String subtitle
* PrintWinPacket (0xC4) + String title, subtitle
* DEPRECATED ScoreboardTitlePacket (0xc0) + String scoreboardTitle
* DEPRECATED ScoreboardDataPacket (0xc1) + String key + int value
* DEPRECATED BossBarPacket (0xc2) + double leftBlueProgress, leftRedProgress + String leftBlueText, leftRedText
* DEPRECATED SubtitlePacket (0xc3) + String subtitle
* DEPRECATED PrintWinPacket (0xc4) + String title, subtitle
* SubtitlePacket (0xc5) + Message
* WinPacket (0xc6) + byte team + Message subtitle
* BossBarPacket (0xc7) + double leftBlueProgress, leftRedProgress + Message leftBlueText, leftRedText
*
* CommentPacket (0xfe) + String comment
* TickPacket (0xff)
*
* Message-Format
* String message + byte prefixed Object-Params + byte 0x00
* 0x00: End of message
* 0x01: boolean following
* 0x02: byte following
* 0x03: short following
* 0x04: int following
* 0x05: float following
* 0x06: double following
* 0x07: String following
* 0x08: Message following
* */
default void playerJoins(Player p){
@ -224,16 +243,16 @@ public interface Recorder {
write(0x34, soundType, volume, pitch);
}
default void chat(String s) {
write(0xa0, s);
default void countdown(String message, int displaytime, Message appendix) {
write(0xa3, message, displaytime, appendix);
}
default void actionBar(String s) {
write(0xa1, s);
default void chat(String msg, Object... params) {
write(0xa4, new Message(msg, params));
}
default void systemChat(String s) {
write(0xa2, s);
default void system(String msg, Object... params) {
write(0xa5, new Message(msg, params));
}
default void teamIds(int blueTeamId, int redTeamId) {
@ -268,16 +287,27 @@ public interface Recorder {
write(embedId, schemId, buffer.toByteArray());
}
default void bossBar(double leftBlueProgress, double leftRedProgress, String leftBlueText, String leftRedText) {
write(0xc2, leftBlueProgress, leftRedProgress, leftBlueText, leftRedText);
static void copy(InputStream input, OutputStream output) throws IOException {
int bytes;
for(byte[] buffer = new byte[8192]; (bytes = input.read(buffer)) > 0;) {
output.write(buffer, 0, bytes);
}
}
default void subtitle(String subtitle) {
write(0xc3, subtitle);
default void bossBar(double leftBlueProgress, double leftRedProgress, Message leftBlueText, Message leftRedText) {
write(0xc7, leftBlueProgress, leftRedProgress, leftBlueText, leftRedText);
}
default void printWin(String title, String subtitle) {
write(0xc4, title, subtitle);
default void subtitle(Message subtitle) {
write(0xc5, subtitle);
}
default void winMessage(FightTeam team, String subtitle, Object... params) {
byte bTeam = 0x00;
if(team != null) {
bTeam = (byte) (team.isBlue() ? 0x01 : 0x02);
}
write(0xc6, bTeam, new Message(subtitle, params));
}
default void tick(){
@ -288,25 +318,8 @@ public interface Recorder {
DataOutputStream stream = getStream();
try {
stream.writeByte(id);
for(Object o : objects){
if(o instanceof Boolean)
stream.writeBoolean((Boolean)o);
else if(o instanceof Byte)
stream.writeByte((Byte)o);
else if(o instanceof Short)
stream.writeShort((Short)o);
else if(o instanceof Integer)
stream.writeInt((Integer)o);
else if(o instanceof Float)
stream.writeFloat((Float)o);
else if(o instanceof Double)
stream.writeDouble((Double)o);
else if(o instanceof String)
stream.writeUTF((String)o);
else if(o instanceof byte[])
stream.write((byte[])o);
else
throw new SecurityException("Undefined write for: " + o.getClass().getName());
for(Object o : objects) {
writeObject(stream, o);
}
stream.flush();
} catch (IOException e) {
@ -315,10 +328,53 @@ public interface Recorder {
}
}
static void copy(InputStream var0, OutputStream var1) throws IOException {
int var5;
for(byte[] var4 = new byte[8192]; (var5 = var0.read(var4)) > 0;) {
var1.write(var4, 0, var5);
}
default void writeObject(DataOutputStream stream, Object o) throws IOException {
if(o instanceof Boolean)
stream.writeBoolean((Boolean)o);
else if(o instanceof Byte)
stream.writeByte((Byte)o);
else if(o instanceof Short)
stream.writeShort((Short)o);
else if(o instanceof Integer)
stream.writeInt((Integer)o);
else if(o instanceof Float)
stream.writeFloat((Float)o);
else if(o instanceof Double)
stream.writeDouble((Double)o);
else if(o instanceof String)
stream.writeUTF((String)o);
else if(o instanceof byte[])
stream.write((byte[])o);
else if(o instanceof Message)
writeMessage(stream, (Message) o);
else
throw new SecurityException("Undefined write for: " + o.getClass().getName());
}
default void writeMessage(DataOutputStream stream, Message message) throws IOException {
stream.writeUTF(message.getMsg());
for(Object o : message.getParams()) {
if(o instanceof Boolean)
stream.writeByte(0x01);
else if(o instanceof Byte)
stream.writeByte(0x02);
else if(o instanceof Short)
stream.writeByte(0x03);
else if(o instanceof Integer)
stream.writeByte(0x04);
else if(o instanceof Float)
stream.writeByte(0x05);
else if(o instanceof Double)
stream.writeByte(0x06);
else if(o instanceof String)
stream.writeByte(0x07);
else if(o instanceof Message)
stream.writeByte(0x08);
else
throw new SecurityException("Undefined message serialization for: " + o.getClass().getName());
writeObject(stream, o);
}
stream.writeByte(0x00);
}
}

Datei anzeigen

@ -21,6 +21,7 @@ package de.steamwar.fightsystem.states;
import de.steamwar.fightsystem.ArenaMode;
import de.steamwar.fightsystem.FightSystem;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.PluginCommand;
@ -29,7 +30,7 @@ import java.util.Set;
public class StateDependentCommand extends StateDependent {
private static final CommandExecutor unavailable = (sender, cmd, s, strings) -> {
sender.sendMessage(FightSystem.PREFIX + "§cDieser Befehl ist zu diesem Kampfzeitpunkt nicht verfügbar.");
FightSystem.getMessage().sendPrefixless("COMMAND_CURRENTLY_UNAVAILABLE", sender, ChatMessageType.ACTION_BAR);
return false;
};

Datei anzeigen

@ -20,7 +20,7 @@
package de.steamwar.fightsystem.utils;
import de.steamwar.fightsystem.VersionDependent;
import net.md_5.bungee.api.chat.BaseComponent;
import de.steamwar.fightsystem.fight.FightTeam;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
@ -37,9 +37,6 @@ public class BountifulWrapper {
boolean mainHand(Object packet);
boolean bowInHand(boolean mainHand, Player p);
void toActionbar(Player player, BaseComponent... components);
void toChat(Player player, BaseComponent... components);
void setAttackSpeed(Player player);
void setNametagVisibility(Team team);
@ -58,9 +55,6 @@ public class BountifulWrapper {
void setSpawnPacketUUID(Object packet, UUID uuid);
void setEquipmentPacketSlot(Object packet, String slot);
void setBossbar(double leftBlueProgress, double leftRedProgress, String leftBlueText, String leftRedText);
void removeFromBar(Player player, FightUI.BossBarType type);
void addToBar(Player player, FightUI.BossBarType type);
void broadcastBossbar();
void sendBar(Player player, FightTeam team, double progress, String text);
}
}

Datei anzeigen

@ -115,8 +115,8 @@ public class FightStatistics {
int newRedElo = (int) Math.round(redElo + K * (1 - blueResult - redWinExpectation));
Elo.setElo(blueLeader, gameMode, newBlueElo);
Elo.setElo(redLeader, gameMode, newRedElo);
FightSystem.broadcast("§7ELO von " + Fight.getBlueTeam().getPrefix() + SteamwarUser.get(blueLeader).getUserName() + "§8: §7" + blueElo + "§8»§e" + newBlueElo);
FightSystem.broadcast("§7ELO von " + Fight.getRedTeam().getPrefix() + SteamwarUser.get(redLeader).getUserName() + "§8: §7" + redElo + "§8»§e" + newRedElo);
FightSystem.broadcast("UI_ELO", Fight.getBlueTeam().getPrefix(), SteamwarUser.get(blueLeader).getUserName(), blueElo, newBlueElo);
FightSystem.broadcast("UI_ELO", Fight.getRedTeam().getPrefix(), SteamwarUser.get(redLeader).getUserName(), redElo, newRedElo);
}
}

Datei anzeigen

@ -30,14 +30,12 @@ import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentTask;
import de.steamwar.fightsystem.winconditions.Wincondition;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Map;
import java.util.List;
import java.util.Queue;
import java.util.logging.Level;
import java.util.stream.Collectors;
@ -49,8 +47,6 @@ public class FightUI {
return instance;
}
private final Map<Player, BossBarType> currentBarType = new HashMap<>();
public FightUI() {
new StateDependentTask(ArenaMode.AntiReplay, FightState.All, this::update, 20, 20);
new StateDependentTask(ArenaMode.All, FightState.All, this::sendToPlayers, 5, 5);
@ -75,29 +71,41 @@ public class FightUI {
String time = "§7" + (timeLeft/60) + "§8:§7" + (timeLeft%60<10 ? "0" : "") + (timeLeft%60);
String bluePlayers = blue.getPrefix() + blue.getAlivePlayers() + "§8/§7" + blue.getPlayerCount();
String redPlayers = red.getPrefix() + red.getAlivePlayers() + "§8/§7" + red.getPlayerCount();
String redAdditional = Wincondition.getPrintableWinconditions().stream().map(w -> w.getDisplay(red)).collect(Collectors.joining(" "));
String blueAdditional = Wincondition.getPrintableWinconditions().stream().map(w -> w.getDisplay(blue)).collect(Collectors.joining(" "));
List<Message> redAdditional = Wincondition.getPrintableWinconditions().stream().map(w -> w.getDisplay(red)).collect(Collectors.toList());
List<Message> blueAdditional = Wincondition.getPrintableWinconditions().stream().map(w -> w.getDisplay(blue)).collect(Collectors.toList());
Generator generator;
switch(FightState.getFightState()){
case PRE_LEADER_SETUP:
generator = (l, r, lP, rP, lW, rW) -> "§7Warten auf Teamleader";
generator = (l, r, lP, rP, lW, rW) -> new Message("BAR_PRE_LEADER");
break;
case PRE_SCHEM_SETUP:
generator = (l, r, lP, rP, lW, rW) -> l.getColoredName() + " §7Schemauswahl " + time + " " + r.getColoredName();
generator = (l, r, lP, rP, lW, rW) -> new Message("BAR_PRE_SCHEM", time, l.getColoredName(), r.getColoredName());
break;
case POST_SCHEM_SETUP:
generator = (l, r, lP, rP, lW, rW) -> l.getColoredName() + " " + lP + " §7Vorbereitung " + time + " " + rP + " " + r.getColoredName();
generator = (l, r, lP, rP, lW, rW) -> new Message("BAR_PREPARE", time, l.getColoredName(), r.getColoredName(), lP, rP);
break;
case PRE_RUNNING:
generator = (l, r, lP, rP, lW, rW) -> l.getColoredName() + " " + lP + " §7Kampfbeginn in " + time + " " + rP + " " + r.getColoredName();
generator = (l, r, lP, rP, lW, rW) -> new Message("BAR_PRE_RUNNING", time, l.getColoredName(), r.getColoredName(), lP, rP);
break;
case RUNNING:
generator = (l, r, lP, rP, lW, rW) -> l.getColoredName() + " " + lP + " " + lW + " " + time + " " + rW + " " + rP + " " + r.getColoredName();
generator = (l, r, lP, rP, lW, rW) -> {
List<Object> params = new ArrayList<>();
params.add(time);
params.add(l.getColoredName());
params.add(r.getColoredName());
params.add(lP);
params.add(rP);
for(int i = 0; i < lW.size(); i++) {
params.add(lW.get(i));
params.add(rW.get(i));
}
return new Message("BAR_RUNNING" + lW.size(), params.toArray());
};
break;
case SPECTATE:
default:
generator = (l, r, lP, rP, lW, rW) -> l.getColoredName() + " §7Kampf vorbei " + time + " " + r.getColoredName();
generator = (l, r, lP, rP, lW, rW) -> new Message("BAR_SPECTATE", time, l.getColoredName(), r.getColoredName());
break;
}
@ -109,57 +117,64 @@ public class FightUI {
}
private interface Generator {
String gen(FightTeam l, FightTeam r, String lPlayers, String rPlayers, String lWinconditions, String rWinconditions);
Message gen(FightTeam l, FightTeam r, String lPlayers, String rPlayers, List<Message> lWinconditions, List<Message> rWinconditions);
}
public void setBossbar(double leftBlueProgress, double leftRedProgress, String leftBlueText, String leftRedText) {
GlobalRecorder.getInstance().bossBar(leftBlueProgress, leftRedProgress, leftBlueText, leftRedText);
BountifulWrapper.impl.setBossbar(leftBlueProgress, leftRedProgress, leftBlueText, leftRedText);
setBossbar(leftBlueProgress, leftRedProgress, new Message("OLD_STRING", leftBlueText), new Message("OLD_STRING", leftRedText));
}
public BossBarType bossBarType(Player player) {
return currentBarType.get(player);
public void setBossbar(double leftBlueProgress, double leftRedProgress, Message leftBlueText, Message leftRedText) {
GlobalRecorder.getInstance().bossBar(leftBlueProgress, leftRedProgress, leftBlueText, leftRedText);
BossBarType.BLUE_LEFT.progress = leftBlueProgress;
BossBarType.RED_LEFT.progress = leftRedProgress;
BossBarType.BLUE_LEFT.text = leftBlueText;
BossBarType.RED_LEFT.text = leftRedText;
}
private void sendToPlayers() {
Bukkit.getOnlinePlayers().forEach(player -> {
BossBarType type = BossBarType.byAngle(CraftbukkitWrapper.impl.headRotation(player));
BossBarType current = currentBarType.get(player);
BossBarType bar = BossBarType.byAngle(CraftbukkitWrapper.impl.headRotation(player));
if(type != current) {
if(current != null)
BountifulWrapper.impl.removeFromBar(player, current);
BountifulWrapper.impl.addToBar(player, type);
currentBarType.put(player, type);
Object[] params = bar.text.getParams().clone();
for(int i = 0; i < params.length; i++) {
if(params[i] instanceof Message) {
Message msg = (Message) params[i];
params[i] = FightSystem.getMessage().parse(msg.getMsg(), player, msg.getParams());
}
}
BountifulWrapper.impl.sendBar(player, bar.team, bar.progress, FightSystem.getMessage().parse(bar.text.getMsg(), player, params));
});
BountifulWrapper.impl.broadcastBossbar();
}
private void tpsWatcher() {
double tps = TPSWatcher.getTPS();
if(tps < 15.0) {
BaseComponent[] message = TextComponent.fromLegacyText("§c" + tps + " §7TPS");
Bukkit.getOnlinePlayers().forEach(player -> BountifulWrapper.impl.toActionbar(player, message));
}
if(tps < 15.0)
FightSystem.getMessage().broadcastActionbar("TPS_WARNING", tps);
}
public enum BossBarType {
BLUE_LEFT(345, 165),
RED_LEFT(165, 345);
BLUE_LEFT(Fight.getBlueTeam(), 345, 165),
RED_LEFT(Fight.getRedTeam(), 165, 345);
private static final boolean blueNegZ = Config.blueNegZ();
private static final boolean BLUE_NEG_Z = Config.blueNegZ();
private final double minAngle;
private final double maxAngle;
BossBarType(double minAngle, double maxAngle) {
private final FightTeam team;
private double progress = 0.5;
private Message text = new Message("OLD_STRING", "§7");
BossBarType(FightTeam team, double minAngle, double maxAngle) {
this.team = team;
this.minAngle = minAngle;
this.maxAngle = maxAngle;
}
private static BossBarType byAngle(double angle) {
if(blueNegZ)
if(BLUE_NEG_Z)
angle += 180;
angle = ((angle % 360) + 360) % 360;
@ -173,27 +188,30 @@ public class FightUI {
}
private static final Queue<String> queue = new LinkedList<>();
private static final Queue<Message> queue = new LinkedList<>();
private static boolean subtitleScheduled = false;
public static void printWin(String title, String winreason) {
public static void printWin(FightTeam winner, String subtitle, Object... params) {
queue.clear();
FightSystem.getPlugin().getLogger().log(Level.INFO, title + " " + winreason);
GlobalRecorder.getInstance().printWin(title, winreason);
Bukkit.getOnlinePlayers().forEach(p -> {
p.resetTitle();
WorldOfColorWrapper.impl.sendTitle(p, title, winreason, 5, 40, 5);
});
FightSystem.getPlugin().getLogger().log(Level.INFO, winner + " " + FightSystem.getMessage().parse(subtitle, null, params));
GlobalRecorder.getInstance().winMessage(winner, subtitle, params);
Bukkit.getOnlinePlayers().forEach(Player::resetTitle);
if (winner != null)
Bukkit.getOnlinePlayers().forEach(p -> WorldOfColorWrapper.impl.sendTitle(p, FightSystem.getMessage().parse("UI_WIN", p, winner.getColor(), winner.getName()), FightSystem.getMessage().parse(subtitle, p, params), 5, 40, 5));
else
Bukkit.getOnlinePlayers().forEach(p -> WorldOfColorWrapper.impl.sendTitle(p, FightSystem.getMessage().parse("UI_DRAW", p), FightSystem.getMessage().parse(subtitle, p, params), 5, 40, 5));
}
public static void addSubtitle(String message) {
public static void addSubtitle(String msg, Object... params) {
if(FightState.Spectate.contains(FightState.getFightState()))
return;
Message message = new Message(msg, params);
queue.add(message);
GlobalRecorder.getInstance().subtitle(message);
FightSystem.getPlugin().getLogger().log(Level.INFO, message);
FightSystem.getPlugin().getLogger().log(Level.INFO, FightSystem.getMessage().parse(msg, null, params));
if(!subtitleScheduled)
printSubtitle();
@ -204,9 +222,9 @@ public class FightUI {
subtitleScheduled = false;
return;
}
String message = queue.poll();
Message message = queue.poll();
Bukkit.getOnlinePlayers().forEach(p -> WorldOfColorWrapper.impl.sendTitle(p, "", message, 5, 40, 5));
Bukkit.getOnlinePlayers().forEach(p -> WorldOfColorWrapper.impl.sendTitle(p, "", FightSystem.getMessage().parse(message.getMsg(), p, message.getParams()), 5, 40, 5));
Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), FightUI::printSubtitle, 50);
subtitleScheduled = true;
}

Datei anzeigen

@ -0,0 +1,38 @@
/*
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;
public class Message {
private final String msg;
private final Object[] params;
public Message(String msg, Object... params) {
this.msg = msg;
this.params = params;
}
public String getMsg() {
return msg;
}
public Object[] getParams() {
return params;
}
}

Datei anzeigen

@ -33,7 +33,7 @@ public class EventTeamOffWincondition extends Wincondition{
@Override
public void enable() {
if(Fight.getBlueTeam().allPlayersOut() && Fight.getRedTeam().allPlayersOut()){
win(null, "§7Beide Teams offline");
win(null, "WIN_OFFLINE_BOTH");
}else{
teamOff(Fight.getBlueTeam());
teamOff(Fight.getRedTeam());
@ -49,7 +49,7 @@ public class EventTeamOffWincondition extends Wincondition{
private void teamOff(FightTeam team){
if(team.allPlayersOut()){
win(Fight.getOpposite(team), team.getColoredName() + " §7offline");
win(Fight.getOpposite(team), "WIN_OFFLINE", team.getColoredName());
}
}
}

Datei anzeigen

@ -20,7 +20,8 @@
package de.steamwar.fightsystem.winconditions;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.utils.Message;
public interface PrintableWincondition {
String getDisplay(FightTeam team);
Message getDisplay(FightTeam team);
}

Datei anzeigen

@ -44,7 +44,7 @@ public class RankedPlayerLeftWincondition extends Wincondition implements Listen
return;
if(team.isPlayerLeader(player)) {
win(Fight.getOpposite(team), team.getPrefix() + team.getLeader().getPlayer().getName() + " §7hat den Kampf verlassen");
win(Fight.getOpposite(team), "WIN_RANKED_LEFT", team.getPrefix() + team.getLeader().getPlayer().getName());
}
}
}

Datei anzeigen

@ -47,8 +47,8 @@ public abstract class Wincondition {
return timeOverCountdown.getCountdown();
}
protected void win(FightTeam team, String subtitle){
FightSystem.setSpectateState(team, windescription, subtitle);
protected void win(FightTeam team, String subtitle, Object... params){
FightSystem.setSpectateState(team, windescription, subtitle, params);
}
protected FightTeam isTarget(Player player){

Datei anzeigen

@ -57,6 +57,6 @@ public class WinconditionAllDead extends Wincondition implements Listener {
return;
}
win(Fight.getOpposite(team), team.getPrefix() + "Alle Spieler kampfunfähig");
win(Fight.getOpposite(team), "WIN_ALL_DEAD", team.getPrefix());
}
}

Datei anzeigen

@ -52,7 +52,7 @@ public class WinconditionCaptainDead extends Wincondition implements Listener {
return;
if(team.isPlayerLeader(player)) {
win(Fight.getOpposite(team), team.getPrefix() + team.getLeader().getPlayer().getName() + " kampfunfähig");
win(Fight.getOpposite(team), "WIN_LEADER_DEAD", team.getPrefix() + team.getLeader().getPlayer().getName());
}
}
}

Datei anzeigen

@ -39,11 +39,11 @@ public class WinconditionHeartRatioTimeout extends Wincondition {
double redHeartRatio = Fight.getRedTeam().getHeartRatio();
if(blueHeartRatio > redHeartRatio) {
win(Fight.getBlueTeam(), Fight.getBlueTeam().getPrefix() + "Mehr verbleibende Leben");
win(Fight.getBlueTeam(), "WIN_MORE_HEALTH", Fight.getBlueTeam().getPrefix());
}else if(blueHeartRatio < redHeartRatio){
win(Fight.getRedTeam(), Fight.getRedTeam().getPrefix() + "Mehr verbleibende Leben");
win(Fight.getRedTeam(), "WIN_MORE_HEALTH", Fight.getRedTeam().getPrefix());
}else{
win(null, "§7Zeit abgelaufen");
win(null, "WIN_TIME_OVER");
}
}
}

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.Message;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
@ -62,8 +63,8 @@ public class WinconditionPercentSystem extends Wincondition implements Listener,
}
@Override
public String getDisplay(FightTeam team) {
return team.getPrefix() + (Math.round(100.0 * getPercent(team)) / 100.0) + "§8%";
public Message getDisplay(FightTeam team) {
return new Message("BAR_PERCENT", team.getPrefix() + (Math.round(100.0 * getPercent(team)) / 100.0));
}
@Override
@ -91,7 +92,7 @@ public class WinconditionPercentSystem extends Wincondition implements Listener,
destroyedBlocks += event.blockList().size();
percent = (double)destroyedBlocks * 100 / volume;
if(percent >= Config.PercentWin) {
win(Fight.getOpposite(team), team.getColoredName() + " §7zu beschädigt");
win(Fight.getOpposite(team), "WIN_PERCENT", team.getColoredName());
}
}
}

Datei anzeigen

@ -39,11 +39,11 @@ public class WinconditionPercentTimeout extends Wincondition {
double redPercent = Wincondition.percentWincondition.getPercent(Fight.getRedTeam());
if(bluePercent > redPercent) {
win(Fight.getRedTeam(), Fight.getRedTeam().getColoredName() + " §7weniger beschädigt");
win(Fight.getRedTeam(), "WIN_LESS_DAMAGE", Fight.getRedTeam().getColoredName());
}else if(bluePercent < redPercent){
win(Fight.getBlueTeam(), Fight.getBlueTeam().getColoredName() + " §7weniger beschädigt");
win(Fight.getBlueTeam(), "WIN_LESS_DAMAGE", Fight.getBlueTeam().getColoredName());
}else{
win(null, "§7Zeit abgelaufen");
win(null, "WIN_TIME_OVER");
}
}
}

Datei anzeigen

@ -27,6 +27,7 @@ import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.states.StateDependentCountdown;
import de.steamwar.fightsystem.states.StateDependentListener;
import de.steamwar.fightsystem.utils.Message;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
@ -69,11 +70,11 @@ public class WinconditionPoints extends Wincondition implements PrintableWincond
int bluePoints = teamMap.get(Fight.getBlueTeam()).getPoints();
if(bluePoints < redPoints) {
win(Fight.getRedTeam(), Fight.getRedTeam().getPrefix() + " hat mehr Punkte");
win(Fight.getRedTeam(), "WIN_POINTS", Fight.getRedTeam().getPrefix());
}else if(bluePoints > redPoints){
win(Fight.getBlueTeam(), Fight.getBlueTeam().getPrefix() + " hat mehr Punkte");
win(Fight.getBlueTeam(), "WIN_POINTS", Fight.getBlueTeam().getPrefix());
}else{
win(null, "§7Gleicher Punktestand");
win(null, "WIN_POINTS_EQUAL");
}
}
@ -104,8 +105,8 @@ public class WinconditionPoints extends Wincondition implements PrintableWincond
}
@Override
public String getDisplay(FightTeam team) {
return team.getPrefix() + teamMap.get(team).getPoints() + " §8Punkte";
public Message getDisplay(FightTeam team) {
return new Message("BAR_POINTS", team.getPrefix() + teamMap.get(team).getPoints());
}
private class TeamPoints {

Datei anzeigen

@ -24,6 +24,7 @@ import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentTask;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.inventory.SWItem;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@ -55,8 +56,8 @@ public class WinconditionPumpkinTechKO extends Wincondition implements Printable
}
@Override
public String getDisplay(FightTeam team) {
return team.getPrefix() + teamMap.get(team).pumpkins + " §8Kanonen";
public Message getDisplay(FightTeam team) {
return new Message("BAR_CANNONS", team.getPrefix() + teamMap.get(team).pumpkins);
}
private class TeamPumpkin {
@ -76,7 +77,7 @@ public class WinconditionPumpkinTechKO extends Wincondition implements Printable
});
if(pumpkins == 0) {
win(Fight.getOpposite(team), team.getColoredName() + " ist Tech K.O.");
win(Fight.getOpposite(team), "WIN_TECHKO", team.getColoredName());
}
}
}

Datei anzeigen

@ -25,6 +25,7 @@ import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependent;
import de.steamwar.fightsystem.utils.Message;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.World;
@ -63,8 +64,8 @@ public class WinconditionRelativePercent extends Wincondition implements Printab
}
@Override
public String getDisplay(FightTeam team) {
return team.getPrefix() + (Math.round(100.0 * getPercent(team)) / 100.0) + "§8%";
public Message getDisplay(FightTeam team) {
return new Message("BAR_PERCENT", team.getPrefix() + (Math.round(100.0 * getPercent(team)) / 100.0));
}
public static class TeamPercent extends StateDependent {
@ -99,7 +100,7 @@ public class WinconditionRelativePercent extends Wincondition implements Printab
return;
if(getPercent() >= Config.PercentWin){
FightSystem.setSpectateState(Fight.getOpposite(team), "RelativePercent", team.getColoredName() + " §7zu beschädigt");
FightSystem.setSpectateState(Fight.getOpposite(team), "RelativePercent", "WIN_PERCENT", team.getColoredName());
}
}

Datei anzeigen

@ -25,6 +25,7 @@ import de.steamwar.fightsystem.fight.Fight;
import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentTask;
import de.steamwar.fightsystem.utils.Message;
import de.steamwar.fightsystem.utils.SWSound;
import org.bukkit.Bukkit;
import org.bukkit.World;
@ -108,19 +109,14 @@ public class WinconditionTimeTechKO extends Wincondition {
private final FightTeam team;
public TechKOCountdown(FightTeam team, int countdownTime) {
super(countdownTime, SWSound.BLOCK_NOTE_PLING, false);
super(countdownTime, new Message("TECHKO_COUNTDOWN", team.getColoredName()), SWSound.BLOCK_NOTE_PLING, false);
this.team = team;
super.enable();
}
@Override
public final String countdownCounting() {
return "bis " + team.getColoredName() + " §feinen Schuss abgegeben haben muss!";
}
@Override
public void countdownFinished() {
win(Fight.getOpposite(team), team.getColoredName() + " ist Tech K.O.");
win(Fight.getOpposite(team), "WIN_TECHKO", team.getColoredName());
}
}
}

Datei anzeigen

@ -34,6 +34,6 @@ public class WinconditionTimeout extends Wincondition {
}
protected void timeOver() {
win(null, "§7Zeit abgelaufen");
win(null, "WIN_TIME_OVER");
}
}

Datei anzeigen

@ -25,6 +25,7 @@ import de.steamwar.fightsystem.fight.FightTeam;
import de.steamwar.fightsystem.states.FightState;
import de.steamwar.fightsystem.states.StateDependentTask;
import de.steamwar.fightsystem.utils.FlatteningWrapper;
import de.steamwar.fightsystem.utils.Message;
import org.bukkit.Bukkit;
import org.bukkit.World;
@ -53,8 +54,8 @@ public class WinconditionWaterTechKO extends Wincondition implements PrintableWi
}
@Override
public String getDisplay(FightTeam team) {
return team.getPrefix() + teamMap.get(team).water + " §8Wasser";
public Message getDisplay(FightTeam team) {
return new Message("BAR_WATER", team.getPrefix() + teamMap.get(team).water);
}
private class TeamWater {
@ -73,7 +74,7 @@ public class WinconditionWaterTechKO extends Wincondition implements PrintableWi
});
if(water == 0){
win(Fight.getOpposite(team), team.getColoredName() + " ist Tech K.O.");
win(Fight.getOpposite(team), "WIN_TECHKO", team.getColoredName());
}
}
}