Archiviert
13
0

Merge pull request 'Update upstream' (#1) from Mirrors/Paper:master into master

Reviewed-on: SteamWar/Paper#1
Dieser Commit ist enthalten in:
Lixfel 2022-08-21 19:43:10 +02:00
Commit e18ee721dd
885 geänderte Dateien mit 3955 neuen und 1953 gelöschten Zeilen

18
.github/stale.yml vendored
Datei anzeigen

@ -1,18 +0,0 @@
daysUntilStale: 60
daysUntilClose: 7
exemptLabels:
- "for: future"
- "type: bug"
- "status: accepted"
- "status: blocked"
- "status: in progress"
- "status: rebase required"
staleLabel: "resolution: stale"
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
closeComment: >
This issue has been automatically closed because it has not had activity in
a long time. If the issue still applies to the most recent supported
version, please open a new issue referencing this original issue.

Datei anzeigen

@ -40,7 +40,6 @@ rickyboy320 <rickw320@hotmail.com>
DoNotSpamPls <7570108+DoNotSpamPls@users.noreply.github.com>
JRoy <joshroy126@gmail.com>
ysl3000 <yannicklamprecht@live.de>
kennytv <jahnke.nassim@gmail.com>
Machine_Maker <machine@machinemaker.me>
Ivan Pekov <ivan@mrivanplays.com>
Camotoy <20743703+Camotoy@users.noreply.github.com>

Datei anzeigen

@ -5,5 +5,10 @@ import com.mojang.brigadier.suggestion.SuggestionProvider;
import java.util.function.Predicate;
/**
* Brigadier {@link Command}, {@link SuggestionProvider}, and permission checker for Bukkit {@link Command}s.
*
* @param <S> command source type
*/
public interface BukkitBrigadierCommand <S extends BukkitBrigadierCommandSource> extends Command<S>, Predicate<S>, SuggestionProvider<S> {
}

Datei anzeigen

@ -3,33 +3,33 @@ package com.destroystokyo.paper.event.brigadier;
import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource;
import com.mojang.brigadier.tree.RootCommandNode;
import org.bukkit.Bukkit;
import org.bukkit.Warning;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Fired any time a Brigadier RootCommandNode is generated for a player to inform the client of commands.
* You may manipulate this CommandNode to change what the client sees.
*
* This event may fire on login, world change, and permission rebuilds, by plugin request, and potentially future means.
* <p>This event may fire on login, world change, and permission rebuilds, by plugin request, and potentially future means.</p>
*
* This event will fire before {@link org.bukkit.event.player.PlayerCommandSendEvent}, so no filtering has been done by
* other plugins yet.
* <p>This event will fire before {@link org.bukkit.event.player.PlayerCommandSendEvent}, so no filtering has been done by
* other plugins yet.</p>
*
* WARNING: This event will potentially (and most likely) fire twice! Once for Async, and once again for Sync.
* <p>WARNING: This event will potentially (and most likely) fire twice! Once for Async, and once again for Sync.
* It is important that you check event.isAsynchronous() and event.hasFiredAsync() to ensure you only act once.
* If for some reason we are unable to send this asynchronously in the future, only the sync method will fire.
* If for some reason we are unable to send this asynchronously in the future, only the sync method will fire.</p>
*
* Your logic should look like this:
* if (event.isAsynchronous() || !event.hasFiredAsync()) { do stuff }
* <p>Your logic should look like this:
* {@code if (event.isAsynchronous() || !event.hasFiredAsync()) { // do stuff }}</p>
*
* If your logic is not safe to run asynchronously, only react to the synchronous version.
* @deprecated Draft API - Subject to change until confirmed solves desired use cases
* <p>If your logic is not safe to run asynchronously, only react to the synchronous version.</p>
*
* <p>This is a draft/experimental API and is subject to change.</p>
*/
@Deprecated
@Warning(false)
@ApiStatus.Experimental
public class AsyncPlayerSendCommandsEvent <S extends BukkitBrigadierCommandSource> extends PlayerEvent {
private static final HandlerList handlers = new HandlerList();
@ -43,14 +43,18 @@ public class AsyncPlayerSendCommandsEvent <S extends BukkitBrigadierCommandSourc
}
/**
* @return The full Root Command Node being sent to the client, which is mutable.
* Gets the full Root Command Node being sent to the client, which is mutable.
*
* @return the root command node
*/
public RootCommandNode<S> getCommandNode() {
return node;
}
/**
* @return If this event has already fired asynchronously.
* Gets if this event has already fired asynchronously.
*
* @return whether this event has already fired asynchronously
*/
public boolean hasFiredAsync() {
return hasFiredAsync;

Datei anzeigen

@ -10,8 +10,9 @@ import org.bukkit.event.player.PlayerEvent;
import org.jetbrains.annotations.NotNull;
/**
* Called when sending Suggestions to the client. Will be called asynchronously if a plugin
* marks the AsyncTabComplete event handled asynchronously, otherwise called synchronously.
* Called when sending {@link Suggestions} to the client. Will be called asynchronously if a plugin
* marks the {@link com.destroystokyo.paper.event.server.AsyncTabCompleteEvent} event handled asynchronously,
* otherwise called synchronously.
*/
public class AsyncPlayerSendSuggestionsEvent extends PlayerEvent implements Cancellable {
@ -28,21 +29,27 @@ public class AsyncPlayerSendSuggestionsEvent extends PlayerEvent implements Canc
}
/**
* @return The input buffer sent to request these suggestions
* Gets the input buffer sent to request these suggestions.
*
* @return the input buffer
*/
public String getBuffer() {
return buffer;
}
/**
* @return The suggestions being sent to client
* Gets the suggestions to be sent to client.
*
* @return the suggestions
*/
public Suggestions getSuggestions() {
return suggestions;
}
/**
* @param suggestions The suggestions to be sent to client if need to change them
* Sets the suggestions to be sent to client.
*
* @param suggestions suggestions
*/
public void setSuggestions(Suggestions suggestions) {
this.suggestions = suggestions;
@ -57,7 +64,7 @@ public class AsyncPlayerSendSuggestionsEvent extends PlayerEvent implements Canc
}
/**
* Cancels sending suggestions to the client
* Cancels sending suggestions to the client.
* {@inheritDoc}
*/
@Override

Datei anzeigen

@ -5,26 +5,24 @@ import com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource;
import com.mojang.brigadier.tree.ArgumentCommandNode;
import com.mojang.brigadier.tree.LiteralCommandNode;
import com.mojang.brigadier.tree.RootCommandNode;
import org.bukkit.Warning;
import org.bukkit.command.Command;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.server.ServerEvent;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
/**
* Fired anytime the server synchronizes Bukkit CommandMap to Brigadier.
* Fired anytime the server synchronizes Bukkit commands to Brigadier.
*
* Allows a plugin to control the Literal and Argument nodes for this command to be
* sent to the client.
* This is done at Plugin Enable time after commands have been registered, but some
* plugins may use reflection to retrigger this rebuild during runtime.
* <p>Allows a plugin to control the command node structure for its commands.
* This is done at Plugin Enable time after commands have been registered, but may also
* run at a later point in the server lifetime due to plugins, a server reload, etc.</p>
*
* @deprecated Draft API - Subject to change until confirmed solves desired use cases
* <p>This is a draft/experimental API and is subject to change.</p>
*/
@Deprecated
@Warning(false)
public class CommandRegisteredEvent <S extends BukkitBrigadierCommandSource> extends ServerEvent implements Cancellable {
@ApiStatus.Experimental
public class CommandRegisteredEvent<S extends BukkitBrigadierCommandSource> extends ServerEvent implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private final String commandLabel;
@ -33,6 +31,7 @@ public class CommandRegisteredEvent <S extends BukkitBrigadierCommandSource> ext
private final RootCommandNode<S> root;
private final ArgumentCommandNode<S, String> defaultArgs;
private LiteralCommandNode<S> literal;
private boolean rawCommand = false;
private boolean cancelled = false;
public CommandRegisteredEvent(String commandLabel, BukkitBrigadierCommand<S> brigadierCommand, Command command, RootCommandNode<S> root, LiteralCommandNode<S> literal, ArgumentCommandNode<S, String> defaultArgs) {
@ -45,55 +44,99 @@ public class CommandRegisteredEvent <S extends BukkitBrigadierCommandSource> ext
}
/**
* @return The command name being registered
* Gets the command label of the {@link Command} being registered.
*
* @return the command label
*/
public String getCommandLabel() {
return commandLabel;
return this.commandLabel;
}
/**
* @return The Bukkit API Brigadier Wrapped Command Object to handle executions and suggestions
* Gets the {@link BukkitBrigadierCommand} for the {@link Command} being registered. This can be used
* as the {@link com.mojang.brigadier.Command command executor} or
* {@link com.mojang.brigadier.suggestion.SuggestionProvider} of a {@link com.mojang.brigadier.tree.CommandNode}
* to delegate to the {@link Command} being registered.
*
* @return the {@link BukkitBrigadierCommand}
*/
public BukkitBrigadierCommand<S> getBrigadierCommand() {
return brigadierCommand;
}
public Command getCommand() {
return command;
return this.brigadierCommand;
}
/**
* @return Gets the root command node being used to register a command to.
* Gets the {@link Command} being registered.
*
* @return the {@link Command}
*/
public Command getCommand() {
return this.command;
}
/**
* Gets the {@link RootCommandNode} which is being registered to.
*
* @return the {@link RootCommandNode}
*/
public RootCommandNode<S> getRoot() {
return root;
return this.root;
}
/**
* Returns the Bukkit API's default handling of Arguments, if you wish to reuse it.
* @return
* Gets the Bukkit APIs default arguments node (greedy string), for if
* you wish to reuse it.
*
* @return default arguments node
*/
public ArgumentCommandNode<S, String> getDefaultArgs() {
return defaultArgs;
return this.defaultArgs;
}
/**
* Returns the Bukkit API's default literal for this command, including the {@link #getDefaultArgs()} as a child already.
* @return
* Gets the {@link LiteralCommandNode} to be registered for the {@link Command}.
*
* @return the {@link LiteralCommandNode}
*/
public LiteralCommandNode<S> getLiteral() {
return literal;
return this.literal;
}
/**
* Changes the literal used to register this command. The previous literable is mutable, so this is primarily if
* you want to completely replace the object.
* @param literal
* Sets the {@link LiteralCommandNode} used to register this command. The default literal is mutable, so
* this is primarily if you want to completely replace the object.
*
* @param literal new node
*/
public void setLiteral(LiteralCommandNode<S> literal) {
this.literal = literal;
}
/**
* Gets whether this command should is treated as "raw".
*
* @see #setRawCommand(boolean)
* @return whether this command is treated as "raw"
*/
public boolean isRawCommand() {
return this.rawCommand;
}
/**
* Sets whether this command should be treated as "raw".
*
* <p>A "raw" command will only use the node provided by this event for
* sending the command tree to the client. For execution purposes, the default
* greedy string execution of a standard Bukkit {@link Command} is used.</p>
*
* <p>On older versions of Paper, this was the default and only behavior of this
* event.</p>
*
* @param rawCommand whether this command should be treated as "raw"
*/
public void setRawCommand(final boolean rawCommand) {
this.rawCommand = rawCommand;
}
/**
* {@inheritDoc}
*/

Datei anzeigen

@ -19,7 +19,7 @@ Download Paper from our [downloads page](https://papermc.io/downloads).
Run the Paperclip jar directly from your server. Just like old times
* Documentation on using Paper: [docs.papermc.io](https://docs.papermc.io)
* For a sneak peek on upcoming features, [see here](https://github.com/PaperMC/Paper/projects)
* For a sneak peek at upcoming features, [see here](https://github.com/PaperMC/Paper/projects)
How To (Plugin Developers)
------
@ -38,7 +38,7 @@ How To (Plugin Developers)
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.19.1-R0.1-SNAPSHOT</version>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
```
@ -54,7 +54,7 @@ repositories {
}
dependencies {
compileOnly("io.papermc.paper:paper-api:1.19.1-R0.1-SNAPSHOT")
compileOnly("io.papermc.paper:paper-api:1.19.2-R0.1-SNAPSHOT")
}
java {

Datei anzeigen

@ -61,7 +61,7 @@ repositories {
}
dependencies {
paramMappings("net.fabricmc:yarn:1.19.1+build.1:mergedv2")
paramMappings("net.fabricmc:yarn:1.19.2+build.1:mergedv2")
remapper("net.fabricmc:tiny-remapper:0.8.2:fat")
decompiler("net.minecraftforge:forgeflower:1.5.605.7")
spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.6")

Datei anzeigen

@ -1,6 +1,6 @@
group=io.papermc.paper
version=1.19.1-R0.1-SNAPSHOT
mcVersion=1.19.1
version=1.19.2-R0.1-SNAPSHOT
mcVersion=1.19.2
org.gradle.caching=true
org.gradle.parallel=true

Datei anzeigen

@ -114,7 +114,7 @@ index 0000000000000000000000000000000000000000..2c096b3ec6d77d824de974f9a6615916
+}
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 847d05f335e393240d2bafea9949545b2dd53069..0000000000000000000000000000000000000000
index 3dc372008395cace32b28e2f08544d70f67e4511..0000000000000000000000000000000000000000
--- a/pom.xml
+++ /dev/null
@@ -1,252 +0,0 @@
@ -125,7 +125,7 @@ index 847d05f335e393240d2bafea9949545b2dd53069..00000000000000000000000000000000
-
- <groupId>org.spigotmc</groupId>
- <artifactId>spigot-api</artifactId>
- <version>1.19.1-R0.1-SNAPSHOT</version>
- <version>1.19.2-R0.1-SNAPSHOT</version>
- <packaging>jar</packaging>
-
- <name>Spigot-API</name>

Datei anzeigen

@ -77,16 +77,15 @@ index 79bf95d5a19046b142d0162dd6b739b7f0f52e59..84432bf9dd99332098f952ea777ee97d
doLast {
diff --git a/src/main/java/io/papermc/paper/chat/ChatRenderer.java b/src/main/java/io/papermc/paper/chat/ChatRenderer.java
new file mode 100644
index 0000000000000000000000000000000000000000..2fc47afbb233e6e5727a7b672f61b88ad3bab097
index 0000000000000000000000000000000000000000..ffe0a921cc1ebbb95104f22b57e0e3af85e287a6
--- /dev/null
+++ b/src/main/java/io/papermc/paper/chat/ChatRenderer.java
@@ -0,0 +1,78 @@
@@ -0,0 +1,71 @@
+package io.papermc.paper.chat;
+
+import net.kyori.adventure.audience.Audience;
+import net.kyori.adventure.text.Component;
+import org.bukkit.entity.Player;
+import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
@ -115,7 +114,11 @@ index 0000000000000000000000000000000000000000..2fc47afbb233e6e5727a7b672f61b88a
+ */
+ @NotNull
+ static ChatRenderer defaultRenderer() {
+ return viewerUnaware((source, sourceDisplayName, message) -> Component.translatable("chat.type.text", sourceDisplayName, message));
+ return new ViewerUnawareImpl.Default((source, sourceDisplayName, message) -> Component.translatable("chat.type.text", sourceDisplayName, message));
+ }
+
+ @ApiStatus.Internal
+ sealed interface Default extends ChatRenderer, ViewerUnaware permits ViewerUnawareImpl.Default {
+ }
+
+ /**
@ -127,17 +130,7 @@ index 0000000000000000000000000000000000000000..2fc47afbb233e6e5727a7b672f61b88a
+ */
+ @NotNull
+ static ChatRenderer viewerUnaware(final @NotNull ViewerUnaware renderer) {
+ return new ChatRenderer() {
+ private @MonotonicNonNull Component message;
+
+ @Override
+ public @NotNull Component render(final @NotNull Player source, final @NotNull Component sourceDisplayName, final @NotNull Component message, final @NotNull Audience viewer) {
+ if (this.message == null) {
+ this.message = renderer.render(source, sourceDisplayName, message);
+ }
+ return this.message;
+ }
+ };
+ return new ViewerUnawareImpl(renderer);
+ }
+
+ /**
@ -159,6 +152,50 @@ index 0000000000000000000000000000000000000000..2fc47afbb233e6e5727a7b672f61b88a
+ Component render(@NotNull Player source, @NotNull Component sourceDisplayName, @NotNull Component message);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/chat/ViewerUnawareImpl.java b/src/main/java/io/papermc/paper/chat/ViewerUnawareImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..9adeb880f7948f937891d83e256c808b5eb40a27
--- /dev/null
+++ b/src/main/java/io/papermc/paper/chat/ViewerUnawareImpl.java
@@ -0,0 +1,38 @@
+package io.papermc.paper.chat;
+
+import net.kyori.adventure.audience.Audience;
+import net.kyori.adventure.text.Component;
+import org.bukkit.entity.Player;
+import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
+import org.jetbrains.annotations.NotNull;
+
+sealed class ViewerUnawareImpl implements ChatRenderer, ChatRenderer.ViewerUnaware permits ViewerUnawareImpl.Default {
+
+ private final ViewerUnaware unaware;
+
+ private @MonotonicNonNull Component message;
+
+ ViewerUnawareImpl(final ViewerUnaware unaware) {
+ this.unaware = unaware;
+ }
+
+ @Override
+ public @NotNull Component render(final @NotNull Player source, final @NotNull Component sourceDisplayName, final @NotNull Component message, final @NotNull Audience viewer) {
+ return this.render(source, sourceDisplayName, message);
+ }
+
+ @Override
+ public @NotNull Component render(final @NotNull Player source, final @NotNull Component sourceDisplayName, final @NotNull Component message) {
+ if (this.message == null) {
+ this.message = this.unaware.render(source, sourceDisplayName, message);
+ }
+ return this.message;
+ }
+
+ static final class Default extends ViewerUnawareImpl implements ChatRenderer.Default {
+
+ Default(final ViewerUnaware unaware) {
+ super(unaware);
+ }
+ }
+}
diff --git a/src/main/java/io/papermc/paper/event/player/AbstractChatEvent.java b/src/main/java/io/papermc/paper/event/player/AbstractChatEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..fa03a5cb2d3e3e0a60d84bacc911d96c454f81da
@ -277,6 +314,164 @@ index 0000000000000000000000000000000000000000..fa03a5cb2d3e3e0a60d84bacc911d96c
+ this.cancelled = cancelled;
+ }
+}
diff --git a/src/main/java/io/papermc/paper/event/player/AsyncChatCommandDecorateEvent.java b/src/main/java/io/papermc/paper/event/player/AsyncChatCommandDecorateEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..bd216f7333795fc6bc5bec593f9cc0e3c2c1a27e
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/AsyncChatCommandDecorateEvent.java
@@ -0,0 +1,27 @@
+package io.papermc.paper.event.player;
+
+import net.kyori.adventure.text.Component;
+import org.bukkit.entity.Player;
+import org.bukkit.event.HandlerList;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+@ApiStatus.Experimental
+public class AsyncChatCommandDecorateEvent extends AsyncChatDecorateEvent {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ public AsyncChatCommandDecorateEvent(boolean async, @Nullable Player player, @NotNull Component originalMessage, boolean isPreview, @NotNull Component result) {
+ super(async, player, originalMessage, isPreview, result);
+ }
+
+ @Override
+ public @NotNull HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ public static @NotNull HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }
+}
diff --git a/src/main/java/io/papermc/paper/event/player/AsyncChatDecorateEvent.java b/src/main/java/io/papermc/paper/event/player/AsyncChatDecorateEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..347122b12ad98115133ef98db69b271ee0cec194
--- /dev/null
+++ b/src/main/java/io/papermc/paper/event/player/AsyncChatDecorateEvent.java
@@ -0,0 +1,119 @@
+package io.papermc.paper.event.player;
+
+import net.kyori.adventure.text.Component;
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.server.ServerEvent;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * This event is fired when the server decorates a component for chat purposes. It can be called
+ * under the following circumstances:
+ * <ul>
+ * <li><b>Previewing:</b> If the client requests a preview response, this event is fired to decorate the component
+ * before it is sent back to the client for signing.</li>
+ * <li><b>Chat:</b> If the client sends a chat packet without having signed a preview (the client could have previews
+ * disabled or they sent the message too quickly) this event is fired to generated the decorated component. Note
+ * that when this is the case, the message will show up as modified as the decorated component wasn't signed
+ * by the client.</li>
+ * </ul>
+ * @see AsyncChatCommandDecorateEvent for the decoration of messages sent via commands
+ */
+@ApiStatus.Experimental
+public class AsyncChatDecorateEvent extends ServerEvent implements Cancellable {
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
+ private final Player player;
+ private final Component originalMessage;
+ private final boolean isPreview;
+ private Component result;
+ private boolean cancelled;
+
+ @ApiStatus.Internal
+ public AsyncChatDecorateEvent(final boolean async, final @Nullable Player player, final @NotNull Component originalMessage, final boolean isPreview, final @NotNull Component result) {
+ super(async);
+ this.player = player;
+ this.originalMessage = originalMessage;
+ this.isPreview = isPreview;
+ this.result = result;
+ }
+
+ /**
+ * Gets the player (if available) associated with this event.
+ * <p>
+ * Certain commands request decorations without a player context
+ * which is why this is possibly null.
+ *
+ * @return the player or null
+ */
+ public @Nullable Player player() {
+ return this.player;
+ }
+
+ /**
+ * Gets the original decoration input
+ *
+ * @return the input
+ */
+ public @NotNull Component originalMessage() {
+ return this.originalMessage;
+ }
+
+ /**
+ * Gets the decoration result. This may already be different from
+ * {@link #originalMessage()} if some other listener to this event
+ * <b>OR</b> the legacy preview event ({@link org.bukkit.event.player.AsyncPlayerChatPreviewEvent}
+ * changed the result.
+ *
+ * @return the result
+ */
+ public @NotNull Component result() {
+ return this.result;
+ }
+
+ /**
+ * Sets the resulting decorated component.
+ *
+ * @param result the result
+ */
+ public void result(@NotNull Component result) {
+ this.result = result;
+ }
+
+ /**
+ * If this decorating is part of a preview request/response.
+ *
+ * @return true if part of previewing
+ */
+ public boolean isPreview() {
+ return this.isPreview;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.cancelled;
+ }
+
+ /**
+ * A cancelled decorating event means that no changes to the result component
+ * will have any effect. The decorated component will be equal to the original
+ * component.
+ */
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @Override
+ public @NotNull HandlerList getHandlers() {
+ return HANDLER_LIST;
+ }
+
+ public static @NotNull HandlerList getHandlerList() {
+ return HANDLER_LIST;
+ }
+}
diff --git a/src/main/java/io/papermc/paper/event/player/AsyncChatEvent.java b/src/main/java/io/papermc/paper/event/player/AsyncChatEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..0d9e3c23027e3af90cb70e4bb6fb0ac1da35fc4d
@ -475,10 +670,10 @@ index 0000000000000000000000000000000000000000..bff9a6295db367c6b89d69fb55459a40
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 5029d98816c137fcc7068bd5596d6a38d96ee877..ba57a093a2df3c65036377e3093eedabeda7c6f5 100644
index 72143df182e55b70726b066b6b276021c1f4f4d7..c800da7aba43de995682eb724ccf8b7066d6cad3 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -357,7 +357,9 @@ public final class Bukkit {
@@ -358,7 +358,9 @@ public final class Bukkit {
*
* @param message the message
* @return the number of players
@ -488,7 +683,7 @@ index 5029d98816c137fcc7068bd5596d6a38d96ee877..ba57a093a2df3c65036377e3093eedab
public static int broadcastMessage(@NotNull String message) {
return server.broadcastMessage(message);
}
@@ -1071,6 +1073,19 @@ public final class Bukkit {
@@ -1072,6 +1074,19 @@ public final class Bukkit {
server.shutdown();
}
@ -508,7 +703,7 @@ index 5029d98816c137fcc7068bd5596d6a38d96ee877..ba57a093a2df3c65036377e3093eedab
/**
* Broadcasts the specified message to every user with the given
* permission name.
@@ -1080,6 +1095,21 @@ public final class Bukkit {
@@ -1081,6 +1096,21 @@ public final class Bukkit {
* permissibles} must have to receive the broadcast
* @return number of message recipients
*/
@ -530,7 +725,7 @@ index 5029d98816c137fcc7068bd5596d6a38d96ee877..ba57a093a2df3c65036377e3093eedab
public static int broadcast(@NotNull String message, @NotNull String permission) {
return server.broadcast(message, permission);
}
@@ -1318,6 +1348,7 @@ public final class Bukkit {
@@ -1319,6 +1349,7 @@ public final class Bukkit {
return server.createInventory(owner, type);
}
@ -538,7 +733,7 @@ index 5029d98816c137fcc7068bd5596d6a38d96ee877..ba57a093a2df3c65036377e3093eedab
/**
* Creates an empty inventory with the specified type and title. If the type
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
@@ -1343,6 +1374,38 @@ public final class Bukkit {
@@ -1344,6 +1375,38 @@ public final class Bukkit {
* @see InventoryType#isCreatable()
*/
@NotNull
@ -577,7 +772,7 @@ index 5029d98816c137fcc7068bd5596d6a38d96ee877..ba57a093a2df3c65036377e3093eedab
public static Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull String title) {
return server.createInventory(owner, type, title);
}
@@ -1361,6 +1424,7 @@ public final class Bukkit {
@@ -1362,6 +1425,7 @@ public final class Bukkit {
return server.createInventory(owner, size);
}
@ -585,7 +780,7 @@ index 5029d98816c137fcc7068bd5596d6a38d96ee877..ba57a093a2df3c65036377e3093eedab
/**
* Creates an empty inventory of type {@link InventoryType#CHEST} with the
* specified size and title.
@@ -1373,10 +1437,30 @@ public final class Bukkit {
@@ -1374,10 +1438,30 @@ public final class Bukkit {
* @throws IllegalArgumentException if the size is not a multiple of 9
*/
@NotNull
@ -616,7 +811,7 @@ index 5029d98816c137fcc7068bd5596d6a38d96ee877..ba57a093a2df3c65036377e3093eedab
/**
* Creates an empty merchant.
*
@@ -1384,7 +1468,20 @@ public final class Bukkit {
@@ -1385,7 +1469,20 @@ public final class Bukkit {
* when the merchant inventory is viewed
* @return a new merchant
*/
@ -637,7 +832,7 @@ index 5029d98816c137fcc7068bd5596d6a38d96ee877..ba57a093a2df3c65036377e3093eedab
public static Merchant createMerchant(@Nullable String title) {
return server.createMerchant(title);
}
@@ -1501,22 +1598,47 @@ public final class Bukkit {
@@ -1502,22 +1599,47 @@ public final class Bukkit {
return server.isPrimaryThread();
}
@ -810,10 +1005,10 @@ index 803fa0019869127ee8c7e4fb1777a59c43e66f8a..c65f0d6569c130b4920a9e71ad24af64
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 6d6810cc51732830ef139f7099fbc5a45b124e8e..5af7da1d3d62cada69240e2d22db2a32278b0074 100644
index c0a3b44c728ec98ecce4d1e71746747d87582aa9..4d5c3af2e1f0030aa7415fbe9d11fe3580854fd5 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -58,13 +58,13 @@ import org.jetbrains.annotations.Nullable;
@@ -59,13 +59,13 @@ import org.jetbrains.annotations.Nullable;
/**
* Represents a server implementation.
*/
@ -829,7 +1024,7 @@ index 6d6810cc51732830ef139f7099fbc5a45b124e8e..5af7da1d3d62cada69240e2d22db2a32
*/
public static final String BROADCAST_CHANNEL_ADMINISTRATIVE = "bukkit.broadcast.admin";
@@ -72,7 +72,7 @@ public interface Server extends PluginMessageRecipient {
@@ -73,7 +73,7 @@ public interface Server extends PluginMessageRecipient {
* Used for all announcement messages, such as informing users that a
* player has joined.
* <p>
@ -838,7 +1033,7 @@ index 6d6810cc51732830ef139f7099fbc5a45b124e8e..5af7da1d3d62cada69240e2d22db2a32
*/
public static final String BROADCAST_CHANNEL_USERS = "bukkit.broadcast.user";
@@ -294,7 +294,9 @@ public interface Server extends PluginMessageRecipient {
@@ -295,7 +295,9 @@ public interface Server extends PluginMessageRecipient {
*
* @param message the message
* @return the number of players
@ -848,7 +1043,7 @@ index 6d6810cc51732830ef139f7099fbc5a45b124e8e..5af7da1d3d62cada69240e2d22db2a32
public int broadcastMessage(@NotNull String message);
/**
@@ -910,8 +912,33 @@ public interface Server extends PluginMessageRecipient {
@@ -911,8 +913,33 @@ public interface Server extends PluginMessageRecipient {
* @param permission the required permission {@link Permissible
* permissibles} must have to receive the broadcast
* @return number of message recipients
@ -882,7 +1077,7 @@ index 6d6810cc51732830ef139f7099fbc5a45b124e8e..5af7da1d3d62cada69240e2d22db2a32
/**
* Gets the player by the given name, regardless if they are offline or
@@ -1109,6 +1136,7 @@ public interface Server extends PluginMessageRecipient {
@@ -1110,6 +1137,7 @@ public interface Server extends PluginMessageRecipient {
@NotNull
Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type);
@ -890,7 +1085,7 @@ index 6d6810cc51732830ef139f7099fbc5a45b124e8e..5af7da1d3d62cada69240e2d22db2a32
/**
* Creates an empty inventory with the specified type and title. If the type
* is {@link InventoryType#CHEST}, the new inventory has a size of 27;
@@ -1134,6 +1162,36 @@ public interface Server extends PluginMessageRecipient {
@@ -1135,6 +1163,36 @@ public interface Server extends PluginMessageRecipient {
* @see InventoryType#isCreatable()
*/
@NotNull
@ -927,7 +1122,7 @@ index 6d6810cc51732830ef139f7099fbc5a45b124e8e..5af7da1d3d62cada69240e2d22db2a32
Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull String title);
/**
@@ -1148,6 +1206,22 @@ public interface Server extends PluginMessageRecipient {
@@ -1149,6 +1207,22 @@ public interface Server extends PluginMessageRecipient {
@NotNull
Inventory createInventory(@Nullable InventoryHolder owner, int size) throws IllegalArgumentException;
@ -950,7 +1145,7 @@ index 6d6810cc51732830ef139f7099fbc5a45b124e8e..5af7da1d3d62cada69240e2d22db2a32
/**
* Creates an empty inventory of type {@link InventoryType#CHEST} with the
* specified size and title.
@@ -1158,10 +1232,13 @@ public interface Server extends PluginMessageRecipient {
@@ -1159,10 +1233,13 @@ public interface Server extends PluginMessageRecipient {
* viewed
* @return a new inventory
* @throws IllegalArgumentException if the size is not a multiple of 9
@ -964,7 +1159,7 @@ index 6d6810cc51732830ef139f7099fbc5a45b124e8e..5af7da1d3d62cada69240e2d22db2a32
/**
* Creates an empty merchant.
*
@@ -1169,7 +1246,18 @@ public interface Server extends PluginMessageRecipient {
@@ -1170,7 +1247,18 @@ public interface Server extends PluginMessageRecipient {
* when the merchant inventory is viewed
* @return a new merchant
*/
@ -983,7 +1178,7 @@ index 6d6810cc51732830ef139f7099fbc5a45b124e8e..5af7da1d3d62cada69240e2d22db2a32
Merchant createMerchant(@Nullable String title);
/**
@@ -1265,20 +1353,41 @@ public interface Server extends PluginMessageRecipient {
@@ -1266,20 +1354,41 @@ public interface Server extends PluginMessageRecipient {
*/
boolean isPrimaryThread();
@ -1025,7 +1220,7 @@ index 6d6810cc51732830ef139f7099fbc5a45b124e8e..5af7da1d3d62cada69240e2d22db2a32
String getShutdownMessage();
/**
@@ -1650,7 +1759,9 @@ public interface Server extends PluginMessageRecipient {
@@ -1661,7 +1770,9 @@ public interface Server extends PluginMessageRecipient {
* Sends the component to the player
*
* @param component the components to send
@ -1035,7 +1230,7 @@ index 6d6810cc51732830ef139f7099fbc5a45b124e8e..5af7da1d3d62cada69240e2d22db2a32
public void broadcast(@NotNull net.md_5.bungee.api.chat.BaseComponent component) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1659,7 +1770,9 @@ public interface Server extends PluginMessageRecipient {
@@ -1670,7 +1781,9 @@ public interface Server extends PluginMessageRecipient {
* Sends an array of components as a single message to the player
*
* @param components the components to send
@ -4019,7 +4214,7 @@ index 03ca87a1cbace2459174bb7bb8847bda766e80c5..b37938745f916b5f0111b07b1a1c9752
* Returns the name of the plugin.
* <p>
diff --git a/src/main/java/org/bukkit/scoreboard/Objective.java b/src/main/java/org/bukkit/scoreboard/Objective.java
index ff3fcb2697eb00736238d0efdcaefe43043334d3..75acd6f8f3d774bb79e8e513125e801c5569a244 100644
index 2ff3a11f1f9c115722ea224873e7eb6dc6dc63e6..474274fdffe4041bf4bfb146fcc66424eb5be78a 100644
--- a/src/main/java/org/bukkit/scoreboard/Objective.java
+++ b/src/main/java/org/bukkit/scoreboard/Objective.java
@@ -19,14 +19,35 @@ public interface Objective {
@ -4069,10 +4264,10 @@ index ff3fcb2697eb00736238d0efdcaefe43043334d3..75acd6f8f3d774bb79e8e513125e801c
/**
diff --git a/src/main/java/org/bukkit/scoreboard/Scoreboard.java b/src/main/java/org/bukkit/scoreboard/Scoreboard.java
index 5c855dbd0da895392f7a6e92cdc90782baf614ad..1ada91d790abedbc9b3aeb6e96467a0d78560f15 100644
index a15183f302de42956d8965efe5f0585fc2cd030e..ef3e729caf430b08cdf2d680d5a137a1ba56c1c5 100644
--- a/src/main/java/org/bukkit/scoreboard/Scoreboard.java
+++ b/src/main/java/org/bukkit/scoreboard/Scoreboard.java
@@ -27,6 +27,48 @@ public interface Scoreboard {
@@ -27,6 +27,92 @@ public interface Scoreboard {
@Deprecated
@NotNull
Objective registerNewObjective(@NotNull String name, @NotNull String criteria) throws IllegalArgumentException;
@ -4093,8 +4288,10 @@ index 5c855dbd0da895392f7a6e92cdc90782baf614ad..1ada91d790abedbc9b3aeb6e96467a0d
+ * characters.
+ * @throws IllegalArgumentException if an objective by that name already
+ * exists
+ * @deprecated use {@link #registerNewObjective(String, Criteria, net.kyori.adventure.text.Component)}
+ */
+ @NotNull
+ @Deprecated
+ Objective registerNewObjective(@NotNull String name, @NotNull String criteria, @Nullable net.kyori.adventure.text.Component displayName) throws IllegalArgumentException;
+ /**
+ * Registers an Objective on this Scoreboard
@ -4114,34 +4311,92 @@ index 5c855dbd0da895392f7a6e92cdc90782baf614ad..1ada91d790abedbc9b3aeb6e96467a0d
+ * @throws IllegalArgumentException if renderType is null
+ * @throws IllegalArgumentException if an objective by that name already
+ * exists
+ * @deprecated use {@link #registerNewObjective(String, Criteria, net.kyori.adventure.text.Component, RenderType)}
+ */
+ @NotNull
+ @Deprecated
+ Objective registerNewObjective(@NotNull String name, @NotNull String criteria, @Nullable net.kyori.adventure.text.Component displayName, @NotNull RenderType renderType) throws IllegalArgumentException;
+ /**
+ * Registers an Objective on this Scoreboard
+ *
+ * @param name Name of the Objective
+ * @param criteria Criteria for the Objective
+ * @param displayName Name displayed to players for the Objective.
+ * @return The registered Objective
+ * @throws IllegalArgumentException if name is null
+ * @throws IllegalArgumentException if name is longer than 32767
+ * characters.
+ * @throws IllegalArgumentException if criteria is null
+ * @throws IllegalArgumentException if displayName is null
+ * @throws IllegalArgumentException if displayName is longer than 128
+ * characters.
+ * @throws IllegalArgumentException if an objective by that name already
+ * exists
+ */
+ @NotNull
+ Objective registerNewObjective(@NotNull String name, @NotNull Criteria criteria, @Nullable net.kyori.adventure.text.Component displayName) throws IllegalArgumentException;
+ /**
+ * Registers an Objective on this Scoreboard
+ *
+ * @param name Name of the Objective
+ * @param criteria Criteria for the Objective
+ * @param displayName Name displayed to players for the Objective.
+ * @param renderType Manner of rendering the Objective
+ * @return The registered Objective
+ * @throws IllegalArgumentException if name is null
+ * @throws IllegalArgumentException if name is longer than 32767
+ * characters.
+ * @throws IllegalArgumentException if criteria is null
+ * @throws IllegalArgumentException if displayName is null
+ * @throws IllegalArgumentException if displayName is longer than 128
+ * characters.
+ * @throws IllegalArgumentException if renderType is null
+ * @throws IllegalArgumentException if an objective by that name already
+ * exists
+ */
+ @NotNull
+ Objective registerNewObjective(@NotNull String name, @NotNull String criteria, @Nullable net.kyori.adventure.text.Component displayName, @NotNull RenderType renderType) throws IllegalArgumentException;
+ Objective registerNewObjective(@NotNull String name, @NotNull Criteria criteria, @Nullable net.kyori.adventure.text.Component displayName, @NotNull RenderType renderType) throws IllegalArgumentException;
+ // Paper end
/**
* Registers an Objective on this Scoreboard
@@ -44,8 +86,10 @@ public interface Scoreboard {
* characters.
* @throws IllegalArgumentException if an objective by that name already
* exists
+ * @deprecated in favour of {@link #registerNewObjective(String, String, net.kyori.adventure.text.Component)}
@@ -47,6 +133,7 @@ public interface Scoreboard {
* @deprecated use {@link #registerNewObjective(String, Criteria, String)}
*/
@NotNull
+ @Deprecated // Paper
Objective registerNewObjective(@NotNull String name, @NotNull String criteria, @NotNull String displayName) throws IllegalArgumentException;
/**
@@ -66,8 +110,10 @@ public interface Scoreboard {
* @throws IllegalArgumentException if renderType is null
* @throws IllegalArgumentException if an objective by that name already
* exists
+ * @deprecated in favour of {@link #registerNewObjective(String, String, net.kyori.adventure.text.Component, RenderType)}
@@ -70,6 +157,7 @@ public interface Scoreboard {
* @deprecated use {@link #registerNewObjective(String, Criteria, String, RenderType)}
*/
@NotNull
+ @Deprecated // Paper
Objective registerNewObjective(@NotNull String name, @NotNull String criteria, @NotNull String displayName, @NotNull RenderType renderType) throws IllegalArgumentException;
/**
@@ -88,8 +176,10 @@ public interface Scoreboard {
* characters.
* @throws IllegalArgumentException if an objective by that name already
* exists
+ * @deprecated in favour of {@link #registerNewObjective(String, Criteria, net.kyori.adventure.text.Component)}
*/
@NotNull
+ @Deprecated // Paper
Objective registerNewObjective(@NotNull String name, @NotNull Criteria criteria, @NotNull String displayName) throws IllegalArgumentException;
/**
@@ -110,8 +200,10 @@ public interface Scoreboard {
* @throws IllegalArgumentException if renderType is null
* @throws IllegalArgumentException if an objective by that name already
* exists
+ * @deprecated in favour of {@link #registerNewObjective(String, Criteria, net.kyori.adventure.text.Component, RenderType)}
*/
@NotNull
+ @Deprecated // Paper
Objective registerNewObjective(@NotNull String name, @NotNull Criteria criteria, @NotNull String displayName, @NotNull RenderType renderType) throws IllegalArgumentException;
/**
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..47b10df619ad2520b9bb673e2220f36391680f1b 100644

Datei anzeigen

@ -2791,10 +2791,10 @@ index 0000000000000000000000000000000000000000..5989ee21297935651b0edd44b8239e65
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index ba57a093a2df3c65036377e3093eedabeda7c6f5..9b118067de5eb54b266b8349fce7efdec2cb36eb 100644
index c800da7aba43de995682eb724ccf8b7066d6cad3..557cf1ff29e16fa942545ceca14696c2a50b2d4d 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -801,7 +801,6 @@ public final class Bukkit {
@@ -802,7 +802,6 @@ public final class Bukkit {
*/
public static void reload() {
server.reload();
@ -2803,10 +2803,10 @@ index ba57a093a2df3c65036377e3093eedabeda7c6f5..9b118067de5eb54b266b8349fce7efde
/**
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 5af7da1d3d62cada69240e2d22db2a32278b0074..0a433146ebec4416339c4ab33f3523a22d23d332 100644
index 4d5c3af2e1f0030aa7415fbe9d11fe3580854fd5..a2ae6b84fe20e43292f1442401a472dcce1600ec 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1755,6 +1755,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1766,6 +1766,26 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
throw new UnsupportedOperationException("Not supported yet.");
}

Datei anzeigen

@ -7,10 +7,10 @@ Subject: [PATCH] Add command line option to load extra plugin jars not in the
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 9b118067de5eb54b266b8349fce7efdec2cb36eb..aecc0bcaeceb0a2db08a528244c08037e58f399b 100644
index 557cf1ff29e16fa942545ceca14696c2a50b2d4d..a5c02f744664248f46aa35452318b6a728cd4afd 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -75,6 +75,20 @@ public final class Bukkit {
@@ -76,6 +76,20 @@ public final class Bukkit {
return server;
}
@ -32,10 +32,10 @@ index 9b118067de5eb54b266b8349fce7efdec2cb36eb..aecc0bcaeceb0a2db08a528244c08037
* Attempts to set the {@link Server} singleton.
* <p>
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 0a433146ebec4416339c4ab33f3523a22d23d332..b8c47ed7eb7bf52efd1928956584fd993e59f03a 100644
index a2ae6b84fe20e43292f1442401a472dcce1600ec..da13ae75ca1892c21a35aff02f92b91783a868bf 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -60,6 +60,18 @@ import org.jetbrains.annotations.Nullable;
@@ -61,6 +61,18 @@ import org.jetbrains.annotations.Nullable;
*/
public interface Server extends PluginMessageRecipient, net.kyori.adventure.audience.ForwardingAudience { // Paper

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add getTPS method
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index aecc0bcaeceb0a2db08a528244c08037e58f399b..fcdce3b516821d42327452790cc66663e4677613 100644
index a5c02f744664248f46aa35452318b6a728cd4afd..3603bcdadeea10f2babe8d6c609d7eaee3f0f89c 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1876,6 +1876,17 @@ public final class Bukkit {
@@ -1889,6 +1889,17 @@ public final class Bukkit {
return server.getEntity(uuid);
}
@ -27,10 +27,10 @@ index aecc0bcaeceb0a2db08a528244c08037e58f399b..fcdce3b516821d42327452790cc66663
* Get the advancement specified by this key.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index b8c47ed7eb7bf52efd1928956584fd993e59f03a..f52dd4c4602638bf02f676f6415d7051c0439cce 100644
index da13ae75ca1892c21a35aff02f92b91783a868bf..36f5e47ffcdce23b0b5594881fdd49a3a3337578 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1592,6 +1592,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1603,6 +1603,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Nullable
Entity getEntity(@NotNull UUID uuid);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Expose server CommandMap
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index fcdce3b516821d42327452790cc66663e4677613..d225e4a5587aa76a85a4b56e11d4563bdc97fe3f 100644
index 3603bcdadeea10f2babe8d6c609d7eaee3f0f89c..5475f7df443a31e839d353e251b0d9d55e53a84f 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2077,6 +2077,19 @@ public final class Bukkit {
@@ -2090,6 +2090,19 @@ public final class Bukkit {
return server.getUnsafe();
}
@ -29,10 +29,10 @@ index fcdce3b516821d42327452790cc66663e4677613..d225e4a5587aa76a85a4b56e11d4563b
public static Server.Spigot spigot() {
return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index f52dd4c4602638bf02f676f6415d7051c0439cce..f6f3297231d3a9e9f142faf992437cc99e241109 100644
index 36f5e47ffcdce23b0b5594881fdd49a3a3337578..2dac2c6e01b4f230750605ab1f49317927705c6b 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1602,6 +1602,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1613,6 +1613,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
public double[] getTPS();
// Paper end

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses
Change Javadoc to be accurate
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index d225e4a5587aa76a85a4b56e11d4563bdc97fe3f..e13ffa85390f2feda49309ba02ccf75856e4c8f2 100644
index 5475f7df443a31e839d353e251b0d9d55e53a84f..7a8eaf46ecd37163dbe34beb2cf8754bddae302f 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -378,6 +378,30 @@ public final class Bukkit {
@@ -379,6 +379,30 @@ public final class Bukkit {
return server.broadcastMessage(message);
}
@ -41,10 +41,10 @@ index d225e4a5587aa76a85a4b56e11d4563bdc97fe3f..e13ffa85390f2feda49309ba02ccf758
* Gets the name of the update folder. The update folder is used to safely
* update plugins at the right moment on a plugin load.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index f6f3297231d3a9e9f142faf992437cc99e241109..1dcf90071bae51e6b767ac26eb6624d372acac68 100644
index 2dac2c6e01b4f230750605ab1f49317927705c6b..1aed052ea337f2875b581064bd8e79d8a5a1a9ec 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -311,6 +311,30 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -312,6 +312,30 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Deprecated // Paper
public int broadcastMessage(@NotNull String message);

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add command to reload permissions.yml and require confirm to
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index e13ffa85390f2feda49309ba02ccf75856e4c8f2..c015c0b7678a141c84f0c0e339fe7c2a93988685 100644
index 7a8eaf46ecd37163dbe34beb2cf8754bddae302f..9463169bdb45a53ad774a0e3a5ec07704508685f 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2112,6 +2112,13 @@ public final class Bukkit {
@@ -2125,6 +2125,13 @@ public final class Bukkit {
public static org.bukkit.command.CommandMap getCommandMap() {
return server.getCommandMap();
}
@ -24,10 +24,10 @@ index e13ffa85390f2feda49309ba02ccf75856e4c8f2..c015c0b7678a141c84f0c0e339fe7c2a
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 1dcf90071bae51e6b767ac26eb6624d372acac68..7204f8ea6271dbb94406f07bc98ec322f928fcea 100644
index 1aed052ea337f2875b581064bd8e79d8a5a1a9ec..cd51a1a9a59cfa868237ab750d98d9df8464152f 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1863,4 +1863,6 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1874,4 +1874,6 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@NotNull
Spigot spigot();
// Spigot end

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases
Reload the aliases stored in commands.yml
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index c015c0b7678a141c84f0c0e339fe7c2a93988685..48eb69015cc70b0734f220f95fc0d8ffcd84954a 100644
index 9463169bdb45a53ad774a0e3a5ec07704508685f..fe5f6494fb0610dd11e59793701b2182fa862419 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2119,6 +2119,15 @@ public final class Bukkit {
@@ -2132,6 +2132,15 @@ public final class Bukkit {
public static void reloadPermissions() {
server.reloadPermissions();
}
@ -26,10 +26,10 @@ index c015c0b7678a141c84f0c0e339fe7c2a93988685..48eb69015cc70b0734f220f95fc0d8ff
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 7204f8ea6271dbb94406f07bc98ec322f928fcea..f7c54fbffe6b39d4f73b45cbc7c23f3508217f74 100644
index cd51a1a9a59cfa868237ab750d98d9df8464152f..29e71b746adcec45657787bf38427027508b0043 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1865,4 +1865,6 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1876,4 +1876,6 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
// Spigot end
void reloadPermissions(); // Paper

Datei anzeigen

@ -5,13 +5,13 @@ Subject: [PATCH] Expose WorldBorder#isInBounds(Location) check
diff --git a/src/main/java/org/bukkit/WorldBorder.java b/src/main/java/org/bukkit/WorldBorder.java
index 95bb16185514e0b894f407028997ce7d4504f8fb..238b9e2309d633623d35a1dbded6edadf20831f3 100644
index b1c08a7fc5856bcc29ee64d0a87b95a8ac940ddc..0f2f17f0a443ec5087b3373293b23f663be9dbe1 100644
--- a/src/main/java/org/bukkit/WorldBorder.java
+++ b/src/main/java/org/bukkit/WorldBorder.java
@@ -127,4 +127,18 @@ public interface WorldBorder {
* @return if this location is inside the border or not
@@ -162,4 +162,18 @@ public interface WorldBorder {
* @return The absolute maximum center coordinate of the WorldBorder
*/
public boolean isInside(@NotNull Location location);
public double getMaxCenterCoordinate();
+
+ // Paper start
+ /**

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add configuration option to prevent player names from being
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 48eb69015cc70b0734f220f95fc0d8ffcd84954a..aea30cacbf43c4c6d30b0c9e0d59fcd2db444ad8 100644
index fe5f6494fb0610dd11e59793701b2182fa862419..05908e512b0f2c01124737cf68df79c6c04518ee 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2128,6 +2128,16 @@ public final class Bukkit {
@@ -2141,6 +2141,16 @@ public final class Bukkit {
public static boolean reloadCommandAliases() {
return server.reloadCommandAliases();
}
@ -27,10 +27,10 @@ index 48eb69015cc70b0734f220f95fc0d8ffcd84954a..aea30cacbf43c4c6d30b0c9e0d59fcd2
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index f7c54fbffe6b39d4f73b45cbc7c23f3508217f74..5e4e6e83ac6b52493cb285561425bed53ffff2b6 100644
index 29e71b746adcec45657787bf38427027508b0043..f84c37ad591f4d0e4062889941791a3aeb7c5be5 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1867,4 +1867,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1878,4 +1878,14 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
void reloadPermissions(); // Paper
boolean reloadCommandAliases(); // Paper

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Fix upstream javadocs
Upstream still refuses to use Java 8 with the API so they are likely unaware these are even issues.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index aea30cacbf43c4c6d30b0c9e0d59fcd2db444ad8..e25a6532deca1df59eff2ab59697b851535ee952 100644
index 05908e512b0f2c01124737cf68df79c6c04518ee..2ff65157d511108e2902838f37732742b186af6e 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1331,6 +1331,8 @@ public final class Bukkit {
@@ -1332,6 +1332,8 @@ public final class Bukkit {
/**
* Gets every player that has ever played on this server.
@ -19,10 +19,10 @@ index aea30cacbf43c4c6d30b0c9e0d59fcd2db444ad8..e25a6532deca1df59eff2ab59697b851
* @return an array containing all previous players
*/
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 5e4e6e83ac6b52493cb285561425bed53ffff2b6..2bfbb0ce71c8c5f8bd9bbd908488831b94ce583f 100644
index f84c37ad591f4d0e4062889941791a3aeb7c5be5..d9566b18e6109db824cbc1732666771bf124adbf 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -509,13 +509,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -510,13 +510,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* </ul>
* <p>
* <b>Note:</b> If set to 0, {@link SpawnCategory} mobs spawning will be disabled.
@ -37,7 +37,7 @@ index 5e4e6e83ac6b52493cb285561425bed53ffff2b6..2bfbb0ce71c8c5f8bd9bbd908488831b
*/
public int getTicksPerSpawns(@NotNull SpawnCategory spawnCategory);
@@ -1126,6 +1123,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1127,6 +1124,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
/**
* Gets every player that has ever played on this server.
@ -46,6 +46,36 @@ index 5e4e6e83ac6b52493cb285561425bed53ffff2b6..2bfbb0ce71c8c5f8bd9bbd908488831b
*
* @return an array containing all previous players
*/
diff --git a/src/main/java/org/bukkit/block/Bed.java b/src/main/java/org/bukkit/block/Bed.java
index f9bd74f9ce6bd6650726e5a993f9b6e292cdc74d..f4c37ce1fe7aac3dde8485ee51fc8888ed56e79e 100644
--- a/src/main/java/org/bukkit/block/Bed.java
+++ b/src/main/java/org/bukkit/block/Bed.java
@@ -4,7 +4,22 @@ import org.bukkit.material.Colorable;
/**
* Represents a captured state of a bed.
- * @deprecated does not provide useful information beyond the material itself
*/
-@Deprecated
-public interface Bed extends TileState, Colorable { }
+// Paper start
+// @Deprecated
+public interface Bed extends TileState, Colorable {
+
+ @Override
+ @org.jetbrains.annotations.NotNull org.bukkit.DyeColor getColor();
+
+ /**
+ * <b>Unsupported</b>
+ *
+ * @throws UnsupportedOperationException not supported, set the block type
+ */
+ @Override
+ @org.jetbrains.annotations.Contract("_ -> fail")
+ @Deprecated(forRemoval = true)
+ void setColor(@org.bukkit.UndefinedNullability("not supported") org.bukkit.DyeColor color);
+// Paper end
+}
diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org/bukkit/entity/ArmorStand.java
index 91fc11dda99de506be83d40df8929bf7cd8e8d85..7dc631ebd009f5f5c3ac1699c3f3515c47609c05 100644
--- a/src/main/java/org/bukkit/entity/ArmorStand.java

Datei anzeigen

@ -321,10 +321,10 @@ index 0000000000000000000000000000000000000000..7b3b6ef533d32169fbeca389bd61cfc6
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index e25a6532deca1df59eff2ab59697b851535ee952..be46b7aa492226d2c943b9a15f0e009878be422c 100644
index 2ff65157d511108e2902838f37732742b186af6e..d5fd584c109c0a84a4259b10e7b43fae3a1da1ae 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2140,6 +2140,83 @@ public final class Bukkit {
@@ -2153,6 +2153,83 @@ public final class Bukkit {
public static boolean suggestPlayerNamesWhenNullTabCompletions() {
return server.suggestPlayerNamesWhenNullTabCompletions();
}
@ -409,10 +409,10 @@ index e25a6532deca1df59eff2ab59697b851535ee952..be46b7aa492226d2c943b9a15f0e0098
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 2bfbb0ce71c8c5f8bd9bbd908488831b94ce583f..04752eebe9df1138207a969fb1492a1f55b0b753 100644
index d9566b18e6109db824cbc1732666771bf124adbf..fab39e4fc595c022da27e87e27bd168939e54381 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1875,5 +1875,74 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1886,5 +1886,74 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return true if player names should be suggested
*/
boolean suggestPlayerNamesWhenNullTabCompletions();

Datei anzeigen

@ -1,5 +1,5 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Sun, 26 Nov 2017 13:17:09 -0500
Subject: [PATCH] AsyncTabCompleteEvent
@ -11,12 +11,14 @@ and avoid going to main for tab completions.
Especially useful if you need to query a database in order to obtain the results for tab
completion, such as offline players.
Co-authored-by: Aikar <aikar@aikar.co>
diff --git a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..a135a9bfb2ccc8842baa9d5760fa05b7b1a529b1
index 0000000000000000000000000000000000000000..9be64a95c2345433b6142d611077dedadcef9f5d
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
@@ -0,0 +1,176 @@
@@ -0,0 +1,328 @@
+/*
+ * Copyright (c) 2017 Daniel Ennis (Aikar) MIT License
+ *
@ -43,6 +45,11 @@ index 0000000000000000000000000000000000000000..a135a9bfb2ccc8842baa9d5760fa05b7
+package com.destroystokyo.paper.event.server;
+
+import com.google.common.base.Preconditions;
+import io.papermc.paper.util.TransformingRandomAccessList;
+import net.kyori.adventure.text.Component;
+import net.kyori.examination.Examinable;
+import net.kyori.examination.ExaminableProperty;
+import net.kyori.examination.string.StringExaminer;
+import org.bukkit.Location;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandSender;
@ -52,6 +59,7 @@ index 0000000000000000000000000000000000000000..a135a9bfb2ccc8842baa9d5760fa05b7
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
@ -66,15 +74,29 @@ index 0000000000000000000000000000000000000000..a135a9bfb2ccc8842baa9d5760fa05b7
+ private final boolean isCommand;
+ @Nullable
+ private final Location loc;
+ @NotNull private List<String> completions;
+ private final List<Completion> completions = new ArrayList<>();
+ private final List<String> stringCompletions = new TransformingRandomAccessList<>(
+ this.completions,
+ Completion::suggestion,
+ Completion::completion
+ );
+ private boolean cancelled;
+ private boolean handled = false;
+ private boolean fireSyncHandler = true;
+
+ public AsyncTabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, boolean isCommand, @Nullable Location loc) {
+ super(true);
+ this.sender = sender;
+ this.buffer = buffer;
+ this.isCommand = isCommand;
+ this.loc = loc;
+ }
+
+ @Deprecated
+ public AsyncTabCompleteEvent(@NotNull CommandSender sender, @NotNull List<String> completions, @NotNull String buffer, boolean isCommand, @Nullable Location loc) {
+ super(true);
+ this.sender = sender;
+ this.completions = completions;
+ this.completions.addAll(fromStrings(completions));
+ this.buffer = buffer;
+ this.isCommand = isCommand;
+ this.loc = loc;
@ -102,7 +124,7 @@ index 0000000000000000000000000000000000000000..a135a9bfb2ccc8842baa9d5760fa05b7
+ */
+ @NotNull
+ public List<String> getCompletions() {
+ return completions;
+ return this.stringCompletions;
+ }
+
+ /**
@ -116,8 +138,42 @@ index 0000000000000000000000000000000000000000..a135a9bfb2ccc8842baa9d5760fa05b7
+ * @param completions the new completions
+ */
+ public void setCompletions(@NotNull List<String> completions) {
+ if (completions == this.stringCompletions) {
+ return;
+ }
+ Preconditions.checkNotNull(completions);
+ this.completions = new ArrayList<>(completions);
+ this.completions.clear();
+ this.completions.addAll(fromStrings(completions));
+ }
+
+ /**
+ * The list of {@link Completion completions} which will be offered to the sender, in order.
+ * This list is mutable and reflects what will be offered.
+ * <p>
+ * If this collection is not empty after the event is fired, then
+ * the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
+ * or current player names will not be called.
+ *
+ * @return a list of offered completions
+ */
+ public @NotNull List<Completion> completions() {
+ return this.completions;
+ }
+
+ /**
+ * Set the {@link Completion completions} offered, overriding any already set.
+ * If this collection is not empty after the event is fired, then
+ * the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
+ * or current player names will not be called.
+ * <p>
+ * The passed collection will be cloned to a new List. You must call {{@link #completions()}} to mutate from here
+ *
+ * @param newCompletions the new completions
+ */
+ public void completions(final @NotNull List<Completion> newCompletions) {
+ Preconditions.checkNotNull(newCompletions, "new completions");
+ this.completions.clear();
+ this.completions.addAll(newCompletions);
+ }
+
+ /**
@ -192,6 +248,279 @@ index 0000000000000000000000000000000000000000..a135a9bfb2ccc8842baa9d5760fa05b7
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ private static @NotNull List<Completion> fromStrings(final @NotNull List<String> strings) {
+ final List<Completion> list = new ArrayList<>();
+ for (final String it : strings) {
+ list.add(new CompletionImpl(it, null));
+ }
+ return list;
+ }
+
+ /**
+ * A rich tab completion, consisting of a string suggestion, and a nullable {@link Component} tooltip.
+ */
+ public interface Completion extends Examinable {
+ /**
+ * Get the suggestion string for this {@link Completion}.
+ *
+ * @return suggestion string
+ */
+ @NotNull String suggestion();
+
+ /**
+ * Get the suggestion tooltip for this {@link Completion}.
+ *
+ * @return tooltip component
+ */
+ @Nullable Component tooltip();
+
+ @Override
+ default @NotNull Stream<? extends ExaminableProperty> examinableProperties() {
+ return Stream.of(ExaminableProperty.of("suggestion", this.suggestion()), ExaminableProperty.of("tooltip", this.tooltip()));
+ }
+
+ /**
+ * Create a new {@link Completion} from a suggestion string.
+ *
+ * @param suggestion suggestion string
+ * @return new completion instance
+ */
+ static @NotNull Completion completion(final @NotNull String suggestion) {
+ return new CompletionImpl(suggestion, null);
+ }
+
+ /**
+ * Create a new {@link Completion} from a suggestion string and a tooltip {@link Component}.
+ *
+ * <p>If the provided component is null, the suggestion will not have a tooltip.</p>
+ *
+ * @param suggestion suggestion string
+ * @param tooltip tooltip component, or null
+ * @return new completion instance
+ */
+ static @NotNull Completion completion(final @NotNull String suggestion, final @Nullable Component tooltip) {
+ return new CompletionImpl(suggestion, tooltip);
+ }
+ }
+
+ static final class CompletionImpl implements Completion {
+ private final String suggestion;
+ private final Component tooltip;
+
+ CompletionImpl(final @NotNull String suggestion, final @Nullable Component tooltip) {
+ this.suggestion = suggestion;
+ this.tooltip = tooltip;
+ }
+
+ @Override
+ public @NotNull String suggestion() {
+ return this.suggestion;
+ }
+
+ @Override
+ public @Nullable Component tooltip() {
+ return this.tooltip;
+ }
+
+ @Override
+ public boolean equals(final @Nullable Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || this.getClass() != o.getClass()) {
+ return false;
+ }
+ final CompletionImpl that = (CompletionImpl) o;
+ return this.suggestion.equals(that.suggestion)
+ && java.util.Objects.equals(this.tooltip, that.tooltip);
+ }
+
+ @Override
+ public int hashCode() {
+ return java.util.Objects.hash(this.suggestion, this.tooltip);
+ }
+
+ @Override
+ public @NotNull String toString() {
+ return StringExaminer.simpleEscaping().examine(this);
+ }
+ }
+}
diff --git a/src/main/java/io/papermc/paper/util/TransformingRandomAccessList.java b/src/main/java/io/papermc/paper/util/TransformingRandomAccessList.java
new file mode 100644
index 0000000000000000000000000000000000000000..6f560a51277ccbd46a9142cfa057d276118c1c7b
--- /dev/null
+++ b/src/main/java/io/papermc/paper/util/TransformingRandomAccessList.java
@@ -0,0 +1,169 @@
+package io.papermc.paper.util;
+
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.AbstractList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.RandomAccess;
+import java.util.function.Function;
+import java.util.function.Predicate;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Modified version of the Guava class with the same name to support add operations.
+ *
+ * @param <F> backing list element type
+ * @param <T> transformed list element type
+ */
+public final class TransformingRandomAccessList<F, T> extends AbstractList<T> implements RandomAccess {
+ final List<F> fromList;
+ final Function<? super F, ? extends T> toFunction;
+ final Function<? super T, ? extends F> fromFunction;
+
+ /**
+ * Create a new {@link TransformingRandomAccessList}.
+ *
+ * @param fromList backing list
+ * @param toFunction function mapping backing list element type to transformed list element type
+ * @param fromFunction function mapping transformed list element type to backing list element type
+ */
+ public TransformingRandomAccessList(
+ final @NonNull List<F> fromList,
+ final @NonNull Function<? super F, ? extends T> toFunction,
+ final @NonNull Function<? super T, ? extends F> fromFunction
+ ) {
+ this.fromList = checkNotNull(fromList);
+ this.toFunction = checkNotNull(toFunction);
+ this.fromFunction = checkNotNull(fromFunction);
+ }
+
+ @Override
+ public void clear() {
+ this.fromList.clear();
+ }
+
+ @Override
+ public T get(int index) {
+ return this.toFunction.apply(this.fromList.get(index));
+ }
+
+ @Override
+ public @NotNull Iterator<T> iterator() {
+ return this.listIterator();
+ }
+
+ @Override
+ public @NotNull ListIterator<T> listIterator(int index) {
+ return new TransformedListIterator<F, T>(this.fromList.listIterator(index)) {
+ @Override
+ T transform(F from) {
+ return TransformingRandomAccessList.this.toFunction.apply(from);
+ }
+
+ @Override
+ F transformBack(T from) {
+ return TransformingRandomAccessList.this.fromFunction.apply(from);
+ }
+ };
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return this.fromList.isEmpty();
+ }
+
+ @Override
+ public boolean removeIf(Predicate<? super T> filter) {
+ checkNotNull(filter);
+ return this.fromList.removeIf(element -> filter.test(this.toFunction.apply(element)));
+ }
+
+ @Override
+ public T remove(int index) {
+ return this.toFunction.apply(this.fromList.remove(index));
+ }
+
+ @Override
+ public int size() {
+ return this.fromList.size();
+ }
+
+ @Override
+ public T set(int i, T t) {
+ return this.toFunction.apply(this.fromList.set(i, this.fromFunction.apply(t)));
+ }
+
+ @Override
+ public void add(int i, T t) {
+ this.fromList.add(i, this.fromFunction.apply(t));
+ }
+
+ static abstract class TransformedListIterator<F, T> implements ListIterator<T>, Iterator<T> {
+ final Iterator<F> backingIterator;
+
+ TransformedListIterator(ListIterator<F> backingIterator) {
+ this.backingIterator = checkNotNull((Iterator<F>) backingIterator);
+ }
+
+ private ListIterator<F> backingIterator() {
+ return cast(this.backingIterator);
+ }
+
+ static <A> ListIterator<A> cast(Iterator<A> iterator) {
+ return (ListIterator<A>) iterator;
+ }
+
+ @Override
+ public final boolean hasPrevious() {
+ return this.backingIterator().hasPrevious();
+ }
+
+ @Override
+ public final T previous() {
+ return this.transform(this.backingIterator().previous());
+ }
+
+ @Override
+ public final int nextIndex() {
+ return this.backingIterator().nextIndex();
+ }
+
+ @Override
+ public final int previousIndex() {
+ return this.backingIterator().previousIndex();
+ }
+
+ @Override
+ public void set(T element) {
+ this.backingIterator().set(this.transformBack(element));
+ }
+
+ @Override
+ public void add(T element) {
+ this.backingIterator().add(this.transformBack(element));
+ }
+
+ abstract T transform(F from);
+
+ abstract F transformBack(T to);
+
+ @Override
+ public final boolean hasNext() {
+ return this.backingIterator.hasNext();
+ }
+
+ @Override
+ public final T next() {
+ return this.transform(this.backingIterator.next());
+ }
+
+ @Override
+ public final void remove() {
+ this.backingIterator.remove();
+ }
+ }
+}
diff --git a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java
index 270e6d8ad4358baa256cee5f16cff281f063ce3b..4a3451af454295ac3e1b688e6665cad9fc594c82 100644
@ -248,3 +577,16 @@ index 270e6d8ad4358baa256cee5f16cff281f063ce3b..4a3451af454295ac3e1b688e6665cad9
}
@Override
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
index 93498307004b68b934fbfa1aeb3aaf0e97cbdac7..bbe81f7a420f913ffdcad913a3c43ff41ead41f5 100644
--- a/src/test/java/org/bukkit/AnnotationTest.java
+++ b/src/test/java/org/bukkit/AnnotationTest.java
@@ -48,6 +48,8 @@ public class AnnotationTest {
// Generic functional interface
"org/bukkit/util/Consumer",
// Paper start
+ "io/papermc/paper/util/TransformingRandomAccessList",
+ "io/papermc/paper/util/TransformingRandomAccessList$TransformedListIterator",
// Timings history is broken in terms of nullability due to guavas Function defining that the param is NonNull
"co/aikar/timings/TimingHistory$2",
"co/aikar/timings/TimingHistory$2$1",

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Player.setPlayerProfile API
This can be useful for changing name or skins after a player has logged in.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index be46b7aa492226d2c943b9a15f0e009878be422c..edbe7363b2da4f89cc31cbf9521c9a6271060ccd 100644
index d5fd584c109c0a84a4259b10e7b43fae3a1da1ae..a452adcbf8657c501ad92f4cb361b551992f128f 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1196,8 +1196,10 @@ public final class Bukkit {
@@ -1197,8 +1197,10 @@ public final class Bukkit {
* @return the new PlayerProfile
* @throws IllegalArgumentException if both the unique id is
* <code>null</code> and the name is <code>null</code> or blank
@ -20,7 +20,7 @@ index be46b7aa492226d2c943b9a15f0e009878be422c..edbe7363b2da4f89cc31cbf9521c9a62
public static PlayerProfile createPlayerProfile(@Nullable UUID uniqueId, @Nullable String name) {
return server.createPlayerProfile(uniqueId, name);
}
@@ -1208,8 +1210,10 @@ public final class Bukkit {
@@ -1209,8 +1211,10 @@ public final class Bukkit {
* @param uniqueId the unique id
* @return the new PlayerProfile
* @throws IllegalArgumentException if the unique id is <code>null</code>
@ -31,7 +31,7 @@ index be46b7aa492226d2c943b9a15f0e009878be422c..edbe7363b2da4f89cc31cbf9521c9a62
public static PlayerProfile createPlayerProfile(@NotNull UUID uniqueId) {
return server.createPlayerProfile(uniqueId);
}
@@ -1221,8 +1225,10 @@ public final class Bukkit {
@@ -1222,8 +1226,10 @@ public final class Bukkit {
* @return the new PlayerProfile
* @throws IllegalArgumentException if the name is <code>null</code> or
* blank
@ -43,10 +43,10 @@ index be46b7aa492226d2c943b9a15f0e009878be422c..edbe7363b2da4f89cc31cbf9521c9a62
return server.createPlayerProfile(name);
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 04752eebe9df1138207a969fb1492a1f55b0b753..ca784abeb7f31c65e87df7750ae19aa9a8b65d72 100644
index fab39e4fc595c022da27e87e27bd168939e54381..e90056341407f58ff6ce2d9b80c8f3f64464e650 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1014,8 +1014,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1015,8 +1015,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return the new PlayerProfile
* @throws IllegalArgumentException if both the unique id is
* <code>null</code> and the name is <code>null</code> or blank
@ -57,7 +57,7 @@ index 04752eebe9df1138207a969fb1492a1f55b0b753..ca784abeb7f31c65e87df7750ae19aa9
PlayerProfile createPlayerProfile(@Nullable UUID uniqueId, @Nullable String name);
/**
@@ -1024,8 +1026,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1025,8 +1027,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param uniqueId the unique id
* @return the new PlayerProfile
* @throws IllegalArgumentException if the unique id is <code>null</code>
@ -68,7 +68,7 @@ index 04752eebe9df1138207a969fb1492a1f55b0b753..ca784abeb7f31c65e87df7750ae19aa9
PlayerProfile createPlayerProfile(@NotNull UUID uniqueId);
/**
@@ -1035,8 +1039,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1036,8 +1040,10 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return the new PlayerProfile
* @throws IllegalArgumentException if the name is <code>null</code> or
* blank

Datei anzeigen

@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index edbe7363b2da4f89cc31cbf9521c9a6271060ccd..5e5e8147b477b876a579327d5ea3d8d2393c0374 100644
index a452adcbf8657c501ad92f4cb361b551992f128f..908e1aba5257688bb70fbf1ed83d2212305263a1 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -656,6 +656,20 @@ public final class Bukkit {
@@ -657,6 +657,20 @@ public final class Bukkit {
return server.getPlayer(id);
}
@ -34,10 +34,10 @@ index edbe7363b2da4f89cc31cbf9521c9a6271060ccd..5e5e8147b477b876a579327d5ea3d8d2
* Gets the plugin manager for interfacing with plugins.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index ca784abeb7f31c65e87df7750ae19aa9a8b65d72..1a4559c88ece08e4a0c27e808f69693fb89fc474 100644
index e90056341407f58ff6ce2d9b80c8f3f64464e650..b0e6446c0dc49088878d7ae453dc3eee8b346f4e 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -558,6 +558,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -559,6 +559,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Nullable
public Player getPlayer(@NotNull UUID id);

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add More Creeper API
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..ff10251b6ded533b08048ec533525176eff03707
index 0000000000000000000000000000000000000000..e9768c919a1860881802ab68eff559874590ac1c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
@@ -0,0 +1,54 @@
@@ -0,0 +1,56 @@
+package com.destroystokyo.paper.event.entity;
+
+import org.bukkit.entity.Creeper;
@ -19,7 +19,9 @@ index 0000000000000000000000000000000000000000..ff10251b6ded533b08048ec533525176
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a Creeper is ignite flag is changed (armed/disarmed to explode).
+ * Called when a Creeper is ignited either by a
+ * flint and steel, {@link Creeper#ignite()} or
+ * {@link Creeper#setIgnited(boolean)}.
+ */
+public class CreeperIgniteEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();

Datei anzeigen

@ -5,10 +5,26 @@ Subject: [PATCH] Inventory#removeItemAnySlot
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index 5576a6a8df8c95164bf2dde45d756ce8b7ec957a..9c6a5bdac8c3ab682bbfae04ff24b76a62bc2883 100644
index 5576a6a8df8c95164bf2dde45d756ce8b7ec957a..f1a48eab1a357ae64545e1f1dc941c383cff8707 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -125,6 +125,34 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -104,7 +104,9 @@ public interface Inventory extends Iterable<ItemStack> {
public HashMap<Integer, ItemStack> addItem(@NotNull ItemStack... items) throws IllegalArgumentException;
/**
- * Removes the given ItemStacks from the inventory.
+ * Removes the given ItemStacks from the storage contents of the inventory.
+ * For removing ItemStacks from the inventories that have other content groups,
+ * like Player inventories, see {@link #removeItemAnySlot(ItemStack...)}.
* <p>
* It will try to remove 'as much as possible' from the types and amounts
* you give as arguments.
@@ -121,10 +123,39 @@ public interface Inventory extends Iterable<ItemStack> {
* @param items The ItemStacks to remove
* @return A HashMap containing items that couldn't be removed.
* @throws IllegalArgumentException if items is null
+ * @see #removeItemAnySlot(ItemStack...)
*/
@NotNull
public HashMap<Integer, ItemStack> removeItem(@NotNull ItemStack... items) throws IllegalArgumentException;

Datei anzeigen

@ -48,10 +48,10 @@ index 0000000000000000000000000000000000000000..909617079db61b675cc7b60b44ef96b3
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 5e5e8147b477b876a579327d5ea3d8d2393c0374..1c416a48d2a069a0167bc0be6fa1d65d14f35816 100644
index 908e1aba5257688bb70fbf1ed83d2212305263a1..303e539338383d0d7825b873611ca5843ee1c0a3 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -53,6 +53,7 @@ import org.bukkit.util.CachedServerIcon;
@@ -54,6 +54,7 @@ import org.bukkit.util.CachedServerIcon;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@ -59,7 +59,7 @@ index 5e5e8147b477b876a579327d5ea3d8d2393c0374..1c416a48d2a069a0167bc0be6fa1d65d
/**
* Represents the Bukkit core, for version and Server singleton handling
@@ -102,7 +103,25 @@ public final class Bukkit {
@@ -103,7 +104,25 @@ public final class Bukkit {
}
Bukkit.server = server;

Datei anzeigen

@ -113,7 +113,7 @@ index 0000000000000000000000000000000000000000..a02a02aa0c87e0f0ed9e509e4dcab015
+}
diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java
new file mode 100644
index 0000000000000000000000000000000000000000..41384ef616c5d3099482ea7d09dea12a240e758a
index 0000000000000000000000000000000000000000..1a78872e26f8fadbddd9af15fff063d03690077f
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java
@@ -0,0 +1,661 @@
@ -741,7 +741,7 @@ index 0000000000000000000000000000000000000000..41384ef616c5d3099482ea7d09dea12a
+ * Combine with other copper-related tags to filter is-un-waxed or not.
+ */
+ public static final MaterialSetTag UNWAXED_COPPER_BLOCKS = new MaterialSetTag(keyFor("unwaxed_copper_blocks"))
+ .contains("CUT_COPPER").endsWith("_COPPER").notContains("WAXED").ensureSize("UNWAXED_COPPER_BLOCKS", 16).lock();
+ .contains("CUT_COPPER").endsWith("_COPPER").notContains("WAXED").add(Material.COPPER_BLOCK).not(Material.RAW_COPPER).ensureSize("UNWAXED_COPPER_BLOCKS", 16).lock();
+
+ /**
+ * Covers all copper block variants.

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Make the default permission message configurable
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 1c416a48d2a069a0167bc0be6fa1d65d14f35816..62ecce029f38bd6a3e07981887916bb54e0c62f9 100644
index 303e539338383d0d7825b873611ca5843ee1c0a3..00295e256c0def25dd3e552ef67eea06ab01ad15 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2180,6 +2180,28 @@ public final class Bukkit {
@@ -2193,6 +2193,28 @@ public final class Bukkit {
return server.suggestPlayerNamesWhenNullTabCompletions();
}
@ -38,10 +38,10 @@ index 1c416a48d2a069a0167bc0be6fa1d65d14f35816..62ecce029f38bd6a3e07981887916bb5
* Creates a PlayerProfile for the specified uuid, with name as null.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 1a4559c88ece08e4a0c27e808f69693fb89fc474..85a0de6277aff8a81c8e58b3b29b98d99b6b1fb9 100644
index b0e6446c0dc49088878d7ae453dc3eee8b346f4e..dc26cf95f1769da76dd4d768a0912c1f5346d83e 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1894,6 +1894,23 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1905,6 +1905,23 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
boolean suggestPlayerNamesWhenNullTabCompletions();

Datei anzeigen

@ -9,10 +9,10 @@ a ton of noise to plugin developers.
These do not help plugin developers if they bring moise noise than value.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 62ecce029f38bd6a3e07981887916bb54e0c62f9..5f684c9ac218f105efe77ef08cae4b759868b0ea 100644
index 00295e256c0def25dd3e552ef67eea06ab01ad15..940e93021aba7dade1558054deead5896d74d3c6 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1197,10 +1197,8 @@ public final class Bukkit {
@@ -1198,10 +1198,8 @@ public final class Bukkit {
* @param name the name the player to retrieve
* @return an offline player
* @see #getOfflinePlayer(java.util.UUID)
@ -24,7 +24,7 @@ index 62ecce029f38bd6a3e07981887916bb54e0c62f9..5f684c9ac218f105efe77ef08cae4b75
@NotNull
public static OfflinePlayer getOfflinePlayer(@NotNull String name) {
return server.getOfflinePlayer(name);
@@ -1749,7 +1747,7 @@ public final class Bukkit {
@@ -1750,7 +1748,7 @@ public final class Bukkit {
*
* @return the scoreboard manager or null if no worlds are loaded.
*/
@ -159,10 +159,10 @@ index 6277451c3c6c551078c237cd767b6d70c4f585ea..10f5cfb1885833a1d2c1027c03974da4
CRACKED(0x0),
GLYPHED(0x1),
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 85a0de6277aff8a81c8e58b3b29b98d99b6b1fb9..1fecaed0b5774e3888bd1f5103828cc38f0265d9 100644
index dc26cf95f1769da76dd4d768a0912c1f5346d83e..8c608f9260acd8257b49f9befae510fa645886a8 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -998,10 +998,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -999,10 +999,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @param name the name the player to retrieve
* @return an offline player
* @see #getOfflinePlayer(java.util.UUID)
@ -174,7 +174,7 @@ index 85a0de6277aff8a81c8e58b3b29b98d99b6b1fb9..1fecaed0b5774e3888bd1f5103828cc3
@NotNull
public OfflinePlayer getOfflinePlayer(@NotNull String name);
@@ -1467,7 +1465,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1468,7 +1466,7 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*
* @return the scoreboard manager or null if no worlds are loaded.
*/
@ -183,6 +183,18 @@ index 85a0de6277aff8a81c8e58b3b29b98d99b6b1fb9..1fecaed0b5774e3888bd1f5103828cc3
ScoreboardManager getScoreboardManager();
/**
diff --git a/src/main/java/org/bukkit/UndefinedNullability.java b/src/main/java/org/bukkit/UndefinedNullability.java
index f465ea001c190e10eb99db818559d302e5512e99..567f560d145dea6fc7240699175496156c468a6d 100644
--- a/src/main/java/org/bukkit/UndefinedNullability.java
+++ b/src/main/java/org/bukkit/UndefinedNullability.java
@@ -13,6 +13,7 @@ import java.lang.annotation.RetentionPolicy;
* suggests a bad API design.
*/
@Retention(RetentionPolicy.CLASS)
+@java.lang.annotation.Documented // Paper
@Deprecated
public @interface UndefinedNullability {
diff --git a/src/main/java/org/bukkit/Vibration.java b/src/main/java/org/bukkit/Vibration.java
index 8d568d21fcbf706f55cda087bd7222ac60889c0a..209a302c3a2ed333780ed760314a6ed352fc0767 100644
--- a/src/main/java/org/bukkit/Vibration.java
@ -563,10 +575,10 @@ index 1d442dc16cbb0fed21714d47007f3f11e30c57d4..af8f7b88edf0fa790edcf16356a030c4
return setInput(input.getItemType(), input.getData());
}
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index 9c6a5bdac8c3ab682bbfae04ff24b76a62bc2883..875c401153349b0f2468525e54cf10ca86430087 100644
index f1a48eab1a357ae64545e1f1dc941c383cff8707..466d1bd7089b76f48f953e1a51c611ecd93dcd54 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -158,8 +158,7 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -161,8 +161,7 @@ public interface Inventory extends Iterable<ItemStack> {
*
* @return An array of ItemStacks from the inventory. Individual items may be null.
*/
@ -576,7 +588,7 @@ index 9c6a5bdac8c3ab682bbfae04ff24b76a62bc2883..875c401153349b0f2468525e54cf10ca
/**
* Completely replaces the inventory's contents. Removes all existing
@@ -170,7 +169,7 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -173,7 +172,7 @@ public interface Inventory extends Iterable<ItemStack> {
* @throws IllegalArgumentException If the array has more items than the
* inventory.
*/
@ -585,7 +597,7 @@ index 9c6a5bdac8c3ab682bbfae04ff24b76a62bc2883..875c401153349b0f2468525e54cf10ca
/**
* Return the contents from the section of the inventory where items can
@@ -183,8 +182,7 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -186,8 +185,7 @@ public interface Inventory extends Iterable<ItemStack> {
*
* @return inventory storage contents. Individual items may be null.
*/
@ -595,7 +607,7 @@ index 9c6a5bdac8c3ab682bbfae04ff24b76a62bc2883..875c401153349b0f2468525e54cf10ca
/**
* Put the given ItemStacks into the storage slots
@@ -193,7 +191,7 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -196,7 +194,7 @@ public interface Inventory extends Iterable<ItemStack> {
* @throws IllegalArgumentException If the array has more items than the
* inventory.
*/

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Expose the internal current tick
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 5f684c9ac218f105efe77ef08cae4b759868b0ea..fb5ba85b324eb78c31367bc59f2d1ca7eec1bf2b 100644
index 940e93021aba7dade1558054deead5896d74d3c6..d3f784c0c68567ee94befa57e0be1cedc7d586cb 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2276,6 +2276,10 @@ public final class Bukkit {
@@ -2289,6 +2289,10 @@ public final class Bukkit {
public static com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name) {
return server.createProfileExact(uuid, name);
}
@ -20,10 +20,10 @@ index 5f684c9ac218f105efe77ef08cae4b759868b0ea..fb5ba85b324eb78c31367bc59f2d1ca7
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 1fecaed0b5774e3888bd1f5103828cc38f0265d9..05587286b253b6f877aa5fae19d556cc8967a326 100644
index 8c608f9260acd8257b49f9befae510fa645886a8..d092d43178c1795028c33518713a8156648c460b 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1977,5 +1977,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1988,5 +1988,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull
com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name);

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add tick times API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index fb5ba85b324eb78c31367bc59f2d1ca7eec1bf2b..4ba11b4a22981472e3fcbfe8ffadaa3f3c140e2f 100644
index d3f784c0c68567ee94befa57e0be1cedc7d586cb..dab845c22713c0a3ae044afaf16d7b72eeff8ea5 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1948,6 +1948,25 @@ public final class Bukkit {
@@ -1961,6 +1961,25 @@ public final class Bukkit {
public static double[] getTPS() {
return server.getTPS();
}
@ -35,10 +35,10 @@ index fb5ba85b324eb78c31367bc59f2d1ca7eec1bf2b..4ba11b4a22981472e3fcbfe8ffadaa3f
/**
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 05587286b253b6f877aa5fae19d556cc8967a326..a4775467581c351f4c89521c2e017b31d48bf3b5 100644
index d092d43178c1795028c33518713a8156648c460b..13e4893049219ff1e50ede8df405561360ae4760 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1639,6 +1639,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1650,6 +1650,21 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull
public double[] getTPS();

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Expose MinecraftServer#isRunning
This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 4ba11b4a22981472e3fcbfe8ffadaa3f3c140e2f..88fe6c7dabdcf5c1a81126e7c98a361ec25438a0 100644
index dab845c22713c0a3ae044afaf16d7b72eeff8ea5..4771149c9fcee5e51c5313fffb105ad6f68a256a 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2299,6 +2299,15 @@ public final class Bukkit {
@@ -2312,6 +2312,15 @@ public final class Bukkit {
public static int getCurrentTick() {
return server.getCurrentTick();
}
@ -26,10 +26,10 @@ index 4ba11b4a22981472e3fcbfe8ffadaa3f3c140e2f..88fe6c7dabdcf5c1a81126e7c98a361e
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index a4775467581c351f4c89521c2e017b31d48bf3b5..8cf4a6d82278770598dee9191409c676b7fb1b08 100644
index 13e4893049219ff1e50ede8df405561360ae4760..201cbb0d33fc25e90b7960894eb6a9e6ef0d107b 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1999,5 +1999,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2010,5 +2010,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return Current tick
*/
int getCurrentTick();

Datei anzeigen

@ -1,5 +1,5 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <jahnke.nassim@gmail.com>
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Sat, 25 Apr 2020 23:31:28 +0200
Subject: [PATCH] Add item slot convenience methods

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Expose game version
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 88fe6c7dabdcf5c1a81126e7c98a361ec25438a0..e9e7fdcb8b57d07d88c9e9694dd119b07fa5b823 100644
index 4771149c9fcee5e51c5313fffb105ad6f68a256a..022a3de1bc7969a1db7395a910782bde1468758a 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -154,6 +154,18 @@ public final class Bukkit {
@@ -155,6 +155,18 @@ public final class Bukkit {
return server.getBukkitVersion();
}
@ -28,10 +28,10 @@ index 88fe6c7dabdcf5c1a81126e7c98a361ec25438a0..e9e7fdcb8b57d07d88c9e9694dd119b0
* Gets a view of all currently logged in players. This {@linkplain
* Collections#unmodifiableCollection(Collection) view} is a reused
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 8cf4a6d82278770598dee9191409c676b7fb1b08..dd1bb341714d27c286b57f9410a690f754bd937b 100644
index 201cbb0d33fc25e90b7960894eb6a9e6ef0d107b..832b19712612fdbac5d2f472aab203b14f7e4a46 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -112,6 +112,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -113,6 +113,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@NotNull
public String getBukkitVersion();

Datei anzeigen

@ -523,10 +523,10 @@ index 0000000000000000000000000000000000000000..8fd399f791b45eb7fc62693ca954eea0
+ @Deprecated GoalKey<Mob> UNIVERSAL_ANGER_RESET = GoalKey.of(Mob.class, NamespacedKey.minecraft("universal_anger_reset"));
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index e9e7fdcb8b57d07d88c9e9694dd119b07fa5b823..1f2d25a48bfd67f770560e6284e0be27b6b4df38 100644
index 022a3de1bc7969a1db7395a910782bde1468758a..f3f8a6db7ee1b4ea1aaf6bc972fa02a8af5f3772 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2320,6 +2320,16 @@ public final class Bukkit {
@@ -2333,6 +2333,16 @@ public final class Bukkit {
public static boolean isStopping() {
return server.isStopping();
}
@ -544,10 +544,10 @@ index e9e7fdcb8b57d07d88c9e9694dd119b07fa5b823..1f2d25a48bfd67f770560e6284e0be27
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index dd1bb341714d27c286b57f9410a690f754bd937b..88eab327d5854fd853b1adb5b4f04a2bcfd66849 100644
index 832b19712612fdbac5d2f472aab203b14f7e4a46..4f17bc607639bb3d20a1694ffb02d22d283348b3 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2016,5 +2016,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2027,5 +2027,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return true if server is in the process of being shutdown
*/
boolean isStopping();

Datei anzeigen

@ -28,10 +28,10 @@ index 83a4642119c3f33749e04c774cf2b39839f797e2..a39d2f1acbbd84ae0e2cf29f85594e09
public Location getLocation() {
return getInventory().getLocation();
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index 875c401153349b0f2468525e54cf10ca86430087..960626dd64ec9b0c5f4638c1ada463fd20c6b5fc 100644
index 466d1bd7089b76f48f953e1a51c611ecd93dcd54..129b5ab5062beeb9bb52465a788bc3a3aee9c49e 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -382,6 +382,17 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -385,6 +385,17 @@ public interface Inventory extends Iterable<ItemStack> {
@Nullable
public InventoryHolder getHolder();

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add #setMaxPlayers API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 1f2d25a48bfd67f770560e6284e0be27b6b4df38..bd7c7d1cc25f1bc246944de2ffc20cadaacd1d29 100644
index f3f8a6db7ee1b4ea1aaf6bc972fa02a8af5f3772..2d26f1fd3bbbe95e7a73bb5ebc7d85c9e066c1ee 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -207,6 +207,17 @@ public final class Bukkit {
@@ -208,6 +208,17 @@ public final class Bukkit {
return server.getMaxPlayers();
}
@ -27,10 +27,10 @@ index 1f2d25a48bfd67f770560e6284e0be27b6b4df38..bd7c7d1cc25f1bc246944de2ffc20cad
* 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 88eab327d5854fd853b1adb5b4f04a2bcfd66849..f05dc6c186c94b940ea69d7ebc32451cc38f7fcf 100644
index 4f17bc607639bb3d20a1694ffb02d22d283348b3..634a7e38987bc18232c07e5f767b37b523f13920 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -159,6 +159,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -160,6 +160,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
public int getMaxPlayers();

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add getOfflinePlayerIfCached(String)
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index bd7c7d1cc25f1bc246944de2ffc20cadaacd1d29..104738ea3bc2a678f15011ab1c6c7f38b56bf340 100644
index 2d26f1fd3bbbe95e7a73bb5ebc7d85c9e066c1ee..f1e1efaebfd9fe4399ff9d23c76f7dde6419ff71 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1227,6 +1227,27 @@ public final class Bukkit {
@@ -1228,6 +1228,27 @@ public final class Bukkit {
return server.getOfflinePlayer(name);
}
@ -37,10 +37,10 @@ index bd7c7d1cc25f1bc246944de2ffc20cadaacd1d29..104738ea3bc2a678f15011ab1c6c7f38
* Gets the player by the given UUID, regardless if they are offline or
* online.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index f05dc6c186c94b940ea69d7ebc32451cc38f7fcf..5e8ce65588a4b4be71292f5b92c049ae58d3a9a0 100644
index 634a7e38987bc18232c07e5f767b37b523f13920..50542df291d90a667af119fb9fcc3db2535ae6b5 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1022,6 +1022,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1023,6 +1023,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@NotNull
public OfflinePlayer getOfflinePlayer(@NotNull String name);

Datei anzeigen

@ -1,5 +1,5 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <jahnke.nassim@gmail.com>
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Tue, 25 Aug 2020 13:45:15 +0200
Subject: [PATCH] Add PlayerItemCooldownEvent

Datei anzeigen

@ -1,5 +1,5 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <jahnke.nassim@gmail.com>
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Sun, 26 Jul 2020 14:44:16 +0200
Subject: [PATCH] More lightning API

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add API to get Material from Boats and Minecarts
diff --git a/src/main/java/org/bukkit/entity/Boat.java b/src/main/java/org/bukkit/entity/Boat.java
index e5d5d2c944df1e9a81b38d3854fbe70c166588d1..3f848572935a73f637c6a91a97fa70041b0c6361 100644
index e5d5d2c944df1e9a81b38d3854fbe70c166588d1..3e458b96d5c15a78d3d411d5b88a716213588a94 100644
--- a/src/main/java/org/bukkit/entity/Boat.java
+++ b/src/main/java/org/bukkit/entity/Boat.java
@@ -173,4 +173,16 @@ public interface Boat extends Vehicle {
@@ -173,4 +173,14 @@ public interface Boat extends Vehicle {
ON_LAND,
IN_AIR;
}
@ -18,9 +18,7 @@ index e5d5d2c944df1e9a81b38d3854fbe70c166588d1..3f848572935a73f637c6a91a97fa7004
+ * Gets the {@link Material} that represents this Boat type.
+ *
+ * @return the boat material.
+ * @deprecated use {@link #getBoatType()} and {@link Type#getMaterial()}
+ */
+ @Deprecated
+ @NotNull
+ public Material getBoatMaterial();
+ // Paper end

Datei anzeigen

@ -1,5 +1,5 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <jahnke.nassim@gmail.com>
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Fri, 29 Jan 2021 15:13:04 +0100
Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Expand world key API
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 104738ea3bc2a678f15011ab1c6c7f38b56bf340..0ddad5d32494495bb797559a10336a401e445fef 100644
index f1e1efaebfd9fe4399ff9d23c76f7dde6419ff71..db44d88bf169f59a759be165094876497487d756 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -810,6 +810,18 @@ public final class Bukkit {
@@ -811,6 +811,18 @@ public final class Bukkit {
public static World getWorld(@NotNull UUID uid) {
return server.getWorld(uid);
}
@ -56,10 +56,10 @@ index 2fa3de66107162ccaa158b369e2c4a926ecaff92..aa534b1a9a1fb84a2fbd4b372f313bb4
// Paper end
}
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 5e8ce65588a4b4be71292f5b92c049ae58d3a9a0..80d762390a42070f1953a388c896cd93640b506e 100644
index 50542df291d90a667af119fb9fcc3db2535ae6b5..723057dcc769bd29acdb82561ee0126ed467579d 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -670,6 +670,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -671,6 +671,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@Nullable
public World getWorld(@NotNull UUID uid);

Datei anzeigen

@ -1,5 +1,5 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <jahnke.nassim@gmail.com>
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Fri, 26 Mar 2021 11:23:27 +0100
Subject: [PATCH] Expose protocol version

Datei anzeigen

@ -1,407 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Thu, 1 Apr 2021 00:34:41 -0700
Subject: [PATCH] Allow for Component suggestion tooltips in
AsyncTabCompleteEvent
diff --git a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
index a135a9bfb2ccc8842baa9d5760fa05b7b1a529b1..9be64a95c2345433b6142d611077dedadcef9f5d 100644
--- a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
+++ b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java
@@ -24,6 +24,11 @@
package com.destroystokyo.paper.event.server;
import com.google.common.base.Preconditions;
+import io.papermc.paper.util.TransformingRandomAccessList;
+import net.kyori.adventure.text.Component;
+import net.kyori.examination.Examinable;
+import net.kyori.examination.ExaminableProperty;
+import net.kyori.examination.string.StringExaminer;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
@@ -33,6 +38,7 @@ import org.bukkit.event.HandlerList;
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Stream;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -47,15 +53,29 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable {
private final boolean isCommand;
@Nullable
private final Location loc;
- @NotNull private List<String> completions;
+ private final List<Completion> completions = new ArrayList<>();
+ private final List<String> stringCompletions = new TransformingRandomAccessList<>(
+ this.completions,
+ Completion::suggestion,
+ Completion::completion
+ );
private boolean cancelled;
private boolean handled = false;
private boolean fireSyncHandler = true;
+ public AsyncTabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, boolean isCommand, @Nullable Location loc) {
+ super(true);
+ this.sender = sender;
+ this.buffer = buffer;
+ this.isCommand = isCommand;
+ this.loc = loc;
+ }
+
+ @Deprecated
public AsyncTabCompleteEvent(@NotNull CommandSender sender, @NotNull List<String> completions, @NotNull String buffer, boolean isCommand, @Nullable Location loc) {
super(true);
this.sender = sender;
- this.completions = completions;
+ this.completions.addAll(fromStrings(completions));
this.buffer = buffer;
this.isCommand = isCommand;
this.loc = loc;
@@ -83,7 +103,7 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable {
*/
@NotNull
public List<String> getCompletions() {
- return completions;
+ return this.stringCompletions;
}
/**
@@ -97,8 +117,42 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable {
* @param completions the new completions
*/
public void setCompletions(@NotNull List<String> completions) {
+ if (completions == this.stringCompletions) {
+ return;
+ }
Preconditions.checkNotNull(completions);
- this.completions = new ArrayList<>(completions);
+ this.completions.clear();
+ this.completions.addAll(fromStrings(completions));
+ }
+
+ /**
+ * The list of {@link Completion completions} which will be offered to the sender, in order.
+ * This list is mutable and reflects what will be offered.
+ * <p>
+ * If this collection is not empty after the event is fired, then
+ * the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
+ * or current player names will not be called.
+ *
+ * @return a list of offered completions
+ */
+ public @NotNull List<Completion> completions() {
+ return this.completions;
+ }
+
+ /**
+ * Set the {@link Completion completions} offered, overriding any already set.
+ * If this collection is not empty after the event is fired, then
+ * the standard process of calling {@link Command#tabComplete(CommandSender, String, String[])}
+ * or current player names will not be called.
+ * <p>
+ * The passed collection will be cloned to a new List. You must call {{@link #completions()}} to mutate from here
+ *
+ * @param newCompletions the new completions
+ */
+ public void completions(final @NotNull List<Completion> newCompletions) {
+ Preconditions.checkNotNull(newCompletions, "new completions");
+ this.completions.clear();
+ this.completions.addAll(newCompletions);
}
/**
@@ -173,4 +227,102 @@ public class AsyncTabCompleteEvent extends Event implements Cancellable {
public static HandlerList getHandlerList() {
return handlers;
}
+
+ private static @NotNull List<Completion> fromStrings(final @NotNull List<String> strings) {
+ final List<Completion> list = new ArrayList<>();
+ for (final String it : strings) {
+ list.add(new CompletionImpl(it, null));
+ }
+ return list;
+ }
+
+ /**
+ * A rich tab completion, consisting of a string suggestion, and a nullable {@link Component} tooltip.
+ */
+ public interface Completion extends Examinable {
+ /**
+ * Get the suggestion string for this {@link Completion}.
+ *
+ * @return suggestion string
+ */
+ @NotNull String suggestion();
+
+ /**
+ * Get the suggestion tooltip for this {@link Completion}.
+ *
+ * @return tooltip component
+ */
+ @Nullable Component tooltip();
+
+ @Override
+ default @NotNull Stream<? extends ExaminableProperty> examinableProperties() {
+ return Stream.of(ExaminableProperty.of("suggestion", this.suggestion()), ExaminableProperty.of("tooltip", this.tooltip()));
+ }
+
+ /**
+ * Create a new {@link Completion} from a suggestion string.
+ *
+ * @param suggestion suggestion string
+ * @return new completion instance
+ */
+ static @NotNull Completion completion(final @NotNull String suggestion) {
+ return new CompletionImpl(suggestion, null);
+ }
+
+ /**
+ * Create a new {@link Completion} from a suggestion string and a tooltip {@link Component}.
+ *
+ * <p>If the provided component is null, the suggestion will not have a tooltip.</p>
+ *
+ * @param suggestion suggestion string
+ * @param tooltip tooltip component, or null
+ * @return new completion instance
+ */
+ static @NotNull Completion completion(final @NotNull String suggestion, final @Nullable Component tooltip) {
+ return new CompletionImpl(suggestion, tooltip);
+ }
+ }
+
+ static final class CompletionImpl implements Completion {
+ private final String suggestion;
+ private final Component tooltip;
+
+ CompletionImpl(final @NotNull String suggestion, final @Nullable Component tooltip) {
+ this.suggestion = suggestion;
+ this.tooltip = tooltip;
+ }
+
+ @Override
+ public @NotNull String suggestion() {
+ return this.suggestion;
+ }
+
+ @Override
+ public @Nullable Component tooltip() {
+ return this.tooltip;
+ }
+
+ @Override
+ public boolean equals(final @Nullable Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || this.getClass() != o.getClass()) {
+ return false;
+ }
+ final CompletionImpl that = (CompletionImpl) o;
+ return this.suggestion.equals(that.suggestion)
+ && java.util.Objects.equals(this.tooltip, that.tooltip);
+ }
+
+ @Override
+ public int hashCode() {
+ return java.util.Objects.hash(this.suggestion, this.tooltip);
+ }
+
+ @Override
+ public @NotNull String toString() {
+ return StringExaminer.simpleEscaping().examine(this);
+ }
+ }
}
diff --git a/src/main/java/io/papermc/paper/util/TransformingRandomAccessList.java b/src/main/java/io/papermc/paper/util/TransformingRandomAccessList.java
new file mode 100644
index 0000000000000000000000000000000000000000..6f560a51277ccbd46a9142cfa057d276118c1c7b
--- /dev/null
+++ b/src/main/java/io/papermc/paper/util/TransformingRandomAccessList.java
@@ -0,0 +1,169 @@
+package io.papermc.paper.util;
+
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.AbstractList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.RandomAccess;
+import java.util.function.Function;
+import java.util.function.Predicate;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Modified version of the Guava class with the same name to support add operations.
+ *
+ * @param <F> backing list element type
+ * @param <T> transformed list element type
+ */
+public final class TransformingRandomAccessList<F, T> extends AbstractList<T> implements RandomAccess {
+ final List<F> fromList;
+ final Function<? super F, ? extends T> toFunction;
+ final Function<? super T, ? extends F> fromFunction;
+
+ /**
+ * Create a new {@link TransformingRandomAccessList}.
+ *
+ * @param fromList backing list
+ * @param toFunction function mapping backing list element type to transformed list element type
+ * @param fromFunction function mapping transformed list element type to backing list element type
+ */
+ public TransformingRandomAccessList(
+ final @NonNull List<F> fromList,
+ final @NonNull Function<? super F, ? extends T> toFunction,
+ final @NonNull Function<? super T, ? extends F> fromFunction
+ ) {
+ this.fromList = checkNotNull(fromList);
+ this.toFunction = checkNotNull(toFunction);
+ this.fromFunction = checkNotNull(fromFunction);
+ }
+
+ @Override
+ public void clear() {
+ this.fromList.clear();
+ }
+
+ @Override
+ public T get(int index) {
+ return this.toFunction.apply(this.fromList.get(index));
+ }
+
+ @Override
+ public @NotNull Iterator<T> iterator() {
+ return this.listIterator();
+ }
+
+ @Override
+ public @NotNull ListIterator<T> listIterator(int index) {
+ return new TransformedListIterator<F, T>(this.fromList.listIterator(index)) {
+ @Override
+ T transform(F from) {
+ return TransformingRandomAccessList.this.toFunction.apply(from);
+ }
+
+ @Override
+ F transformBack(T from) {
+ return TransformingRandomAccessList.this.fromFunction.apply(from);
+ }
+ };
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return this.fromList.isEmpty();
+ }
+
+ @Override
+ public boolean removeIf(Predicate<? super T> filter) {
+ checkNotNull(filter);
+ return this.fromList.removeIf(element -> filter.test(this.toFunction.apply(element)));
+ }
+
+ @Override
+ public T remove(int index) {
+ return this.toFunction.apply(this.fromList.remove(index));
+ }
+
+ @Override
+ public int size() {
+ return this.fromList.size();
+ }
+
+ @Override
+ public T set(int i, T t) {
+ return this.toFunction.apply(this.fromList.set(i, this.fromFunction.apply(t)));
+ }
+
+ @Override
+ public void add(int i, T t) {
+ this.fromList.add(i, this.fromFunction.apply(t));
+ }
+
+ static abstract class TransformedListIterator<F, T> implements ListIterator<T>, Iterator<T> {
+ final Iterator<F> backingIterator;
+
+ TransformedListIterator(ListIterator<F> backingIterator) {
+ this.backingIterator = checkNotNull((Iterator<F>) backingIterator);
+ }
+
+ private ListIterator<F> backingIterator() {
+ return cast(this.backingIterator);
+ }
+
+ static <A> ListIterator<A> cast(Iterator<A> iterator) {
+ return (ListIterator<A>) iterator;
+ }
+
+ @Override
+ public final boolean hasPrevious() {
+ return this.backingIterator().hasPrevious();
+ }
+
+ @Override
+ public final T previous() {
+ return this.transform(this.backingIterator().previous());
+ }
+
+ @Override
+ public final int nextIndex() {
+ return this.backingIterator().nextIndex();
+ }
+
+ @Override
+ public final int previousIndex() {
+ return this.backingIterator().previousIndex();
+ }
+
+ @Override
+ public void set(T element) {
+ this.backingIterator().set(this.transformBack(element));
+ }
+
+ @Override
+ public void add(T element) {
+ this.backingIterator().add(this.transformBack(element));
+ }
+
+ abstract T transform(F from);
+
+ abstract F transformBack(T to);
+
+ @Override
+ public final boolean hasNext() {
+ return this.backingIterator.hasNext();
+ }
+
+ @Override
+ public final T next() {
+ return this.transform(this.backingIterator.next());
+ }
+
+ @Override
+ public final void remove() {
+ this.backingIterator.remove();
+ }
+ }
+}
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
index 93498307004b68b934fbfa1aeb3aaf0e97cbdac7..bbe81f7a420f913ffdcad913a3c43ff41ead41f5 100644
--- a/src/test/java/org/bukkit/AnnotationTest.java
+++ b/src/test/java/org/bukkit/AnnotationTest.java
@@ -48,6 +48,8 @@ public class AnnotationTest {
// Generic functional interface
"org/bukkit/util/Consumer",
// Paper start
+ "io/papermc/paper/util/TransformingRandomAccessList",
+ "io/papermc/paper/util/TransformingRandomAccessList$TransformedListIterator",
// Timings history is broken in terms of nullability due to guavas Function defining that the param is NonNull
"co/aikar/timings/TimingHistory$2",
"co/aikar/timings/TimingHistory$2$1",

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Inventory#close
diff --git a/src/main/java/org/bukkit/inventory/Inventory.java b/src/main/java/org/bukkit/inventory/Inventory.java
index 960626dd64ec9b0c5f4638c1ada463fd20c6b5fc..1b577c03c3152d22b70f8bdb321b28ad8fbbc3af 100644
index 129b5ab5062beeb9bb52465a788bc3a3aee9c49e..c574bb94b21eb27974b40c839fce52c6ac4b54b4 100644
--- a/src/main/java/org/bukkit/inventory/Inventory.java
+++ b/src/main/java/org/bukkit/inventory/Inventory.java
@@ -352,6 +352,15 @@ public interface Inventory extends Iterable<ItemStack> {
@@ -355,6 +355,15 @@ public interface Inventory extends Iterable<ItemStack> {
*/
public void clear();

Datei anzeigen

@ -70,10 +70,10 @@ index 0000000000000000000000000000000000000000..58f78d5e91beacaf710f62461cf869f7
+
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 0ddad5d32494495bb797559a10336a401e445fef..05186443e25706ed77f7187eea6ac84666613a88 100644
index db44d88bf169f59a759be165094876497487d756..d8e301befb37b540bc246cf58988923b0ab23375 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2374,6 +2374,14 @@ public final class Bukkit {
@@ -2387,6 +2387,14 @@ public final class Bukkit {
public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
return server.getMobGoals();
}
@ -89,10 +89,10 @@ index 0ddad5d32494495bb797559a10336a401e445fef..05186443e25706ed77f7187eea6ac846
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 80d762390a42070f1953a388c896cd93640b506e..3d78e555725b48cb7e5750e8b4b3f1f0463bddc2 100644
index 723057dcc769bd29acdb82561ee0126ed467579d..16f631fdde4b63e0ed3162486dba684697bdffa7 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -2063,5 +2063,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -2074,5 +2074,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/
@NotNull
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();

Datei anzeigen

@ -3,7 +3,7 @@ From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Fri, 28 May 2021 21:06:59 -0400
Subject: [PATCH] Missing Entity Behavior API
Co-authored-by: Nassim Jahnke <jahnke.nassim@gmail.com>
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/entity/AbstractHorse.java b/src/main/java/org/bukkit/entity/AbstractHorse.java
@ -563,6 +563,29 @@ index 627e3c1a96ae3331f5aa2dd7803dd2a31c7204be..3c447d2300c866ae605eeca97bd869f4
+ void setLimitedLifetimeTicks(int ticks);
// Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Warden.java b/src/main/java/org/bukkit/entity/Warden.java
index 25bbecc89b01faa4905def014d07a616e39df992..5cd34abcc42aa2582dee6770ff1563b1b7b0ee21 100644
--- a/src/main/java/org/bukkit/entity/Warden.java
+++ b/src/main/java/org/bukkit/entity/Warden.java
@@ -18,6 +18,18 @@ public interface Warden extends Monster {
*/
int getAnger(@NotNull Entity entity);
+ // Paper start
+ /**
+ * Gets the highest anger level of this warden.
+ * <p>
+ * Anger is an integer from 0 to 150. Once a Warden reaches 80 anger at a
+ * target it will actively pursue it.
+ *
+ * @return highest anger level
+ */
+ int getHighestAnger();
+ // Paper end
+
/**
* Increases the anger level of this warden.
*
diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java
index b86f0196e6eb8070830f63a94f732522c2a6c2f1..a1b42ae35dda2da90ba00a2d6666514f7c5b11dd 100644
--- a/src/main/java/org/bukkit/entity/Wither.java

Datei anzeigen

@ -1,5 +1,5 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <jahnke.nassim@gmail.com>
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Fri, 1 Oct 2021 09:47:00 +0200
Subject: [PATCH] Fix plugin provides load order

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add missing team sidebar display slots
diff --git a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java
index 5d58a18b3625fd01ea34969200edc3bc80cbb587..fe7d0a19f970ac5b4e0c4bef4ff7c4ceae60bb86 100644
index 4959bec21d152a17fe4ca9d3f448aef482a05b5e..fe7d0a19f970ac5b4e0c4bef4ff7c4ceae60bb86 100644
--- a/src/main/java/org/bukkit/scoreboard/DisplaySlot.java
+++ b/src/main/java/org/bukkit/scoreboard/DisplaySlot.java
@@ -1,10 +1,55 @@
@@ -1,26 +1,55 @@
package org.bukkit.scoreboard;
+import net.kyori.adventure.text.format.NamedTextColor; // Paper
@ -18,7 +18,23 @@ index 5d58a18b3625fd01ea34969200edc3bc80cbb587..fe7d0a19f970ac5b4e0c4bef4ff7c4ce
public enum DisplaySlot {
- BELOW_NAME,
- PLAYER_LIST,
- SIDEBAR;
- SIDEBAR,
- SIDEBAR_BLACK,
- SIDEBAR_DARK_BLUE,
- SIDEBAR_DARK_GREEN,
- SIDEBAR_DARK_AQUA,
- SIDEBAR_DARK_RED,
- SIDEBAR_DARK_PURPLE,
- SIDEBAR_GOLD,
- SIDEBAR_GRAY,
- SIDEBAR_DARK_GRAY,
- SIDEBAR_BLUE,
- SIDEBAR_GREEN,
- SIDEBAR_AQUA,
- SIDEBAR_RED,
- SIDEBAR_LIGHT_PURPLE,
- SIDEBAR_YELLOW,
- SIDEBAR_WHITE;
+ // Paper start
+ BELOW_NAME("belowName"),
+ PLAYER_LIST("list"),

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen