Skip to content

Commit 6d4e0cc

Browse files
Added a config file that dictates the port javalin listens on (servertap-io#22)
1 parent 3269c63 commit 6d4e0cc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/main/java/io/servertap/PluginEntrypoint.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import io.swagger.v3.oas.models.info.Info;
1111
import net.milkbowl.vault.economy.Economy;
1212
import org.bukkit.Bukkit;
13+
import org.bukkit.configuration.file.FileConfiguration;
1314
import org.bukkit.plugin.RegisteredServiceProvider;
1415
import org.bukkit.plugin.java.JavaPlugin;
1516

@@ -24,7 +25,8 @@ public class PluginEntrypoint extends JavaPlugin {
2425
private static Javalin app = null;
2526
@Override
2627
public void onEnable() {
27-
28+
saveDefaultConfig();
29+
FileConfiguration bukkitConfig = getConfig();
2830
setupEconomy();
2931

3032
// Get the current class loader.
@@ -44,7 +46,7 @@ public void onEnable() {
4446
});
4547
}
4648
// Don't create a new instance if the plugin is reloaded
47-
app.start(4567);
49+
app.start(bukkitConfig.getInt("port"));
4850

4951
app.before(ctx -> log.info(ctx.req.getPathInfo()));
5052

src/main/resources/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
port: 4567

0 commit comments

Comments
 (0)