fix: welcome module crashing
This commit is contained in:
4 files changed
+8
-15
No files matched your search
@@ -1,6 +1,5 @@
|
||||
package io.ib67.sfcraft.config;
|
||||
|
||||
public class ConfigResources {
|
||||
public static final String UPDATE_LOG="update.log";
|
||||
public static final String MOTD="motd.txt";
|
||||
}
|
||||
@@ -50,6 +50,7 @@ public abstract class GuiceModInitializer extends AbstractModule implements ModI
|
||||
moduleManager = new SimpleModuleManager(Map.copyOf(map));
|
||||
}
|
||||
|
||||
|
||||
private void onServerStopping(MinecraftServer minecraftServer) {
|
||||
onStopping(minecraftServer);
|
||||
}
|
||||
|
||||
@@ -35,25 +35,13 @@ public class WelcomeModule extends ServerModule {
|
||||
private static final DateTimeFormatter FMT = DateTimeFormatter.ofPattern("yyyy/MM/dd");
|
||||
@Inject
|
||||
private SFConfig config;
|
||||
@Inject
|
||||
@ConfigRoot
|
||||
private Path root;
|
||||
@Inject
|
||||
private GeoIPService geoIPService;
|
||||
private String updateLog;
|
||||
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
updateLog = getConfigResource(root, ConfigResources.UPDATE_LOG).orElse("他没写呢");
|
||||
ServerPlayConnectionEvents.JOIN.register(this::onPlayerJoin);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ConfigResource(ConfigResources.UPDATE_LOG)
|
||||
private String getUpdateLog() {
|
||||
return updateLog;
|
||||
}
|
||||
|
||||
public void onPlayerJoin(ServerPlayNetworkHandler serverPlayNetworkHandler, PacketSender
|
||||
packetSender, MinecraftServer minecraftServer) {
|
||||
var player = serverPlayNetworkHandler.getPlayer();
|
||||
|
||||
Reference in new issue
Block a user