9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-24 01:09:29 +00:00

add some paper pr's

This commit is contained in:
NONPLAYT
2023-04-01 00:39:15 +03:00
parent 41bc5dc814
commit 6175d82d67
12 changed files with 628 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Fri, 31 Mar 2023 23:38:43 +0300
Subject: [PATCH] Rework Spigot Deprecations
diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java
index 3578ab0c3a413d56bc39af43b5d3201d20d7d13a..29ac48445c3b6d14b1b549d856c350df6712ccac 100644
--- a/src/main/java/org/bukkit/OfflinePlayer.java
+++ b/src/main/java/org/bukkit/OfflinePlayer.java
@@ -160,9 +160,11 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio
* UTC.
*
* @return Date of last log-in for this player, or 0
- * @deprecated The API contract is ambiguous and the implementation may or may not return the correct value given this API ambiguity. It is instead recommended use {@link #getLastLogin()} or {@link #getLastSeen()} depending on your needs.
+ * @see #hasPlayedBefore()
+ * @see #getLastLogin()
+ * @see #getLastSeen()
*/
- @Deprecated
+ // @Deprecated // DivineMC - remove deprecated
public long getLastPlayed();
/**
diff --git a/src/main/java/org/bukkit/entity/Damageable.java b/src/main/java/org/bukkit/entity/Damageable.java
index fc4d3bcd9b16097086fef7975274d825b65adb10..e485975dbb6973d2b21259c4e4d5d75191bacb60 100644
--- a/src/main/java/org/bukkit/entity/Damageable.java
+++ b/src/main/java/org/bukkit/entity/Damageable.java
@@ -60,9 +60,9 @@ public interface Damageable extends Entity {
* Gets the maximum health this entity has.
*
* @return Maximum health
- * @deprecated use {@link Attribute#GENERIC_MAX_HEALTH}.
+ * @see Attribute#GENERIC_MAX_HEALTH
*/
- @Deprecated
+ // @Deprecated // DivineMC
double getMaxHealth();
/**
@@ -75,15 +75,15 @@ public interface Damageable extends Entity {
* {@link Wither}, etc...} will have their bar scaled accordingly.
*
* @param health amount of health to set the maximum to
- * @deprecated use {@link Attribute#GENERIC_MAX_HEALTH}.
+ * @see Attribute#GENERIC_MAX_HEALTH
*/
- @Deprecated
+ // @Deprecated // DivineMC
void setMaxHealth(double health);
/**
* Resets the max health to the original amount.
- * @deprecated use {@link Attribute#GENERIC_MAX_HEALTH}.
+ * @see Attribute#GENERIC_MAX_HEALTH
*/
- @Deprecated
+ // @Deprecated // DivineMC
void resetMaxHealth();
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 85c5987758b1d5145843705205dc99164c5f9f44..f427855ba2bdf8211a3b8b41129c22bf24a31bfb 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -278,14 +278,15 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* Returns true if the entity is supported by a block.
*
* This value is a state updated by the client after each movement.
- *
- * @return True if entity is on ground.
- * @deprecated This value is controlled only by the client and is therefore
+ * <p>
+ * Note: This value is controlled only by the client and is therefore
* unreliable and vulnerable to spoofing and/or desync depending on the
* context/time which it is accessed
+ *
+ * @return True if entity is on ground.
*/
@Override
- @Deprecated
+ // @Deprecated // DivineMC
public boolean isOnGround();
/**

View File

@@ -0,0 +1,55 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Sat, 11 Dec 2021 12:18:47 -0500
Subject: [PATCH] Paper PR - Add Movement Direction API
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
index 654dc0c6d98b29cf45d3826aece374726e3e9802..a1dfe9e1509a1b852e991e29c720fdfad596a2f8 100644
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -1149,6 +1149,44 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
* @see Location#setYaw(float)
*/
void setBodyYaw(float bodyYaw);
+
+ /**
+ * This number represents how much the entity is trying to move sideways.
+ * <p>
+ * This number is ranges from -1 to 1,
+ * where positive 1 represents the left and -1 represents the right.
+ * <p>
+ * Note that for {@link Player} entities only update this value when riding an entity, which may cause it
+ * to be inaccurate when dismounted.
+ *
+ * @return direction repesented as -1 to 1
+ */
+ float getSidewaysMotion();
+
+ /**
+ * This number represents how much the entity is trying to move
+ * in the upwards direction.
+ * <p>
+ * This number is ranges from -1 to 1,
+ * where positive 1 represents the up and -1 represents the down.
+ * <p>
+ * Note that for {@link Player} entities this value is never updated.
+ *
+ * @return direction repesented as -1 to 1
+ */
+ float getUpwardsMotion();
+
+ /**
+ * This number represents how much the entity is trying to move forward.
+ * <p>
+ * This number is ranges from -1 to 1,
+ * where positive 1 represents the up and -1 represents the down.
+ * <p>
+ * Note that for {@link Player} entities only update this value when riding an entity, so it may be inaccurate when dismounted.
+ *
+ * @return direction repesented as -1 to 1
+ */
+ float getForwardMotion();
// Paper end
// Purpur start

View File

@@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Sun, 17 Oct 2021 14:53:28 -0400
Subject: [PATCH] Paper PR - BoneMeal API
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index ad00e30379df52575bf2697ccb32abb176ecd47a..75f511532953d5074b22ef938874c65983a992e5 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -4146,4 +4146,20 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
}
}
}
+
+ // Paper start
+ /**
+ * Applies bonemeal at a specific location
+ * <p>
+ * Modifications done in the predicate are respected
+ * and will not be applied if false is returned.
+ *
+ * @param location Location to apply
+ * @param face Blockface to apply as
+ * @param showParticles If particles should be shown on success
+ * @param predicate blockstate predicate
+ * @return true if the bonemeal was applied, false if not
+ */
+ boolean applyBoneMeal(@NotNull Location location, @NotNull org.bukkit.block.BlockFace face, boolean showParticles, @Nullable Predicate<org.bukkit.block.BlockState> predicate);
+ // Paper end
}

