Skip to content

Commit

Permalink
Version - 1.1.0 (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsNature authored Feb 21, 2024
1 parent 3794b36 commit 127266c
Show file tree
Hide file tree
Showing 18 changed files with 87 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
run: ./gradlew publish

- name: Gradle Release
if: "${{ github.ref == 'refs/heads/master' && env.STATUS == 'release' }}"
if: "${{ (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/version/')) && env.STATUS == 'release' }}"
uses: softprops/action-gh-release@v1
with:
draft: false
Expand Down
25 changes: 19 additions & 6 deletions api/src/main/java/com/lunarclient/apollo/module/ApolloModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,27 @@
public abstract class ApolloModule implements ApolloListener {

/**
* Whether to enable this module.
* Whether to enable this module builder.
*
* @since 1.0.0
* @since 1.1.0
*/
public static final SimpleOption<Boolean> ENABLE = Option.<Boolean>builder()
private static final SimpleOption.SimpleOptionBuilder<Boolean> ENABLE_OPTION_BUILDER = Option.<Boolean>builder()
.comment("Set to 'true' to enable this module, otherwise set 'false'.")
.node("enable").type(TypeToken.get(Boolean.class))
.defaultValue(true).build();
.node("enable").type(TypeToken.get(Boolean.class));

/**
* Whether to enable this module with default value set to false.
*
* @since 1.1.0
*/
public static final SimpleOption<Boolean> ENABLE_OPTION_OFF = ENABLE_OPTION_BUILDER.defaultValue(false).build();

/**
* Whether to enable this module with default value set to true.
*
* @since 1.0.0
*/
public static final SimpleOption<Boolean> ENABLE_OPTION_ON = ENABLE_OPTION_BUILDER.defaultValue(true).build();

/**
* Returns an array of {@link Option}s in this module.
Expand Down Expand Up @@ -97,7 +110,7 @@ public abstract class ApolloModule implements ApolloListener {
* @since 1.0.0
*/
protected ApolloModule() {
this.registerOptions(ApolloModule.ENABLE);
this.registerOptions(ApolloModule.ENABLE_OPTION_ON);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@
@ModuleDefinition(id = "packet_enrichment", name = "PacketEnrichment")
public abstract class PacketEnrichmentModule extends ApolloModule {

protected PacketEnrichmentModule() {
this.registerOptions(ApolloModule.ENABLE_OPTION_OFF);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.lunarclient.apollo.module.ApolloModule;
import com.lunarclient.apollo.module.ModuleDefinition;
import com.lunarclient.apollo.option.NumberOption;
import com.lunarclient.apollo.option.SimpleOption;
import io.leangen.geantyref.TypeToken;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Range;
Expand All @@ -51,9 +52,20 @@ public abstract class TntCountdownModule extends ApolloModule {
.defaultValue(80).min(1).max(Integer.MAX_VALUE)
.notifyClient().build();

/**
* Whether to override the amount of ticks for TNT ignited by a plugin.
*
* @since 1.1.0
*/
public static final SimpleOption<Boolean> OVERRIDE_CUSTOM_TICKS = SimpleOption.<Boolean>builder()
.comment("Whether to override custom TNT explosion ticks.")
.node("override-custom-ticks").type(TypeToken.get(Boolean.class))
.defaultValue(false).notifyClient().build();

TntCountdownModule() {
this.registerOptions(
TntCountdownModule.TNT_TICKS
TntCountdownModule.TNT_TICKS,
TntCountdownModule.OVERRIDE_CUSTOM_TICKS
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public GeneralExample1() {

@Listen
public void onApolloRegister(ApolloRegisterPlayerEvent event) {
((Player) event.getPlayer()).sendMessage("You have joined using LunarClient!");
((Player) event.getPlayer().getPlayer()).sendMessage("You have joined using LunarClient!");
}
}

Expand All @@ -55,7 +55,7 @@ public GeneralExample2() {
}

public void onApolloRegister(ApolloRegisterPlayerEvent event) {
((Player) event.getPlayer()).sendMessage("You have joined using LunarClient!");
((Player) event.getPlayer().getPlayer()).sendMessage("You have joined using LunarClient!");
}
}

Expand Down
2 changes: 1 addition & 1 deletion bukkit-example/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Apollo-Example
main: com.lunarclient.apollo.example.ApolloExamplePlugin
version: 1.0.9
version: 1.1.0
author: Moonsworth
depend: [ Apollo-Bukkit ]
api-version: 1.13
Expand Down
1 change: 1 addition & 0 deletions bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ setupDynamicDependency("adventure4", "shadowJarAdventure4", "adventure/4/", "dep

dependencies {
compileOnly(libs.bukkit)
compileOnly(libs.protobuf)

api(project(path = ":apollo-api", configuration = "shadow"))
api(project(path = ":apollo-common", configuration = "shadow"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,29 @@ public void setTntCountdown(ApolloEntity entity, int ticks) {

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
private void onTntSpawn(EntitySpawnEvent event) {
// We only care about TNT
if (event.getEntityType() != EntityType.PRIMED_TNT) {
return;
}

TNTPrimed primed = (TNTPrimed) event.getEntity();
int customFuse = this.getOptions().get(TntCountdownModule.TNT_TICKS);
int customTicks = this.getOptions().get(TntCountdownModule.TNT_TICKS);
int defaultTicks = TntCountdownModule.TNT_TICKS.getDefaultValue();
int currentTicks = primed.getFuseTicks();

// We only care about TNT with a non-standard fuse as well.
if (primed.getFuseTicks() == customFuse) {
return;
if (currentTicks != defaultTicks && !this.getOptions().get(TntCountdownModule.OVERRIDE_CUSTOM_TICKS)) {
customTicks = currentTicks;

SetTntCountdownMessage message = SetTntCountdownMessage.newBuilder()
.setEntityId(NetworkTypes.toProtobuf(new ApolloEntity(primed.getEntityId(), primed.getUniqueId())))
.setDurationTicks(customTicks)
.build();

for (ApolloPlayer viewer : Apollo.getPlayerManager().getPlayers()) {
((AbstractApolloPlayer) viewer).sendPacket(message);
}
}

primed.setFuseTicks(customFuse);
primed.setFuseTicks(customTicks);
}

}
2 changes: 1 addition & 1 deletion bukkit/src/platform-loader/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Apollo-Bukkit
main: com.lunarclient.apollo.loader.BukkitPlatformLoader
version: 1.0.9
version: 1.1.0
author: Moonsworth
api-version: 1.13
soft-depend: [LunarClient-API]
Expand Down
2 changes: 1 addition & 1 deletion bungee/src/platform-loader/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Apollo-Bungee
main: com.lunarclient.apollo.loader.BungeePlatformLoader
version: 1.0.9
version: 1.1.0
author: Moonsworth
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void enableModules() throws Throwable {
this.loadConfiguration(module, options);

// Enable the module if it is able to.
if (module.isEnabled() || module.getOptions().get(ApolloModule.ENABLE) == Boolean.FALSE) {
if (module.isEnabled() || module.getOptions().get(ApolloModule.ENABLE_OPTION_ON) == Boolean.FALSE) {
continue;
}

Expand All @@ -106,7 +106,7 @@ public void reloadModules() throws Throwable {

// Enable or disable the module depending on the setting.
Boolean enable;
if ((enable = module.getOptions().get(ApolloModule.ENABLE)) != Boolean.valueOf(module.isEnabled())) {
if ((enable = module.getOptions().get(ApolloModule.ENABLE_OPTION_ON)) != Boolean.valueOf(module.isEnabled())) {
if (enable == Boolean.TRUE) {
EventBus.getBus().register(module);
module.enable();
Expand Down
4 changes: 2 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Deploy apollo to the test server
set -e
./gradlew clean build
scp bukkit/build/libs/apollo-bukkit-1.0.9.jar [email protected]:/home/ubuntu/apollo/plugins/
scp bukkit-example/build/libs/apollo-bukkit-example-1.0.9.jar [email protected]:/home/ubuntu/apollo/plugins/
scp bukkit/build/libs/apollo-bukkit-1.1.0.jar [email protected]:/home/ubuntu/apollo/plugins/
scp bukkit-example/build/libs/apollo-bukkit-example-1.1.0.jar [email protected]:/home/ubuntu/apollo/plugins/
4 changes: 2 additions & 2 deletions docs/developers/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public class GeneralExample1 implements ApolloListener {

@Listen
public void onApolloRegister(ApolloRegisterPlayerEvent event) {
((Player) event.getPlayer()).sendMessage("You have joined using LunarClient!");
((Player) event.getPlayer().getPlayer()).sendMessage("You have joined using LunarClient!");
}
}
```
Expand All @@ -261,7 +261,7 @@ public class GeneralExample2 implements ApolloListener {
}

public void onApolloRegister(ApolloRegisterPlayerEvent event) {
((Player) event.getPlayer()).sendMessage("You have joined using LunarClient!");
((Player) event.getPlayer().getPlayer()).sendMessage("You have joined using LunarClient!");
}
}
```
Expand Down
5 changes: 5 additions & 0 deletions docs/developers/modules/packetenrichment.mdx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Callout } from 'nextra-theme-docs'
import { Tab, Tabs } from 'nextra-theme-docs'

# Packet Enrichment Module
Expand All @@ -6,6 +7,10 @@ import { Tab, Tabs } from 'nextra-theme-docs'

The packet enrichment module provides servers with additional information about already existing packets and/or adds additional packets to provide servers with extra information about a player.

<Callout type="info">
This module is disabled by default, if you wish to use this module you will need to enable it in `config.yml`.
</Callout>

## Integration

The majority of this module is handled through Apollo's [event system](/apollo/developers/events).
Expand Down
8 changes: 7 additions & 1 deletion docs/developers/modules/tntcountdown.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The TNT Countdown module allows you to interact with and set custom TNT timers f
- Adds the ability to set per TNT timers to be displayed for players using the TNT Countdown mod.

<Callout type="info">
This module only changes the displayed TNT Countdown, you'll need to change the actual tnt-tick time server-side.
This module will change the actual TNT fuse time on the server, not just the countdown displayed on the client.
</Callout>

## Integration
Expand Down Expand Up @@ -55,3 +55,9 @@ public void overrideTntCountdownExample(Player viewer) {
- Type: `Integer`
- Default: `80`
- Minimum: `1`

- __`OVERRIDE_CUSTOM_TICKS`__
- Whether to override custom TNT explosion ticks.
- Values
- Type: `Boolean`
- Default: `false`
9 changes: 9 additions & 0 deletions docs/developers/utilities/icons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Apollo adds three different icon builders, `ItemStackIcon`, `SimpleResourceLocat
## `ItemStackIcon` Builder

The `ItemStackIcon` builder is used to assign an icon using a specified ItemStack name or ID. This will utilize the texture present in the player's resource pack as the icon.
If you're using a custom resource pack and want to make the icon appear as a model, you can set the `customModelData` to the models data value. On versions below 1.13 `customModelData` sets the durability instead.

<Callout type="error">
If your server accepts players on Minecraft versions higher than `1.8.8` then you need to use `itemName`.
Expand All @@ -33,6 +34,14 @@ public final class ItemStackIcon extends Icon {
*/
int itemId;

/**
* Returns the icon {@link Integer} custom model data.
*
* @return the icon custom model data
* @since 1.0.7
*/
int customModelData;

}
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group=com.lunarclient
version=1.0.9
version=1.1.0
description=The API for interacting with Lunar Client players.

org.gradle.parallel=true
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
@Plugin(
id = "apollo",
name = "Apollo-Velocity",
version = "1.0.9",
version = "1.1.0",
url = "https://moonsworth.com",
description = "Implementation of Apollo for Velocity",
authors = {"Moonsworth"}
Expand Down

1 comment on commit 127266c

@LunarClientBot
Copy link
Collaborator

@LunarClientBot LunarClientBot commented on 127266c Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📄 Documentation Deployment

Status:✅ Completed
Environment:preview
URL:https://1fe96e17.lunarclient-dev.pages.dev

Please sign in to comment.