1 parent
6747bb6001
commit
2522884da3
6 files changed
+179
-1
No files matched your search
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import carpet.commands.*;
|
||||
import carpet.helpers.ServerNetworkHandler;
|
||||
import carpet.helpers.TickSpeed;
|
||||
import carpet.logging.LoggerRegistry;
|
||||
import carpet.script.CarpetScriptServer;
|
||||
@@ -17,6 +18,7 @@ import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class CarpetServer // static for now - easier to handle all around the code, its one anyways
|
||||
{
|
||||
@@ -26,6 +28,7 @@ public class CarpetServer // static for now - easier to handle all around the co
|
||||
public static CarpetScriptServer scriptServer;
|
||||
public static SettingsManager settingsManager;
|
||||
public static final List<CarpetExtension> extensions = new ArrayList<>();
|
||||
public static final Identifier CARPET_CHANNEL = new Identifier("carpet:info");
|
||||
|
||||
// Separate from onServerLoaded, because a server can be loaded multiple times in singleplayer
|
||||
public static void manageExtension(CarpetExtension extension)
|
||||
@@ -45,6 +48,9 @@ public class CarpetServer // static for now - easier to handle all around the co
|
||||
settingsManager = new SettingsManager(CarpetSettings.carpetVersion, "carpet", "Carpet Mod");
|
||||
settingsManager.parseSettingsClass(CarpetSettings.class);
|
||||
extensions.forEach(CarpetExtension::onGameStarted);
|
||||
CarpetServer.settingsManager.addRuleObserver((source, parsedRule, s) -> {
|
||||
ServerNetworkHandler.sendUpdateToClient(parsedRule.name, parsedRule.getAsString(), source);
|
||||
});
|
||||
}
|
||||
|
||||
public static void onServerLoaded(MinecraftServer server)
|
||||
@@ -104,6 +110,7 @@ public class CarpetServer // static for now - easier to handle all around the co
|
||||
{
|
||||
LoggerRegistry.playerConnected(player);
|
||||
extensions.forEach(e -> e.onPlayerLoggedIn(player));
|
||||
ServerNetworkHandler.onPlayerJoin(player);
|
||||
}
|
||||
|
||||
public static void onPlayerLoggedOut(ServerPlayerEntity player)
|
||||
|
||||
Reference in new issue
Block a user