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:
Paldiu
2022-04-14 14:58:14 -05:00
parent 899768819e
commit 8e70e1de73
7 changed files with 143 additions and 42 deletions

View File

@ -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);
}
}