SteamWar/FightSystem
Archiviert
13
1

RecordSystem (Beta) #199

Manuell gemergt
Lixfel hat 40 Commits von recordSystem nach master 2020-11-01 20:11:45 +01:00 zusammengeführt
4 geänderte Dateien mit 29 neuen und 4 gelöschten Zeilen
Nur Änderungen aus Commit 626dbe9660 werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -128,6 +128,7 @@ public class Config {
//live recorder parameter
public static final String spectateIP = "127.0.0.1";
public static final int spectatePort = 2222;
public static final boolean recording;
static{
File worldConfigFile = new File(Bukkit.getWorlds().get(0).getWorldFolder(), "config.yml");
@ -379,6 +380,8 @@ public class Config {
CheckSchemID = Integer.parseInt(System.getProperty("checkSchemID", "0"));
Ranked = Boolean.parseBoolean(System.getProperty("ranked", "false"));
recording = event();
}
public static boolean event(){

Datei anzeigen

@ -8,6 +8,7 @@ import de.steamwar.fightsystem.states.FightState;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;

Datei anzeigen

@ -4,6 +4,7 @@ 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.RecordSystem;
import de.steamwar.fightsystem.states.FightState;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.TextComponent;
@ -43,6 +44,8 @@ public class PlayerChatListener extends BasicListener {
}
private void broadcastChat(String message) {
if (Config.recording)
RecordSystem.chat(message);
BaseComponent[] msg = TextComponent.fromLegacyText(message);
for(Player p : Bukkit.getOnlinePlayers())
toChat(p, msg);

Datei anzeigen

@ -40,7 +40,7 @@ public class RecordSystem {
*
* */
public static void playerJoins(Player p){
public static synchronized void playerJoins(Player p){
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
Recorder.rByte(0x00);
@ -49,7 +49,7 @@ public class RecordSystem {
entityMoves(p);
}
public static void entityMoves(Entity e){
public static synchronized void entityMoves(Entity e){
Location location = e.getLocation();
Recorder.rByte(0x01);
@ -62,12 +62,30 @@ public class RecordSystem {
Recorder.flush();
}
public static void entityDespawns(Entity e){
public static synchronized void entityDespawns(Entity e){
Recorder.rByte(0x02);
Recorder.rInt(e.getEntityId());
Recorder.flush();
}
public static synchronized void chat(String s) {
Recorder.rByte(0xA0);
Recorder.rString(s);
Recorder.flush();
}
public static synchronized void actionBar(String s) {
Recorder.rByte(0xA1);
Recorder.rString(s);
Recorder.flush();
}
public static synchronized void systemChat(String s) {
Recorder.rByte(0xA2);
Recorder.rString(s);
Recorder.flush();
}
private static void checkWorldState(){
//TODO: Entity position transmissions
}