diff --git a/.idea/misc.xml b/.idea/misc.xml
index a37520a..121ee87 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -12,7 +12,7 @@
-
+
\ No newline at end of file
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/commands/CraterCommand.java b/Common/src/main/java/com/hypherionmc/craterlib/api/commands/CraterCommand.java
new file mode 100644
index 0000000..bef5990
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/commands/CraterCommand.java
@@ -0,0 +1,53 @@
+package com.hypherionmc.craterlib.api.commands;
+
+import com.hypherionmc.craterlib.nojang.authlib.BridgedGameProfile;
+import com.hypherionmc.craterlib.nojang.commands.BridgedCommandSourceStack;
+import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
+import com.mojang.brigadier.arguments.ArgumentType;
+import lombok.Getter;
+import net.minecraft.commands.arguments.GameProfileArgument;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.logging.log4j.util.TriConsumer;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.function.Consumer;
+
+@Getter
+public class CraterCommand {
+
+ private final HashMap, TriConsumer, ?, BridgedCommandSourceStack>>> arguments = new LinkedHashMap<>();
+ private Consumer executor;
+
+ private final String commandName;
+ private int permissionLevel = 4;
+
+ CraterCommand(String commandName) {
+ this.commandName = commandName;
+ }
+
+ public static CraterCommand literal(String commandName) {
+ return new CraterCommand(commandName);
+ }
+
+ public CraterCommand requiresPermission(int perm) {
+ this.permissionLevel = perm;
+ return this;
+ }
+
+ public CraterCommand withGameProfileArgument(String key, TriConsumer, BridgedCommandSourceStack> executor) {
+ arguments.put(key, Pair.of(GameProfileArgument.gameProfile(), executor));
+ return this;
+ }
+
+ public CraterCommand executes(Consumer ctx) {
+ executor = ctx;
+ return this;
+ }
+
+ public boolean hasArguments() {
+ return !arguments.isEmpty();
+ }
+
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/CraterClientTickEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/CraterClientTickEvent.java
deleted file mode 100644
index 1360d9d..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/CraterClientTickEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.hypherionmc.craterlib.api.event.client;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import net.minecraft.client.multiplayer.ClientLevel;
-
-/**
- * @author HypherionSA
- * Cross Modloader Client Tick Event.
- */
-public class CraterClientTickEvent extends CraterEvent {
-
- private final ClientLevel level;
-
- public CraterClientTickEvent(ClientLevel level) {
- this.level = level;
- }
-
- public ClientLevel getLevel() {
- return level;
- }
-
- @Override
- public boolean canCancel() {
- return false;
- }
-}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/CraterSinglePlayerEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/CraterSinglePlayerEvent.java
deleted file mode 100644
index 3f7b87d..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/CraterSinglePlayerEvent.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.hypherionmc.craterlib.api.event.client;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import net.minecraft.world.entity.player.Player;
-
-public class CraterSinglePlayerEvent extends CraterEvent {
-
- private final Player player;
-
- public CraterSinglePlayerEvent(Player player) {
- this.player = player;
- }
-
- public Player getPlayer() {
- return player;
- }
-
- @Override
- public boolean canCancel() {
- return false;
- }
-
- public static class PlayerLogin extends CraterSinglePlayerEvent {
-
- public PlayerLogin(Player player) {
- super(player);
- }
-
- }
-}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/LateInitEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/LateInitEvent.java
deleted file mode 100644
index 726e0fb..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/LateInitEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.hypherionmc.craterlib.api.event.client;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.Options;
-
-public class LateInitEvent extends CraterEvent {
-
- private final Minecraft minecraft;
- private final Options options;
-
- public LateInitEvent(Minecraft minecraft, Options options) {
- this.minecraft = minecraft;
- this.options = options;
- }
-
- public Minecraft getMinecraft() {
- return minecraft;
- }
-
- public Options getOptions() {
- return options;
- }
-
- @Override
- public boolean canCancel() {
- return false;
- }
-}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/PlayerJoinRealmEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/PlayerJoinRealmEvent.java
deleted file mode 100644
index 97a4cd2..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/PlayerJoinRealmEvent.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.hypherionmc.craterlib.api.event.client;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import com.mojang.realmsclient.dto.RealmsServer;
-
-public class PlayerJoinRealmEvent extends CraterEvent {
-
- private final RealmsServer server;
-
- public PlayerJoinRealmEvent(RealmsServer server) {
- this.server = server;
- }
-
- public RealmsServer getServer() {
- return server;
- }
-
- @Override
- public boolean canCancel() {
- return false;
- }
-}
\ No newline at end of file
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/ScreenEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/ScreenEvent.java
deleted file mode 100644
index f11e83e..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/client/ScreenEvent.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.hypherionmc.craterlib.api.event.client;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import net.minecraft.client.gui.screens.Screen;
-
-import java.util.Objects;
-
-public class ScreenEvent extends CraterEvent {
-
- private final Screen screen;
-
- protected ScreenEvent(Screen screen) {
- this.screen = Objects.requireNonNull(screen);
- }
-
- public Screen getScreen() {
- return screen;
- }
-
- @Override
- public boolean canCancel() {
- return false;
- }
-
- public static class Opening extends ScreenEvent {
-
- private final Screen currentScreen;
- private Screen newScreen;
-
- public Opening(Screen currentScreen, Screen newScreen) {
- super(newScreen);
- this.currentScreen = currentScreen;
- this.newScreen = newScreen;
- }
-
- public Screen getCurrentScreen() {
- return currentScreen;
- }
-
- public Screen getNewScreen() {
- return newScreen;
- }
-
- public void setNewScreen(Screen newScreen) {
- this.newScreen = newScreen;
- }
-
- }
-}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/common/CraterLivingDeathEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/common/CraterLivingDeathEvent.java
deleted file mode 100644
index db5e053..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/common/CraterLivingDeathEvent.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.hypherionmc.craterlib.api.event.common;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import net.minecraft.world.damagesource.DamageSource;
-import net.minecraft.world.entity.LivingEntity;
-
-public class CraterLivingDeathEvent extends CraterEvent {
-
- private final DamageSource damageSource;
- private final LivingEntity entity;
-
- public CraterLivingDeathEvent(LivingEntity entity, DamageSource source) {
- this.entity = entity;
- this.damageSource = source;
- }
-
- public LivingEntity getEntity() {
- return entity;
- }
-
- public DamageSource getDamageSource() {
- return damageSource;
- }
-
- @Override
- public boolean canCancel() {
- return true;
- }
-}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterAdvancementEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterAdvancementEvent.java
deleted file mode 100644
index 3a3c774..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterAdvancementEvent.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.hypherionmc.craterlib.api.event.server;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import net.minecraft.advancements.Advancement;
-import net.minecraft.advancements.DisplayInfo;
-import net.minecraft.network.chat.Component;
-import net.minecraft.world.entity.player.Player;
-
-import java.util.Optional;
-
-public class CraterAdvancementEvent extends CraterEvent {
-
- private final Advancement advancement;
- private final Player player;
- private final Component title;
- private final Component description;
-
- public CraterAdvancementEvent(Player player, Advancement advancement) {
- this.player = player;
- this.advancement = advancement;
-
- Optional displayInfo = advancement.display();
-
- if (displayInfo.isPresent()) {
- this.title = displayInfo.get().getTitle();
- this.description = displayInfo.get().getDescription();
- } else {
- this.title = Component.literal("Unknown");
- this.description = Component.literal("Unknown");
- }
- }
-
- public Advancement getAdvancement() {
- return advancement;
- }
-
- public Component getDescription() {
- return description;
- }
-
- public Component getTitle() {
- return title;
- }
-
- public Player getPlayer() {
- return player;
- }
-
- @Override
- public boolean canCancel() {
- return false;
- }
-}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterCommandEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterCommandEvent.java
deleted file mode 100644
index 53604cc..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterCommandEvent.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.hypherionmc.craterlib.api.event.server;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import com.mojang.brigadier.ParseResults;
-import net.minecraft.commands.CommandSourceStack;
-
-public class CraterCommandEvent extends CraterEvent {
-
- private ParseResults parseResults;
- private Throwable exception;
- private String command;
-
- public CraterCommandEvent(ParseResults parseResults, String command) {
- this.parseResults = parseResults;
- this.command = command;
- }
-
- public ParseResults getParseResults() {
- return parseResults;
- }
-
- public void setParseResults(ParseResults parseResults) {
- this.parseResults = parseResults;
- }
-
- public Throwable getException() {
- return exception;
- }
-
- public void setException(Throwable exception) {
- this.exception = exception;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-
- @Override
- public boolean canCancel() {
- return true;
- }
-}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterPlayerEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterPlayerEvent.java
deleted file mode 100644
index 3c99592..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterPlayerEvent.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.hypherionmc.craterlib.api.event.server;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import net.minecraft.server.level.ServerPlayer;
-
-public class CraterPlayerEvent extends CraterEvent {
-
- private final ServerPlayer player;
-
- public CraterPlayerEvent(ServerPlayer player) {
- this.player = player;
- }
-
- public ServerPlayer getPlayer() {
- return player;
- }
-
- @Override
- public boolean canCancel() {
- return false;
- }
-
- public static class PlayerLoggedIn extends CraterPlayerEvent {
-
- public PlayerLoggedIn(ServerPlayer player) {
- super(player);
- }
-
- }
-
- public static class PlayerLoggedOut extends CraterPlayerEvent {
-
- public PlayerLoggedOut(ServerPlayer player) {
- super(player);
- }
-
- }
-}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterRegisterCommandEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterRegisterCommandEvent.java
deleted file mode 100644
index 5fe36e1..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterRegisterCommandEvent.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.hypherionmc.craterlib.api.event.server;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import com.mojang.brigadier.CommandDispatcher;
-import net.minecraft.commands.CommandSourceStack;
-
-public class CraterRegisterCommandEvent extends CraterEvent {
-
- private final CommandDispatcher dispatcher;
-
- public CraterRegisterCommandEvent(CommandDispatcher dispatcher) {
- this.dispatcher = dispatcher;
- }
-
- public CommandDispatcher getDispatcher() {
- return dispatcher;
- }
-
- @Override
- public boolean canCancel() {
- return false;
- }
-}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterServerChatEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterServerChatEvent.java
deleted file mode 100644
index e069042..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterServerChatEvent.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.hypherionmc.craterlib.api.event.server;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import net.minecraft.network.chat.Component;
-import net.minecraft.server.level.ServerPlayer;
-
-public class CraterServerChatEvent extends CraterEvent {
-
- private final String message, username;
- private final ServerPlayer player;
- private Component component;
-
- public CraterServerChatEvent(ServerPlayer player, String message, Component component) {
- this.message = message;
- this.player = player;
- this.username = player.getGameProfile().getName();
- this.component = component;
- }
-
- public Component getComponent() {
- return component;
- }
-
- public void setComponent(Component component) {
- this.component = component;
- }
-
- public String getUsername() {
- return username;
- }
-
- public ServerPlayer getPlayer() {
- return player;
- }
-
- public String getMessage() {
- return message;
- }
-
- @Override
- public boolean canCancel() {
- return true;
- }
-}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterServerLifecycleEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterServerLifecycleEvent.java
deleted file mode 100644
index 584b3f6..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/CraterServerLifecycleEvent.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.hypherionmc.craterlib.api.event.server;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import net.minecraft.server.MinecraftServer;
-
-public class CraterServerLifecycleEvent extends CraterEvent {
-
- public CraterServerLifecycleEvent() {
- }
-
- @Override
- public boolean canCancel() {
- return false;
- }
-
- public static class Starting extends CraterServerLifecycleEvent {
-
- private final MinecraftServer server;
-
- public Starting(MinecraftServer server) {
- this.server = server;
- }
-
- public MinecraftServer getServer() {
- return server;
- }
- }
-
- public static class Started extends CraterServerLifecycleEvent {
-
- public Started() {
- }
-
- }
-
- public static class Stopping extends CraterServerLifecycleEvent {
-
- public Stopping() {
- }
-
- }
-
- public static class Stopped extends CraterServerLifecycleEvent {
-
- public Stopped() {
- }
-
- }
-}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/MessageBroadcastEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/MessageBroadcastEvent.java
deleted file mode 100644
index 69207e6..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/MessageBroadcastEvent.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.hypherionmc.craterlib.api.event.server;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import net.minecraft.network.chat.Component;
-import net.minecraft.server.level.ServerPlayer;
-
-import java.util.function.Function;
-
-public class MessageBroadcastEvent extends CraterEvent {
-
- private final Component component;
- private final Function function;
- private final boolean bl;
- private final String threadName;
-
- public MessageBroadcastEvent(Component component, Function function, boolean bl, String threadName) {
- this.component = component;
- this.function = function;
- this.bl = bl;
- this.threadName = threadName;
- }
-
- public Component getComponent() {
- return component;
- }
-
- public boolean isBl() {
- return bl;
- }
-
- public Function getFunction() {
- return function;
- }
-
- public String getThreadName() {
- return threadName;
- }
-
- @Override
- public boolean canCancel() {
- return false;
- }
-}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/PlayerPreLoginEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/PlayerPreLoginEvent.java
deleted file mode 100644
index 4a4efe9..0000000
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/event/server/PlayerPreLoginEvent.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.hypherionmc.craterlib.api.event.server;
-
-import com.hypherionmc.craterlib.core.event.CraterEvent;
-import com.mojang.authlib.GameProfile;
-import net.minecraft.network.chat.Component;
-
-import java.net.SocketAddress;
-
-public class PlayerPreLoginEvent extends CraterEvent {
-
- private final SocketAddress address;
- private final GameProfile gameProfile;
- private Component message;
-
- public PlayerPreLoginEvent(SocketAddress address, GameProfile profile) {
- this.address = address;
- this.gameProfile = profile;
- }
-
- public Component getMessage() {
- return message;
- }
-
- public void setMessage(Component message) {
- this.message = message;
- }
-
- public GameProfile getGameProfile() {
- return gameProfile;
- }
-
- public SocketAddress getAddress() {
- return address;
- }
-
- @Override
- public boolean canCancel() {
- return false;
- }
-}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/CraterClientTickEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/CraterClientTickEvent.java
new file mode 100644
index 0000000..c68c596
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/CraterClientTickEvent.java
@@ -0,0 +1,14 @@
+package com.hypherionmc.craterlib.api.events.client;
+
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import com.hypherionmc.craterlib.nojang.client.multiplayer.BridgedClientLevel;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+@RequiredArgsConstructor
+@Getter
+public class CraterClientTickEvent extends CraterEvent {
+
+ private final BridgedClientLevel level;
+
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/CraterSinglePlayerEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/CraterSinglePlayerEvent.java
new file mode 100644
index 0000000..ab671f0
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/CraterSinglePlayerEvent.java
@@ -0,0 +1,21 @@
+package com.hypherionmc.craterlib.api.events.client;
+
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+@RequiredArgsConstructor
+@Getter
+public class CraterSinglePlayerEvent extends CraterEvent {
+
+ private final BridgedPlayer player;
+
+ public static class PlayerLogin extends CraterSinglePlayerEvent {
+
+ public PlayerLogin(BridgedPlayer player) {
+ super(player);
+ }
+
+ }
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/LateInitEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/LateInitEvent.java
new file mode 100644
index 0000000..33c06fb
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/LateInitEvent.java
@@ -0,0 +1,16 @@
+package com.hypherionmc.craterlib.api.events.client;
+
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import com.hypherionmc.craterlib.nojang.client.BridgedMinecraft;
+import com.hypherionmc.craterlib.nojang.client.BridgedOptions;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+@RequiredArgsConstructor
+@Getter
+public class LateInitEvent extends CraterEvent {
+
+ private final BridgedMinecraft minecraft;
+ private final BridgedOptions options;
+
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/PlayerJoinRealmEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/PlayerJoinRealmEvent.java
new file mode 100644
index 0000000..1ef95de
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/PlayerJoinRealmEvent.java
@@ -0,0 +1,14 @@
+package com.hypherionmc.craterlib.api.events.client;
+
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import com.hypherionmc.craterlib.nojang.realmsclient.dto.BridgedRealmsServer;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+@RequiredArgsConstructor
+@Getter
+public class PlayerJoinRealmEvent extends CraterEvent {
+
+ private final BridgedRealmsServer server;
+
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/ScreenEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/ScreenEvent.java
new file mode 100644
index 0000000..6d3ba24
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/client/ScreenEvent.java
@@ -0,0 +1,28 @@
+package com.hypherionmc.craterlib.api.events.client;
+
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import net.minecraft.client.gui.screens.Screen;
+
+// TODO NOJANG
+@Getter
+@RequiredArgsConstructor
+public class ScreenEvent extends CraterEvent {
+
+ private final Screen screen;
+
+ @Getter
+ public static class Opening extends ScreenEvent {
+
+ private final Screen currentScreen;
+ @Setter private Screen newScreen;
+
+ public Opening(Screen currentScreen, Screen newScreen) {
+ super(newScreen);
+ this.currentScreen = currentScreen;
+ this.newScreen = newScreen;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/common/CraterPlayerDeathEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/common/CraterPlayerDeathEvent.java
new file mode 100644
index 0000000..02cd63c
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/common/CraterPlayerDeathEvent.java
@@ -0,0 +1,21 @@
+package com.hypherionmc.craterlib.api.events.common;
+
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
+import com.hypherionmc.craterlib.utils.ChatUtils;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import net.kyori.adventure.text.Component;
+import net.minecraft.world.damagesource.DamageSource;
+
+@RequiredArgsConstructor
+@Getter
+public class CraterPlayerDeathEvent extends CraterEvent {
+
+ private final BridgedPlayer player;
+ private final DamageSource damageSource;
+
+ public Component getDeathMessage() {
+ return ChatUtils.mojangToAdventure(damageSource.getLocalizedDeathMessage(player.toMojang()));
+ }
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterAdvancementEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterAdvancementEvent.java
new file mode 100644
index 0000000..5cd659d
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterAdvancementEvent.java
@@ -0,0 +1,34 @@
+package com.hypherionmc.craterlib.api.events.server;
+
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import com.hypherionmc.craterlib.nojang.advancements.BridgedAdvancement;
+import com.hypherionmc.craterlib.nojang.advancements.BridgedDisplayInfo;
+import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
+import lombok.Getter;
+import net.kyori.adventure.text.Component;
+
+import java.util.Optional;
+
+@Getter
+public class CraterAdvancementEvent extends CraterEvent {
+
+ private final BridgedAdvancement advancement;
+ private final BridgedPlayer player;
+ private final Component title;
+ private final Component description;
+
+ public CraterAdvancementEvent(BridgedPlayer player, BridgedAdvancement advancement) {
+ this.advancement = advancement;
+ this.player = player;
+
+ Optional displayInfo = advancement.displayInfo();
+
+ if (displayInfo.isPresent()) {
+ this.title = displayInfo.get().displayName();
+ this.description = displayInfo.get().description();
+ } else {
+ this.title = Component.text("Unknown");
+ this.description = Component.text("Unknown");
+ }
+ }
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterCommandEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterCommandEvent.java
new file mode 100644
index 0000000..364cc22
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterCommandEvent.java
@@ -0,0 +1,58 @@
+package com.hypherionmc.craterlib.api.events.server;
+
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
+import com.hypherionmc.craterlib.utils.ChatUtils;
+import com.mojang.brigadier.ParseResults;
+import com.mojang.brigadier.context.CommandContext;
+import com.mojang.brigadier.context.StringRange;
+import lombok.Getter;
+import lombok.Setter;
+import net.kyori.adventure.text.Component;
+import net.minecraft.commands.CommandSourceStack;
+import net.minecraft.commands.arguments.ComponentArgument;
+import net.minecraft.world.entity.player.Player;
+import org.jetbrains.annotations.Nullable;
+
+@Getter
+public class CraterCommandEvent extends CraterEvent {
+
+ private final ParseResults parseResults;
+ @Setter private Throwable exception;
+ private final String command;
+
+ private CraterCommandEvent(ParseResults parseResults, String command) {
+ this.parseResults = parseResults;
+ this.command = command;
+ }
+
+ public static CraterCommandEvent of(ParseResults stack, String command) {
+ return new CraterCommandEvent(stack, command);
+ }
+
+ public String getCommandString() {
+ return parseResults.getReader().getString();
+ }
+
+ @Nullable
+ public BridgedPlayer getPlayer() {
+ try {
+ Player p = parseResults.getContext().getLastChild().getSource().getPlayer();
+
+ if (p != null)
+ return BridgedPlayer.of(p);
+ } catch (Exception ignored) {}
+
+ return null;
+ }
+
+ public String getTarget() {
+ CommandContext context = parseResults.getContext().build(parseResults.getReader().getString());
+ StringRange selector_range = parseResults.getContext().getArguments().get("targets").getRange();
+ return context.getInput().substring(selector_range.getStart(), selector_range.getEnd());
+ }
+
+ public Component getMessage() {
+ return ChatUtils.mojangToAdventure(ComponentArgument.getComponent(parseResults.getContext().build(parseResults.getReader().getString()), "message"));
+ }
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterPlayerEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterPlayerEvent.java
new file mode 100644
index 0000000..7eb3701
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterPlayerEvent.java
@@ -0,0 +1,30 @@
+package com.hypherionmc.craterlib.api.events.server;
+
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+@RequiredArgsConstructor
+@Getter
+public class CraterPlayerEvent extends CraterEvent {
+
+ private final BridgedPlayer player;
+
+ public static class PlayerLoggedIn extends CraterPlayerEvent {
+
+ public PlayerLoggedIn(BridgedPlayer player) {
+ super(player);
+ }
+
+ }
+
+ public static class PlayerLoggedOut extends CraterPlayerEvent {
+
+ public PlayerLoggedOut(BridgedPlayer player) {
+ super(player);
+ }
+
+ }
+
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterRegisterCommandEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterRegisterCommandEvent.java
new file mode 100644
index 0000000..269065a
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterRegisterCommandEvent.java
@@ -0,0 +1,15 @@
+package com.hypherionmc.craterlib.api.events.server;
+
+import com.hypherionmc.craterlib.api.commands.CraterCommand;
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import com.hypherionmc.craterlib.nojang.commands.CommandsRegistry;
+import lombok.NoArgsConstructor;
+
+@NoArgsConstructor
+public class CraterRegisterCommandEvent extends CraterEvent {
+
+ public void registerCommand(CraterCommand cmd) {
+ CommandsRegistry.INSTANCE.registerCommand(cmd);
+ }
+
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterServerChatEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterServerChatEvent.java
new file mode 100644
index 0000000..6fd20eb
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterServerChatEvent.java
@@ -0,0 +1,26 @@
+package com.hypherionmc.craterlib.api.events.server;
+
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import com.hypherionmc.craterlib.core.event.annot.Cancellable;
+import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import net.kyori.adventure.text.Component;
+
+@Cancellable
+@Getter
+public class CraterServerChatEvent extends CraterEvent {
+
+ public final String message, username;
+ public final BridgedPlayer player;
+ @Setter private Component component;
+
+ public CraterServerChatEvent(BridgedPlayer player, String message, Component component) {
+ this.message = message;
+ this.player = player;
+ this.username = player.getGameProfile().getName();
+ this.component = component;
+ }
+
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterServerLifecycleEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterServerLifecycleEvent.java
new file mode 100644
index 0000000..3f87d04
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/CraterServerLifecycleEvent.java
@@ -0,0 +1,34 @@
+package com.hypherionmc.craterlib.api.events.server;
+
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import com.hypherionmc.craterlib.nojang.server.BridgedMinecraftServer;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+public class CraterServerLifecycleEvent extends CraterEvent {
+
+ @RequiredArgsConstructor
+ @Getter
+ public static class Starting extends CraterServerLifecycleEvent {
+ private final BridgedMinecraftServer server;
+ }
+
+ @RequiredArgsConstructor
+ @Getter
+ public static class Started extends CraterServerLifecycleEvent {
+ private final BridgedMinecraftServer server;
+ }
+
+ @RequiredArgsConstructor
+ @Getter
+ public static class Stopping extends CraterServerLifecycleEvent {
+ private final BridgedMinecraftServer server;
+ }
+
+ @RequiredArgsConstructor
+ @Getter
+ public static class Stopped extends CraterServerLifecycleEvent {
+ private final BridgedMinecraftServer server;
+ }
+
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/MessageBroadcastEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/MessageBroadcastEvent.java
new file mode 100644
index 0000000..6b11404
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/MessageBroadcastEvent.java
@@ -0,0 +1,20 @@
+package com.hypherionmc.craterlib.api.events.server;
+
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import net.kyori.adventure.text.Component;
+
+import java.util.function.Function;
+
+@RequiredArgsConstructor
+@Getter
+public class MessageBroadcastEvent extends CraterEvent {
+
+ private final Component component;
+ private final Function function;
+ private final boolean bl;
+ private final String threadName;
+
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/PlayerPreLoginEvent.java b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/PlayerPreLoginEvent.java
new file mode 100644
index 0000000..eaabffd
--- /dev/null
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/events/server/PlayerPreLoginEvent.java
@@ -0,0 +1,20 @@
+package com.hypherionmc.craterlib.api.events.server;
+
+import com.hypherionmc.craterlib.core.event.CraterEvent;
+import com.hypherionmc.craterlib.nojang.authlib.BridgedGameProfile;
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import net.kyori.adventure.text.Component;
+
+import java.net.SocketAddress;
+
+@RequiredArgsConstructor
+@Getter
+public class PlayerPreLoginEvent extends CraterEvent {
+
+ private final SocketAddress address;
+ private final BridgedGameProfile gameProfile;
+ @Setter private Component message;
+
+}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/api/networking/CraterNetworkHandler.java b/Common/src/main/java/com/hypherionmc/craterlib/api/networking/CraterNetworkHandler.java
index 6141a14..6b57e96 100644
--- a/Common/src/main/java/com/hypherionmc/craterlib/api/networking/CraterNetworkHandler.java
+++ b/Common/src/main/java/com/hypherionmc/craterlib/api/networking/CraterNetworkHandler.java
@@ -1,7 +1,7 @@
package com.hypherionmc.craterlib.api.networking;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.server.level.ServerPlayer;
+import com.hypherionmc.craterlib.nojang.server.BridgedMinecraftServer;
+import com.hypherionmc.craterlib.nojang.world.entity.player.BridgedPlayer;
import java.util.List;
@@ -14,15 +14,15 @@ public interface CraterNetworkHandler {
void sendToServer(T packet, boolean ignoreCheck);
- void sendToClient(T packet, ServerPlayer player);
+ void sendToClient(T packet, BridgedPlayer player);
- default void sendToClients(T packet, List players) {
- for (ServerPlayer player : players) {
+ default void sendToClients(T packet, List players) {
+ for (BridgedPlayer player : players) {
sendToClient(packet, player);
}
}
- default void sendToAllClients(T packet, MinecraftServer server) {
- sendToClients(packet, server.getPlayerList().getPlayers());
+ default void sendToAllClients(T packet, BridgedMinecraftServer server) {
+ sendToClients(packet, server.getPlayers());
}
}
diff --git a/Common/src/main/java/com/hypherionmc/craterlib/core/config/ConfigController.java b/Common/src/main/java/com/hypherionmc/craterlib/core/config/ConfigController.java
index af3d6c0..41c9471 100644
--- a/Common/src/main/java/com/hypherionmc/craterlib/core/config/ConfigController.java
+++ b/Common/src/main/java/com/hypherionmc/craterlib/core/config/ConfigController.java
@@ -1,6 +1,7 @@
package com.hypherionmc.craterlib.core.config;
import com.hypherionmc.craterlib.CraterConstants;
+import lombok.Getter;
import me.hypherionmc.moonconfig.core.file.FileWatcher;
import org.jetbrains.annotations.ApiStatus;
@@ -16,6 +17,7 @@ public final class ConfigController implements Serializable {
/**
* Cache of registered configs
*/
+ @Getter
private static final HashMap