1010import org .bukkit .block .data .Ageable ;
1111import org .bukkit .block .data .BlockData ;
1212import org .bukkit .configuration .file .FileConfiguration ;
13+ import org .bukkit .plugin .Plugin ;
1314
1415import java .util .*;
1516import java .util .logging .Logger ;
1617
1718public class ConfigHandler {
1819 private static final Logger logger = Scythe .getScytheLogger ();
19- private static final FileConfiguration config = Scythe .getScytheConfig ();
20+ private static final Plugin instance = Scythe .getInstance ();
2021 private static boolean requireHoe ;
2122 private static boolean rightClickHarvest ;
2223 private static final HashMap <Message , String > messageMap = new HashMap <>();
@@ -30,13 +31,13 @@ public static void configParser(){
3031 setConfiguredCrops ();
3132 requireHoe = false ;
3233 rightClickHarvest = true ;
33- requireHoe = config .getBoolean ("require-hoe" );
34- rightClickHarvest = config .getBoolean ("right-click-to-harvest" );
34+ requireHoe = instance . getConfig () .getBoolean ("require-hoe" );
35+ rightClickHarvest = instance . getConfig () .getBoolean ("right-click-to-harvest" );
3536 }
3637
3738 private static void setConfiguredCrops (){
3839 configuredCrops .clear ();
39- List <String > cropList = config .getStringList ("crops" );
40+ List <String > cropList = instance . getConfig () .getStringList ("crops" );
4041 for (String configCrop : cropList ){
4142 if (Material .matchMaterial (configCrop ) == null ){
4243 logger .warning ( messageMap .get (Message .CONSOLE_PREFIX ) + configCrop + " is not a valid material. Please check to be sure you spelled everything correctly." );
@@ -84,25 +85,25 @@ private static void setMessageMap(){
8485 messageMap .clear ();
8586 messageMap .put (Message .CONSOLE_PREFIX , "[Scythe] " );
8687 messageMap .put (Message .PREFIX ,
87- config .getString ("prefix" ,"<gold><bold>[</bold><yellow>Scythe</yellow><bold>]<reset>" ));
88+ instance . getConfig () .getString ("prefix" ,"<gold><bold>[</bold><yellow>Scythe</yellow><bold>]<reset>" ));
8889 messageMap .put (Message .TOGGLE_ON ,
89- config .getString ("toggle-on" , "<green>Scythe toggled on!" ));
90+ instance . getConfig () .getString ("toggle-on" , "<green>Scythe toggled on!" ));
9091 messageMap .put (Message .TOGGLE_OFF ,
91- config .getString ("toggle-off" , "<red>Scythe toggled off!" ));
92+ instance . getConfig () .getString ("toggle-off" , "<red>Scythe toggled off!" ));
9293 messageMap .put (Message .UNKNOWN_COMMAND ,
93- config .getString ("unknown-command" , "<red>Unknown Command" ));
94+ instance . getConfig () .getString ("unknown-command" , "<red>Unknown Command" ));
9495 messageMap .put (Message .CONFIG_RELOAD ,
95- config .getString ("config-reload" , "<gold>Scythe Config Reloaded!" ));
96+ instance . getConfig () .getString ("config-reload" , "<gold>Scythe Config Reloaded!" ));
9697 messageMap .put (Message .NO_PERMISSION ,
97- config .getString ("no-permission" , "<red>You do not have the required Permission to run this command" ));
98+ instance . getConfig () .getString ("no-permission" , "<red>You do not have the required Permission to run this command" ));
9899 messageMap .put (Message .NOT_A_PLAYER ,
99- config .getString ("not-a-player" , "Sorry! This command can only be run by a player" ));
100+ instance . getConfig () .getString ("not-a-player" , "Sorry! This command can only be run by a player" ));
100101 messageMap .put (Message .HELP_MAIN ,
101- config .getString ("help-main" , "<grey>Scythe allows players to harvest grown crops without needing to replant" ));
102+ instance . getConfig () .getString ("help-main" , "<grey>Scythe allows players to harvest grown crops without needing to replant" ));
102103 messageMap .put (Message .HELP_TOGGLE ,
103- config .getString ("help-toggle" , "<yellow>/scythe toggle \n <grey>• Toggle scythe on or off" ));
104+ instance . getConfig () .getString ("help-toggle" , "<yellow>/scythe toggle \n <grey>• Toggle scythe on or off" ));
104105 messageMap .put (Message .HELP_RELOAD ,
105- config .getString ("help-reload" , "<yellow>/scythe reload \n <grey>• Reloads config settings" ));
106+ instance . getConfig () .getString ("help-reload" , "<yellow>/scythe reload \n <grey>• Reloads config settings" ));
106107 }
107108 public static Map <Message , String > getMessageMap () {
108109 return Collections .unmodifiableMap (messageMap );
0 commit comments