SteamWar/FightSystem
Archiviert
13
1

WIP first half multiling
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2021-10-02 11:44:12 +02:00
Ursprung c983b40d9f
Commit 1cc57539e4
29 geänderte Dateien mit 296 neuen und 206 gelöschten Zeilen

Datei anzeigen

@ -36,6 +36,7 @@ import de.steamwar.fightsystem.utils.FightStatistics;
import de.steamwar.fightsystem.utils.FightUI;
import de.steamwar.fightsystem.utils.TechHider;
import de.steamwar.fightsystem.winconditions.*;
import de.steamwar.message.Message;
import de.steamwar.sql.EventFight;
import de.steamwar.sql.Schematic;
import org.bukkit.Bukkit;
@ -51,6 +52,8 @@ public class FightSystem extends JavaPlugin {
private static EventFight eventFight;
private static Player eventLeiter;
private Message message;
@Override
public void onLoad() {
plugin = this;
@ -58,6 +61,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();
@ -240,6 +245,10 @@ public class FightSystem extends JavaPlugin {
GlobalRecorder.getInstance().systemChat(PREFIX + message);
}
public static Message getMessage() {
return plugin.message;
}
private static void kickNext(){
if(Bukkit.getOnlinePlayers().isEmpty()){
Bukkit.shutdown();

Datei anzeigen

@ -0,0 +1,119 @@
#
# 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
# Winconditions
HELLS_BELLS_COUNTDOWN=bis die Bomben fallen

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", null));
inv.setItem(6, Material.GLASS, msg.parse("STATE_SPECTATE_WIN", p, Fight.getRedTeam().getColoredName()), (ClickType click) -> FightSystem.setSpectateState(Fight.getRedTeam(), "operator", null));
inv.setItem(7, Material.GLASS, msg.parse("STATE_SPECTATE_TIE", p), (ClickType click) -> FightSystem.setSpectateState(null, "operator", null));
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,14 +42,14 @@ 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) {
FightSystem.getMessage().sendPrefixless("GAMEMODE_HELP", sender);
sender.sendMessage(FightSystem.PREFIX + this.usageMessage);
return false;
}
@ -57,14 +57,14 @@ public class GamemodeCommand extends BukkitCommand {
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 +91,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,12 +25,12 @@ 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;
}

Datei anzeigen

@ -21,12 +21,10 @@ 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.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;
@ -81,22 +79,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");
}
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, String appendix) {
FightSystem.getMessage().sendPrefixless(message, p, ChatMessageType.ACTION_BAR, displaytime, FightSystem.getMessage().parse(appendix, p));
}
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, divisor, countdownCounting());
Bukkit.getOnlinePlayers().forEach(p -> sendCountdownMessage(p, message, time / divisor, countdownCounting()));
}
protected void prepareFinish() {}
public int getTimeLeft(){
return time;
}
@ -106,22 +112,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,9 @@ 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.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;
@ -43,41 +41,23 @@ public class EnternCountdown extends Countdown {
@Override
public String countdownCounting() {
return "bis Entern erlaubt ist!";
return "ENTERN_COUNTDOWN";
}
@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, countdownCounting());
}
}

Datei anzeigen

