Add SpectateConnection chat
Dieser Commit ist enthalten in:
Ursprung
ab15562e06
Commit
626dbe9660
@ -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(){
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
@ -42,7 +43,9 @@ public class PlayerChatListener extends BasicListener {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
private void broadcastChat(String message){
|
||||
private void broadcastChat(String message) {
|
||||
if (Config.recording)
|
||||
RecordSystem.chat(message);
|
||||
BaseComponent[] msg = TextComponent.fromLegacyText(message);
|
||||
for(Player p : Bukkit.getOnlinePlayers())
|
||||
toChat(p, msg);
|
||||
|
@ -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
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren