9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2026-01-03 22:16:22 +00:00

started rework and first stable build

This commit is contained in:
NONPLAYT
2023-03-27 02:03:05 +03:00
parent b58fd22ec5
commit d24cbfd514
62 changed files with 794 additions and 76 deletions

View File

@@ -1,60 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ivan Pekov <ivan@mrivanplays.com>
Date: Sun, 27 Sep 2020 18:01:50 +0300
Subject: [PATCH] Add last tick time API
Original code by YatopiaMC, licensed under MIT
You can find the original code on https://github.com/YatopiaMC/Yatopia
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index ac9b690fcccb60b587e5345f12f1383afd0a73a1..4078ec0faa173d23b631cd221eec7f14aab1fc74 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2432,6 +2432,16 @@ public final class Bukkit {
return server.isStopping();
}
+ // Yatopia start
+ @Deprecated
+ public static long getLastTickMs() {
+ return server.getLastTickMs();
+ }
+ @NotNull public static java.time.Duration getLastTickTime() {
+ return server.getLastTickTime();
+ }
+ // Yatopia end
+
/**
* Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 2204336d8800311b65e894739ab1b27273e7c6f2..3b454a75809eec9d8294ec6fa15c7e918497489c 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2118,6 +2118,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
boolean isStopping();
+ // Yatopia start
+ /**
+ * Returns the time the last tick took in milliseconds.
+ *
+ * @return long time value
+ * @deprecated newer method with java's Duration and a possibility to convert it from millis to something else
+ */
+ @Deprecated
+ default long getLastTickMs() {
+ return getLastTickTime().toMillis();
+ }
+ /**
+ * Returns the time in {@link java.time.Duration} the last tick took.
+ *
+ * @return duration
+ */
+ @NotNull
+ java.time.Duration getLastTickTime();
+ // Yatopia end
+
/**
* Returns the {@link com.destroystokyo.paper.entity.ai.MobGoals} manager
*

View File

@@ -1,30 +0,0 @@
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 aa04d7df70d99402c91e920fd693d7d4fb655786..b572a760c09634d58485be71911bbae3c744e368 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -4069,4 +4069,19 @@ 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

@@ -1,33 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 24 Apr 2017 20:27:23 -0400
Subject: [PATCH] EMC - Add ChatColor.getById
diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java
index e3f185dc982d1c38195a4e01ddd485c13ffa58c0..8a3d05702ad0cfa8384d3a9c7a5695d82e13523e 100644
--- a/src/main/java/org/bukkit/ChatColor.java
+++ b/src/main/java/org/bukkit/ChatColor.java
@@ -233,6 +233,10 @@ public enum ChatColor {
}
};
+ public int getId() {
+ return intCode;
+ }
+
/**
* The special character which prefixes all chat colour codes. Use this if
* you need to dynamically convert colour codes from your custom format.
@@ -296,6 +300,11 @@ public enum ChatColor {
return !isFormat && this != RESET;
}
+ @Nullable
+ public static ChatColor getById(int id) {
+ return BY_ID.get(id);
+ }
+
/**
* Gets the color represented by the specified color code
*

View File

@@ -1,64 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Justin <justin@justinf.dev>
Date: Wed, 24 Aug 2022 05:08:52 -0700
Subject: [PATCH] Paper PR - Add Entity hidden by default API
This patch adds API that allows entities to be hidden by default. Entities that are hidden by
default are not shown to players until Player#showEntity is invoked on said entity. The same is
true for players that join the server after an Entity is hidden by default.
Hiding entities by default also respects precedent of keeping entities hidden when other plugins
explicitly hide them from a player. If an entity is hidden by default and by a plugin, the entity
must have the plugin that hid them from a player show them in order to be shown to a player again.
If no plugin had previously hidden the entity before the entity was hidden by default, then any
plugin that attempts to show the entity to a player will succeed in doing so.
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 365350d38b2eee00d22bad09ab95c6054f11d536..565a3bcc49ccb4650188263632751e9f6326a5d1 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -953,4 +953,25 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
boolean wouldCollideUsing(@NotNull BoundingBox boundingBox);
// Paper End - Collision API
+
+ // Paper start - Entity hiddenByDefault
+ /**
+ * Sets whether the entity is hidden by default. When an entity is hidden by default,
+ * {@link Player#showEntity(org.bukkit.plugin.Plugin, Entity)} must be called in order to
+ * display the entity again. Players that join the server do not see entities that are
+ * hidden by default at first and must be shown the entity with the same method above.
+ *
+ * This method also respects plugins hiding entities - if another plugin still wishes for an entity
+ * to be hidden (via {@link Player#hideEntity(org.bukkit.plugin.Plugin, Entity)}), then the entity will
+ * remain hidden even if hiddenByDefault is set to false again or if another plugin tries to show the entity.
+ *
+ * @param hiddenByDefault
+ */
+ void setHiddenByDefault(boolean hiddenByDefault);
+
+ /**
+ * @return true if the Entity is hidden by default, false otherwise
+ */
+ boolean isHiddenByDefault();
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index b5fd857896b3afcfa69cce55cbc2696dd625f805..7d44d455a550490e8e505c205dfe26e1d048719e 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1568,9 +1568,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Allows this player to see an entity that was previously hidden. If
- * another another plugin had hidden the entity too, then the entity will
+ * another plugin had hidden the entity too, then the entity will
* remain hidden until the other plugin calls this method too.
*
+ * If no other plugin is hiding the entity after this method is called,
+ * then this method also allows the player to see entities hidden by default
+ * with {@link Entity#setHiddenByDefault(boolean)}.
+ *
* @param plugin Plugin that wants to show the entity
* @param entity Entity to show
*/