added config support

This commit is contained in:
2023-10-07 03:09:28 +02:00
parent 0fe5ce24a8
commit 6ac6455f2d
9 changed files with 51 additions and 16 deletions

View File

@ -0,0 +1,14 @@
package de.steev.bm.Manager;
public class ConfigManager {
private GameManager gameManager;
public ConfigManager(GameManager gameManager) {
this.gameManager = gameManager;
}
public boolean GetBool(String Key){
return gameManager.getPlugin().getConfig().getBoolean(Key);
}
}

View File

@ -12,6 +12,7 @@ public class GameManager {
private BetterMinecraft plugin;
private RecipyManager recipyManager;
private PlayerManager playerManager;
private ConfigManager configManager;
/**
* initilizes the Gamemanager and all systems beneath it
@ -26,20 +27,22 @@ public class GameManager {
this.recipyManager = new RecipyManager(this);
this.playerManager = new PlayerManager(this);
this.configManager = new ConfigManager(this);
this.plugin.getLogger().info("registring Recipies");
this.plugin.getLogger().info("saddle");
char[] s_ing = { 'L', 'S', 'I', 'W' };
String[] s_rec = { "LLL", "SWS", "I I" };
Material[] s_mat = { Material.LEATHER, Material.STRING, Material.IRON_INGOT, Material.WHITE_WOOL};
this.recipyManager.RegisterNew(s_ing, s_mat, s_rec, 1, Material.SADDLE, "Saddle");
this.plugin.getLogger().info("String");
char[] w_ing = { 'W', 'F', };
String[] w_rec = { " W ", "WFW", " W " };
Material[] w_mat = { Material.WHITE_WOOL, Material.FLINT };
this.recipyManager.RegisterNew(w_ing, w_mat, w_rec, 4, Material.STRING, "String");
if (this.configManager.GetBool("custom_recipes")) {
this.plugin.getLogger().info("registring Recipies");
this.plugin.getLogger().info("saddle");
char[] s_ing = {'L', 'S', 'I', 'W'};
String[] s_rec = {"LLL", "SWS", "I I"};
Material[] s_mat = {Material.LEATHER, Material.STRING, Material.IRON_INGOT, Material.WHITE_WOOL};
this.recipyManager.RegisterNew(s_ing, s_mat, s_rec, 1, Material.SADDLE, "Saddle");
this.plugin.getLogger().info("String");
char[] w_ing = {'W', 'F',};
String[] w_rec = {" W ", "WFW", " W "};
Material[] w_mat = {Material.WHITE_WOOL, Material.FLINT};
this.recipyManager.RegisterNew(w_ing, w_mat, w_rec, 4, Material.STRING, "String");
}
}
public BetterMinecraft getPlugin(){
@ -53,5 +56,9 @@ public class GameManager {
public PlayerManager getPlayerManager() {
return playerManager;
}
public ConfigManager getConfigManager() {
return configManager;
}
}