diff options
author | Glare <[email protected]> | 2021-12-09 22:26:24 -0600 |
---|---|---|
committer | GitHub <[email protected]> | 2021-12-10 04:26:24 +0000 |
commit | d4318a6ebca2a3f2859ca0ef1b274192633c7d5e (patch) | |
tree | bc80c926ba449e09e80d2bd900c26116f720d616 /patches/server/0809-More-CommmandBlock-API.patch | |
parent | 244b392f390afa7a4880e2207c7358fe195bd431 (diff) | |
download | Paper-d4318a6ebca2a3f2859ca0ef1b274192633c7d5e.tar.gz Paper-d4318a6ebca2a3f2859ca0ef1b274192633c7d5e.zip |
Update Log4J (#7072)
Diffstat (limited to 'patches/server/0809-More-CommmandBlock-API.patch')
-rw-r--r-- | patches/server/0809-More-CommmandBlock-API.patch | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/patches/server/0809-More-CommmandBlock-API.patch b/patches/server/0809-More-CommmandBlock-API.patch new file mode 100644 index 0000000000..f7ef8c10d6 --- /dev/null +++ b/patches/server/0809-More-CommmandBlock-API.patch @@ -0,0 +1,100 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic <[email protected]> +Date: Thu, 23 Sep 2021 10:40:09 -0700 +Subject: [PATCH] More CommmandBlock API + + +diff --git a/src/main/java/io/papermc/paper/commands/PaperCommandBlockHolder.java b/src/main/java/io/papermc/paper/commands/PaperCommandBlockHolder.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0b42306f17bf8850a13a51067c2d19e7583187e5 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/commands/PaperCommandBlockHolder.java +@@ -0,0 +1,33 @@ ++package io.papermc.paper.commands; ++ ++import io.papermc.paper.adventure.PaperAdventure; ++import io.papermc.paper.command.CommandBlockHolder; ++import net.kyori.adventure.text.Component; ++import net.minecraft.world.level.BaseCommandBlock; ++import org.jetbrains.annotations.NotNull; ++import org.jetbrains.annotations.Nullable; ++ ++public interface PaperCommandBlockHolder extends CommandBlockHolder { ++ ++ BaseCommandBlock getCommandBlockHandle(); ++ ++ @Override ++ default @NotNull Component lastOutput() { ++ return PaperAdventure.asAdventure(getCommandBlockHandle().getLastOutput()); ++ } ++ ++ @Override ++ default void lastOutput(@Nullable Component lastOutput) { ++ getCommandBlockHandle().setLastOutput(PaperAdventure.asVanilla(lastOutput)); ++ } ++ ++ @Override ++ default int getSuccessCount() { ++ return getCommandBlockHandle().getSuccessCount(); ++ } ++ ++ @Override ++ default void setSuccessCount(int successCount) { ++ getCommandBlockHandle().setSuccessCount(successCount); ++ } ++} +diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java +index 5df1e8c7277759bda57253db449907eb1185cce3..f36aa9d37facc5f1e2c6ae95f27c7020b5d0002b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java ++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCommandBlock.java +@@ -5,7 +5,7 @@ import org.bukkit.World; + import org.bukkit.block.CommandBlock; + import org.bukkit.craftbukkit.util.CraftChatMessage; + +-public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity> implements CommandBlock { ++public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity> implements CommandBlock, io.papermc.paper.commands.PaperCommandBlockHolder { + + public CraftCommandBlock(World world, CommandBlockEntity tileEntity) { + super(world, tileEntity); +@@ -41,5 +41,10 @@ public class CraftCommandBlock extends CraftBlockEntityState<CommandBlockEntity> + public void name(net.kyori.adventure.text.Component name) { + getSnapshot().getCommandBlock().setName(name == null ? new net.minecraft.network.chat.TextComponent("@") : io.papermc.paper.adventure.PaperAdventure.asVanilla(name)); + } ++ ++ @Override ++ public net.minecraft.world.level.BaseCommandBlock getCommandBlockHandle() { ++ return getSnapshot().getCommandBlock(); ++ } + // Paper end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java +index f9863e138994f6c7a7975a852f106faa96d52315..b709a1d909c189f60d0c3aa97b4b96623e7c1db0 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartCommand.java +@@ -14,7 +14,7 @@ import org.bukkit.permissions.PermissionAttachment; + import org.bukkit.permissions.PermissionAttachmentInfo; + import org.bukkit.plugin.Plugin; + +-public class CraftMinecartCommand extends CraftMinecart implements CommandMinecart { ++public class CraftMinecartCommand extends CraftMinecart implements CommandMinecart, io.papermc.paper.commands.PaperCommandBlockHolder { + private final PermissibleBase perm = new PermissibleBase(this); + + public CraftMinecartCommand(CraftServer server, MinecartCommandBlock entity) { +@@ -70,6 +70,17 @@ public class CraftMinecartCommand extends CraftMinecart implements CommandMineca + public [email protected] Component name() { + return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.getHandle().getCommandBlock().getName()); + } ++ ++ @Override ++ public net.minecraft.world.level.BaseCommandBlock getCommandBlockHandle() { ++ return getHandle().getCommandBlock(); ++ } ++ ++ @Override ++ public void lastOutput(net.kyori.adventure.text.Component lastOutput) { ++ io.papermc.paper.commands.PaperCommandBlockHolder.super.lastOutput(lastOutput); ++ getCommandBlockHandle().onUpdated(); ++ } + // Paper end + + @Override |