fixed missed command registration for extension, 1.3.0, added optional version.
This commit is contained in:
1 parent
3dfd44538b
commit
8b1286f8af
5 files changed
+17
-3
No files matched your search
+1
-1
@@ -9,7 +9,7 @@ org.gradle.jvmargs=-Xmx1G
|
|||||||
loader_version=0.7.2+build.174
|
loader_version=0.7.2+build.174
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.2.6+v191209
|
mod_version = 1.3.0+v191210
|
||||||
maven_group = carpet
|
maven_group = carpet
|
||||||
archives_base_name = fabric-carpet
|
archives_base_name = fabric-carpet
|
||||||
|
|
||||||
|
|||||||
@@ -47,4 +47,6 @@ public interface CarpetExtension
|
|||||||
default void onPlayerLoggedOut(ServerPlayerEntity player) {}
|
default void onPlayerLoggedOut(ServerPlayerEntity player) {}
|
||||||
|
|
||||||
default void onServerClosed(MinecraftServer server) {}
|
default void onServerClosed(MinecraftServer server) {}
|
||||||
|
|
||||||
|
default String version() {return null;}
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,7 @@ public class CarpetServer // static for now - easier to handle all around the co
|
|||||||
{
|
{
|
||||||
public static final Random rand = new Random((int)((2>>16)*Math.random()));
|
public static final Random rand = new Random((int)((2>>16)*Math.random()));
|
||||||
public static MinecraftServer minecraft_server;
|
public static MinecraftServer minecraft_server;
|
||||||
|
private static CommandDispatcher<ServerCommandSource> currentCommandDispatcher;
|
||||||
public static CarpetScriptServer scriptServer;
|
public static CarpetScriptServer scriptServer;
|
||||||
public static SettingsManager settingsManager;
|
public static SettingsManager settingsManager;
|
||||||
public static List<CarpetExtension> extensions = new ArrayList<>();
|
public static List<CarpetExtension> extensions = new ArrayList<>();
|
||||||
@@ -41,6 +42,13 @@ public class CarpetServer // static for now - easier to handle all around the co
|
|||||||
public static void manageExtension(CarpetExtension extension)
|
public static void manageExtension(CarpetExtension extension)
|
||||||
{
|
{
|
||||||
extensions.add(extension);
|
extensions.add(extension);
|
||||||
|
// for extensions that come late to the party, after server is created / loaded
|
||||||
|
// we will handle them now.
|
||||||
|
// that would handle all extensions, even these that add themselves really late to the party
|
||||||
|
if (currentCommandDispatcher != null)
|
||||||
|
{
|
||||||
|
extension.registerCommands(currentCommandDispatcher);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onGameStarted()
|
public static void onGameStarted()
|
||||||
@@ -93,7 +101,10 @@ public class CarpetServer // static for now - easier to handle all around the co
|
|||||||
DrawCommand.register(dispatcher);
|
DrawCommand.register(dispatcher);
|
||||||
ScriptCommand.register(dispatcher);
|
ScriptCommand.register(dispatcher);
|
||||||
MobAICommand.register(dispatcher);
|
MobAICommand.register(dispatcher);
|
||||||
|
// registering command of extensions that has registered before either server is created
|
||||||
|
// for all other, they will have them registered when they add themselves
|
||||||
extensions.forEach(e -> e.registerCommands(dispatcher));
|
extensions.forEach(e -> e.registerCommands(dispatcher));
|
||||||
|
currentCommandDispatcher = dispatcher;
|
||||||
//TestCommand.register(dispatcher);
|
//TestCommand.register(dispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,6 +122,7 @@ public class CarpetServer // static for now - easier to handle all around the co
|
|||||||
|
|
||||||
public static void onServerClosed(MinecraftServer server)
|
public static void onServerClosed(MinecraftServer server)
|
||||||
{
|
{
|
||||||
|
currentCommandDispatcher = null;
|
||||||
scriptServer.onClose();
|
scriptServer.onClose();
|
||||||
settingsManager.detachServer();
|
settingsManager.detachServer();
|
||||||
LoggerRegistry.stopLoggers();
|
LoggerRegistry.stopLoggers();
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import static carpet.settings.RuleCategory.DISPENSER;
|
|||||||
|
|
||||||
public class CarpetSettings
|
public class CarpetSettings
|
||||||
{
|
{
|
||||||
public static final String carpetVersion = "1.2.6+v191209";
|
public static final String carpetVersion = "1.3.0+v191210";
|
||||||
public static final Logger LOG = LogManager.getLogger();
|
public static final Logger LOG = LogManager.getLogger();
|
||||||
public static boolean skipGenerationChecks = false;
|
public static boolean skipGenerationChecks = false;
|
||||||
public static boolean impendingFillSkipUpdates = false;
|
public static boolean impendingFillSkipUpdates = false;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"schemaVersion": 1,
|
"schemaVersion": 1,
|
||||||
"id": "carpet",
|
"id": "carpet",
|
||||||
"version": "1.2.6",
|
"version": "1.3.0",
|
||||||
|
|
||||||
"name": "Carpet Mod in Fabric",
|
"name": "Carpet Mod in Fabric",
|
||||||
"description": "Carpet made out of fabric",
|
"description": "Carpet made out of fabric",
|
||||||
|
|||||||
Reference in new issue
Block a user