Organize PlayerInfoData by constructor order
Dieser Commit ist enthalten in:
Ursprung
776eeb898f
Commit
0af57b853e
@ -3,6 +3,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.comphenix.protocol.wrappers;
|
package com.comphenix.protocol.wrappers;
|
||||||
|
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.reflect.EquivalentConverter;
|
import com.comphenix.protocol.reflect.EquivalentConverter;
|
||||||
import com.comphenix.protocol.reflect.StructureModifier;
|
import com.comphenix.protocol.reflect.StructureModifier;
|
||||||
@ -10,8 +12,6 @@ import com.comphenix.protocol.utility.MinecraftReflection;
|
|||||||
import com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode;
|
import com.comphenix.protocol.wrappers.EnumWrappers.NativeGameMode;
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author dmulloy2
|
* @author dmulloy2
|
||||||
*/
|
*/
|
||||||
@ -20,8 +20,8 @@ public class PlayerInfoData {
|
|||||||
private static Constructor<?> constructor;
|
private static Constructor<?> constructor;
|
||||||
|
|
||||||
protected final PacketContainer packet;
|
protected final PacketContainer packet;
|
||||||
protected final int ping;
|
|
||||||
protected final NativeGameMode gameMode;
|
protected final NativeGameMode gameMode;
|
||||||
|
protected final int ping;
|
||||||
protected final WrappedGameProfile profile;
|
protected final WrappedGameProfile profile;
|
||||||
protected final WrappedChatComponent displayName;
|
protected final WrappedChatComponent displayName;
|
||||||
|
|
||||||
@ -33,14 +33,18 @@ public class PlayerInfoData {
|
|||||||
this.displayName = displayName;
|
this.displayName = displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getPing() {
|
public PacketContainer getPacket() {
|
||||||
return ping;
|
return packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NativeGameMode getGameMode() {
|
public NativeGameMode getGameMode() {
|
||||||
return gameMode;
|
return gameMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPing() {
|
||||||
|
return ping;
|
||||||
|
}
|
||||||
|
|
||||||
public WrappedGameProfile getProfile() {
|
public WrappedGameProfile getProfile() {
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
@ -82,7 +86,7 @@ public class PlayerInfoData {
|
|||||||
);
|
);
|
||||||
return result;
|
return result;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException("Cannot construct BlockPosition.", e);
|
throw new RuntimeException("Failed to construct PlayerInfoData.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +118,7 @@ public class PlayerInfoData {
|
|||||||
return new PlayerInfoData(PacketContainer.fromPacket(packet), gameMode, ping, gameProfile, displayName);
|
return new PlayerInfoData(PacketContainer.fromPacket(packet), gameMode, ping, gameProfile, displayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, return NULL
|
// Otherwise, return null
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,7 +139,7 @@ public class PlayerInfoData {
|
|||||||
// Only compare objects of similar type
|
// Only compare objects of similar type
|
||||||
if (obj instanceof PlayerInfoData) {
|
if (obj instanceof PlayerInfoData) {
|
||||||
PlayerInfoData other = (PlayerInfoData) obj;
|
PlayerInfoData other = (PlayerInfoData) obj;
|
||||||
return ping == other.ping && gameMode == other.gameMode
|
return packet.equals(other.packet) && gameMode == other.gameMode && ping == other.ping
|
||||||
&& profile.equals(other.profile) && displayName.equals(other.displayName);
|
&& profile.equals(other.profile) && displayName.equals(other.displayName);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -143,11 +147,11 @@ public class PlayerInfoData {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hashCode(ping, gameMode, profile, displayName);
|
return Objects.hashCode(packet, gameMode, ping, profile, displayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("PlayerInfoData[ping=%s,gameMode=%s,profile=%s,displayName=%s]", ping, gameMode, profile, displayName);
|
return String.format("PlayerInfoData[gameMode=%s,ping=%s,profile=%s,displayName=%s]", gameMode, ping, profile, displayName);
|
||||||
}
|
}
|
||||||
}
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren