Multiling (nur Multling) #294
@ -44,7 +44,6 @@ 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;
|
||||
@ -133,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 {
|
||||
@ -186,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);
|
||||
|
||||
@ -207,7 +200,7 @@ public class FightSystem extends JavaPlugin {
|
||||
getEventFight().setErgebnis(2);
|
||||
}
|
||||
|
||||
FightStatistics.saveStats(winFightTeam, windescription);
|
||||
FightStatistics.saveStats(winFightTeam, winreason);
|
||||
}
|
||||
}
|
||||
|
||||
@ -231,9 +224,9 @@ public class FightSystem extends JavaPlugin {
|
||||
return plugin;
|
||||
}
|
||||
|
||||
public static void broadcast(String message) {
|
||||
Bukkit.broadcastMessage(PREFIX + message);
|
||||
GlobalRecorder.getInstance().systemChat(PREFIX + message);
|
||||
public static void broadcast(String msg, Object... params) {
|
||||
getMessage().broadcast(msg, params);
|
||||
GlobalRecorder.getInstance().system(msg, params);
|
||||
}
|
||||
|
||||
public static Message getMessage() {
|
||||
|
@ -155,10 +155,14 @@ PREPARE_SCHEM_DELETED=
|
||||
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
|
||||
@ -168,6 +172,33 @@ COMMAND_CURRENTLY_UNAVAILABLE=
|
||||
# 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
|
||||
|
||||
|
||||
# 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.
|
||||
|
@ -77,9 +77,9 @@ public class GUI {
|
||||
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.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();
|
||||
}
|
||||
|
@ -50,7 +50,6 @@ public class GamemodeCommand extends BukkitCommand {
|
||||
return false;
|
||||
}else if (args.length == 0) {
|
||||
FightSystem.getMessage().sendPrefixless("GAMEMODE_HELP", sender);
|
||||
sender.sendMessage(FightSystem.PREFIX + this.usageMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -35,11 +35,11 @@ public class WinCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.fight.Fight;
|
||||
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.ChatMessageType;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -37,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;
|
||||
@ -44,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;
|
||||
}
|
||||
@ -86,19 +89,19 @@ public abstract class Countdown {
|
||||
countdown.show();
|
||||
}
|
||||
|
||||
FightUI.addSubtitle("§7Sprung zum nächsten Ereignis");
|
||||
FightUI.addSubtitle("UI_SKIP");
|
||||
}
|
||||
|
||||
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));
|
||||
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, divisor, countdownCounting());
|
||||
Bukkit.getOnlinePlayers().forEach(p -> sendCountdownMessage(p, message, time / divisor, countdownCounting()));
|
||||
GlobalRecorder.getInstance().countdown(message, divisor, appendix);
|
||||
Bukkit.getOnlinePlayers().forEach(p -> sendCountdownMessage(p, message, time / divisor, appendix));
|
||||
}
|
||||
|
||||
protected void prepareFinish() {}
|
||||
|
@ -22,6 +22,7 @@ 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.utils.Message;
|
||||
import de.steamwar.fightsystem.utils.SWSound;
|
||||
import de.steamwar.fightsystem.utils.TechHider;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
@ -34,16 +35,11 @@ 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 "ENTERN_COUNTDOWN";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
FightSystem.getMessage().sendPrefixless("ENTERN_ALLOWED", fightPlayer.getPlayer(), ChatMessageType.ACTION_BAR);
|
||||
@ -58,6 +54,6 @@ public class EnternCountdown extends Countdown {
|
||||
@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());
|
||||
sendCountdownMessage(fightPlayer.getPlayer(), message, time / divisor, appendix);
|
||||
}
|
||||
}
|
||||
|
@ -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 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 "SHUTDOWN_COUNTDOWN";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
FightSystem.shutdown();
|
||||
|
@ -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,7 +33,7 @@ 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) {
|
||||
@ -44,11 +45,6 @@ public class NoPlayersOnlineCountdown extends Countdown implements Listener {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String countdownCounting() {
|
||||
return "SHUTDOWN_COUNTDOWN";
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void handlePlayerJoin(PlayerJoinEvent event) {
|
||||
disable();
|
||||
|
@ -24,19 +24,15 @@ 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);
|
||||
super(Config.SetupDuration, new Message("POST_SCHEM_COUNTDOWN"), null, false);
|
||||
new StateDependentCountdown(ArenaMode.AntiTest, FightState.PostSchemSetup, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String countdownCounting() {
|
||||
return "POST_SCHEM_COUNTDOWN";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
FightSystem.setPreRunningState();
|
||||
|
@ -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 "PRE_RUNNING_COUNTDOWN";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
FightSystem.setRunningState();
|
||||
|
@ -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 "PRE_SCHEM_COUNTDOWN";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
FightSystem.setPostSchemState();
|
||||
|
@ -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 "SPECTATE_COUNTDOWN";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
FightSystem.setPreLeaderState();
|
||||
|
@ -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 "RUNNING_COUNTDOWN";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void countdownFinished() {
|
||||
timeOver.run();
|
||||
|
@ -24,6 +24,7 @@ import de.steamwar.fightsystem.FightSystem;
|
||||
import de.steamwar.fightsystem.countdown.Countdown;
|
||||
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;
|
||||
@ -124,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 "HELLS_BELLS_COUNTDOWN";
|
||||
public HellsBellsCountdown(int time) {
|
||||
super(time, new Message("HELLS_BELLS_COUNTDOWN"), SWSound.BLOCK_NOTE_BASS, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -216,7 +216,7 @@ public class FightTeam {
|
||||
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) {
|
||||
@ -227,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();
|
||||
@ -271,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)
|
||||
@ -418,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);
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
package de.steamwar.fightsystem.listener;
|
||||
|
||||
import de.steamwar.core.BountifulWrapper;
|
||||
import de.steamwar.fightsystem.ArenaMode;
|
||||
import de.steamwar.fightsystem.Config;
|
||||
import de.steamwar.fightsystem.FightSystem;
|
||||
@ -28,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 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.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -57,20 +52,19 @@ public class Chat implements Listener {
|
||||
if(message.startsWith(Config.TeamChatDetection)) {
|
||||
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);
|
||||
BaseComponent[] msg = TextComponent.fromLegacyText(message);
|
||||
Bukkit.getOnlinePlayers().forEach(p -> BountifulWrapper.impl.sendMessage(p, ChatMessageType.CHAT, msg));
|
||||
private void broadcastChat(String message, Object... params) {
|
||||
GlobalRecorder.getInstance().chat(message, params);
|
||||
FightSystem.getMessage().chat(message, params);
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.record.REntity;
|
||||
|
@ -30,6 +30,7 @@ import de.steamwar.fightsystem.fight.Fight;
|
||||
import de.steamwar.fightsystem.fight.FightTeam;
|
||||
import de.steamwar.fightsystem.fight.FreezeWorld;
|
||||
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;
|
||||
@ -105,6 +106,8 @@ public class PacketProcessor {
|
||||
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;
|
||||
@ -115,6 +118,8 @@ public class PacketProcessor {
|
||||
packetDecoder[0xc2] = this::bossBar;
|
||||
packetDecoder[0xc3] = this::subtitle;
|
||||
packetDecoder[0xc4] = this::printWin;
|
||||
packetDecoder[0xc5] = this::messageSubtitle;
|
||||
packetDecoder[0xc6] = this::winMessage;
|
||||
packetDecoder[0xef] = source::readUTF;
|
||||
packetDecoder[0xff] = this::tick;
|
||||
|
||||
@ -125,6 +130,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) {
|
||||
@ -242,7 +282,7 @@ public class PacketProcessor {
|
||||
private void countdown() throws IOException {
|
||||
String message = source.readUTF();
|
||||
int displaytime = source.readInt();
|
||||
String appendix = source.readUTF();
|
||||
Message appendix = readMessage();
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(p -> Countdown.sendCountdownMessage(p, message, displaytime, appendix));
|
||||
}
|
||||
@ -384,25 +424,28 @@ public class PacketProcessor {
|
||||
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);
|
||||
Bukkit.getOnlinePlayers().forEach(p -> {
|
||||
p.resetTitle();
|
||||
WorldOfColorWrapper.impl.sendTitle(p, title, subtitle, 5, 40, 5);
|
||||
});
|
||||
if(Config.replayserver() || ArenaMode.AntiReplay.contains(Config.mode)) {
|
||||
FightState.setFightState(FightState.SPECTATE);
|
||||
}else{
|
||||
new EventSpectateCountdown().enable();
|
||||
}
|
||||
}
|
||||
|
||||
private void endReplay() {
|
||||
REntity.dieAll();
|
||||
freezer.disable();
|
||||
if(Config.replayserver() || ArenaMode.AntiReplay.contains(Config.mode)) {
|
||||
FightSystem.setSpectateState(null, "Replay ends", null);
|
||||
}else{
|
||||
FightSystem.getMessage().broadcast("REPLAY_ENDS");
|
||||
new EventSpectateCountdown().enable();
|
||||
}
|
||||
replaying = false;
|
||||
}
|
||||
|
||||
@ -460,7 +503,8 @@ public class PacketProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
private Object[] readMessageParams() throws IOException {
|
||||
private Message readMessage() throws IOException {
|
||||
String msg = source.readUTF();
|
||||
List<Object> params = new ArrayList<>();
|
||||
|
||||
int type;
|
||||
@ -495,7 +539,7 @@ public class PacketProcessor {
|
||||
}
|
||||
} while(type != 0x00);
|
||||
|
||||
return params.toArray();
|
||||
return new Message(msg, params.toArray());
|
||||
}
|
||||
|
||||
private interface PacketParser{
|
||||
|
@ -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,22 +108,26 @@ public interface Recorder {
|
||||
* ShortBlockPacket (0x35) + pos relative to ArenaMinX,BluePasteY,ArenaMinZ byte, byte, byte + short BlockState
|
||||
*
|
||||
*
|
||||
* ChatPacket (0xA0) + String message
|
||||
* DEPRECATED ActionBarPacket (0xA1) + String message
|
||||
* SystemPacket (0xA2) + String message
|
||||
* CountdownPacket (0xA3) + String message, int displaytime, String appendix
|
||||
* 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
|
||||
* 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
|
||||
*
|
||||
* CommentPacket (0xfe) + String comment
|
||||
* TickPacket (0xff)
|
||||
@ -236,18 +241,18 @@ public interface Recorder {
|
||||
write(0x34, soundType, volume, pitch);
|
||||
}
|
||||
|
||||
default void chat(String s) {
|
||||
write(0xa0, s);
|
||||
}
|
||||
|
||||
default void systemChat(String s) {
|
||||
write(0xa2, s);
|
||||
}
|
||||
|
||||
default void countdown(String message, int displaytime, String appendix) {
|
||||
default void countdown(String message, int displaytime, Message appendix) {
|
||||
write(0xa3, message, displaytime, appendix);
|
||||
}
|
||||
|
||||
default void chat(String msg, Object... params) {
|
||||
write(0xa4, new Message(msg, params));
|
||||
}
|
||||
|
||||
default void system(String msg, Object... params) {
|
||||
write(0xa5, new Message(msg, params));
|
||||
}
|
||||
|
||||
default void teamIds(int blueTeamId, int redTeamId) {
|
||||
write(0xb2, blueTeamId, redTeamId);
|
||||
}
|
||||
@ -280,16 +285,27 @@ public interface Recorder {
|
||||
write(embedId, schemId, buffer.toByteArray());
|
||||
}
|
||||
|
||||
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 bossBar(double leftBlueProgress, double leftRedProgress, String leftBlueText, String leftRedText) {
|
||||
write(0xc2, leftBlueProgress, leftRedProgress, leftBlueText, leftRedText);
|
||||
}
|
||||
|
||||
default void subtitle(String subtitle) {
|
||||
write(0xc3, subtitle);
|
||||
default void subtitle(Message subtitle) {
|
||||
write(0xc5, subtitle);
|
||||
}
|
||||
|
||||
default void printWin(String title, String subtitle) {
|
||||
write(0xc4, title, 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(){
|
||||
@ -327,13 +343,15 @@ public interface Recorder {
|
||||
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, String message, Object... params) throws IOException {
|
||||
stream.writeUTF(message);
|
||||
for(Object o : params) {
|
||||
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)
|
||||
@ -355,10 +373,4 @@ public interface Recorder {
|
||||
stream.writeByte(0x00);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,27 +169,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();
|
||||
@ -200,9 +203,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;
|
||||
}
|
||||
|
38
FightSystem_Core/src/de/steamwar/fightsystem/utils/Message.java
Normale Datei
38
FightSystem_Core/src/de/steamwar/fightsystem/utils/Message.java
Normale Datei
@ -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;
|
||||
}
|
||||
}
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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){
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,11 +69,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");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,20 +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() {
|
||||
//TODO: ARRRG!
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,6 @@ public class WinconditionTimeout extends Wincondition {
|
||||
}
|
||||
|
||||
protected void timeOver() {
|
||||
win(null, "§7Zeit abgelaufen");
|
||||
win(null, "WIN_TIME_OVER");
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren