Compare commits

...
16 Commits
Author SHA1 Message Date
Pilzinsel64 ec694d2833 revert improvements from b284f46 2023-10-15 13:59:23 +02:00
Pascal e878c8e276 Merge branch 'GTNewHorizons:master' into master 2023-10-15 13:54:42 +02:00
Pilzinsel64 b284f46d45 revert/improve commit 538d87e 2023-10-08 17:20:07 +02:00
Pilzinsel64 a4dc958482 Merge branch 'GTNewHorizons:master' into master 2023-10-08 16:20:11 +02:00
Pilzinsel64 6a762101ad Merge branch 'GTNewHorizons:master' into master 2023-10-01 13:51:50 +02:00
Pilzinsel64 9eb040ee6f Merge branch 'GTNewHorizons:master' into master 2023-09-28 12:12:04 +02:00
Pilzinsel64 3ef15ad081 Merge branch 'GTNewHorizons:master' into master 2023-07-24 09:58:04 +02:00
Pilzinsel64 1d92c0dd7f Merge branch 'GTNewHorizons:master' into master 2023-05-09 20:21:53 +02:00
Pilzinsel64 13d6533edc Merge branch 'GTNewHorizons:master' into master 2023-05-08 18:14:50 +02:00
Pilzinsel64 a4373ebe5c Merge branch 'GTNewHorizons:master' into master 2023-05-08 08:05:01 +02:00
Pilzinsel64 f91de79376 Merge branch 'GTNewHorizons:master' into master 2023-05-01 23:14:59 +02:00
Pilzinsel64 567cd3e78b Merge branch 'GTNewHorizons:master' into master 2023-04-30 20:08:08 +02:00
Pilzinsel64 84e23b3e8e add config enforceOfflinePlayerUUID 2023-04-17 17:20:15 +02:00
Pilzinsel64 eba2bf1f86 re-add .github 2023-04-17 14:03:56 +02:00
Pilzinsel64 47bd83e29e remove .github 2023-04-17 14:03:43 +02:00
Pilzinsel64 f7b49fccdd Fix invalid check for offline UUID in UserIdent.create() (#2)
See more: https://github.com/GTNewHorizons/EnderIO/pull/118
2023-04-17 13:34:53 +02:00
2 changed files with 21 additions and 3 deletions

No files matched your search

@@ -84,6 +84,8 @@ public final class Config {
public static boolean reinforcedObsidianEnabled = true;
public static boolean reinforcedObsidianUseDarkSteelBlocks = false;
public static boolean enforceOfflinePlayerUUID = false;
public static boolean useAlternateBinderRecipe = false;
public static boolean useAlternateTesseractModel = false;
@@ -1035,6 +1037,13 @@ public final class Config {
"Enable per tick sampling on individual power inputs and outputs. This allows slightly more detailed messages from the RF Reader but has a negative impact on server performance.")
.getBoolean(detailedPowerTrackingEnabled);
enforceOfflinePlayerUUID = config.get(
sectionAdvanced.name,
"enforceOfflinePlayerUUID",
false,
"Enforces to use the players offline UUID. Recommendet to use before creating your world, otherwise it might breaks all secuity related things.")
.getBoolean(enforceOfflinePlayerUUID);
useSneakMouseWheelYetaWrench = config.get(
sectionPersonal.name,
"useSneakMouseWheelYetaWrench",
+12 -3
View File
@@ -6,6 +6,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.common.UsernameCache;
import com.enderio.core.common.util.PlayerUtil;
@@ -13,6 +14,7 @@ import com.google.common.base.Charsets;
import com.mojang.authlib.GameProfile;
import crazypants.enderio.Log;
import crazypants.enderio.config.Config;
public class UserIdent {
@@ -76,7 +78,7 @@ public class UserIdent {
* changes, implement them and write a log message.
*/
public static @Nonnull UserIdent create(@Nonnull String suuid, @Nullable String playerName) {
if (NONE_MARKER.equals(suuid)) {
if (NONE_MARKER.equals(suuid) || Config.enforceOfflinePlayerUUID) {
return new UserIdent(null, playerName);
}
try {
@@ -110,8 +112,7 @@ public class UserIdent {
*/
public static @Nonnull UserIdent create(@Nullable GameProfile gameProfile) {
if (gameProfile != null && (gameProfile.getId() != null || gameProfile.getName() != null)) {
if (gameProfile.getId() != null && gameProfile.getName() != null
&& gameProfile.getId().equals(offlineUUID(gameProfile.getName()))) {
if (gameProfile.getName() != null && (Config.enforceOfflinePlayerUUID || !isOnlineMode())) {
return new UserIdent(null, gameProfile.getName());
} else {
return new UserIdent(gameProfile.getId(), gameProfile.getName());
@@ -121,6 +122,11 @@ public class UserIdent {
}
}
private static boolean isOnlineMode() {
MinecraftServer server = MinecraftServer.getServer();
return server != null ? server.isServerInOnlineMode() : true;
}
private static @Nonnull UUID offlineUUID(String playerName) {
UUID result = UUID.nameUUIDFromBytes(("OfflinePlayer:" + playerName).getBytes(Charsets.UTF_8));
return result != null ? result : new UUID(-1, -1);
@@ -221,6 +227,9 @@ public class UserIdent {
@Override
public boolean equals(Object obj) {
if (obj instanceof UUID) {
return getUUID().equals(obj);
}
return this == obj;
}