mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-12 17:07:55 -04:00
Remove Log::game references on protocol level (in packet classes)
This commit is contained in:
parent
ddd33e4132
commit
1a6fed4b52
@ -94,4 +94,9 @@ public class PlayerListItemBulk {
|
|||||||
public PacketPlayerListItem.PlayerListItemActions getAction() {
|
public PacketPlayerListItem.PlayerListItemActions getAction() {
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("uuid=%s, action=%s, name=%s, gameMode=%s, ping=%d, displayName=%s", getUUID(), getAction(), getName(), getGameMode(), getPing(), getDisplayName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,9 @@ public class Log {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void log(LogLevels level, String prefix, String message, RGBColor color) {
|
public static void log(LogLevels level, String prefix, String message, RGBColor color) {
|
||||||
|
if (message.isBlank()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (level.ordinal() > Log.level.ordinal()) {
|
if (level.ordinal() > Log.level.ordinal()) {
|
||||||
// log level too low
|
// log level too low
|
||||||
return;
|
return;
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
package de.bixilon.minosoft.protocol.packets.clientbound.play;
|
package de.bixilon.minosoft.protocol.packets.clientbound.play;
|
||||||
|
|
||||||
import de.bixilon.minosoft.data.GameModes;
|
|
||||||
import de.bixilon.minosoft.data.MapSet;
|
import de.bixilon.minosoft.data.MapSet;
|
||||||
import de.bixilon.minosoft.data.VersionValueMap;
|
import de.bixilon.minosoft.data.VersionValueMap;
|
||||||
import de.bixilon.minosoft.logging.Log;
|
import de.bixilon.minosoft.logging.Log;
|
||||||
@ -39,12 +38,7 @@ public class PacketChangeGameState implements ClientboundPacket {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void log() {
|
public void log() {
|
||||||
switch (getReason()) {
|
Log.protocol(String.format("Received game status change (%s)", getReason()));
|
||||||
case START_RAIN -> Log.game("Received weather packet: Starting rain...");
|
|
||||||
case END_RAIN -> Log.game("Received weather packet: Stopping rain...");
|
|
||||||
case CHANGE_GAMEMODE -> Log.game(String.format("Received game mode change: Now in %s", GameModes.byId(getValue().intValue())));
|
|
||||||
default -> Log.protocol(String.format("Received game status change (%s)", getReason()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Reason getReason() {
|
public Reason getReason() {
|
||||||
|
@ -35,7 +35,7 @@ public class PacketDisconnect implements ClientboundPacket {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void log() {
|
public void log() {
|
||||||
Log.game(String.format("Disconnected: %s", reason.getANSIColoredMessage()));
|
Log.protocol(String.format("Received disconnect packet (reason=\"%s\")", reason.getANSIColoredMessage()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatComponent getReason() {
|
public ChatComponent getReason() {
|
||||||
|
@ -57,7 +57,7 @@ public class PacketEntityEffect implements ClientboundPacket {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void log() {
|
public void log() {
|
||||||
Log.game(String.format("Entity effect added: %d %s", entityId, effect.toString()));
|
Log.protocol(String.format("Entity effect added: %d %s", entityId, effect.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEntityId() {
|
public int getEntityId() {
|
||||||
|
@ -83,11 +83,7 @@ public class PacketPlayerListItem implements ClientboundPacket {
|
|||||||
@Override
|
@Override
|
||||||
public void log() {
|
public void log() {
|
||||||
for (PlayerListItemBulk property : playerList) {
|
for (PlayerListItemBulk property : playerList) {
|
||||||
if (property.isLegacy()) {
|
Log.protocol(String.format("Received player list item bulk (%s)", property));
|
||||||
Log.game(String.format("[TAB] Player list item bulk (uuid=%s, name=%s, ping=%d)", property.getUUID(), property.getName(), property.getPing()));
|
|
||||||
} else {
|
|
||||||
Log.game(String.format("[TAB] Player list item bulk (uuid=%s, action=%s, name=%s, gameMode=%s, ping=%d, displayName=%s)", property.getUUID(), property.getAction(), property.getName(), property.getGameMode(), property.getPing(), property.getDisplayName()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public class PacketRemoveEntityEffect implements ClientboundPacket {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void log() {
|
public void log() {
|
||||||
Log.game(String.format("Entity effect removed (entityId=%d, effect=%s)", entityId, effect));
|
Log.protocol(String.format("Entity effect removed (entityId=%d, effect=%s)", entityId, effect));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEntityId() {
|
public int getEntityId() {
|
||||||
|
@ -44,7 +44,7 @@ public class PacketUpdateSignReceiving implements ClientboundPacket {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void log() {
|
public void log() {
|
||||||
Log.game(String.format("Sign data received at: %s", position));
|
Log.protocol(String.format("Sign data received at: %s", position));
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockPosition getPosition() {
|
public BlockPosition getPosition() {
|
||||||
|
@ -266,6 +266,13 @@ public class PacketHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.game(switch (pkg.getReason()) {
|
||||||
|
case START_RAIN -> "Received weather packet: Starting rain...";
|
||||||
|
case END_RAIN -> "Received weather packet: Stopping rain...";
|
||||||
|
case CHANGE_GAMEMODE -> String.format("Received game mode change: Now in %s", GameModes.byId(pkg.getValue().intValue()));
|
||||||
|
default -> "";
|
||||||
|
});
|
||||||
|
|
||||||
switch (pkg.getReason()) {
|
switch (pkg.getReason()) {
|
||||||
case START_RAIN -> connection.getPlayer().getWorld().setRaining(true);
|
case START_RAIN -> connection.getPlayer().getWorld().setRaining(true);
|
||||||
case END_RAIN -> connection.getPlayer().getWorld().setRaining(false);
|
case END_RAIN -> connection.getPlayer().getWorld().setRaining(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user