Bug Fix 0001

**Changelog**:
 - Fixed a bug where the PlayerListener was not being initialized
 - Included the registration for the listener inside the constructor
 - Dropped static import in favor of class parent access
 - Added to the Luck method "setValue(double)" to automatically update the configuration file when called.
 - Adjusted Luck to utilize all 1024 units when calculating the boolean for rng percentage.
This commit is contained in:
Paldiu
2022-04-02 09:00:40 -05:00
parent ffdafda69c
commit 247a2fafc0
18 changed files with 33 additions and 16 deletions

View File

@ -1,5 +1,6 @@
package io.github.simplex.luck;
import io.github.simplex.luck.listener.PlayerListener;
import io.github.simplex.luck.player.PlayerConfig;
import io.github.simplex.luck.player.PlayerHandler;
import org.bukkit.Bukkit;
@ -15,6 +16,7 @@ public final class FeelingLucky extends JavaPlugin {
private static final Map<UUID, PlayerConfig> configMap = new HashMap<>();
public LuckCMD cmd;
public PlayerHandler handler;
public PlayerListener playerListener;
public static Map<UUID, PlayerConfig> getConfigMap() {
return configMap;
@ -24,8 +26,8 @@ public final class FeelingLucky extends JavaPlugin {
public void onEnable() {
Bukkit.getLogger().info("Initializing the PlayerHandler...");
handler = new PlayerHandler(this);
Bukkit.getLogger().info("Initialization complete! Attempting to register the handler...");
this.getServer().getPluginManager().registerEvents(handler, this);
Bukkit.getLogger().info("Initialization complete! Attempting to register the Listeners...");
playerListener = new PlayerListener(this);
Bukkit.getLogger().info("Registration complete! Attempting to load all player configuration files...");
File[] files = getDataFolder().listFiles();