Skip to content

Remove Ponder dependency and implement equivalent classes locally#296

Merged
dmccoystephenson merged 7 commits intomainfrom
copilot/remove-ponder-dependency
Mar 8, 2026
Merged

Remove Ponder dependency and implement equivalent classes locally#296
dmccoystephenson merged 7 commits intomainfrom
copilot/remove-ponder-dependency

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 8, 2026

  • Inline Ponder library classes locally, remove JitPack dependency
  • Move classes to appropriate packages (no ponder references)
  • Add CI workflow (.github/workflows/ci.yml) to verify compilation and run tests
  • Address PR review comments:
    • PermissionChecker: format permissions with String.join instead of raw ArrayList
    • UUIDChecker: return null instead of empty string for unknown players, update Javadoc
    • EventHandlerRegistry: accept List instead of ArrayList
    • Lockable: return List instead of ArrayList (and update Pet implementation)
    • AbstractPluginCommand: use provided color parameter instead of hardcoded RED
    • CommandService: case-insensitive subcommand matching

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI self-assigned this Mar 8, 2026
Copilot AI and others added 2 commits March 8, 2026 01:44
- Created local equivalent classes under dansplugins.wildpets.ponder package:
  - abs/Savable, abs/Lockable, abs/AbstractPluginCommand
  - services/CommandService
  - tools/EventHandlerRegistry, UUIDChecker, PermissionChecker
  - misc/ArgumentParser
- Updated WildPets to extend JavaPlugin directly instead of PonderBukkitPlugin
- Changed CommandService constructor to accept JavaPlugin directly
- Updated all import statements across 22 files
- Removed Ponder dependency and JitPack repository from pom.xml

Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove Ponder dependency and implement equivalent classes Remove Ponder dependency and implement equivalent classes locally Mar 8, 2026
@dmccoystephenson
Copy link
Copy Markdown
Member

@copilot move ponder equivalent classes to appropriate packages that do not reference ponder

- AbstractPluginCommand, CommandService, ArgumentParser, PermissionChecker → commands/
- Savable, Lockable → data/
- EventHandlerRegistry → listeners/
- UUIDChecker → helpers/
- Removed ponder/ directory entirely
- Cleaned up redundant same-package imports

Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 8, 2026

@copilot move ponder equivalent classes to appropriate packages that do not reference ponder

Done in abcc21a. Moved all classes to existing packages:

  • AbstractPluginCommand, CommandService, ArgumentParser, PermissionCheckercommands/
  • Savable, Lockabledata/
  • EventHandlerRegistrylisteners/
  • UUIDCheckerhelpers/

The ponder/ package has been removed entirely.

@dmccoystephenson
Copy link
Copy Markdown
Member

@copilot add CI check to verify compilation

Copilot AI and others added 2 commits March 8, 2026 03:16
Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 8, 2026

@copilot add CI check to verify compilation

