Package dev.koifysh.archipelago
Class Client
java.lang.Object
dev.koifysh.archipelago.Client
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd a tag to your list, keeping all previous tags intact.booleancheckLocation(long locationID) inform the Archipelago server that a location ID has been checked.booleancheckLocations(Collection<Long> locationIDs) inform the Archipelago server that a collection of location ID has been checked.voidclose()closes a connection to the Archipelago server if connected.voidWorks exactly likeconnect(URI, boolean)with allowDowngrade set to true;voidWorks exactly likeconnect(URI, boolean)but allowDowngrade is FalsevoidEquivalent toconnect(URI, boolean, SocketFactory)socketFactory being null.voidconnect(URI address, boolean allowDowngrade, SocketFactory socketFactory) Connects to an Archipelago server with previously provided info.intdataStorageGet(Collection<String> keys) Uses DataStorage to reterieve a value from the server will get value back though aRetrievedEvent.intdataStorageSet(SetPacket setPacket) Uses DataStorage to save a value on the AP server.voiddataStorageSetNotify(Collection<String> keys) Registers to receive updates of when a key in the Datastorage has been changed on the server.voiddisconnects from a connected Archipelago server.getAlias()gets the alias of this slot.getGame()intintfetch the itemflags that have been set, bitwise Or againstItemsHandlingto read.fetches theintgetSlot()getTags()intgetTeam()getUUID()Gets the UUID of this client.booleanReturns true only if connected to an Archipelago server.protected voidabstract voidabstract voidvoidthis should not need to be called externally but is left public just in case.voidremoves supplied tag, if it exists.voidvoidscoutLocations(ArrayList<Long> locationIDs) Ask the server for information about what is in locations.voidscoutLocations(ArrayList<Long> locationIDs, CreateAsHint createAsHint) voidsendBounce(BouncePacket bouncePacket) voidSends a Chat message to all other connected Clients.voidSets the name of the game to send to Archipelago's serversvoidsetGameState(ClientStatus status) Update the current game status.voidsetItemsHandlingFlags(int itemsHandlingFlags) fetch the itemflags that have been set, bitwise Or againstItemsHandlingto read.voidsets the slot name to connect to an Archcipelago server with.voidsetPassword(String password) sets a password to authenticate with to join a password protected room.voidoverwrite, and set all tags sent to the Archipelago server.voidsync()manually trigger a resync to the Archipelago server.
-
Field Details
-
versions
-
games
-
client
-
protocolVersion
-
-
Constructor Details
-
Client
public Client()
-
-
Method Details
-
setGame
Sets the name of the game to send to Archipelago's servers- Parameters:
game- the name of your game.
-
setTags
overwrite, and set all tags sent to the Archipelago server. this will overwrite any previous tags that have been set.- Parameters:
tags- a Set of tags to send.
-
addTag
add a tag to your list, keeping all previous tags intact.- Parameters:
tag- String tag to be added.
-
removeTag
removes supplied tag, if it exists.- Parameters:
tag- String tag to be removed.
-
loadDataPackage
protected void loadDataPackage() -
saveDataPackage
public void saveDataPackage() -
isConnected
public boolean isConnected()Returns true only if connected to an Archipelago server.- Returns:
- true if connected, otherwise false
-
close
public void close()closes a connection to the Archipelago server if connected. -
setPassword
sets a password to authenticate with to join a password protected room.- Parameters:
password- room password
-
setName
sets the slot name to connect to an Archcipelago server with.- Parameters:
name-
-
getTeam
public int getTeam()- Returns:
- team ID
-
getSlot
public int getSlot()- Returns:
- Slot ID
-
getRoomInfo
fetches the- Returns:
- Room info.
-
getSlotInfo
-
connect
Works exactly likeconnect(URI, boolean)with allowDowngrade set to true;- Parameters:
address-- Throws:
URISyntaxException- on malformed address
-
connect
Works exactly likeconnect(URI, boolean)but allowDowngrade is False- Parameters:
address- Address to connect to
-
connect
Equivalent toconnect(URI, boolean, SocketFactory)socketFactory being null. -
connect
Connects to an Archipelago server with previously provided info.
supply the following info before calling this method
game:setGame(String)
slot name:setName(String)
if no protocolwss://orws://is given will attempt a ssl connection to the supplied address, if that fails it will then try a non-ssl connection, unlessallowDowngradeis false.
Do not prefixaddresswithwss://orws://. let the user enter a protocol to use. by default ssl will be tried first, if that fails then non-ssl will be used. unlessallowDowngradeis set to false.- Parameters:
address- address of the archipelago server.allowDowngrade- if set to false will prevent auto downgrade of ssl connection.
-
sendChat
Sends a Chat message to all other connected Clients.- Parameters:
message- Message to send.
-
checkLocation
public boolean checkLocation(long locationID) inform the Archipelago server that a location ID has been checked.- Parameters:
locationID- id of a location.- Returns:
- true if packet was successfully sent. False if not connected or otherwise failed to send.
-
checkLocations
inform the Archipelago server that a collection of location ID has been checked.- Parameters:
locationIDs- a collection of a locations.- Returns:
- true if packet was successfully sent. False if not connected or otherwise failed to send.
-
scoutLocations
Ask the server for information about what is in locations. you will get a response in theLocationInfoEventevent.- Parameters:
locationIDs- List of location ID's to request info on.
-
scoutLocations
-
onError
-
onClose
-
getDataPackage
-
getMyName
-
getPassword
-
getHintPoints
public int getHintPoints() -
getGame
-
getConnectedAddress
-
reconnect
public void reconnect()this should not need to be called externally but is left public just in case. -
getUUID
Gets the UUID of this client.- Returns:
- UUID of the client, this should theoretically never change.
-
getAlias
gets the alias of this slot.- Returns:
- Alias of the slot connected to.
-
getLocationManager
-
getItemManager
-
setGameState
Update the current game status.- Parameters:
status- aClientStatusto send to the server.- See Also:
-
sync
public void sync()manually trigger a resync to the Archipelago server. this should be done automatically if the library detects a desync. -
sendBounce
-
disconnect
public void disconnect()disconnects from a connected Archipelago server. -
getTags
- Returns:
- set of tags currently in use.
-
getItemsHandlingFlags
public int getItemsHandlingFlags()fetch the itemflags that have been set, bitwise Or againstItemsHandlingto read.- Returns:
- items handling int.
-
setItemsHandlingFlags
public void setItemsHandlingFlags(int itemsHandlingFlags) fetch the itemflags that have been set, bitwise Or againstItemsHandlingto read. -
getEventManager
- Returns:
- the event manager.
-
dataStorageSet
Uses DataStorage to save a value on the AP server. -
dataStorageSetNotify
Registers to receive updates of when a key in the Datastorage has been changed on the server.- Parameters:
keys- List of Keys to be notified of.
-
dataStorageGet
Uses DataStorage to reterieve a value from the server will get value back though aRetrievedEvent.
see following table for list of reserved keys.Name Type Notes hints_{team}_{slot} list[Hint] All Hints belonging to the requested Player. slot_data_{slot} dict[str, any] slot_data belonging to the requested slot. item_name_groups_{game_name} dict[str, list[str]] item_name_groups belonging to the requested game. location_name_groups_{game_name} dict[str, list[str]] location_name_groups belonging to the requested game. client_status_{team}_{slot} ClientStatus The current game status of the requested player. race_mode int 0 if race mode is disabled, and 1 if it's enabled. - Parameters:
keys- a list of keys to retrieve values for
-