@@ -104,27 +104,17 @@ public class RBountyPlugin {
104
104
private ConfigurationLoader <CommentedConfigurationNode > configLoader = HoconConfigurationLoader .builder ()
105
105
.setPath (configFile ).build ();
106
106
private CommentedConfigurationNode configNode ;
107
- public boolean broadcasts ;
108
-
109
- @ Listener
110
- public void onPreInit (GamePreInitializationEvent e ) {
111
- // Creates config directory, your could also create a method for this.
112
- if (!Files .exists (configDir )) {
113
- try {
114
- Files .createDirectories (configDir );
115
- } catch (IOException io ) {
116
- io .printStackTrace ();
117
- }
118
- }
119
- setup ();
120
- }
107
+ public boolean broadcasts = true ;
121
108
122
109
// Creates config file not directory
123
110
public void setup () {
124
111
if (!Files .exists (configFile )) {
125
112
try {
113
+ logger .error ("I GOT HERE" );
126
114
Files .createFile (configFile );
127
-
115
+ configNode = configLoader .load ();
116
+ configNode .setComment ("Should the server broadcast bounty changes/claims?" );
117
+ configNode .setValue (true );
128
118
} catch (IOException e ) {
129
119
e .printStackTrace ();
130
120
}
@@ -137,6 +127,7 @@ public void setup() {
137
127
public void load () {
138
128
try {
139
129
configNode = configLoader .load ();
130
+ broadcasts = configNode .getBoolean ();
140
131
} catch (IOException e ) {
141
132
e .printStackTrace ();
142
133
}
@@ -148,6 +139,16 @@ public void onInit(GameInitializationEvent event) {
148
139
.builder (new BountyDataBuilder ()).manipulatorId ("rbounty:bounty" ).dataName ("Bounty" )
149
140
.buildAndRegister (container );
150
141
142
+ // Creates config directory, your could also create a method for this.
143
+ if (!Files .exists (configDir )) {
144
+ try {
145
+ Files .createDirectories (configDir );
146
+ } catch (IOException io ) {
147
+ io .printStackTrace ();
148
+ }
149
+ }
150
+ setup ();
151
+
151
152
Sponge .getCommandManager ().register (container , bountyMain , "bounty" );
152
153
}
153
154
0 commit comments