Fix rules-to-wiki and generalize some code for extension's equivalents (#696)
* Fix rules-to-wiki output * Publicize OLD_OUT in RulePrinter to simplify extension's equivalents And rename to CarpetRulePrinter because of the same reason
This commit is contained in:
1 parent
2604ff5a9d
commit
4807e4d518
3 files changed
+35
-23
No files matched your search
@@ -0,0 +1,33 @@
|
||||
package carpet.utils;
|
||||
|
||||
import carpet.CarpetServer;
|
||||
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.lang.System;
|
||||
|
||||
/**
|
||||
* Runs only from GitHub Actions to generate the wiki
|
||||
* page with all Carpet rules on it.
|
||||
* It is here so it can be managed by the IDE
|
||||
*
|
||||
*/
|
||||
public class CarpetRulePrinter implements DedicatedServerModInitializer, PreLaunchEntrypoint {
|
||||
public static final PrintStream OLD_OUT = System.out;
|
||||
|
||||
@Override
|
||||
public void onInitializeServer() {
|
||||
// Minecraft (or whatever) changes the System.out to have prefixes,
|
||||
// our simple parser doesn't like that. So we change it back
|
||||
System.setOut(OLD_OUT);
|
||||
CarpetServer.onGameStarted();
|
||||
CarpetServer.settingsManager.printAllRulesToLog(null);
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPreLaunch() {
|
||||
// Just initializes our OLD_OUT by nooping the class
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user