Skip to content

Commit

Permalink
add javadocs for some methods, add methods with array instead of list
Browse files Browse the repository at this point in the history
  • Loading branch information
jumpingpxl committed Jul 25, 2024
1 parent 40516ca commit ed41931
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -221,6 +222,15 @@ public void disableAddons(List<String> addonsToDisable) {
this.sendPacket(AddonDisablePacket.disable(addonsToDisable));
}

/**
* Forcefully disables the provided addons.
*
* @param addonsToDisable the addons to disable
*/
public void disableAddons(String... addonsToDisable) {
this.disableAddons(Arrays.asList(addonsToDisable));
}

/**
* Reverts the forced disable state for the provided addons
*
Expand All @@ -234,6 +244,15 @@ public void revertDisabledAddons(List<String> addonsToRevert) {
this.sendPacket(AddonDisablePacket.revert(addonsToRevert));
}

/**
* Reverts the forced disable state for the provided addons
*
* @param addonsToRevert the addons to revert
*/
public void revertDisabledAddons(String... addonsToRevert) {
this.revertDisabledAddons(Arrays.asList(addonsToRevert));
}

/**
* Reverts the forced disable state for all addons disabled via {@link #disableAddons(List)}
*/
Expand Down Expand Up @@ -524,6 +543,29 @@ public void sendAddonRecommendations(@NotNull List<RecommendedAddon> addons) {
this.sendLabyModPacket(new AddonRecommendationPacket(addons));
}

/**
* Sends the provided recommended addons to the player
*
* @param addons The recommended addons
*/
public void sendAddonRecommendations(@NotNull RecommendedAddon... addons) {
this.sendLabyModPacket(new AddonRecommendationPacket(addons));
}

/**
* Sends the provided recommended addons to the player and handle the response via the provided
* consumer
*
* @param responseConsumer The consumer for the response
* @param addons The recommended addons
*/
public void sendAddonRecommendations(
@NotNull Consumer<AddonRecommendationResponsePacket> responseConsumer,
@NotNull RecommendedAddon... addons
) {
this.sendAddonRecommendations(Arrays.asList(addons), responseConsumer);
}

/**
* Sends the provided recommended addons to the player and handle the response via the provided
* consumer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.function.Consumer;
Expand Down Expand Up @@ -60,22 +61,67 @@ public T getPlayer() {
return this.serverPlayer;
}

/**
* @return the installed addons of the user. The object is empty until one of the request
* methods is called.
*/
public @NotNull InstalledAddonsResponse installedAddons() {
return this.installedAddonsResponse;
}

/**
* Requests ALL installed addons from the user.
*/
public void requestInstalledAddons() {
this.requestInstalledAddons(new ArrayList<>(), null);
}

/**
* Requests ALL installed addons from the user.
*
* @param response the response consumer. Called when the response is received.
*/
public void requestInstalledAddons(Consumer<InstalledAddonsResponse> response) {
this.requestInstalledAddons(new ArrayList<>(), response);
}

/**
* Requests the installed state of the provided addons.
*
* @param addonsToRequest The addons to request the installed state of.
*/
public void requestInstalledAddons(String... addonsToRequest) {
this.requestInstalledAddons(Arrays.asList(addonsToRequest), null);
}

/**
* Requests the installed state of the provided addons.
*
* @param addonsToRequest The addons to request the installed state of.
*/
public void requestInstalledAddons(@NotNull List<String> addonsToRequest) {
this.requestInstalledAddons(addonsToRequest, null);
}

/**
* Requests the installed state of the provided addons.
*
* @param response the response consumer. Called when the response is received.
* @param addonsToRequest The addons to request the installed state of.
*/
public void requestInstalledAddons(
Consumer<InstalledAddonsResponse> response,
String... addonsToRequest
) {
this.requestInstalledAddons(Arrays.asList(addonsToRequest), response);
}

/**
* Requests the installed state of the provided addons.
*
* @param addonsToRequest The addons to request the installed state of.
* @param response the response consumer. Called when the response is received.
*/
public void requestInstalledAddons(
@NotNull List<String> addonsToRequest,
Consumer<InstalledAddonsResponse> response
Expand Down

0 comments on commit ed41931

Please sign in to comment.