geforkt von Mirrors/Velocity
Prettier, conciser, and more useful ProtocolVersion#toString()
Dieser Commit ist enthalten in:
Ursprung
c30cc66461
Commit
c5dcfb1ba6
@ -1,5 +1,6 @@
|
|||||||
package com.velocitypowered.proxy.protocol;
|
package com.velocitypowered.proxy.protocol;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.primitives.ImmutableIntArray;
|
import com.google.common.primitives.ImmutableIntArray;
|
||||||
import com.velocitypowered.proxy.protocol.packet.*;
|
import com.velocitypowered.proxy.protocol.packet.*;
|
||||||
import io.netty.util.collection.IntObjectHashMap;
|
import io.netty.util.collection.IntObjectHashMap;
|
||||||
@ -258,9 +259,18 @@ public enum StateRegistry {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
StringBuilder mappingAsString = new StringBuilder("{");
|
||||||
|
for (Object2IntMap.Entry<Class<? extends MinecraftPacket>> entry : packetClassToId.object2IntEntrySet()) {
|
||||||
|
mappingAsString.append(entry.getKey().getSimpleName()).append(" -> ")
|
||||||
|
.append("0x")
|
||||||
|
.append(Strings.padStart(Integer.toHexString(entry.getIntValue()), 2, '0'))
|
||||||
|
.append(", ");
|
||||||
|
}
|
||||||
|
mappingAsString.setLength(mappingAsString.length() - 2);
|
||||||
|
mappingAsString.append("}");
|
||||||
return "ProtocolVersion{" +
|
return "ProtocolVersion{" +
|
||||||
"id=" + id +
|
"id=" + id +
|
||||||
", packetClassToId=" + packetClassToId +
|
", packetClassToId=" + mappingAsString.toString() +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren