Package io.github.archipelagomw
Class Client
java.lang.Object
io.github.archipelagomw.Client
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd a tag to your list, keeping all previous tags intact.checkLocation(long locationID) inform the Archipelago server that a location ID has been checked.checkLocations(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.createHints(List<Long> locations) Creates hints for the provided locations with this client's slotcreateHints(List<Long> locations, int player) Creates hints for the provided locationscreateHints(List<Long> locations, int player, HintStatus status) Creates hints for the provided locationsdataStorageGet(Collection<String> keys) Uses DataStorage to reterieve a value from the server will get value back though aRetrievedEvent.dataStorageSet(SetPacket setPacket) Uses DataStorage to save a value on the AP server.dataStorageSetNotify(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.protected <T> APResult<T>getAlias()gets the alias of this slot.getGame()intintfetch the itemflags that have been set, bitwise Or againstItemsHandlingto read.fetches theintgetSlot()getTags()intgetTeam()static StringgetUUID()Gets the UUID of clients on this machinebooleanReturns 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.removes supplied tag, if it exists.voidscoutLocations(ArrayList<Long> locationIDs) Ask the server for information about what is in locations.scoutLocations(ArrayList<Long> locationIDs, CreateAsHint createAsHint) Ask the server for information about what is in locations.sendBounce(BouncePacket bouncePacket) sends a bouncepacket to the server, such as for deathlinkSends a Chat message to all other connected Clients.sendDeathlink(String source, String cause) Helper for sending a death link bounce packet.sendPackets(List<APPacket> packets) Enables sending multiple packets at once.setDeathLinkEnabled(boolean enabled) Enable or disable receiving death links.voidSets the name of the game to send to Archipelago's serverssetGameState(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.overwrite, and set all tags sent to the Archipelago server.sync()manually trigger a resync to the Archipelago server.
-
Field Details
-
protocolVersion
-
versions
-
games
-
client
-
-
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.- Returns:
- Whether the send was successful or not
-
addTag
add a tag to your list, keeping all previous tags intact.- Parameters:
tag- String tag to be added.- Returns:
- Whether the send was successful or not
-
removeTag
removes supplied tag, if it exists.- Parameters:
tag- String tag to be removed.- Returns:
- Whether the send was successful or not
-
getUUID
Gets the UUID of clients on this machine- Returns:
- UUID of the client, this should theoretically never change.
-
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.- Returns:
- Whether the send was successful or not
-
checkLocation
inform the Archipelago server that a location ID has been checked.- Parameters:
locationID- id of a location.- Returns:
- Whether send was successful or not
-
checkLocations
inform the Archipelago server that a collection of location ID has been checked.- Parameters:
locationIDs- a collection of a locations.- Returns:
- Whether send was successful or not
-
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.- Returns:
- Whether the send was successful or not
-
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.createAsHint- Whether to create hints for the provided locations- Returns:
- Whether the send was successful or not
-
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. -
getAlias
gets the alias of this slot.- Returns:
- Alias of the slot connected to.
-
getLocationManager
-
getItemManager
-
ensureConnectedAndAuth
-
setGameState
Update the current game status.- Parameters:
status- aClientStatusto send to the server.- Returns:
- Whether the send was successful or not
- See Also:
-
sync
manually trigger a resync to the Archipelago server. this should be done automatically if the library detects a desync.- Returns:
- Whether the send was successful or not
-
sendBounce
sends a bouncepacket to the server, such as for deathlink- Parameters:
bouncePacket- The packet to send- Returns:
- Whether the send was successful or not
-
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.
-
getBouncedManager
- Returns:
- the bounced packet handler
-
dataStorageSet
Uses DataStorage to save a value on the AP server.- Returns:
- Whether the send was successful or not, and the requestId
-
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.- Returns:
- Whether the send was successful or not
-
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- Returns:
- Whether the send was successful or not, and the requestId
-
sendDeathlink
Helper for sending a death link bounce packet. You can send these without enabling death link first, but it is frowned upon.- Parameters:
source- A String that is the name of the player sending the death link (does not have to be slot name)cause- A String that is the cause of this death. may be empty.- Returns:
- Whether the send was successful or not
-
setDeathLinkEnabled
Enable or disable receiving death links.- Parameters:
enabled- set to TRUE to enable death links, FALSE to disable.- Returns:
- Whether the send was successful or not
-
sendPackets
Enables sending multiple packets at once.- Parameters:
packets- The packets to send- Returns:
- Whether the send was successful
-
createHints
Creates hints for the provided locations- Parameters:
locations- The locations to hint for.player- The id of the player whose locations are being hinted forstatus- Sets the status of the hint to this status; server rejects HINT_FOUND- Returns:
- Whether the send was successful
-
createHints
Creates hints for the provided locations- Parameters:
locations- The locations to hint for.player- The id of the player whose locations are being hinted for- Returns:
- Whether the send was successful
-
createHints
Creates hints for the provided locations with this client's slot- Parameters:
locations- The locations to hint for.- Returns:
- Whether the send was successful
-