More more more more more more more more more more more more more more work
This commit is contained in:
parent
45c36e5d0c
commit
97a4a70766
33 changed files with 301 additions and 326 deletions
|
@ -1,34 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Gerrygames <gecam59@gmail.com>
|
||||
Date: Thu, 16 Jul 2020 10:40:10 +0200
|
||||
Subject: [PATCH] Support hex colors in getLastColors
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/ChatColor.java b/src/main/java/org/bukkit/ChatColor.java
|
||||
index 44d597d7a6f66a18b8037e971170ff7cea5e825f..4594701d77c5d0f744bece871b98d9f6f73eb5a7 100644
|
||||
--- a/src/main/java/org/bukkit/ChatColor.java
|
||||
+++ b/src/main/java/org/bukkit/ChatColor.java
|
||||
@@ -363,6 +363,7 @@ public enum ChatColor {
|
||||
return new String(b);
|
||||
}
|
||||
|
||||
+ private static final Pattern HEX_COLOR_PATTERN = Pattern.compile(COLOR_CHAR + "x(?>" + COLOR_CHAR + "[0-9a-f]){6}", Pattern.CASE_INSENSITIVE); // Paper - Support hex colors in getLastColors
|
||||
/**
|
||||
* Gets the ChatColors used at the end of the given input string.
|
||||
*
|
||||
@@ -380,6 +381,15 @@ public enum ChatColor {
|
||||
for (int index = length - 1; index > -1; index--) {
|
||||
char section = input.charAt(index);
|
||||
if (section == COLOR_CHAR && index < length - 1) {
|
||||
+ // Paper start - Support hex colors
|
||||
+ if (index > 11 && input.charAt(index - 12) == COLOR_CHAR && (input.charAt(index - 11) == 'x' || input.charAt(index - 11) == 'X')) {
|
||||
+ String color = input.substring(index - 12, index + 2);
|
||||
+ if (HEX_COLOR_PATTERN.matcher(color).matches()) {
|
||||
+ result = color + result;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
char c = input.charAt(index + 1);
|
||||
ChatColor color = getByChar(c);
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Mariell Hoversholm <proximyst@proximyst.com>
|
||||
Date: Sat, 22 Aug 2020 23:59:25 +0200
|
||||
Subject: [PATCH] Add #setMaxPlayers API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 51eb99fd09ab546ebdf0c5ab5a76492a31a93139..9a1da52ce6d255715e1f765f491a9e20e47da400 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -172,6 +172,17 @@ public final class Bukkit {
|
||||
return server.getMaxPlayers();
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Set the maximum amount of players which can login to this server.
|
||||
+ *
|
||||
+ * @param maxPlayers the amount of players this server allows
|
||||
+ */
|
||||
+ public static void setMaxPlayers(int maxPlayers) {
|
||||
+ server.setMaxPlayers(maxPlayers);
|
||||
+ }
|
||||
+ // Paper 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 849384a6fc7380c5344430beb08210c102c39407..8a10350c4ed5e8f3de5a1cd7fb5064b01d7dd7c2 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -145,6 +145,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
public int getMaxPlayers();
|
||||
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Set the maximum amount of players which can login to this server.
|
||||
+ *
|
||||
+ * @param maxPlayers the amount of players this server allows
|
||||
+ */
|
||||
+ public void setMaxPlayers(int maxPlayers);
|
||||
+ // Paper end
|
||||
+
|
||||
/**
|
||||
* Get the game port that the server runs on.
|
||||
*
|
|
@ -1,65 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sun, 23 Aug 2020 16:32:03 +0200
|
||||
Subject: [PATCH] Add moon phase API
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/world/MoonPhase.java b/src/main/java/io/papermc/paper/world/MoonPhase.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..df05153397b42930cd53d37b30824c7e5f008f7e
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/world/MoonPhase.java
|
||||
@@ -0,0 +1,36 @@
|
||||
+package io.papermc.paper.world;
|
||||
+
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+import java.util.HashMap;
|
||||
+import java.util.Map;
|
||||
+
|
||||
+public enum MoonPhase {
|
||||
+ FULL_MOON(0L),
|
||||
+ WANING_GIBBOUS(1L),
|
||||
+ LAST_QUARTER(2L),
|
||||
+ WANING_CRESCENT(3L),
|
||||
+ NEW_MOON(4L),
|
||||
+ WAXING_CRESCENT(5L),
|
||||
+ FIRST_QUARTER(6L),
|
||||
+ WAXING_GIBBOUS(7L);
|
||||
+
|
||||
+ private final long day;
|
||||
+
|
||||
+ MoonPhase(long day) {
|
||||
+ this.day = day;
|
||||
+ }
|
||||
+
|
||||
+ private static final Map<Long, MoonPhase> BY_DAY = new HashMap<>();
|
||||
+
|
||||
+ static {
|
||||
+ for (MoonPhase phase : values()) {
|
||||
+ BY_DAY.put(phase.day, phase);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static MoonPhase getPhase(long day) {
|
||||
+ return BY_DAY.get(day % 8L);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index bcac107353149d0129571a3548965a407aa7640c..ef960a72bc10d43690c89ff412dc1b3edb7bdd34 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -68,6 +68,12 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
* @return The amount of Players in this world
|
||||
*/
|
||||
int getPlayerCount();
|
||||
+
|
||||
+ /**
|
||||
+ * @return the current moon phase at the current time in the world
|
||||
+ */
|
||||
+ @NotNull
|
||||
+ io.papermc.paper.world.MoonPhase getMoonPhase();
|
||||
// Paper end
|
||||
|
||||
/**
|
|
@ -1,39 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sun, 23 Aug 2020 19:36:08 +0200
|
||||
Subject: [PATCH] Add playPickupItemAnimation to LivingEntity
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 5ab8db52160049e36464df4e20e374b8849ef29c..1b6c2b2cfb910e7651e7f18ea407e31db685af8a 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -822,5 +822,28 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
* @param jumping entity jump state
|
||||
*/
|
||||
void setJumping(boolean jumping);
|
||||
+
|
||||
+ /**
|
||||
+ * Plays pickup item animation towards this entity.
|
||||
+ * <p>
|
||||
+ * <b>This will remove the item on the client.</b>
|
||||
+ * <p>
|
||||
+ * Quantity is inferred to be that of the {@link Item}.
|
||||
+ *
|
||||
+ * @param item item to pickup
|
||||
+ */
|
||||
+ default void playPickupItemAnimation(@NotNull Item item) {
|
||||
+ playPickupItemAnimation(item, item.getItemStack().getAmount());
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Plays pickup item animation towards this entity.
|
||||
+ * <p>
|
||||
+ * <b>This will remove the item on the client.</b>
|
||||
+ *
|
||||
+ * @param item item to pickup
|
||||
+ * @param quantity quantity of item
|
||||
+ */
|
||||
+ void playPickupItemAnimation(@NotNull Item item, int quantity);
|
||||
// Paper end
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Eearslya Sleiarion <eearslya@gmail.com>
|
||||
Date: Mon, 24 Jun 2019 21:27:39 -0700
|
||||
Subject: [PATCH] Add BellRingEvent
|
||||
|
||||
Add a new event, BellRingEvent, to trigger whenever a player rings a
|
||||
village bell. Passes along the bell block and the player who rang it.
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/event/block/BellRingEvent.java b/src/main/java/io/papermc/paper/event/block/BellRingEvent.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..881e545df51409e6101b4bb49f699655a744f13f
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/io/papermc/paper/event/block/BellRingEvent.java
|
||||
@@ -0,0 +1,55 @@
|
||||
+package io.papermc.paper.event.block;
|
||||
+
|
||||
+import org.bukkit.block.Block;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.event.Cancellable;
|
||||
+import org.bukkit.event.HandlerList;
|
||||
+import org.bukkit.event.block.BlockEvent;
|
||||
+import org.bukkit.potion.PotionEffect;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+import org.jetbrains.annotations.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a bell is rung.
|
||||
+ */
|
||||
+public class BellRingEvent extends BlockEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private boolean cancelled;
|
||||
+ private final Entity entity;
|
||||
+
|
||||
+ public BellRingEvent(@NotNull Block block, @Nullable Entity entity) {
|
||||
+ super(block);
|
||||
+ this.entity = entity;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancelled) {
|
||||
+ this.cancelled = cancelled;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the entity that rang the bell.
|
||||
+ *
|
||||
+ * @return the ringer or null if none
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getEntity() {
|
||||
+ return entity;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @NotNull
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+}
|
|
@ -1,27 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: DigitalRegent <misterwener@gmail.com>
|
||||
Date: Mon, 6 Apr 2020 20:30:09 +0200
|
||||
Subject: [PATCH] Brand support
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 7d4959a96e0cbf9b9e8a980ae4711d02ecd1a430..d0d44acb364bafca80e6efa04532b66663ca336a 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -2244,6 +2244,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
// Paper end
|
||||
}
|
||||
|
||||
+ // Paper start - brand support
|
||||
+ /**
|
||||
+ * Returns player's client brand name. If the client didn't send this information, the brand name will be null.<br>
|
||||
+ * For the Notchian client this name defaults to <code>vanilla</code>. Some modified clients report other names such as <code>forge</code>.<br>
|
||||
+ * @return client brand name
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ String getClientBrandName();
|
||||
+ // Paper end
|
||||
+
|
||||
@NotNull
|
||||
@Override
|
||||
Spigot spigot();
|
Loading…
Add table
Add a link
Reference in a new issue