diff --git a/patches/api/0003-Create-a-dedicated-config-directory.patch b/patches/api/0003-Create-a-dedicated-config-directory.patch new file mode 100644 index 0000000..6cb338a --- /dev/null +++ b/patches/api/0003-Create-a-dedicated-config-directory.patch @@ -0,0 +1,25 @@ +From e58022d26d7a1ac6db3226c7f5da411b31501ee0 Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 05:34:09 +0300 +Subject: [PATCH] Create a dedicated config directory + + +diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +index b057b053..696dc37f 100644 +--- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java ++++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +@@ -76,9 +76,9 @@ public final class JavaPluginLoader implements PluginLoader { + } + + final File parentFile = file.getParentFile(); +- final File dataFolder = new File(parentFile, description.getName()); ++ final File dataFolder = new File("config", description.getName()); // MineHQ + @SuppressWarnings("deprecation") +- final File oldDataFolder = new File(parentFile, description.getRawName()); ++ final File oldDataFolder = new File("config", description.getRawName()); // MineHQ + + // Found old data folder + if (dataFolder.equals(oldDataFolder)) { +-- +2.41.0.windows.1 + diff --git a/patches/api/0004-Add-yaw-and-pitch-to-world-spawn.patch b/patches/api/0004-Add-yaw-and-pitch-to-world-spawn.patch new file mode 100644 index 0000000..bc1afeb --- /dev/null +++ b/patches/api/0004-Add-yaw-and-pitch-to-world-spawn.patch @@ -0,0 +1,78 @@ +From 9f97679b367a7c16081fc43c04df67c4a608eb46 Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 05:43:47 +0300 +Subject: [PATCH] Add yaw and pitch to world spawn + + +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index 325d65a3..3e98db76 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -492,8 +492,22 @@ public interface World extends PluginMessageRecipient, Metadatable { + * @param z Z coordinate + * @return True if it was successfully set. + */ ++ + public boolean setSpawnLocation(int x, int y, int z); + ++ /** ++ * Sets the spawn location of the world ++ * ++ * @param x X coordinate ++ * @param y Y coordinate ++ * @param z Z coordinate ++ * @param yaw left-right rotation ++ * @param pitch up-down rotation ++ * @return True if it was successfully set. ++ */ ++ ++ public boolean setSpawnLocation(int x, int y, int z, float yaw, float pitch); ++ + /** + * Gets the relative in-game time of this world. + *

