mirror of
https://github.com/SimplexDevelopment/FeelingLucky.git
synced 2025-07-04 19:16:41 +00:00
Beta 20220414-SNAPSHOT
Changelog: - Added the ability to fully mature crops when using bone meal - Added the ability to cheat death (Grants 1 half heart and between 2.5 and 5 points of absorption) - Added #info, #warn, and #err to MiniComponent, and utilized these across the board. - Switched the #color method to use org.bukkit.ChatColor instead of TextColor for accessibility. - Moved loading configurations and listener registration to separate methods.
This commit is contained in:
@ -28,27 +28,9 @@ public final class FeelingLucky extends JavaPlugin {
|
||||
getLogger().info("Initializing the PlayerHandler...");
|
||||
handler = new PlayerHandler(this);
|
||||
getLogger().info("Initialization complete! Attempting to register the Listeners...");
|
||||
new PlayerListener(this);
|
||||
new BlockDrops(this);
|
||||
new ItemDrops(this);
|
||||
new TakeDamage(this);
|
||||
new RestoreHunger(this);
|
||||
new EnchantmentBoost(this);
|
||||
new ExpBoost(this);
|
||||
registerListeners();
|
||||
getLogger().info("Registration complete! Attempting to load all player configuration files...");
|
||||
|
||||
File[] files = getDataFolder().listFiles();
|
||||
if (files != null) {
|
||||
Arrays.stream(files).forEach(file -> {
|
||||
UUID uuid = UUID.fromString(file.getName().split("\\.")[0]);
|
||||
configMap.put(uuid, PlayerConfig.loadFrom(this, file));
|
||||
});
|
||||
configMap.forEach((u, pc) -> pc.load());
|
||||
getLogger().info("Successfully loaded all configurations!");
|
||||
} else {
|
||||
getLogger().info("There are no player configurations to load.");
|
||||
}
|
||||
|
||||
loadConfigurations();
|
||||
Bukkit.getLogger().info("Attempting to load the Luck command...");
|
||||
cmd = new LuckCMD(this);
|
||||
Bukkit.getLogger().info("Successfully loaded the Luck command!");
|
||||
@ -61,4 +43,30 @@ public final class FeelingLucky extends JavaPlugin {
|
||||
Bukkit.getLogger().info("Saving all player configurations...");
|
||||
configMap.values().forEach(PlayerConfig::save);
|
||||
}
|
||||
|
||||
private void loadConfigurations() {
|
||||
File[] files = getDataFolder().listFiles();
|
||||
if (files != null) {
|
||||
Arrays.stream(files).forEach(file -> {
|
||||
UUID uuid = UUID.fromString(file.getName().split("\\.")[0]);
|
||||
configMap.put(uuid, PlayerConfig.loadFrom(this, file));
|
||||
});
|
||||
configMap.forEach((u, pc) -> pc.load());
|
||||
getLogger().info("Successfully loaded all configurations!");
|
||||
} else {
|
||||
getLogger().info("There are no player configurations to load.");
|
||||
}
|
||||
}
|
||||
|
||||
private void registerListeners() {
|
||||
new PlayerListener(this);
|
||||
new BlockDrops(this);
|
||||
new ItemDrops(this);
|
||||
new TakeDamage(this);
|
||||
new RestoreHunger(this);
|
||||
new EnchantmentBoost(this);
|
||||
new ExpBoost(this);
|
||||
new CheatDeath(this);
|
||||
new BonemealFullCrop(this);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user