1
0
mirror of https://github.com/chylex/Minecraft-Server-Properties-Reload.git synced 2025-02-28 17:46:05 +01:00

Add support for hide-online-players property

This commit is contained in:
chylex 2021-11-08 01:51:19 +01:00
parent 9f08aa7ce0
commit d2ed153f7f
Signed by: chylex
GPG Key ID: 4DE42C8F19A80548
3 changed files with 25 additions and 0 deletions

View File

@ -25,6 +25,7 @@ public interface DedicatedServerPropertiesMixin {
@Mutable @Accessor void setFunctionPermissionLevel(int functionPermissionLevel);
@Mutable @Accessor void setGamemode(GameType gamemode);
@Mutable @Accessor void setHardcore(boolean hardcore);
@Mutable @Accessor void setHideOnlinePlayers(boolean hideOnlinePlayers);
@Mutable @Accessor void setMaxPlayers(int maxPlayers);
@Mutable @Accessor void setMaxWorldSize(int maxWorldSize);
@Mutable @Accessor void setMotd(String motd);

View File

@ -15,6 +15,7 @@ import chylex.serverproperties.props.supported.ForceGamemodeProperty;
import chylex.serverproperties.props.supported.FunctionPermissionLevel;
import chylex.serverproperties.props.supported.GamemodeProperty;
import chylex.serverproperties.props.supported.HardcoreProperty;
import chylex.serverproperties.props.supported.HideOnlinePlayersProperty;
import chylex.serverproperties.props.supported.MaxPlayersProperty;
import chylex.serverproperties.props.supported.MaxWorldSizeProperty;
import chylex.serverproperties.props.supported.MotdProperty;
@ -87,6 +88,7 @@ public final class ServerProperties {
register("function-permission-level", FunctionPermissionLevel.INSTANCE);
register("gamemode", GamemodeProperty.INSTANCE);
register("hardcore", HardcoreProperty.INSTANCE);
register("hide-online-players", HideOnlinePlayersProperty.INSTANCE);
register("max-players", MaxPlayersProperty.INSTANCE);
register("max-world-size", MaxWorldSizeProperty.INSTANCE);
register("motd", MotdProperty.INSTANCE);

View File

@ -0,0 +1,22 @@
package chylex.serverproperties.props.supported;
import chylex.serverproperties.mixin.DedicatedServerPropertiesMixin;
import chylex.serverproperties.props.BoolServerProperty;
import chylex.serverproperties.props.PropertyChangeCallback;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.dedicated.DedicatedServerProperties;
public final class HideOnlinePlayersProperty extends BoolServerProperty {
public static final HideOnlinePlayersProperty INSTANCE = new HideOnlinePlayersProperty();
private HideOnlinePlayersProperty() {}
@Override
protected boolean getBool(final DedicatedServerProperties properties) {
return properties.hideOnlinePlayers;
}
@Override
protected void applyBool(final DedicatedServer server, final DedicatedServerPropertiesMixin target, final boolean value, final PropertyChangeCallback callback) {
target.setHideOnlinePlayers(value);
}
}