View File

@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: nopjar <code.nopjar@gmail.com>
Date: Mon, 13 Jun 2022 11:29:42 +0200
Subject: [PATCH] Paper PR - Add sendTitleUpdate for inventories
diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java
index daca40b63e95ea33178bcb54ad45911da591ca54..957e2d091e40ecc283343b7b07b813406d75e852 100644
--- a/src/main/java/org/bukkit/inventory/InventoryView.java
+++ b/src/main/java/org/bukkit/inventory/InventoryView.java
@@ -468,4 +468,16 @@ public abstract class InventoryView {
@Deprecated // Paper
@NotNull
public abstract String getTitle();
+
+ // Paper start
+ /**
+ * Sends a packet to the client to open a new inventory with the new title.
+ * <p>
+ * The ID of the inventory and the contents stay the same. This does not affect the title on the
+ * server. Methods like {@link #title()} will still return the old title.
+ *
+ * @param title the new title
+ */
+ public abstract void sendTitleUpdate(@NotNull net.kyori.adventure.text.Component title);
+ // Paper end
}

View File

@@ -0,0 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Sat, 1 Apr 2023 00:31:15 +0300
Subject: [PATCH] Additional pathfinding API
diff --git a/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java
index 43f062257472a06e9e64c2feef6c3b1012aee00e..d3f12a2edeb5c0c548cfa1a13e93dbd1774b83a3 100644
--- a/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java
+++ b/src/main/java/com/destroystokyo/paper/entity/Pathfinder.java
@@ -208,5 +208,14 @@ public interface Pathfinder {
* @return The closest point the path can get to the target location
*/
@Nullable Location getFinalPoint();
+
+ // DivineMC start
+ /**
+ * Checks whether the final point if this path can be reached
+ *
+ * @return whether the final point if this path can be reached
+ */
+ boolean canReachFinalPoint();
+ // DivineMC end
}
}