Paper/nms-patches/CommandBlockListenerAbstract.patch

50 lines
2.0 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/CommandBlockListenerAbstract.java
+++ b/net/minecraft/server/CommandBlockListenerAbstract.java
2018-07-15 02:00:00 +02:00
@@ -5,6 +5,7 @@
import java.text.SimpleDateFormat;
import java.util.Date;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
2017-06-26 00:27:25 +02:00
+import org.bukkit.command.CommandSender;
2018-07-15 02:00:00 +02:00
public abstract class CommandBlockListenerAbstract implements ICommandListener {
2018-07-15 02:00:00 +02:00
@@ -16,6 +17,10 @@
private IChatBaseComponent f;
2017-05-14 04:00:00 +02:00
private String g = "";
2018-07-15 02:00:00 +02:00
private IChatBaseComponent h = new ChatComponentText("@");
+ // CraftBukkit start
+ @Override
+ public abstract CommandSender getBukkitSender(CommandListenerWrapper wrapper);
+ // CraftBukkit end
public CommandBlockListenerAbstract() {}
2018-07-15 02:00:00 +02:00
@@ -103,14 +108,7 @@
2018-08-26 04:00:00 +02:00
if (minecraftserver != null && minecraftserver.D() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.g)) {
2017-05-14 04:00:00 +02:00
try {
this.f = null;
2018-07-15 02:00:00 +02:00
- CommandListenerWrapper commandlistenerwrapper = this.getWrapper().a((commandcontext, flag, i) -> {
- if (flag) {
- ++this.d;
- }
-
- });
-
- minecraftserver.getCommandDispatcher().a(commandlistenerwrapper, this.g);
+ this.d = minecraftserver.getCommandDispatcher().dispatchServerCommand(this.getWrapper(), this.g); // CraftBukkit
2017-05-14 04:00:00 +02:00
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Executing command block");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed");
2018-07-16 08:20:46 +02:00
@@ -141,6 +139,11 @@
}
public void setName(IChatBaseComponent ichatbasecomponent) {
+ // CraftBukkit start
+ if (ichatbasecomponent == null) {
+ ichatbasecomponent = new ChatComponentText("@");
+ }
+ // CraftBukkit end
this.h = ichatbasecomponent;
}