Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "http://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<!-- don't require javadocs on platform modules -->
<suppress files="bukkit-example[\\/]src[\\/]main[\\/]java[\\/].*" checks="(FilteringWriteTag|MissingJavadoc.*)"/>
<suppress files="bukkit-example-(api|json|proto|common)[\\/]src[\\/]main[\\/]java[\\/].*" checks="(FilteringWriteTag|MissingJavadoc.*)"/>

<!-- ignore illegal import in loader -->
<suppress files="extra[\\/]loader[\\/]src[\\/]main[\\/]java[\\/].*" checks="(IllegalImport)"/>
Expand Down
12 changes: 12 additions & 0 deletions bukkit-example-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
id("apollo.base-conventions")
id("apollo.shadow-conventions")
}

dependencies {
compileOnly(project(":extra:apollo-extra-adventure4"))
compileOnly(project(path = ":apollo-api", configuration = "bukkit"))
compileOnly(project(path = ":apollo-common", configuration = "shadow"))

implementation(project(":apollo-bukkit-example-common"))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* This file is part of Apollo, licensed under the MIT License.
*
* Copyright (c) 2023 Moonsworth
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.api;

import com.lunarclient.apollo.example.ApolloExamplePlugin;
import com.lunarclient.apollo.example.ApolloExampleType;
import com.lunarclient.apollo.example.api.commands.debug.ApolloDebugCommand;
import com.lunarclient.apollo.example.api.debug.SpamPacketDebug;
import com.lunarclient.apollo.example.api.listener.ApolloPlayerApiListener;
import com.lunarclient.apollo.example.api.module.BeamApiExample;
import com.lunarclient.apollo.example.api.module.BorderApiExample;
import com.lunarclient.apollo.example.api.module.ChatApiExample;
import com.lunarclient.apollo.example.api.module.ColoredFireApiExample;
import com.lunarclient.apollo.example.api.module.CombatApiExample;
import com.lunarclient.apollo.example.api.module.CooldownApiExample;
import com.lunarclient.apollo.example.api.module.EntityApiExample;
import com.lunarclient.apollo.example.api.module.GlowApiExample;
import com.lunarclient.apollo.example.api.module.HologramApiExample;
import com.lunarclient.apollo.example.api.module.LimbApiExample;
import com.lunarclient.apollo.example.api.module.ModSettingsApiExample;
import com.lunarclient.apollo.example.api.module.NametagApiExample;
import com.lunarclient.apollo.example.api.module.NickHiderApiExample;
import com.lunarclient.apollo.example.api.module.NotificationApiExample;
import com.lunarclient.apollo.example.api.module.RichPresenceApiExample;
import com.lunarclient.apollo.example.api.module.ServerRuleApiExample;
import com.lunarclient.apollo.example.api.module.StaffModApiExample;
import com.lunarclient.apollo.example.api.module.StopwatchApiExample;
import com.lunarclient.apollo.example.api.module.TeamApiExample;
import com.lunarclient.apollo.example.api.module.TebexApiExample;
import com.lunarclient.apollo.example.api.module.TitleApiExample;
import com.lunarclient.apollo.example.api.module.TntCountdownApiExample;
import com.lunarclient.apollo.example.api.module.TransferApiExample;
import com.lunarclient.apollo.example.api.module.VignetteApiExample;
import com.lunarclient.apollo.example.api.module.WaypointApiExample;
import lombok.Getter;

@Getter
public class ApolloApiExamplePlatform extends ApolloExamplePlugin {

@Getter
private static ApolloApiExamplePlatform instance;

private SpamPacketDebug spamPacketDebug;

@Override
public void enable() {
instance = this;
}

@Override
public void registerCommands() {
this.getCommand("apollodebug").setExecutor(new ApolloDebugCommand());
}

@Override
public void registerModuleExamples() {
this.setBeamExample(new BeamApiExample());
this.setBorderExample(new BorderApiExample());
this.setChatExample(new ChatApiExample());
this.setColoredFireExample(new ColoredFireApiExample());
this.setCombatExample(new CombatApiExample());
this.setCooldownExample(new CooldownApiExample());
this.setEntityExample(new EntityApiExample());
this.setGlowExample(new GlowApiExample());
this.setHologramExample(new HologramApiExample());
this.setLimbExample(new LimbApiExample());
this.setModSettingsExample(new ModSettingsApiExample());
this.setNametagExample(new NametagApiExample());
this.setNickHiderExample(new NickHiderApiExample());
this.setNotificationExample(new NotificationApiExample());
this.setRichPresenceExample(new RichPresenceApiExample());
this.setServerRuleExample(new ServerRuleApiExample());
this.setStaffModExample(new StaffModApiExample());
this.setStopwatchExample(new StopwatchApiExample());
this.setTeamExample(new TeamApiExample());
this.setTebexExample(new TebexApiExample());
this.setTitleExample(new TitleApiExample());
this.setTntCountdownExample(new TntCountdownApiExample());
this.setTransferExample(new TransferApiExample());
this.setVignetteExample(new VignetteApiExample());
this.setWaypointExample(new WaypointApiExample());
}

@Override
public void registerListeners() {
this.spamPacketDebug = new SpamPacketDebug();

new ApolloPlayerApiListener(this);
}

@Override
public ApolloExampleType getType() {
return ApolloExampleType.API;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.common.commands.debug;
package com.lunarclient.apollo.example.api.commands.debug;

import com.lunarclient.apollo.common.ApolloComponent;
import net.kyori.adventure.text.Component;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.common.commands.debug;
package com.lunarclient.apollo.example.api.commands.debug;

import com.lunarclient.apollo.common.ApolloComponent;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
import com.lunarclient.apollo.example.debug.SpamPacketDebug;
import com.lunarclient.apollo.example.api.ApolloApiExamplePlatform;
import com.lunarclient.apollo.example.api.debug.SpamPacketDebug;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration;
Expand All @@ -37,7 +37,7 @@

public class SpamPacketsCommand implements CommandExecutor {

private final SpamPacketDebug spamPacketDebug = ApolloExamplePlugin.getPlugin().getSpamPacketDebug();
private final SpamPacketDebug spamPacketDebug = ApolloApiExamplePlatform.getInstance().getSpamPacketDebug();

@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.debug;
package com.lunarclient.apollo.example.api.debug;

import com.google.common.collect.Maps;
import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
import com.lunarclient.apollo.example.api.ApolloApiExamplePlatform;
import com.lunarclient.apollo.network.NetworkOptions;
import java.util.Map;
import java.util.UUID;
Expand All @@ -40,7 +40,7 @@ public class SpamPacketDebug implements Listener {
private final Map<UUID, SpamPacketTask> players = Maps.newConcurrentMap();

public SpamPacketDebug() {
Bukkit.getPluginManager().registerEvents(this, ApolloExamplePlugin.getPlugin());
Bukkit.getPluginManager().registerEvents(this, ApolloApiExamplePlatform.getInstance());
}

@EventHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.api.listeners;
package com.lunarclient.apollo.example.api.general;

import com.lunarclient.apollo.event.ApolloListener;
import com.lunarclient.apollo.event.Event;
Expand All @@ -32,7 +32,7 @@
import com.lunarclient.apollo.player.ApolloPlayer;
import org.bukkit.entity.Player;

public class ApolloGeneralApiListener {
public class ApolloEventListenerExample {

// Method 1
public class GeneralExample1 implements ApolloListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.api;
package com.lunarclient.apollo.example.api.general;

import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.module.border.BorderModule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.api.listeners;
package com.lunarclient.apollo.example.api.listener;

import com.lunarclient.apollo.event.ApolloListener;
import com.lunarclient.apollo.event.EventBus;
import com.lunarclient.apollo.event.Listen;
import com.lunarclient.apollo.event.player.ApolloRegisterPlayerEvent;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
import com.lunarclient.apollo.example.api.examples.TeamApiExample;
import com.lunarclient.apollo.example.api.module.TeamApiExample;
import com.lunarclient.apollo.player.ApolloPlayer;
import org.bukkit.entity.Player;

public class ApolloPlayerApiListener implements ApolloListener {

private final ApolloExamplePlugin plugin;
private final ApolloExamplePlugin example;
private final TeamApiExample.Team defaultTeam;

public ApolloPlayerApiListener(ApolloExamplePlugin plugin) {
this.plugin = plugin;
this.defaultTeam = ((TeamApiExample) this.plugin.getTeamExample()).createTeam();
public ApolloPlayerApiListener(ApolloExamplePlugin example) {
this.example = example;
this.defaultTeam = ((TeamApiExample) this.example.getTeamExample()).createTeam();

EventBus.getBus().register(this);
}
Expand All @@ -56,11 +56,11 @@ private void onApolloRegister(ApolloRegisterPlayerEvent event) {
// Default team view markers
this.defaultTeam.addMember(player);

this.plugin.getBeamExample().displayBeamExample(player);
this.plugin.getBorderExample().displayBorderExample(player);
this.plugin.getCooldownExample().displayCooldownItemExample(player);
this.plugin.getNametagExample().overrideNametagExample(player);
this.plugin.getWaypointExample().displayWaypointExample(player);
this.example.getBeamExample().displayBeamExample(player);
this.example.getBorderExample().displayBorderExample(player);
this.example.getCooldownExample().displayCooldownItemExample(player);
this.example.getNametagExample().overrideNametagExample(player);
this.example.getWaypointExample().displayWaypointExample(player);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.api.examples;
package com.lunarclient.apollo.example.api.module;

import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.common.location.ApolloBlockLocation;
import com.lunarclient.apollo.example.common.modules.impl.BeamExample;
import com.lunarclient.apollo.example.module.impl.BeamExample;
import com.lunarclient.apollo.module.beam.Beam;
import com.lunarclient.apollo.module.beam.BeamModule;
import com.lunarclient.apollo.player.ApolloPlayer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.api.examples;
package com.lunarclient.apollo.example.api.module;

import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.common.cuboid.Cuboid2D;
import com.lunarclient.apollo.example.common.modules.impl.BorderExample;
import com.lunarclient.apollo.example.module.impl.BorderExample;
import com.lunarclient.apollo.module.border.Border;
import com.lunarclient.apollo.module.border.BorderModule;
import com.lunarclient.apollo.player.ApolloPlayer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.api.examples;
package com.lunarclient.apollo.example.api.module;

import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.example.ApolloExamplePlugin;
import com.lunarclient.apollo.example.common.modules.impl.ChatExample;
import com.lunarclient.apollo.example.module.impl.ChatExample;
import com.lunarclient.apollo.module.chat.ChatModule;
import com.lunarclient.apollo.recipients.Recipients;
import net.kyori.adventure.text.Component;
Expand Down Expand Up @@ -63,7 +63,7 @@ public void run() {
}
};

runnable.runTaskTimer(ApolloExamplePlugin.getPlugin(), 0L, 20L);
runnable.runTaskTimer(ApolloExamplePlugin.getInstance(), 0L, 20L);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.api.examples;
package com.lunarclient.apollo.example.api.module;

import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.example.common.modules.impl.ColoredFireExample;
import com.lunarclient.apollo.example.module.impl.ColoredFireExample;
import com.lunarclient.apollo.module.coloredfire.ColoredFireModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import com.lunarclient.apollo.recipients.Recipients;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.api.examples;
package com.lunarclient.apollo.example.api.module;

import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.example.common.modules.impl.CombatExample;
import com.lunarclient.apollo.example.module.impl.CombatExample;
import com.lunarclient.apollo.module.combat.CombatModule;

public class CombatApiExample extends CombatExample {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.api.examples;
package com.lunarclient.apollo.example.api.module;

import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.common.icon.ItemStackIcon;
import com.lunarclient.apollo.common.icon.SimpleResourceLocationIcon;
import com.lunarclient.apollo.example.common.modules.impl.CooldownExample;
import com.lunarclient.apollo.example.module.impl.CooldownExample;
import com.lunarclient.apollo.module.cooldown.Cooldown;
import com.lunarclient.apollo.module.cooldown.CooldownModule;
import com.lunarclient.apollo.player.ApolloPlayer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.api.examples;
package com.lunarclient.apollo.example.api.module;

import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.common.ApolloEntity;
import com.lunarclient.apollo.example.common.modules.impl.EntityExample;
import com.lunarclient.apollo.example.module.impl.EntityExample;
import com.lunarclient.apollo.module.entity.EntityModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.lunarclient.apollo.example.api.examples;
package com.lunarclient.apollo.example.api.module;

import com.lunarclient.apollo.Apollo;
import com.lunarclient.apollo.example.common.modules.impl.GlowExample;
import com.lunarclient.apollo.example.module.impl.GlowExample;
import com.lunarclient.apollo.module.glow.GlowModule;
import com.lunarclient.apollo.player.ApolloPlayer;
import com.lunarclient.apollo.recipients.Recipients;
Expand Down
Loading