+diff --git a/src/main/java/org/bukkit/command/defaults/SetWorldSpawnCommand.java b/src/main/java/org/bukkit/command/defaults/SetWorldSpawnCommand.java +index 8bec19c9..b51ab6ca 100644 +--- a/src/main/java/org/bukkit/command/defaults/SetWorldSpawnCommand.java ++++ b/src/main/java/org/bukkit/command/defaults/SetWorldSpawnCommand.java +@@ -36,6 +36,7 @@ public class SetWorldSpawnCommand extends VanillaCommand { + } + + final int x, y, z; ++ Float yaw = null, pitch = null; // Poweruser + + if (args.length == 0) { + if (player == null) { +@@ -48,6 +49,10 @@ public class SetWorldSpawnCommand extends VanillaCommand { + x = location.getBlockX(); + y = location.getBlockY(); + z = location.getBlockZ(); ++ // Poweruser start ++ yaw = location.getYaw(); ++ pitch = location.getPitch(); ++ // Poweruser end + } else if (args.length == 3) { + try { + x = getInteger(sender, args[0], MIN_COORD, MAX_COORD, true); +@@ -62,9 +67,15 @@ public class SetWorldSpawnCommand extends VanillaCommand { + return false; + } + +- world.setSpawnLocation(x, y, z); +- +- Command.broadcastCommandMessage(sender, "Set world " + world.getName() + "'s spawnpoint to (" + x + ", " + y + ", " + z + ")"); ++ // Poweruser start ++ if(yaw != null && pitch != null) { ++ world.setSpawnLocation(x, y, z, yaw, pitch); ++ Command.broadcastCommandMessage(sender, "Set world " + world.getName() + "'s spawnpoint to (" + x + ", " + y + ", " + z + ", yaw=" + yaw.floatValue() + ", pitch=" + pitch.floatValue()); ++ } else { ++ world.setSpawnLocation(x, y, z); ++ Command.broadcastCommandMessage(sender, "Set world " + world.getName() + "'s spawnpoint to (" + x + ", " + y + ", " + z + ")"); ++ } ++ // Poweruser end + return true; + + } +-- +2.41.0.windows.1 + diff --git a/patches/api/0005-Added-Lombok.patch b/patches/api/0005-Added-Lombok.patch new file mode 100644 index 0000000..3c0d86e --- /dev/null +++ b/patches/api/0005-Added-Lombok.patch @@ -0,0 +1,87 @@ +From b3fbe50987cd4d979540110d210b237dede252dc Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 05:49:22 +0300 +Subject: [PATCH] Added Lombok + + +diff --git a/pom.xml b/pom.xml +index 83f9f514..c1f582f1 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -17,14 +17,12 @@ + An enhanced plugin API for Minecraft servers. + + +- + -Xdoclint:none + 1.8 + 1.8 + UTF-8 + + +- + + + spigotmc-public +@@ -37,7 +35,6 @@ + net.sf.trove4j + trove4j + 3.0.3 +- + provided + + +@@ -53,14 +50,12 @@ + jar + compile + +- + + com.google.guava + guava + 17.0 + compile + +- + + com.google.code.gson + gson +@@ -85,8 +80,6 @@ + jar + compile + +- +- + + junit + junit +@@ -99,6 +92,12 @@ + 1.3 + test + ++ ++ org.projectlombok ++ lombok ++ 1.18.28 ++ provided ++ + + + +@@ -109,6 +108,13 @@ + 3.11.0 + + true ++ ++ ++ org.projectlombok ++ lombok ++ 1.18.28 ++ ++ + + + +-- +2.41.0.windows.1 + diff --git a/patches/api/0006-Add-PlayerAttackEvent.patch b/patches/api/0006-Add-PlayerAttackEvent.patch new file mode 100644 index 0000000..abf8f47 --- /dev/null +++ b/patches/api/0006-Add-PlayerAttackEvent.patch @@ -0,0 +1,42 @@ +From 747c2f133092187e5239432a2a123eaac6bf0caa Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 05:49:47 +0300 +Subject: [PATCH] Add PlayerAttackEvent + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerAttackEvent.java b/src/main/java/org/bukkit/event/player/PlayerAttackEvent.java +new file mode 100644 +index 00000000..eb648e76 +--- /dev/null ++++ b/src/main/java/org/bukkit/event/player/PlayerAttackEvent.java +@@ -0,0 +1,26 @@ ++package org.bukkit.event.player; ++ ++import org.bukkit.entity.Entity; ++import org.bukkit.entity.Player; ++import org.bukkit.event.HandlerList; ++ ++import lombok.Getter; ++ ++public class PlayerAttackEvent extends PlayerEvent { ++ ++ @Getter private static HandlerList handlerList = new HandlerList(); ++ ++ @Getter private final Entity target; ++ ++ public PlayerAttackEvent(Player player, Entity target) { ++ super(player); ++ ++ this.target = target; ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return handlerList; ++ } ++ ++} +\ No newline at end of file +-- +2.41.0.windows.1 + diff --git a/patches/api/0007-Add-Server-and-Bukkit-getServerGroup.patch b/patches/api/0007-Add-Server-and-Bukkit-getServerGroup.patch new file mode 100644 index 0000000..09b390b --- /dev/null +++ b/patches/api/0007-Add-Server-and-Bukkit-getServerGroup.patch @@ -0,0 +1,46 @@ +From c6f31092649e1ffbe6b501a09423919c560f3b8e Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 05:53:13 +0300 +Subject: [PATCH] Add Server and Bukkit#getServerGroup() + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 8fbc8283..48cbaa23 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -79,6 +79,13 @@ public final class Bukkit { + server.getLogger().info("This server is running " + getName() + " version " + getVersion() + " (Implementing API version " + getBukkitVersion() + ")"); + } + ++ /** ++ * @see Server#getServerGroup() ++ */ ++ public static String getServerGroup() { ++ return server.getServerGroup(); ++ } ++ + /** + * Gets the name of this server implementation. + * +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 1b62463a..d001e286 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -65,6 +65,14 @@ public interface Server extends PluginMessageRecipient { + */ + public static final String BROADCAST_CHANNEL_USERS = "bukkit.broadcast.user"; + ++ /** ++ * Get the server group of this server. ++ * ++ * @return the server group of this server ++ */ ++ public String getServerGroup(); ++ ++ + /** + * Gets the name of this server implementation. + * +-- +2.41.0.windows.1 + diff --git a/patches/api/0008-Add-PlayerHealthEvent.patch b/patches/api/0008-Add-PlayerHealthEvent.patch new file mode 100644 index 0000000..b99f6de --- /dev/null +++ b/patches/api/0008-Add-PlayerHealthEvent.patch @@ -0,0 +1,53 @@ +From e21c21692f6c955b90d2e8fecf136c0dd08ac24a Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 05:55:55 +0300 +Subject: [PATCH] Add PlayerHealthEvent + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerHealthChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerHealthChangeEvent.java +new file mode 100644 +index 00000000..bca20174 +--- /dev/null ++++ b/src/main/java/org/bukkit/event/player/PlayerHealthChangeEvent.java +@@ -0,0 +1,37 @@ ++package org.bukkit.event.player; ++ ++import org.bukkit.entity.Player; ++import org.bukkit.event.HandlerList; ++ ++public class PlayerHealthChangeEvent extends PlayerEvent { ++ ++ private static final HandlerList handlers = new HandlerList(); ++ ++ private final double previousHealth; ++ private final double newHealth; ++ ++ public PlayerHealthChangeEvent(final Player player, final double previousHealth, final double newHealth) { ++ super(player); ++ ++ this.previousHealth = previousHealth; ++ this.newHealth = newHealth; ++ } ++ ++ public double getPreviousHealth() { ++ return previousHealth; ++ } ++ ++ public double getNewHealth() { ++ return newHealth; ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++ ++} +\ No newline at end of file +-- +2.41.0.windows.1 + diff --git a/patches/api/0009-Disguises.patch b/patches/api/0009-Disguises.patch new file mode 100644 index 0000000..5535148 --- /dev/null +++ b/patches/api/0009-Disguises.patch @@ -0,0 +1,141 @@ +From f4e6040fbdea9cd0bd43b30d1a58c9bfb5084ad1 Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 06:04:59 +0300 +Subject: [PATCH] Disguises + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 48cbaa23..def61fbc 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -168,6 +168,23 @@ public final class Bukkit { + return server.getMaxPlayers(); + } + ++ ++ // MineHQ start ++ /** ++ * @see Server#getPlayerByDisguise(String name) ++ */ ++ public static Player getPlayerByDisguise(String name) { ++ return server.getPlayerByDisguise(name); ++ } ++ ++ /** ++ * @see Server#getPlayerExactByDisguise(String name) ++ */ ++ public static Player getPlayerExactByDisguise(String name) { ++ return server.getPlayerExactByDisguise(name); ++ } ++ // MineHQ end ++ + /** + * Get the game port that the server runs on. + * +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index d001e286..537c2293 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -143,6 +143,29 @@ public interface Server extends PluginMessageRecipient { + */ + public int getMaxPlayers(); + ++ // MineHQ start ++ /** ++ * Gets a player object by the given disguised name. ++ *

