Package appeng.api.features
Interface IPlayerRegistry
public interface IPlayerRegistry
Maintains a save specific list of userids and username combinations this greatly simplifies storage internally and
gives a common place to look up and get IDs for the security framework.
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable net.minecraft.server.level.ServerPlayer
getConnected
(net.minecraft.server.MinecraftServer server, int playerId) Convenience method to get a connectedServerPlayer
for a given ME player id.static IPlayerRegistry
getMapping
(net.minecraft.server.MinecraftServer server) Gets the mapping betweenGameProfile
ids and AE2's player ids for the given server.static @Nullable IPlayerRegistry
getMapping
(net.minecraft.world.level.Level level) Convenience method to get the player registry that's associated with the server that hosts the given level.default int
getPlayerId
(com.mojang.authlib.GameProfile gameProfile) Queries AE2's internal player ID for the givenGameProfile
.int
getPlayerId
(UUID profileId) Queries AE2's internal player ID for the givenprofile UUID
.static int
getPlayerId
(net.minecraft.server.level.ServerPlayer player) Convenience method to get the ME player id associated with a connected player.@Nullable UUID
getProfileId
(int playerId) Find the storedprofile UUID
that is stored for the given ME player id, if any.
-
Method Details
-
getMapping
Gets the mapping betweenGameProfile
ids and AE2's player ids for the given server. -
getMapping
Convenience method to get the player registry that's associated with the server that hosts the given level. Null will be returned for client-side levels. -
getPlayerId
static int getPlayerId(net.minecraft.server.level.ServerPlayer player) Convenience method to get the ME player id associated with a connected player. -
getConnected
@Nullable static @Nullable net.minecraft.server.level.ServerPlayer getConnected(net.minecraft.server.MinecraftServer server, int playerId) Convenience method to get a connectedServerPlayer
for a given ME player id. This can return null for two reasons: the ME player id is unknown, or the player associated with the given ID is not logged onto the server. -
getPlayerId
default int getPlayerId(com.mojang.authlib.GameProfile gameProfile) Queries AE2's internal player ID for the givenGameProfile
. If AE2 has not assigned an ID to that player yet, it will be automatically assigned.- Returns:
- -1 if the given profile has no id set. Usually, the game should create a stable UUID even for offline players by hashing their name.
-
getPlayerId
Queries AE2's internal player ID for the givenprofile UUID
. If AE2 has not assigned an ID to that player yet, it will be automatically assigned. -
getProfileId
Find the storedprofile UUID
that is stored for the given ME player id, if any.- Returns:
- Null if no such player is known.
-