@ -35,7 +35,7 @@ public class EventSpectateCountdown extends Countdown {
@Override
public String countdownCounting() {
return "bis der Server gestoppt wird!";
return "SHUTDOWN_COUNTDOWN";
}
@Override

Datei anzeigen

@ -35,7 +35,7 @@ public class NoPlayersOnlineCountdown extends Countdown implements Listener {
super(Config.NoPlayerOnlineDuration, 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())
@ -46,7 +46,7 @@ public class NoPlayersOnlineCountdown extends Countdown implements Listener {
@Override
public String countdownCounting() {
return "bis der Server gestoppt wird!";
return "SHUTDOWN_COUNTDOWN";
}
@EventHandler

Datei anzeigen

@ -34,7 +34,7 @@ public class PostSchemCountdown extends Countdown {
@Override
public String countdownCounting() {
return "bis die Kits verteilt werden!";
return "POST_SCHEM_COUNTDOWN";
}
@Override

Datei anzeigen

@ -35,7 +35,7 @@ public class PreRunningCountdown extends Countdown {
@Override
public String countdownCounting() {
return "bis die Arena freigegeben ist!";
return "PRE_RUNNING_COUNTDOWN";
}
@Override

Datei anzeigen

@ -35,7 +35,7 @@ public class PreSchemCountdown extends Countdown {
@Override
public String countdownCounting() {
return "bis eine Public-Schematic gewählt wird!";
return "PRE_SCHEM_COUNTDOWN";
}
@Override

Datei anzeigen

@ -35,7 +35,7 @@ public class SpectateOverCountdown extends Countdown {
@Override
public String countdownCounting() {
return "bis die Arena zurückgesetzt wird!";
return "SPECTATE_COUNTDOWN";
}
@Override

Datei anzeigen

@ -33,7 +33,7 @@ public class TimeOverCountdown extends Countdown {
@Override
public String countdownCounting() {
return "bis der Kampf vorbei ist!";
return "RUNNING_COUNTDOWN";
}
@Override

Datei anzeigen

@ -22,9 +22,9 @@ 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.SWSound;
import de.steamwar.fightsystem.winconditions.Winconditions;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -32,8 +32,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 +48,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 +66,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();
@ -145,7 +130,7 @@ public class HellsBells {
@Override
public String countdownCounting() {
return "bis die Bomben fallen";
return "HELLS_BELLS_COUNTDOWN";
}
@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

@ -34,6 +34,7 @@ import de.steamwar.fightsystem.utils.*;
import de.steamwar.inventory.SWItem;
import de.steamwar.sql.Schematic;
import de.steamwar.sql.SteamwarUser;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.*;
@ -186,9 +187,12 @@ 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 broadcastSystem(String message, Object... params) {
players.forEach((player, fp) -> FightSystem.getMessage().send(message, player, params));
}
public void broadcastChat(String message) {

Datei anzeigen

@ -24,6 +24,7 @@ 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;
@ -102,6 +103,7 @@ public class PacketProcessor {
packetDecoder[0xa0] = () -> send(ChatMessageType.CHAT);
packetDecoder[0xa1] = () -> send(ChatMessageType.ACTION_BAR);
packetDecoder[0xa2] = () -> send(ChatMessageType.SYSTEM);
packetDecoder[0xa3] = this::countdown;
packetDecoder[0xb0] = () -> pasteSchem(Fight.getBlueTeam());
packetDecoder[0xb1] = () -> pasteSchem(Fight.getRedTeam());
packetDecoder[0xb2] = this::teams;
@ -248,6 +250,14 @@ public class PacketProcessor {
});
}
private void countdown() throws IOException {
String message = source.readUTF();
int displaytime = source.readInt();
String appendix = source.readUTF();
Bukkit.getOnlinePlayers().forEach(p -> Countdown.sendCountdownMessage(p, message, displaytime, appendix));
}
private void arenaInfo() throws IOException {
rotateZ = source.readBoolean() != Config.blueNegZ();
arenaMinY = Byte.toUnsignedInt(source.readByte());

Datei anzeigen

@ -108,8 +108,9 @@ public interface Recorder {
*
*
* ChatPacket (0xA0) + String message
* ActionBarPacket (0xA1) + String message
* DEPRECATED ActionBarPacket (0xA1) + String message
* SystemPacket (0xA2) + String message
* CountdownPacket (0xA3) + String message, int displaytime, String appendix
*
* BlueSchemPacket (0xB0) + int blueSchemId
* RedSchemPacket (0xB1) + int redSchemId
@ -228,14 +229,14 @@ public interface Recorder {
write(0xa0, s);
}
default void actionBar(String s) {
write(0xa1, s);
}
default void systemChat(String s) {
write(0xa2, s);
}
default void countdown(String message, int displaytime, String appendix) {
write(0xa3, message, displaytime, appendix);
}
default void teamIds(int blueTeamId, int redTeamId) {
write(0xb2, blueTeamId, redTeamId);
}

Datei anzeigen

@ -115,6 +115,7 @@ public class WinconditionTimeTechKO extends Wincondition {
@Override
public final String countdownCounting() {
//TODO: ARRRG!
return "bis " + team.getColoredName() + " §feinen Schuss abgegeben haben muss!";
}