[FEAT] Paper Support
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
--- a/Paper/src/main/java/com/hypherionmc/craterlib/paper/CraterLibPlugin.java
|
||||
+++ b/Paper/src/main/java/com/hypherionmc/craterlib/paper/CraterLibPlugin.java
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
- CraterEventBus.INSTANCE.postEvent(new CraterRegisterCommandEvent(MinecraftServer.getServer().createCommandSourceStack().dispatcher()));
|
||||
+ CraterEventBus.INSTANCE.postEvent(new CraterRegisterCommandEvent(MinecraftServer.getServer().getCommands().getDispatcher()));
|
||||
getServer().getPluginManager().registerEvents(listener, this);
|
||||
getServer().getScheduler().scheduleSyncDelayedTask(this, listener::onServerStarted);
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
--- a/Paper/src/main/java/com/hypherionmc/craterlib/paper/PaperEventListener.java
|
||||
+++ b/Paper/src/main/java/com/hypherionmc/craterlib/paper/PaperEventListener.java
|
||||
@@ -16,9 +16,8 @@
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.bukkit.command.ConsoleCommandSender;
|
||||
-import org.bukkit.craftbukkit.advancement.CraftAdvancement;
|
||||
-import org.bukkit.craftbukkit.damage.CraftDamageSource;
|
||||
-import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.craftbukkit.v1_20_R1.advancement.CraftAdvancement;
|
||||
+import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -31,17 +30,17 @@
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerDeath(PlayerDeathEvent event) {
|
||||
CraterEventBus.INSTANCE.postEvent(
|
||||
- new CraterPlayerDeathEvent(BridgedPlayer.of(((CraftPlayer) event.getPlayer()).getHandle()), ((CraftDamageSource) event.getDamageSource()).getHandle())
|
||||
+ new CraterPlayerDeathEvent(BridgedPlayer.of(((CraftPlayer) event.getPlayer()).getHandle()), null, event.deathMessage())
|
||||
);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onAdvancement(PlayerAdvancementDoneEvent event) {
|
||||
- if (((CraftAdvancement) event.getAdvancement()).getHandle().value().display().isEmpty() || !((CraftAdvancement) event.getAdvancement()).getHandle().value().display().get().shouldAnnounceChat())
|
||||
+ if (((CraftAdvancement) event.getAdvancement()).getHandle() == null || ((CraftAdvancement) event.getAdvancement()).getHandle().getDisplay() == null || !((CraftAdvancement) event.getAdvancement()).getHandle().getDisplay().shouldAnnounceChat())
|
||||
return;
|
||||
|
||||
CraterEventBus.INSTANCE.postEvent(
|
||||
- new CraterAdvancementEvent(BridgedPlayer.of(((CraftPlayer) event.getPlayer()).getHandle()), BridgedAdvancement.of(((CraftAdvancement) event.getAdvancement()).getHandle().value()))
|
||||
+ new CraterAdvancementEvent(BridgedPlayer.of(((CraftPlayer) event.getPlayer()).getHandle()), BridgedAdvancement.of(((CraftAdvancement) event.getAdvancement()).getHandle()))
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user