-
Notifications
You must be signed in to change notification settings - Fork 0
Bump into Plugin Version #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…t and registration
…nd detailed documentation
…er damage handling
…file initialization and reload functionality
…for improved initialization
… management with MockBukkit integration
…dency for improved functionality
…dency for improved functionality
There was a problem hiding this 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 pull request introduces significant architectural changes to support Folia compatibility, refactor the plugin structure, and update the ItemCreator API to require plugin instances. The changes include package restructuring, removal of deprecated features, and introduction of a new scheduler abstraction for Folia/Bukkit compatibility.
- Package reorganization: Moving core plugin classes from
com.github.pinont.singularitylib.plugintocom.github.pinont.plugin - API breaking change: ItemCreator constructors now require a Plugin parameter
- New functionality: Folia detection and Scheduler abstraction for cross-platform task scheduling
- Cleanup: Removal of deprecated commands (DevTool, FlySpeed, Vanish)
Reviewed Changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| ItemCreatorMetaTest.java | Updated all ItemCreator instantiations to include plugin parameter |
| TestPlugin.java | Updated CorePlugin import path after package restructure |
| paper-plugin.yml | New plugin configuration file for Paper/Folia |
| api-version.yml | Removed version configuration file |
| Vanish.java, FlySpeed.java, DevTool.java | Removed deprecated command implementations |
| ItemCreator.java | Updated to require Plugin parameter, moved static utility methods to ItemInteraction |
| ItemHeadCreator.java, CrossbowCreator.java | Updated constructors to accept Plugin parameter |
| ItemInteraction.java | Changed from interface to abstract class, added static utility methods |
| Menu.java, Layout.java | Updated to require Plugin parameter, changed Layout to concrete class |
| Scheduler.java, Runner.java | New Folia/Bukkit scheduler abstraction layer |
| EntityCreator.java | Refactored to use HashMap for properties instead of individual boolean flags |
| ConfigManager.java | Added reloadConfig method, changed config field to non-final |
| CorePlugin.java | Added Folia detection, updated package paths |
| pom.xml | Updated version to 1.3.0-SNAPSHOT, added Folia API dependency |
| Various manager/util classes | Updated import statements for new package structure |
Comments suppressed due to low confidence (1)
src/main/java/com/github/pinont/singularitylib/api/entity/EntityCreator.java:243
- Variable properties may be null at this access as suggested by this null guard.
if (properties.containsKey("maxHealth")) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| private boolean isSetMaxHealth = false; | ||
| private double maxHealth; | ||
| private HashMap<String, Object> properties; |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The properties HashMap is never initialized, which will cause a NullPointerException when any setter method is called (e.g., addPassenger, setMaxHealth). Initialize the HashMap in the constructor: this.properties = new HashMap<>();
| Entity entity = Objects.requireNonNull(location.getWorld()).spawnEntity(location, entityType); | ||
| sendDebugMessage("Spawned " + entityType + " at " + location); | ||
| if (isSetMaxHealth) { | ||
| if (properties != null) return entity; |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is inverted. The method returns early if properties is NOT null, which means all property configurations are ignored. This should be if (properties == null) return entity; to skip property application only when no properties have been set.
| if (properties != null) return entity; | |
| if (properties == null) return entity; |
| scheduledTask = regionScheduler.runAtFixedRate(plugin, location, _ -> runner.run(), delayTicks, periodTicks); | ||
| } else { | ||
| bukkitScheduler = server.getScheduler(); | ||
| bukkitTask = bukkitScheduler.runTaskTimer(plugin, runner::run, 0L, periodTicks * timeUnit.toMillis(periodTicks)); |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect calculation for Bukkit task timer period. The timeUnit.toMillis(periodTicks) converts ticks to milliseconds, but runTaskTimer expects ticks. This should use Common.toTicks(periodTicks, timeUnit) instead to convert the period to ticks correctly.
| bukkitTask = bukkitScheduler.runTaskTimer(plugin, runner::run, 0L, periodTicks * timeUnit.toMillis(periodTicks)); | |
| bukkitTask = bukkitScheduler.runTaskTimer(plugin, runner::run, 0L, Common.toTicks(periodTicks, timeUnit)); |
| } | ||
|
|
||
| public void runRepeatingTask(Plugin plugin, World world, Runner runner, int delayTicks, long periodTicks, TimeUnit timeUnit) { | ||
| new Scheduler().runRepeatingTask(plugin, new Location(world, 0, 0, 0), runner,delayTicks, periodTicks, timeUnit); |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a new Scheduler instance and calling an instance method is inefficient and loses the reference to the scheduled task. This should either call the method on the current instance (this.runRepeatingTask(...)) or return the created Scheduler so the caller can manage the task.
| new Scheduler().runRepeatingTask(plugin, new Location(world, 0, 0, 0), runner,delayTicks, periodTicks, timeUnit); | |
| this.runRepeatingTask(plugin, new Location(world, 0, 0, 0), runner, delayTicks, periodTicks, timeUnit); |
| } | ||
|
|
||
| public void runRepeatingTask(Plugin plugin, World world, Runner runner, int delayTicks, long periodTicks, TimeUnit timeUnit) { | ||
| new Scheduler().runRepeatingTask(plugin, new Location(world, 0, 0, 0), runner,delayTicks, periodTicks, timeUnit); |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after comma in method call arguments between runner and delayTicks.
| new Scheduler().runRepeatingTask(plugin, new Location(world, 0, 0, 0), runner,delayTicks, periodTicks, timeUnit); | |
| new Scheduler().runRepeatingTask(plugin, new Location(world, 0, 0, 0), runner, delayTicks, periodTicks, timeUnit); |
| * A layout maps a character key to a button for menu positioning. | ||
| */ | ||
| public interface Layout { | ||
| public class Layout { |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing Layout from an interface to a concrete class is a breaking API change that will affect any code that implements the interface. Consider deprecating the interface first or providing a migration path for existing implementations.
| <dependency> | ||
| <groupId>com.github.Pinont</groupId> | ||
| <artifactId>Singularity-DevTool</artifactId> | ||
| <version>cbd0e31e44</version> |
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using a git commit hash as a version for the Singularity-DevTool dependency is not recommended for production. Consider using a tagged release version for better version tracking and stability.
| <version>cbd0e31e44</version> | |
| <version>1.2.0</version> |
| public Player getDamager() { | ||
| return this.damager; | ||
| } | ||
|
|
Copilot
AI
Nov 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method overrides Event.callEvent; it is advisable to add an Override annotation.
| @Override |
No description provided.