mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-12 16:27:49 +00:00
More data sent in the player message, renamed it to playerstatus
This commit is contained in:
1 parent
be53815b57
commit
67bb9e0c77
5 files changed
+64
-43
No files matched your search
@@ -40,7 +40,7 @@ import mcp.mobius.opis.data.holders.newtypes.DataTiming;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataTimingMillisecond;
|
||||
import mcp.mobius.opis.data.holders.newtypes.NexusAuth;
|
||||
import mcp.mobius.opis.data.holders.newtypes.NexusData;
|
||||
import mcp.mobius.opis.data.holders.newtypes.PlayerLogging;
|
||||
import mcp.mobius.opis.data.holders.newtypes.PlayerStatus;
|
||||
import mcp.mobius.opis.data.holders.stats.StatAbstract;
|
||||
import mcp.mobius.opis.data.holders.stats.StatsChunk;
|
||||
|
||||
@@ -86,7 +86,7 @@ public enum DataType {
|
||||
STATSCHUNK (StatsChunk.class),
|
||||
NEXUSDATA (NexusData.class),
|
||||
NEXUSAUTH (NexusAuth.class),
|
||||
PLAYERLOGGING (PlayerLogging.class);
|
||||
PLAYERLOGGING (PlayerStatus.class);
|
||||
|
||||
private Class clazz;
|
||||
private static HashBiMap<DataType, Class> bimap = HashBiMap.create(50);
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialString;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
public class PlayerLogging implements ISerializable {
|
||||
|
||||
CachedString name;
|
||||
boolean status;
|
||||
|
||||
public PlayerLogging(String name, boolean status){
|
||||
this.name = new CachedString(name);
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public PlayerLogging(CachedString name, boolean status){
|
||||
this.name = name;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToStream(ByteArrayDataOutput stream){
|
||||
this.name.writeToStream(stream);
|
||||
stream.writeBoolean(this.status);
|
||||
}
|
||||
|
||||
public static PlayerLogging readFromStream(ByteArrayDataInput stream){
|
||||
return new PlayerLogging(
|
||||
CachedString.readFromStream(stream),
|
||||
stream.readBoolean()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package mcp.mobius.opis.data.holders.newtypes;
|
||||
|
||||
import mcp.mobius.opis.data.holders.ISerializable;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialString;
|
||||
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
|
||||
public class PlayerStatus implements ISerializable {
|
||||
|
||||
CachedString name;
|
||||
boolean status;
|
||||
int x, y, z, dim;
|
||||
|
||||
public PlayerStatus(String name, boolean status, int dim, int x, int y, int z){
|
||||
this.name = new CachedString(name);
|
||||
this.status = status;
|
||||
this.dim = dim;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
public PlayerStatus(CachedString name, boolean status, int dim, int x, int y, int z){
|
||||
this.name = name;
|
||||
this.status = status;
|
||||
this.dim = dim;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void writeToStream(ByteArrayDataOutput stream){
|
||||
this.name.writeToStream(stream);
|
||||
stream.writeBoolean(this.status);
|
||||
stream.writeInt(dim);
|
||||
stream.writeInt(x);
|
||||
stream.writeInt(y);
|
||||
stream.writeInt(z);
|
||||
}
|
||||
|
||||
public static PlayerStatus readFromStream(ByteArrayDataInput stream){
|
||||
return new PlayerStatus(
|
||||
CachedString.readFromStream(stream),
|
||||
stream.readBoolean(),
|
||||
stream.readInt(),
|
||||
stream.readInt(),
|
||||
stream.readInt(),
|
||||
stream.readInt()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import mcp.mobius.opis.modOpis;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialLong;
|
||||
import mcp.mobius.opis.data.holders.newtypes.PlayerLogging;
|
||||
import mcp.mobius.opis.data.holders.newtypes.PlayerStatus;
|
||||
import mcp.mobius.opis.data.managers.StringCache;
|
||||
import mcp.mobius.opis.gui.overlay.OverlayStatus;
|
||||
import mcp.mobius.opis.network.PacketManager;
|
||||
@@ -106,7 +106,9 @@ public enum PlayerTracker{
|
||||
this.playerDimension.remove(event.player);
|
||||
//this.playersOpis.remove(player);
|
||||
this.playersSwing.remove(event.player);
|
||||
PacketManager.sendPacketToAllSwing(new NetDataValue(Message.PLAYER_ONLINE_CHANGED, new PlayerLogging(event.player.getGameProfile().getName(), false)));
|
||||
PacketManager.sendPacketToAllSwing(new NetDataValue(Message.PLAYER_STATUS_UPDATE,
|
||||
new PlayerStatus(event.player.getGameProfile().getName(), false,
|
||||
event.player.worldObj.provider.dimensionId, (int)event.player.posX, (int)event.player.posY, (int)event.player.posZ)));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -121,6 +123,8 @@ public enum PlayerTracker{
|
||||
*/
|
||||
|
||||
StringCache.INSTANCE.syncCache((EntityPlayerMP)event.player);
|
||||
PacketManager.sendPacketToAllSwing(new NetDataValue(Message.PLAYER_ONLINE_CHANGED, new PlayerLogging(event.player.getGameProfile().getName(), true)));
|
||||
PacketManager.sendPacketToAllSwing(new NetDataValue(Message.PLAYER_STATUS_UPDATE,
|
||||
new PlayerStatus(event.player.getGameProfile().getName(), true,
|
||||
event.player.worldObj.provider.dimensionId, (int)event.player.posX, (int)event.player.posY, (int)event.player.posZ)));
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public enum Message {
|
||||
SWING_TAB_CHANGED,
|
||||
NEXUS_UUID, // Login data for the nexus system
|
||||
NEXUS_DATA, // Data blob with everything needed to update the summary screen in realtime
|
||||
PLAYER_ONLINE_CHANGED; // Sent when the online/offline status of a player changes
|
||||
PLAYER_STATUS_UPDATE; // Update for the players (name, position, offline/online, etc)
|
||||
|
||||
private AccessLevel accessLevel = AccessLevel.NONE;
|
||||
private EnumSet<SelectedTab> tabEnum;
|
||||
|
||||
Reference in new issue
Block a user