mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-28 07:55:41 +00:00
[ci skip] spotlessApply with the new settings
This commit is contained in:
1 parent
8d02293e71
commit
275d137ba8
775 files changed
+10673
-8709
No files matched your search
@@ -1,16 +1,20 @@
|
||||
package crazypants.util;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.UsernameCache;
|
||||
|
||||
import com.enderio.core.common.util.PlayerUtil;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import crazypants.enderio.Log;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.UsernameCache;
|
||||
|
||||
public class UserIdent {
|
||||
|
||||
private static final String NONE_MARKER = "none";
|
||||
private final @Nullable UUID uuid;
|
||||
private final @Nonnull UUID uuid_offline;
|
||||
@@ -37,9 +41,8 @@ public class UserIdent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a UserIdent from a UUID object and a name. Use this when reading
|
||||
* stored data, it will check for username changes, implement them and write a
|
||||
* log message.
|
||||
* Create a UserIdent from a UUID object and a name. Use this when reading stored data, it will check for username
|
||||
* changes, implement them and write a log message.
|
||||
*/
|
||||
public static @Nonnull UserIdent create(@Nullable UUID uuid, @Nullable String playerName) {
|
||||
if (uuid != null) {
|
||||
@@ -49,8 +52,13 @@ public class UserIdent {
|
||||
if (playerName != null) {
|
||||
String lastKnownName = UsernameCache.getLastKnownUsername(uuid);
|
||||
if (lastKnownName != null && !lastKnownName.equals(playerName)) {
|
||||
Log.warn("The user with the UUID " + uuid + " changed name from '" + playerName + "' to '"
|
||||
+ lastKnownName + "'");
|
||||
Log.warn(
|
||||
"The user with the UUID " + uuid
|
||||
+ " changed name from '"
|
||||
+ playerName
|
||||
+ "' to '"
|
||||
+ lastKnownName
|
||||
+ "'");
|
||||
return new UserIdent(uuid, lastKnownName);
|
||||
}
|
||||
}
|
||||
@@ -63,9 +71,8 @@ public class UserIdent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a UserIdent from a UUID string and a name. Use this when reading
|
||||
* stored data, it will check for username changes, implement them and write a
|
||||
* log message.
|
||||
* Create a UserIdent from a UUID string and a name. Use this when reading stored data, it will check for username
|
||||
* changes, implement them and write a log message.
|
||||
*/
|
||||
public static @Nonnull UserIdent create(@Nonnull String suuid, @Nullable String playerName) {
|
||||
if (NONE_MARKER.equals(suuid)) {
|
||||
@@ -83,8 +90,8 @@ public class UserIdent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a UserIdent from a legacy string. The string can either be a UUID or
|
||||
* a player name. Use this when reading legacy data or user configured values.
|
||||
* Create a UserIdent from a legacy string. The string can either be a UUID or a player name. Use this when reading
|
||||
* legacy data or user configured values.
|
||||
*/
|
||||
public static @Nonnull UserIdent create(@Nullable String legacyData) {
|
||||
UUID uuid = PlayerUtil.getPlayerUIDUnstable(legacyData);
|
||||
@@ -98,13 +105,11 @@ public class UserIdent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a UserIdent from a GameProfile. Use this when creating a UserIdent
|
||||
* for a currently active player.
|
||||
* Create a UserIdent from a GameProfile. Use this when creating a UserIdent for a currently active player.
|
||||
*/
|
||||
public static @Nonnull UserIdent create(@Nullable GameProfile gameProfile) {
|
||||
if (gameProfile != null && (gameProfile.getId() != null || gameProfile.getName() != null)) {
|
||||
if (gameProfile.getId() != null
|
||||
&& gameProfile.getName() != null
|
||||
if (gameProfile.getId() != null && gameProfile.getName() != null
|
||||
&& gameProfile.getId().equals(offlineUUID(gameProfile.getName()))) {
|
||||
return new UserIdent(null, gameProfile.getName());
|
||||
} else {
|
||||
@@ -138,8 +143,7 @@ public class UserIdent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Please note that a UserIdent will successfully equal against GameProfiles
|
||||
* and UUIDs.
|
||||
* Please note that a UserIdent will successfully equal against GameProfiles and UUIDs.
|
||||
*/
|
||||
@SuppressWarnings("null")
|
||||
// it's final(!), eclipse...
|
||||
@@ -207,6 +211,7 @@ public class UserIdent {
|
||||
public static final @Nonnull Nobody nobody = new Nobody();
|
||||
|
||||
private static class Nobody extends UserIdent {
|
||||
|
||||
private static final String NOBODY_MARKER = "nobody";
|
||||
|
||||
private Nobody() {
|
||||
|
||||
Reference in new issue
Block a user