This commit is contained in:
gnembon committed 2019-07-17 22:36:56 -03:00
1 parent dc0dc9e406
commit 17a23f14dd
3 files changed
+23

No files matched your search

@@ -46,4 +46,5 @@ public abstract class CarpetExtension
*/
public void onPlayerLoggedOut(PlayerEntity player) {}
default void onServerClosed(MinecraftServer server) {};
}
+16
View File
@@ -25,6 +25,7 @@ import carpet.utils.HUDController;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;
public class CarpetServer // static for now - easier to handle all around the code, its one anyways
{
@@ -90,5 +91,20 @@ public class CarpetServer // static for now - easier to handle all around the co
extensions.forEach(e -> e.registerCommands(dispatcher));
//TestCommand.register(dispatcher);
}
public static void onPlayerLoggedIn(ServerPlayerEntity player)
{
extensions.forEach(e -> e.onPlayerLoggedIn(player));
}
public static void onPlayerLoggedOut(ServerPlayerEntity player)
{
extensions.forEach(e -> e.onPlayerLoggedOut(player));
}
public static void onServerClosed(MinecraftServer server)
{
extensions.forEach(e -> e.onServerClosed(server));
}
}
@@ -35,4 +35,10 @@ public abstract class MinecraftServer_coreMixin
{
CarpetServer.onServerLoaded((MinecraftServer) (Object) this);
}
@Inject(method = "shutdown", at = @At("HEAD"))
private void serverClosed(CallbackInfo ci)
{
CarpetServer.onServerClosed((MinecraftServer) (Object) this);
}
}