Class IdUtilLocal
java.lang.Object
com.kamikazejam.kamicommon.util.id.IdUtilLocal
Identification of a CommandSender can be done in 4 different ways.
1. CommandSender sender (the sender itself) 2. UUID senderUuid (the uuid for the sender) 3. String senderId (the string id for the sender) 4. String senderName (the name for the sender) (5). Object senderObject (any of the four above)
This works very fine for players (instances of the Player class). The UUID would be the Mojang account uuid, the id would be the stringified UUID and the name would be the current player name (it's always unique even though it can be changed).
Then there is the server console command sender (instance of ConsoleCommandSender). This one does not natively have a proper uuid, id or name. I have however given it some. It's very often practical being able to treat the console as any player.
We provide the following features: - Lookup of all the data based on one of the unique parts. - Maintained sets for All, Online and Offline.
Players are registered automatically. Console is registered with imaginary and deterministic data values. Non-standard CommandSenders must be manually registered using the register method.
1. CommandSender sender (the sender itself) 2. UUID senderUuid (the uuid for the sender) 3. String senderId (the string id for the sender) 4. String senderName (the name for the sender) (5). Object senderObject (any of the four above)
This works very fine for players (instances of the Player class). The UUID would be the Mojang account uuid, the id would be the stringified UUID and the name would be the current player name (it's always unique even though it can be changed).
Then there is the server console command sender (instance of ConsoleCommandSender). This one does not natively have a proper uuid, id or name. I have however given it some. It's very often practical being able to treat the console as any player.
We provide the following features: - Lookup of all the data based on one of the unique parts. - Maintained sets for All, Online and Offline.
Players are registered automatically. Console is registered with imaginary and deterministic data values. Non-standard CommandSenders must be manually registered using the register method.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic IdUtilLocalget()static ConsoleCommandSendergetAsConsole(Object object) static PlayergetAsPlayer(Object object) static CommandSendergetAsSender(Object object) static @NotNull Filestatic @NotNull Filestatic @NotNull ConsoleCommandSenderstatic IdDatagetDatas()static GameModegetGameMode(@Nullable Object object, GameMode def) static Stringstatic @Nullable StringgetIdFromSender(CommandSender sender) static StringgetIdFromUuid(@NotNull UUID uuid) getIds(@NotNull SenderPresence presence, @NotNull SenderType type) static com.google.gson.GsonBuilderstatic @NotNull Set<CommandSender> static SenderMapstatic SenderMapstatic Longstatic StringgetNameFromSender(@NotNull CommandSender sender) static @NotNull StringgetNameOrUUID(@NotNull Object senderObject) getNames(@NotNull SenderPresence presence, @NotNull SenderType type) static OfflinePlayergetOfflinePlayer(Object senderObject) static Playerstatic @NotNull @UnmodifiableView Map<String, CommandSender> static @NotNull @UnmodifiableView Map<CommandSender, String> static CommandSenderstatic UUIDstatic booleanstatic booleanisConsoleId(String string) static booleanisGameMode(@Nullable Object object, GameMode gm, boolean def) static booleanstatic booleanstatic booleanisPlayerId(String string) static voidvoidplayerJoinLowest(@NotNull PlayerJoinEvent event) voidplayerKickMonitor(@NotNull PlayerKickEvent event) voidplayerLeaveMonitor(@NotNull PlayerQuitEvent event) voidplayerLoginLowest(@NotNull PlayerLoginEvent event) static voidregister(CommandSender sender) voidrun()static voidstatic voidsetup(@NotNull KamiPlugin plugin) static voidunregister(CommandSender sender) static voidstatic voidstatic voidstatic voidupdate(String id, String name, long millis, SenderPresence presence) static voidupdate(String id, String name, SenderPresence presence)
-
Field Details
-
IDPREFIX
- See Also:
-
CONSOLE_ID
- See Also:
-
CONSOLE_DATA
-
CACHEFILE_TYPE
-
gson
public static final com.google.gson.Gson gson
-
-
Constructor Details
-
IdUtilLocal
public IdUtilLocal()
-
-
Method Details
-
get
-
getDatas
-
getIdToData
-
getNameToData
-
getMaintainedIds
-
getIds
@NotNull public static @NotNull @UnmodifiableView Set<String> getIds(@NotNull @NotNull SenderPresence presence, @NotNull @NotNull SenderType type) -
getMaintainedNames
-
getNames
@NotNull public static @NotNull @UnmodifiableView Set<String> getNames(@NotNull @NotNull SenderPresence presence, @NotNull @NotNull SenderType type) -
getRegistryIdToSender
@Contract(value=" -> new", pure=true) @NotNull public static @NotNull @UnmodifiableView Map<String,CommandSender> getRegistryIdToSender() -
getRegistrySenderToId
@Contract(value=" -> new", pure=true) @NotNull public static @NotNull @UnmodifiableView Map<CommandSender,String> getRegistrySenderToId() -
register
-
unregister
-
getLocalSenders
-
update
-
update
-
update
@Contract("null, null, _ -> fail") public static void update(String id, String name, SenderPresence presence) -
update
-
update
@Contract("null, null, _, _ -> fail") public static void update(String id, String name, long millis, SenderPresence presence) -
setup
-
playerLoginLowest
-
playerJoinLowest
-
playerLeaveMonitor
-
playerKickMonitor
-
getData
-
getConsole
-
getPlayer
-
getSender
-
getUUID
-
getId
-
getIdFromSender
@Contract("null -> !null") @Nullable public static @Nullable String getIdFromSender(CommandSender sender) -
getIdFromUuid
-
getName
- Returns:
- the name of the senderObject, or null if the senderObject is null/has no known name.
- See Also:
-
getNameOrUUID
- Returns:
- the name of the senderObject, or the UUID if the senderObject is null/has no known name.
-
getOfflinePlayer
-
getNameFromSender
-
isOnline
-
getMillis
-
isPlayerId
-
isPlayer
-
isConsoleId
-
isConsole
-
getAsSender
-
getAsPlayer
-
getAsConsole
@Contract(value="null -> null", pure=true) public static ConsoleCommandSender getAsConsole(Object object) -
getGameMode
-
isGameMode
-
loadDatas
public static void loadDatas() -
getCacheFile
-
getCacheFileTemp
-
saveCachefileDatas
public static void saveCachefileDatas() -
getCachefileDatas
-
run
public void run() -
getLocalPlayerDatas
-
getKamiCommonGsonBuilder
public static com.google.gson.GsonBuilder getKamiCommonGsonBuilder()
-