++ * This method may not return objects for disguises not in use. ++ * ++ * @param name the disguised name to look up ++ * @return a player if one was found, null otherwise ++ */ ++ public Player getPlayerByDisguise(String name); ++ ++ /** ++ * Gets the player with the exact given disguise name, case insensitive ++ *

++ * This method may not return objects for disguises not in use. ++ * ++ * @param name the exact disguised name of a player ++ * @return a player if one was found, null otherwise ++ */ ++ public Player getPlayerExactByDisguise(String name); ++ // MineHQ end ++ ++ + /** + * Get the game port that the server runs on. + * +diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java +index c126a1e7..4d45b52d 100644 +--- a/src/main/java/org/bukkit/command/Command.java ++++ b/src/main/java/org/bukkit/command/Command.java +@@ -32,6 +32,7 @@ public abstract class Command { + protected String usageMessage; + private String permission; + private String permissionMessage; ++ + public co.aikar.timings.Timing timings; // Spigot + public String getTimingName() {return getName();} // Spigot + +@@ -100,7 +101,7 @@ public abstract class Command { + + ArrayList matchedPlayers = new ArrayList(); + for (Player player : sender.getServer().getOnlinePlayers()) { +- String name = player.getName(); ++ String name = player.getDisguisedName(); // MineHQ - Disguises + if ((senderPlayer == null || senderPlayer.canSee(player)) && StringUtil.startsWithIgnoreCase(name, lastWord)) { + matchedPlayers.add(name); + } +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index d02fe560..559f3357 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -50,6 +50,44 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline + */ + public void setDisplayName(String name); + ++ // MineHQ start - Disguises ++ /** ++ * Gets the disguised name of this player, or their ++ * actual name if they're not currently disguised. ++ */ ++ public String getDisguisedName(); ++ ++ /** ++ * Is this {@link Player} currently disguised? ++ */ ++ public boolean isDisguised(); ++ ++ /** ++ * Disguise this {@link Player} as someone else. ++ * This will disguise their tab-list name and tab-completion ++ * should take this into account. ++ * ++ * {@link #getDisplayName()} will return the disguised name, as ++ * well as {@link #getDisguisedName()}. {@link #getName()} should ++ * only be used in situations where we absolutely need the player's ++ * real name, and should never be outputted to other players. ++ * ++ * @param name The name of the player we want to disguise as ++ * @param texture We can add custom skins by doing this.*/ ++ public void disguise(String name, String texture); ++ ++ /** ++ * @see #disguise(String, String) ++ * This method does not allow for a custom skin. ++ */ ++ public void disguise(String name); ++ ++ /** ++ * Un-disguise this player. ++ */ ++ public void undisguise(); ++ // MineHQ end ++ + /** + * Gets the name that is shown on the player list. + * +-- +2.41.0.windows.1 + diff --git a/patches/api/0010-Chunk-snapshot-API.patch b/patches/api/0010-Chunk-snapshot-API.patch new file mode 100644 index 0000000..bd2da24 --- /dev/null +++ b/patches/api/0010-Chunk-snapshot-API.patch @@ -0,0 +1,33 @@ +From e96e8b8df1f574feccdf9007d513bfc03a054028 Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 06:07:20 +0300 +Subject: [PATCH] Chunk snapshot API + + +diff --git a/src/main/java/net/frozenorb/chunksnapshot/ChunkSnapshot.java b/src/main/java/net/frozenorb/chunksnapshot/ChunkSnapshot.java +new file mode 100644 +index 00000000..fd051bdc +--- /dev/null ++++ b/src/main/java/net/frozenorb/chunksnapshot/ChunkSnapshot.java +@@ -0,0 +1,4 @@ ++package net.frozenorb.chunksnapshot; ++ ++public interface ChunkSnapshot { ++} +diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java +index 05101517..109f32f9 100644 +--- a/src/main/java/org/bukkit/Chunk.java ++++ b/src/main/java/org/bukkit/Chunk.java +@@ -121,4 +121,9 @@ public interface Chunk { + * @return true if the chunk has unloaded successfully, otherwise false + */ + boolean unload(); ++ ++ // MineHQ start - chunk snapshot api ++ net.frozenorb.chunksnapshot.ChunkSnapshot takeSnapshot(); ++ void restoreSnapshot(net.frozenorb.chunksnapshot.ChunkSnapshot snapshot); ++ // MineHQ end + } +-- +2.41.0.windows.1 + diff --git a/patches/api/0011-BlockDropItemsEvent.patch b/patches/api/0011-BlockDropItemsEvent.patch new file mode 100644 index 0000000..7bd1719 --- /dev/null +++ b/patches/api/0011-BlockDropItemsEvent.patch @@ -0,0 +1,72 @@ +From 32b4fc0d2b0459b34c001cb0180b614bc0c4bc77 Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 06:10:39 +0300 +Subject: [PATCH] BlockDropItemsEvent + + +diff --git a/src/main/java/org/bukkit/event/block/BlockDropItemsEvent.java b/src/main/java/org/bukkit/event/block/BlockDropItemsEvent.java +new file mode 100644 +index 00000000..fb7d18ee +--- /dev/null ++++ b/src/main/java/org/bukkit/event/block/BlockDropItemsEvent.java +@@ -0,0 +1,56 @@ ++package org.bukkit.event.block; ++ ++import java.util.List; ++ ++import org.bukkit.block.Block; ++import org.bukkit.entity.Item; ++import org.bukkit.entity.Player; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++ ++public class BlockDropItemsEvent extends Event implements Cancellable { ++ ++ private static final HandlerList handlers = new HandlerList(); ++ private Block block; ++ private Player player; ++ private List toDrop; ++ private boolean cancelled = false; ++ ++ public BlockDropItemsEvent(Block block, Player player, List toDrop) { ++ this.block = block; ++ this.player = player; ++ this.toDrop = toDrop; ++ } ++ ++ public Block getBlock() { ++ return this.block; ++ } ++ ++ public Player getPlayer() { ++ return this.player; ++ } ++ ++ public List getToDrop() { ++ return this.toDrop; ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return this.cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++} +\ No newline at end of file +-- +2.41.0.windows.1 + diff --git a/patches/api/0012-Riot-style-HCF-changes-for-better-QOL-Potion-related.patch b/patches/api/0012-Riot-style-HCF-changes-for-better-QOL-Potion-related.patch new file mode 100644 index 0000000..84c54c8 --- /dev/null +++ b/patches/api/0012-Riot-style-HCF-changes-for-better-QOL-Potion-related.patch @@ -0,0 +1,183 @@ +From 520669969c02c527fbcd06dc51a8c04e867cd670 Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 06:19:50 +0300 +Subject: [PATCH] Riot-style HCF changes for better QOL (Potion related part) + + +diff --git a/src/main/java/org/bukkit/event/entity/PotionEffectAddEvent.java b/src/main/java/org/bukkit/event/entity/PotionEffectAddEvent.java +new file mode 100644 +index 00000000..6ac7dc75 +--- /dev/null ++++ b/src/main/java/org/bukkit/event/entity/PotionEffectAddEvent.java +@@ -0,0 +1,40 @@ ++package org.bukkit.event.entity; ++ ++import org.bukkit.entity.LivingEntity; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.potion.PotionEffect; ++ ++import lombok.Getter; ++import lombok.Setter; ++ ++ ++public class PotionEffectAddEvent extends PotionEffectEvent implements Cancellable { ++ ++ private static final HandlerList handlers = new HandlerList(); ++ ++ @Getter @Setter private boolean cancelled; ++ @Getter protected final EffectCause effectCause; ++ ++ public PotionEffectAddEvent(LivingEntity entity, PotionEffect effect, EffectCause effectCause) { ++ super(entity, effect); ++ this.effectCause = effectCause; ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++ ++ public enum EffectCause { ++ POTION_SPLASH, ++ BEACON, ++ WITHER_SKELETON, ++ PLUGIN, ++ UNKNOWN ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/org/bukkit/event/entity/PotionEffectEvent.java b/src/main/java/org/bukkit/event/entity/PotionEffectEvent.java +new file mode 100644 +index 00000000..aefbc8f8 +--- /dev/null ++++ b/src/main/java/org/bukkit/event/entity/PotionEffectEvent.java +@@ -0,0 +1,23 @@ ++package org.bukkit.event.entity; ++ ++import org.bukkit.entity.LivingEntity; ++import org.bukkit.potion.PotionEffect; ++ ++import lombok.Getter; ++ ++public abstract class PotionEffectEvent extends EntityEvent { ++ ++ @Getter private final PotionEffect effect; ++ ++ public PotionEffectEvent(LivingEntity what, PotionEffect effect) { ++ super(what); ++ this.effect = effect; ++ } ++ ++ @Override ++ public LivingEntity getEntity() { ++ return (LivingEntity) super.getEntity(); ++ } ++ ++ ++} +\ No newline at end of file +diff --git a/src/main/java/org/bukkit/event/entity/PotionEffectExpireEvent.java b/src/main/java/org/bukkit/event/entity/PotionEffectExpireEvent.java +new file mode 100644 +index 00000000..2c1e7424 +--- /dev/null ++++ b/src/main/java/org/bukkit/event/entity/PotionEffectExpireEvent.java +@@ -0,0 +1,30 @@ ++package org.bukkit.event.entity; ++ ++import org.bukkit.entity.LivingEntity; ++import org.bukkit.potion.PotionEffect; ++ ++import lombok.Getter; ++ ++public class PotionEffectExpireEvent extends PotionEffectRemoveEvent { ++ ++ @Getter private int duration = 0; ++ ++ public PotionEffectExpireEvent(LivingEntity entity, PotionEffect effect) { ++ super(entity, effect); ++ } ++ ++ public void setDuration(int duration) { ++ this.duration = Math.max(0, duration); ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return duration > 0; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.duration = cancel ? Integer.MAX_VALUE : 0; ++ } ++ ++} +\ No newline at end of file +diff --git a/src/main/java/org/bukkit/event/entity/PotionEffectExtendEvent.java b/src/main/java/org/bukkit/event/entity/PotionEffectExtendEvent.java +new file mode 100644 +index 00000000..bb25707a +--- /dev/null ++++ b/src/main/java/org/bukkit/event/entity/PotionEffectExtendEvent.java +@@ -0,0 +1,16 @@ ++package org.bukkit.event.entity; ++ ++import org.bukkit.entity.LivingEntity; ++import org.bukkit.potion.PotionEffect; ++ ++import lombok.Getter; ++ ++public class PotionEffectExtendEvent extends PotionEffectAddEvent { ++ ++ @Getter private final PotionEffect oldEffect; ++ ++ public PotionEffectExtendEvent(LivingEntity entity, PotionEffect effect, PotionEffect oldEffect, EffectCause effectCause) { ++ super(entity, effect, effectCause); ++ this.oldEffect = oldEffect; ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/org/bukkit/event/entity/PotionEffectRemoveEvent.java b/src/main/java/org/bukkit/event/entity/PotionEffectRemoveEvent.java +new file mode 100644 +index 00000000..f2be18e7 +--- /dev/null ++++ b/src/main/java/org/bukkit/event/entity/PotionEffectRemoveEvent.java +@@ -0,0 +1,30 @@ ++package org.bukkit.event.entity; ++ ++import org.bukkit.entity.LivingEntity; ++import org.bukkit.event.Cancellable; ++import org.bukkit.event.HandlerList; ++import org.bukkit.potion.PotionEffect; ++ ++import lombok.Getter; ++import lombok.Setter; ++ ++public class PotionEffectRemoveEvent extends PotionEffectEvent implements Cancellable { ++ ++ private static final HandlerList handlers = new HandlerList(); ++ ++ @Getter @Setter private boolean cancelled; ++ ++ public PotionEffectRemoveEvent(LivingEntity entity, PotionEffect effect) { ++ super(entity, effect); ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++ ++} +\ No newline at end of file +-- +2.41.0.windows.1 + diff --git a/patches/api/0013-Riot-style-HCF-changes-for-better-QOL-EquipmentSetEv.patch b/patches/api/0013-Riot-style-HCF-changes-for-better-QOL-EquipmentSetEv.patch new file mode 100644 index 0000000..219d445 --- /dev/null +++ b/patches/api/0013-Riot-style-HCF-changes-for-better-QOL-EquipmentSetEv.patch @@ -0,0 +1,46 @@ +From 870f476a17bcd50d09f5884d7e834b82ee9ddfae Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 06:23:04 +0300 +Subject: [PATCH] Riot-style HCF changes for better QOL (EquipmentSetEvent) + + +diff --git a/src/main/java/org/bukkit/event/inventory/EquipmentSetEvent.java b/src/main/java/org/bukkit/event/inventory/EquipmentSetEvent.java +new file mode 100644 +index 00000000..217f79b2 +--- /dev/null ++++ b/src/main/java/org/bukkit/event/inventory/EquipmentSetEvent.java +@@ -0,0 +1,30 @@ ++package org.bukkit.event.inventory; ++ ++import org.bukkit.entity.HumanEntity; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++import org.bukkit.inventory.ItemStack; ++ ++import lombok.AllArgsConstructor; ++import lombok.Getter; ++import lombok.Setter; ++ ++@Getter @Setter @AllArgsConstructor ++public class EquipmentSetEvent extends Event { ++ ++ private static final HandlerList handlers = new HandlerList(); ++ ++ private final HumanEntity humanEntity; ++ private final int slot; ++ private final ItemStack previousItem; ++ private final ItemStack newItem; ++ ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++} +\ No newline at end of file +-- +2.41.0.windows.1 + diff --git a/patches/api/0014-Riot-style-HCF-changes-for-better-QOL-PlayerPearlRef.patch b/patches/api/0014-Riot-style-HCF-changes-for-better-QOL-PlayerPearlRef.patch new file mode 100644 index 0000000..babb09d --- /dev/null +++ b/patches/api/0014-Riot-style-HCF-changes-for-better-QOL-PlayerPearlRef.patch @@ -0,0 +1,38 @@ +From 3a546cfa32f0c331d4993b66949dfe4e473cf084 Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 06:24:38 +0300 +Subject: [PATCH] Riot-style HCF changes for better QOL + (PlayerPearlRefundEvent) + + +diff --git a/src/main/java/org/bukkit/event/player/PlayerPearlRefundEvent.java b/src/main/java/org/bukkit/event/player/PlayerPearlRefundEvent.java +new file mode 100644 +index 00000000..7491f127 +--- /dev/null ++++ b/src/main/java/org/bukkit/event/player/PlayerPearlRefundEvent.java +@@ -0,0 +1,21 @@ ++package org.bukkit.event.player; ++ ++import org.bukkit.entity.Player; ++import org.bukkit.event.HandlerList; ++ ++public class PlayerPearlRefundEvent extends PlayerEvent { ++ private static final HandlerList handlers = new HandlerList(); ++ ++ public PlayerPearlRefundEvent(final Player player) { ++ super(player); ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++} +\ No newline at end of file +-- +2.41.0.windows.1 + diff --git a/patches/api/0015-PotionEffect-event-updates.patch b/patches/api/0015-PotionEffect-event-updates.patch new file mode 100644 index 0000000..4dc0274 --- /dev/null +++ b/patches/api/0015-PotionEffect-event-updates.patch @@ -0,0 +1,217 @@ +From 92f50ed8215a1e22aa896d5b166aac73b113e4b7 Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 06:33:27 +0300 +Subject: [PATCH] PotionEffect event updates + + +diff --git a/src/main/java/org/bukkit/event/entity/PotionEffectAddEvent.java b/src/main/java/org/bukkit/event/entity/PotionEffectAddEvent.java +index 6ac7dc75..6627e6ed 100644 +--- a/src/main/java/org/bukkit/event/entity/PotionEffectAddEvent.java ++++ b/src/main/java/org/bukkit/event/entity/PotionEffectAddEvent.java +@@ -5,16 +5,15 @@ import org.bukkit.event.Cancellable; + import org.bukkit.event.HandlerList; + import org.bukkit.potion.PotionEffect; + +-import lombok.Getter; +-import lombok.Setter; +- +- ++/** ++ * Called when a potion effect is applied to an entity, or an existing effect is extended or upgraded ++ */ + public class PotionEffectAddEvent extends PotionEffectEvent implements Cancellable { + + private static final HandlerList handlers = new HandlerList(); + +- @Getter @Setter private boolean cancelled; +- @Getter protected final EffectCause effectCause; ++ private boolean cancelled; ++ protected final EffectCause effectCause; + + public PotionEffectAddEvent(LivingEntity entity, PotionEffect effect, EffectCause effectCause) { + super(entity, effect); +@@ -30,11 +29,46 @@ public class PotionEffectAddEvent extends PotionEffectEvent implements Cancellab + return handlers; + } + ++ public EffectCause getCause() { ++ return effectCause; ++ } ++ ++ @Override ++ public boolean isCancelled() { ++ return cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ ++ + public enum EffectCause { ++ /** ++ * Indicates the effect was caused by the proximity of a potion effect splash ++ */ + POTION_SPLASH, ++ /** ++ * Indicates the effect was caused by the proximity of a beacon ++ */ + BEACON, ++ /** ++ * Indicates the effect was caused by damage from a wither skeleton ++ */ + WITHER_SKELETON, ++ /** ++ * Indicates the effect was caused by damage from a wither skull ++ */ ++ WITHER_SKULL, ++ /** ++ * Indicates the effect was caused by a plugin ++ */ + PLUGIN, ++ /** ++ * Indicates the effect was caused by an event not covered by ++ * this enum ++ */ + UNKNOWN + } + } +\ No newline at end of file +diff --git a/src/main/java/org/bukkit/event/entity/PotionEffectEvent.java b/src/main/java/org/bukkit/event/entity/PotionEffectEvent.java +index aefbc8f8..6510a624 100644 +--- a/src/main/java/org/bukkit/event/entity/PotionEffectEvent.java ++++ b/src/main/java/org/bukkit/event/entity/PotionEffectEvent.java +@@ -3,11 +3,9 @@ package org.bukkit.event.entity; + import org.bukkit.entity.LivingEntity; + import org.bukkit.potion.PotionEffect; + +-import lombok.Getter; +- + public abstract class PotionEffectEvent extends EntityEvent { + +- @Getter private final PotionEffect effect; ++ private final PotionEffect effect; + + public PotionEffectEvent(LivingEntity what, PotionEffect effect) { + super(what); +@@ -19,5 +17,7 @@ public abstract class PotionEffectEvent extends EntityEvent { + return (LivingEntity) super.getEntity(); + } + +- ++ public PotionEffect getEffect() { ++ return effect; ++ } + } +\ No newline at end of file +diff --git a/src/main/java/org/bukkit/event/entity/PotionEffectExpireEvent.java b/src/main/java/org/bukkit/event/entity/PotionEffectExpireEvent.java +index 2c1e7424..70a92ae4 100644 +--- a/src/main/java/org/bukkit/event/entity/PotionEffectExpireEvent.java ++++ b/src/main/java/org/bukkit/event/entity/PotionEffectExpireEvent.java +@@ -5,14 +5,33 @@ import org.bukkit.potion.PotionEffect; + + import lombok.Getter; + ++/** ++ * Called when a potion effect on an entity runs out. Cancelling the event extends ++ * the effect with a practically infinite duration. The new duration can also be set ++ * explicitly by calling {@link #setDuration}. ++ * ++ * Handlers of {@link PotionEffectRemoveEvent} will also receive this event. ++ */ + public class PotionEffectExpireEvent extends PotionEffectRemoveEvent { + +- @Getter private int duration = 0; ++ private int duration = 0; + + public PotionEffectExpireEvent(LivingEntity entity, PotionEffect effect) { + super(entity, effect); + } + ++ ++ /** ++ * Get the new duration for the potion effect. This is initially 0. ++ */ ++ public int getDuration() { ++ return duration; ++ } ++ ++ /** ++ * Set a new duration for the potion effect. Passing 0 to this method un-cancels ++ * the event, and passing anything above 0 cancels it. ++ */ + public void setDuration(int duration) { + this.duration = Math.max(0, duration); + } +diff --git a/src/main/java/org/bukkit/event/entity/PotionEffectExtendEvent.java b/src/main/java/org/bukkit/event/entity/PotionEffectExtendEvent.java +index bb25707a..1292c2fb 100644 +--- a/src/main/java/org/bukkit/event/entity/PotionEffectExtendEvent.java ++++ b/src/main/java/org/bukkit/event/entity/PotionEffectExtendEvent.java +@@ -3,14 +3,24 @@ package org.bukkit.event.entity; + import org.bukkit.entity.LivingEntity; + import org.bukkit.potion.PotionEffect; + +-import lombok.Getter; +- ++/** ++ * Called when an entity's active potion effect is extended or upgraded. ++ * ++ * Handlers of {@link PotionEffectAddEvent} will also receive this event. ++ */ + public class PotionEffectExtendEvent extends PotionEffectAddEvent { + +- @Getter private final PotionEffect oldEffect; ++ private final PotionEffect oldEffect; + + public PotionEffectExtendEvent(LivingEntity entity, PotionEffect effect, PotionEffect oldEffect, EffectCause effectCause) { + super(entity, effect, effectCause); + this.oldEffect = oldEffect; + } ++ ++ /** ++ * Get the state of the potion effect prior to the change ++ */ ++ public PotionEffect getOldEffect() { ++ return oldEffect; ++ } + } +\ No newline at end of file +diff --git a/src/main/java/org/bukkit/event/entity/PotionEffectRemoveEvent.java b/src/main/java/org/bukkit/event/entity/PotionEffectRemoveEvent.java +index f2be18e7..9f5bddb7 100644 +--- a/src/main/java/org/bukkit/event/entity/PotionEffectRemoveEvent.java ++++ b/src/main/java/org/bukkit/event/entity/PotionEffectRemoveEvent.java +@@ -8,16 +8,29 @@ import org.bukkit.potion.PotionEffect; + import lombok.Getter; + import lombok.Setter; + ++/** ++ * Called when a potion effect is removed from an entity for whatever reason ++ */ + public class PotionEffectRemoveEvent extends PotionEffectEvent implements Cancellable { + + private static final HandlerList handlers = new HandlerList(); + +- @Getter @Setter private boolean cancelled; ++ private boolean cancelled; + + public PotionEffectRemoveEvent(LivingEntity entity, PotionEffect effect) { + super(entity, effect); + } + ++ @Override ++ public boolean isCancelled() { ++ return cancelled; ++ } ++ ++ @Override ++ public void setCancelled(boolean cancel) { ++ this.cancelled = cancel; ++ } ++ + @Override + public HandlerList getHandlers() { + return handlers; +-- +2.41.0.windows.1 + diff --git a/patches/server/0002-ignore-unresolved-property-in-pom.xml.patch b/patches/server/0002-ignore-unresolved-property-in-pom.xml.patch new file mode 100644 index 0000000..68bcfce --- /dev/null +++ b/patches/server/0002-ignore-unresolved-property-in-pom.xml.patch @@ -0,0 +1,21 @@ +From eecfe9bab75f9debbf78f4ae465da329f1003643 Mon Sep 17 00:00:00 2001 +From: virtualWinter +Date: Fri, 21 Jul 2023 05:17:33 +0300 +Subject: [PATCH] ignore unresolved property in pom.xml + + +diff --git a/pom.xml b/pom.xml +index e70c7c4b..22d3abec 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -134,6 +134,7 @@ + + org.bukkit.craftbukkit.Main + CraftBukkit ++ + ${describe} + Bukkit Team + Bukkit +-- +2.41.0.windows.1 +