done with all the api related patches

This commit is contained in:
virtualWinter 2023-07-21 06:34:25 +03:00
parent e2e954b5a2
commit e2f97021e9
14 changed files with 1082 additions and 0 deletions

View File

@ -0,0 +1,25 @@
From e58022d26d7a1ac6db3226c7f5da411b31501ee0 Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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

View File

@ -0,0 +1,78 @@
From 9f97679b367a7c16081fc43c04df67c4a608eb46 Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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.
* <p>
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

View File

@ -0,0 +1,87 @@
From b3fbe50987cd4d979540110d210b237dede252dc Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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 @@
<description>An enhanced plugin API for Minecraft servers.</description>
<properties>
- <!--PaperSpigot - Bump to 1.8 - This will haunt me -->
<additionalparam>-Xdoclint:none</additionalparam>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
- <!-- required until fixed plexus-compiler-eclipse is deployed -->
<pluginRepositories>
<pluginRepository>
<id>spigotmc-public</id>
@@ -37,7 +35,6 @@
<groupId>net.sf.trove4j</groupId>
<artifactId>trove4j</artifactId>
<version>3.0.3</version>
- <!-- Trove Provided by CraftBukkit -->
<scope>provided</scope>
</dependency>
<dependency>
@@ -53,14 +50,12 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
- <!-- bundled with Minecraft, should be kept in sync -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>17.0</version>
<scope>compile</scope>
</dependency>
- <!-- bundled with Minecraft, should be kept in sync -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
@@ -85,8 +80,6 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
-
- <!-- testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -99,6 +92,12 @@
<version>1.3</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.28</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
@@ -109,6 +108,13 @@
<version>3.11.0</version>
<configuration>
<optimize>true</optimize>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.28</version>
+ </path>
+ </annotationProcessorPaths>
</configuration>
<dependencies>
<dependency>
--
2.41.0.windows.1

View File

@ -0,0 +1,42 @@
From 747c2f133092187e5239432a2a123eaac6bf0caa Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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

View File

@ -0,0 +1,46 @@
From c6f31092649e1ffbe6b501a09423919c560f3b8e Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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

View File

@ -0,0 +1,53 @@
From e21c21692f6c955b90d2e8fecf136c0dd08ac24a Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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

View File

@ -0,0 +1,141 @@
From f4e6040fbdea9cd0bd43b30d1a58c9bfb5084ad1 Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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.
+ * <p>
+ * 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
+ * <p>
+ * 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<String> matchedPlayers = new ArrayList<String>();
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

View File

@ -0,0 +1,33 @@
From e96e8b8df1f574feccdf9007d513bfc03a054028 Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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

View File

@ -0,0 +1,72 @@
From 32b4fc0d2b0459b34c001cb0180b614bc0c4bc77 Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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<Item> toDrop;
+ private boolean cancelled = false;
+
+ public BlockDropItemsEvent(Block block, Player player, List<Item> toDrop) {
+ this.block = block;
+ this.player = player;
+ this.toDrop = toDrop;
+ }
+
+ public Block getBlock() {
+ return this.block;
+ }
+
+ public Player getPlayer() {
+ return this.player;
+ }
+
+ public List<Item> 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

View File

@ -0,0 +1,183 @@
From 520669969c02c527fbcd06dc51a8c04e867cd670 Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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

View File

@ -0,0 +1,46 @@
From 870f476a17bcd50d09f5884d7e834b82ee9ddfae Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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

View File

@ -0,0 +1,38 @@
From 3a546cfa32f0c331d4993b66949dfe4e473cf084 Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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

View File

@ -0,0 +1,217 @@
From 92f50ed8215a1e22aa896d5b166aac73b113e4b7 Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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

View File

@ -0,0 +1,21 @@
From eecfe9bab75f9debbf78f4ae465da329f1003643 Mon Sep 17 00:00:00 2001
From: virtualWinter <winter@catmc.club>
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 @@
<manifestEntries>
<Main-Class>org.bukkit.craftbukkit.Main</Main-Class>
<Implementation-Title>CraftBukkit</Implementation-Title>
+ <!--suppress UnresolvedMavenProperty -->
<Implementation-Version>${describe}</Implementation-Version>
<Implementation-Vendor>Bukkit Team</Implementation-Vendor>
<Specification-Title>Bukkit</Specification-Title>
--
2.41.0.windows.1