1
0

Disable name / skin overrides by default

This commit is contained in:
Ryan Fox 2023-06-09 20:01:43 -07:00
parent e5a9c1b04d
commit b617dd4d54
Signed by: flewkey
GPG Key ID: 94F56ADFD848851E
3 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import party._2a03.mc.util.Config;
import party._2a03.mc.util.Database; import party._2a03.mc.util.Database;
import party._2a03.mc.util.PlayerData; import party._2a03.mc.util.PlayerData;
@ -24,6 +25,8 @@ public class MixinGameProfile {
UUID uuid = ((GameProfile)(Object)this).getId(); UUID uuid = ((GameProfile)(Object)this).getId();
if (uuid == null) // wait until UUID is set if (uuid == null) // wait until UUID is set
return; return;
if (!Config.getBool("overrideNames"))
return;
if (this.server_name == "") { if (this.server_name == "") {
PlayerData playerdata = Database.getPlayer(uuid.toString()); PlayerData playerdata = Database.getPlayer(uuid.toString());
this.server_name = playerdata.getName(); this.server_name = playerdata.getName();

View File

@ -19,6 +19,8 @@ import party._2a03.mc.util.PlayerData;
public abstract class MixinPlayerManager { public abstract class MixinPlayerManager {
@Inject(method = "onPlayerConnect", at = @At(value = "HEAD")) @Inject(method = "onPlayerConnect", at = @At(value = "HEAD"))
void onConnect(ClientConnection connection, ServerPlayerEntity player, CallbackInfo ci) { void onConnect(ClientConnection connection, ServerPlayerEntity player, CallbackInfo ci) {
if (!Config.getBool("overrideSkins"))
return;
PlayerData playerdata = Database.getPlayer(player.getGameProfile().getId()); PlayerData playerdata = Database.getPlayer(player.getGameProfile().getId());
PropertyMap map = player.getGameProfile().getProperties(); PropertyMap map = player.getGameProfile().getProperties();
map.removeAll("textures"); map.removeAll("textures");

View File

@ -35,6 +35,8 @@ public class Config {
json = new JSONObject(); json = new JSONObject();
} }
setDefault("overrideNames", false);
setDefault("overrideSkins", false);
setDefault("persistentFlight", false); setDefault("persistentFlight", false);
setDefault("disableFlyCommand", true); setDefault("disableFlyCommand", true);
setDefault("disableTntExplosions", false); setDefault("disableTntExplosions", false);