Added in 78b1973. Created .github/workflows/ci.yml that runs on push/PR to main/master — sets up JDK 8, caches Maven dependencies, then runs mvn compile and mvn test.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • hub.spigotmc.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.12/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.12/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.12 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.12/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/Wild-Pets/Wild-Pets org.codehaus.plexus.classworlds.launcher.Launcher compile -q (dns block)
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.12/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.12/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.12 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.12/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/Wild-Pets/Wild-Pets org.codehaus.plexus.classworlds.launcher.Launcher compile (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the external Ponder (JitPack) dependency by inlining equivalent utility classes into the WildPets codebase and updating the plugin to extend JavaPlugin directly.

Changes:

  • Replaced Ponder imports/usages with local equivalents under dansplugins.wildpets.commands, data, listeners, and helpers.
  • Updated WildPets to extend JavaPlugin and wired in the new local CommandService / event registration utilities.
  • Removed JitPack + Ponder dependency from pom.xml and added a GitHub Actions CI workflow.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/main/java/dansplugins/wildpets/pet/record/PetRecord.java Switches Savable import to local interface.
src/main/java/dansplugins/wildpets/pet/Pet.java Switches Lockable/Savable imports to local interfaces.
src/main/java/dansplugins/wildpets/listeners/InteractionHandler.java Updates UUIDChecker import to local helper.
src/main/java/dansplugins/wildpets/listeners/EventHandlerRegistry.java Adds local listener registration utility.
src/main/java/dansplugins/wildpets/info/InfoSender.java Updates UUIDChecker import to local helper.
src/main/java/dansplugins/wildpets/helpers/UUIDChecker.java Adds local UUID/name lookup utility.
src/main/java/dansplugins/wildpets/data/Savable.java Adds local Savable serialization interface.
src/main/java/dansplugins/wildpets/data/Lockable.java Adds local Lockable access-control interface.
src/main/java/dansplugins/wildpets/commands/WanderCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/UnlockCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/TameCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/StayCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/StatsCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/SetFreeCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/SelectCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/RenameCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/PermissionChecker.java Adds local permission-check helper used by command service.
src/main/java/dansplugins/wildpets/commands/LockCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/LocateCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/ListCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/InfoCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/HelpCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/GatherCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/FollowCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/DefaultCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/ConfigCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/CommandService.java Adds local command dispatch/permission enforcement service.
src/main/java/dansplugins/wildpets/commands/CheckAccessCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/CallCommand.java Removes Ponder command base import (uses local base).
src/main/java/dansplugins/wildpets/commands/ArgumentParser.java Adds local argument parsing utility for commands.
src/main/java/dansplugins/wildpets/commands/AbstractPluginCommand.java Adds local command base class replacing Ponder’s base.
src/main/java/dansplugins/wildpets/WildPets.java Moves from PonderBukkitPlugin to JavaPlugin; wires local services.
pom.xml Removes JitPack repo and Ponder dependency.
.github/workflows/ci.yml Adds CI to compile and run tests on PRs/pushes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

private void informSenderTheyDoNotHaveOneOfTheRequiredPermissions(CommandSender sender, ArrayList<String> permissions) {
sender.sendMessage(ChatColor.RED + "In order to use this command, you need one of the following permissions: '" + permissions + "'");
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

The "need one of the following permissions" message currently interpolates the raw ArrayList ('" + permissions + "'), which prints with brackets and commas and includes extra quoting. Formatting the permissions as a readable, comma-separated list (and removing the extra quotes) would make this error message clearer for users.

Suggested change
sender.sendMessage(ChatColor.RED + "In order to use this command, you need one of the following permissions: '" + permissions + "'");
String joinedPermissions = String.join(", ", permissions);
sender.sendMessage(ChatColor.RED + "In order to use this command, you need one of the following permissions: " + joinedPermissions);

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +32
public String findPlayerNameBasedOnUUID(UUID playerUUID) {
if (playerUUID == null) {
throw new IllegalArgumentException("Player UUID cannot be null!");
}
final Player player = Bukkit.getPlayer(playerUUID);
if (player != null) {
return player.getName();
}
final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerUUID);
final String name = offlinePlayer.getName();
return name == null || !offlinePlayer.hasPlayedBefore() ? "" : name;
}
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

findPlayerNameBasedOnUUID returns an empty string when the name can't be resolved, but the method contract doesn't mention this and call sites often check for null rather than empty. Consider returning null for "unknown" (and documenting it), or update the Javadoc to explicitly state that "" is returned when no name is available.

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +35
public void registerEventHandlers(ArrayList<Listener> listeners, Plugin plugin) {
if (listeners == null || listeners.isEmpty()) {
throw new IllegalArgumentException("Listeners cannot be null or empty!");
}
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null!");
}
listeners.forEach(listener -> manager.registerEvents(listener, plugin));
}
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

registerEventHandlers takes an ArrayList<Listener> instead of the List interface, which unnecessarily constrains callers and makes the API harder to use. Accepting List<Listener> (or Collection<Listener>) would be more flexible without changing behavior.

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +15
public interface Lockable<T> {
void setOwner(T toSet);
T getOwner();
void addToAccessList(T toAdd);
void removeFromAccessList(T toRemove);
boolean hasAccess(T toCheck);
ArrayList<T> getAccessList();
}
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

