Skip to content

Commit 86bcfa5

Browse files
author
RohitM2019
committed
oh no
1 parent 124f3c0 commit 86bcfa5

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

src/main/java/io/github/rm2023/rbounty/RBountyPlugin.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,27 +104,17 @@ public class RBountyPlugin {
104104
private ConfigurationLoader<CommentedConfigurationNode> configLoader = HoconConfigurationLoader.builder()
105105
.setPath(configFile).build();
106106
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;
121108

122109
// Creates config file not directory
123110
public void setup() {
124111
if (!Files.exists(configFile)) {
125112
try {
113+
logger.error("I GOT HERE");
126114
Files.createFile(configFile);
127-
115+
configNode = configLoader.load();
116+
configNode.setComment("Should the server broadcast bounty changes/claims?");
117+
configNode.setValue(true);
128118
} catch (IOException e) {
129119
e.printStackTrace();
130120
}
@@ -137,6 +127,7 @@ public void setup() {
137127
public void load() {
138128
try {
139129
configNode = configLoader.load();
130+
broadcasts = configNode.getBoolean();
140131
} catch (IOException e) {
141132
e.printStackTrace();
142133
}
@@ -148,6 +139,16 @@ public void onInit(GameInitializationEvent event) {
148139
.builder(new BountyDataBuilder()).manipulatorId("rbounty:bounty").dataName("Bounty")
149140
.buildAndRegister(container);
150141

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+
151152
Sponge.getCommandManager().register(container, bountyMain, "bounty");
152153
}
153154

0 commit comments

Comments
 (0)