diff --git a/api/src/main/java/com/lunarclient/apollo/event/player/ApolloPlayerHandshakeEvent.java b/api/src/main/java/com/lunarclient/apollo/event/player/ApolloPlayerHandshakeEvent.java index 6ca4e88b..313d2107 100644 --- a/api/src/main/java/com/lunarclient/apollo/event/player/ApolloPlayerHandshakeEvent.java +++ b/api/src/main/java/com/lunarclient/apollo/event/player/ApolloPlayerHandshakeEvent.java @@ -27,7 +27,7 @@ import com.lunarclient.apollo.client.version.LunarClientVersion; import com.lunarclient.apollo.client.version.MinecraftVersion; import com.lunarclient.apollo.event.Event; -import com.lunarclient.apollo.module.tebex.TebexCheckoutSupportType; +import com.lunarclient.apollo.module.tebex.TebexEmbeddedCheckoutSupport; import com.lunarclient.apollo.player.ApolloPlayer; import java.util.List; import lombok.Value; @@ -73,11 +73,11 @@ public class ApolloPlayerHandshakeEvent implements Event { List installedMods; /** - * The {@link TebexCheckoutSupportType} type. + * The {@link TebexEmbeddedCheckoutSupport} type. * * @return the Tebex checkout support type * @since 1.1.5 */ - TebexCheckoutSupportType tebexCheckoutSupportType; + TebexEmbeddedCheckoutSupport tebexEmbeddedCheckoutSupport; } diff --git a/api/src/main/java/com/lunarclient/apollo/module/tebex/TebexCheckoutSupportType.java b/api/src/main/java/com/lunarclient/apollo/module/tebex/TebexEmbeddedCheckoutSupport.java similarity index 97% rename from api/src/main/java/com/lunarclient/apollo/module/tebex/TebexCheckoutSupportType.java rename to api/src/main/java/com/lunarclient/apollo/module/tebex/TebexEmbeddedCheckoutSupport.java index c92f6e67..99b7fe1e 100644 --- a/api/src/main/java/com/lunarclient/apollo/module/tebex/TebexCheckoutSupportType.java +++ b/api/src/main/java/com/lunarclient/apollo/module/tebex/TebexEmbeddedCheckoutSupport.java @@ -28,7 +28,7 @@ * * @since 1.1.5 */ -public enum TebexCheckoutSupportType { +public enum TebexEmbeddedCheckoutSupport { /** * External checkout is supported as a game overlay. diff --git a/api/src/main/java/com/lunarclient/apollo/player/ApolloPlayer.java b/api/src/main/java/com/lunarclient/apollo/player/ApolloPlayer.java index cdd37ced..ab95f624 100644 --- a/api/src/main/java/com/lunarclient/apollo/player/ApolloPlayer.java +++ b/api/src/main/java/com/lunarclient/apollo/player/ApolloPlayer.java @@ -27,7 +27,7 @@ import com.lunarclient.apollo.client.version.LunarClientVersion; import com.lunarclient.apollo.client.version.MinecraftVersion; import com.lunarclient.apollo.common.location.ApolloLocation; -import com.lunarclient.apollo.module.tebex.TebexCheckoutSupportType; +import com.lunarclient.apollo.module.tebex.TebexEmbeddedCheckoutSupport; import com.lunarclient.apollo.option.Option; import com.lunarclient.apollo.option.Options; import com.lunarclient.apollo.recipients.Recipients; @@ -136,11 +136,11 @@ default boolean hasPermission(Options options, Option option) { List getInstalledMods(); /** - * Returns the {@link TebexCheckoutSupportType} type. + * Returns the {@link TebexEmbeddedCheckoutSupport} type. * * @return the Tebex checkout support type * @since 1.1.5 */ - TebexCheckoutSupportType getTebexCheckoutSupportType(); + TebexEmbeddedCheckoutSupport getTebexEmbeddedCheckoutSupport(); } diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TebexCommand.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TebexCommand.java index 606e1fd9..829140dc 100644 --- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TebexCommand.java +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/commands/TebexCommand.java @@ -44,20 +44,20 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command Player player = (Player) sender; - if (args.length != 1) { - player.sendMessage("Usage: /tebex "); + if (args.length != 2) { + player.sendMessage("Usage: /tebex "); return true; } switch (args[0].toLowerCase()) { case "display": { - this.tebexExample.displayTebexEmbeddedCheckoutExample(player); + this.tebexExample.displayTebexEmbeddedCheckoutExample(player, args[1]); player.sendMessage("Displaying checkout...."); break; } default: { - player.sendMessage("Usage: /tebex "); + player.sendMessage("Usage: /tebex "); break; } } diff --git a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TebexExample.java b/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TebexExample.java index 11bf2cc0..f954336f 100644 --- a/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TebexExample.java +++ b/bukkit-example/src/main/java/com/lunarclient/apollo/example/modules/TebexExample.java @@ -24,7 +24,7 @@ package com.lunarclient.apollo.example.modules; import com.lunarclient.apollo.Apollo; -import com.lunarclient.apollo.module.tebex.TebexCheckoutSupportType; +import com.lunarclient.apollo.module.tebex.TebexEmbeddedCheckoutSupport; import com.lunarclient.apollo.module.tebex.TebexModule; import com.lunarclient.apollo.player.ApolloPlayer; import java.util.Optional; @@ -34,15 +34,14 @@ public class TebexExample { private final TebexModule tebexModule = Apollo.getModuleManager().getModule(TebexModule.class); - public void displayTebexEmbeddedCheckoutExample(Player viewer) { + public void displayTebexEmbeddedCheckoutExample(Player viewer, String basketId) { Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); apolloPlayerOpt.ifPresent(apolloPlayer -> { - if (apolloPlayer.getTebexCheckoutSupportType() == TebexCheckoutSupportType.UNSUPPORTED) { + if (apolloPlayer.getTebexEmbeddedCheckoutSupport() == TebexEmbeddedCheckoutSupport.UNSUPPORTED) { return; } - // The basket ids expire, so this example may not work - this.tebexModule.displayTebexEmbeddedCheckout(apolloPlayer, "c4rodk-b8d3439942d859decf45f6ed8b4dad2455f06738"); + this.tebexModule.displayTebexEmbeddedCheckout(apolloPlayer, basketId); }); } diff --git a/common/src/main/java/com/lunarclient/apollo/player/AbstractApolloPlayer.java b/common/src/main/java/com/lunarclient/apollo/player/AbstractApolloPlayer.java index d5ab77cc..f1044b7a 100644 --- a/common/src/main/java/com/lunarclient/apollo/player/AbstractApolloPlayer.java +++ b/common/src/main/java/com/lunarclient/apollo/player/AbstractApolloPlayer.java @@ -32,7 +32,7 @@ import com.lunarclient.apollo.client.version.LunarClientVersion; import com.lunarclient.apollo.client.version.MinecraftVersion; import com.lunarclient.apollo.common.location.ApolloLocation; -import com.lunarclient.apollo.module.tebex.TebexCheckoutSupportType; +import com.lunarclient.apollo.module.tebex.TebexEmbeddedCheckoutSupport; import com.lunarclient.apollo.roundtrip.ApolloRequest; import com.lunarclient.apollo.roundtrip.ApolloResponse; import com.lunarclient.apollo.world.ApolloWorld; @@ -52,7 +52,7 @@ public abstract class AbstractApolloPlayer implements ApolloPlayer { private MinecraftVersion minecraftVersion; private LunarClientVersion lunarClientVersion; private List installedMods; - private TebexCheckoutSupportType tebexCheckoutSupportType; + private TebexEmbeddedCheckoutSupport tebexEmbeddedCheckoutSupport; @Override public Optional getWorld() { diff --git a/common/src/main/java/com/lunarclient/apollo/player/ApolloPlayerManagerImpl.java b/common/src/main/java/com/lunarclient/apollo/player/ApolloPlayerManagerImpl.java index e64fdddb..ddb1f6ae 100644 --- a/common/src/main/java/com/lunarclient/apollo/player/ApolloPlayerManagerImpl.java +++ b/common/src/main/java/com/lunarclient/apollo/player/ApolloPlayerManagerImpl.java @@ -32,7 +32,7 @@ import com.lunarclient.apollo.event.player.ApolloPlayerHandshakeEvent; import com.lunarclient.apollo.event.player.ApolloRegisterPlayerEvent; import com.lunarclient.apollo.event.player.ApolloUnregisterPlayerEvent; -import com.lunarclient.apollo.module.tebex.TebexCheckoutSupportType; +import com.lunarclient.apollo.module.tebex.TebexEmbeddedCheckoutSupport; import com.lunarclient.apollo.network.NetworkOptions; import com.lunarclient.apollo.player.v1.PlayerHandshakeMessage; import java.util.Collection; @@ -137,11 +137,11 @@ public void handlePlayerHandshake(@NotNull ApolloPlayer player, @NotNull PlayerH .build() ).collect(Collectors.toList()); - TebexCheckoutSupportType checkoutSupportType; + TebexEmbeddedCheckoutSupport checkoutSupportType; try { - checkoutSupportType = TebexCheckoutSupportType.values()[message.getEmbeddedCheckoutSupportValue() - 1]; + checkoutSupportType = TebexEmbeddedCheckoutSupport.values()[message.getEmbeddedCheckoutSupportValue() - 1]; } catch (ArrayIndexOutOfBoundsException e) { - checkoutSupportType = TebexCheckoutSupportType.UNSUPPORTED; + checkoutSupportType = TebexEmbeddedCheckoutSupport.UNSUPPORTED; } EventBus.EventResult result = EventBus.getBus() @@ -155,7 +155,7 @@ public void handlePlayerHandshake(@NotNull ApolloPlayer player, @NotNull PlayerH apolloPlayer.setMinecraftVersion(minecraftVersion); apolloPlayer.setLunarClientVersion(lunarClientVersion); apolloPlayer.setInstalledMods(mods); - apolloPlayer.setTebexCheckoutSupportType(checkoutSupportType); + apolloPlayer.setTebexEmbeddedCheckoutSupport(checkoutSupportType); } } diff --git a/docs/developers/modules/tebex.mdx b/docs/developers/modules/tebex.mdx index a9b99b61..e078ca70 100644 --- a/docs/developers/modules/tebex.mdx +++ b/docs/developers/modules/tebex.mdx @@ -9,15 +9,14 @@ TODO ### Sample Code ```java -public void displayTebexEmbeddedCheckoutExample(Player viewer) { +public void displayTebexEmbeddedCheckoutExample(Player viewer, String basketId) { Optional apolloPlayerOpt = Apollo.getPlayerManager().getPlayer(viewer.getUniqueId()); apolloPlayerOpt.ifPresent(apolloPlayer -> { - if (apolloPlayer.getTebexCheckoutSupportType() == TebexCheckoutSupportType.UNSUPPORTED) { + if (apolloPlayer.getTebexEmbeddedCheckoutSupport() == TebexEmbeddedCheckoutSupport.UNSUPPORTED) { return; } - // The basket ids expire, so this example may not work - this.tebexModule.displayTebexEmbeddedCheckout(apolloPlayer, "c4rodk-b8d3439942d859decf45f6ed8b4dad2455f06738"); + this.tebexModule.displayTebexEmbeddedCheckout(apolloPlayer, basketId); }); } ```