Lockable#getAccessList returns an ArrayList<T>, which exposes the concrete collection type and restricts implementations/callers. Returning the List<T> interface would reduce coupling while keeping the same semantics.

Copilot uses AI. Check for mistakes.
*/
public boolean sendMessageIfNoArguments(String message, String[] args, CommandSender sender, ChatColor color) {
if (args.length == 0) {
sender.sendMessage(ChatColor.RED + message);
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

sendMessageIfNoArguments ignores its color parameter and always prefixes messages with ChatColor.RED, so callers cannot control the color as the signature suggests. Use the provided color when sending the message (or remove the parameter if color should be fixed).

Suggested change
sender.sendMessage(ChatColor.RED + message);
sender.sendMessage(color + message);

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +52
if (command.getNames().contains(subCommand)) {
if (!permissionChecker.checkPermission(sender, command.getPermissions())) {
return false;
}
if (arguments.length == 0) {
return command.execute(sender);
}
else {
return command.execute(sender, arguments);
}
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

Subcommand dispatch is currently case-sensitive (command.getNames().contains(subCommand)), so /wp Help (or any mixed-case subcommand) will not match even though Bukkit arguments preserve user casing. Consider normalizing subCommand and command names to a consistent case (e.g., lower-case) or using case-insensitive comparison when matching.

Suggested change
if (command.getNames().contains(subCommand)) {
if (!permissionChecker.checkPermission(sender, command.getPermissions())) {
return false;
}
if (arguments.length == 0) {
return command.execute(sender);
}
else {
return command.execute(sender, arguments);
}
for (String name : command.getNames()) {
if (name.equalsIgnoreCase(subCommand)) {
if (!permissionChecker.checkPermission(sender, command.getPermissions())) {
return false;
}
if (arguments.length == 0) {
return command.execute(sender);
}
else {
return command.execute(sender, arguments);
}
}

Copilot uses AI. Check for mistakes.
@dmccoystephenson
Copy link
Copy Markdown
Member

@copilot address comments

Co-authored-by: dmccoystephenson <21204351+dmccoystephenson@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 8, 2026

@copilot address comments

All 6 review comments addressed in 6d657cf:

  • PermissionChecker: permissions formatted with String.join instead of raw ArrayList.toString()
  • UUIDChecker: returns null instead of "" for unknown players; Javadoc updated
  • EventHandlerRegistry: accepts List<Listener> instead of ArrayList<Listener>
  • Lockable: returns List<T> instead of ArrayList<T> (Pet implementation updated too)
  • AbstractPluginCommand: uses provided color parameter instead of hardcoded ChatColor.RED
  • CommandService: subcommand matching is now case-insensitive via equalsIgnoreCase

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • hub.spigotmc.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --enable-native-access=ALL-UNNAMED -classpath /usr/share/apache-maven-3.9.12/boot/plexus-classworlds-2.9.0.jar -Dclassworlds.conf=/usr/share/apache-maven-3.9.12/bin/m2.conf -Dmaven.home=/usr/share/apache-maven-3.9.12 -Dlibrary.jansi.path=/usr/share/apache-maven-3.9.12/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/home/REDACTED/work/Wild-Pets/Wild-Pets org.codehaus.plexus.classworlds.launcher.Launcher -f pom.xml -B -V -e -Dfindbugs.skip -Dcheckstyle.skip -Dpmd.skip=true -Dspotbugs.skip -Denforcer.skip -Dmaven.javadoc.skip (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@dmccoystephenson dmccoystephenson merged commit 7e9fb0f into main Mar 8, 2026
1 check passed
dmccoystephenson added a commit that referenced this pull request Mar 8, 2026
Merge pull request #296 from Dans-Plugins/copilot/remove-ponder-dependency

Remove Ponder dependency and implement equivalent classes locally
@dmccoystephenson dmccoystephenson deleted the copilot/remove-ponder-dependency branch March 8, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants