Adventure

== AT ==
public net.minecraft.network.chat.HoverEvent$ItemStackInfo item
public net.minecraft.network.chat.HoverEvent$ItemStackInfo count
public net.minecraft.network.chat.HoverEvent$ItemStackInfo components
public net.minecraft.network.chat.contents.TranslatableContents filterAllowedArguments(Ljava/lang/Object;)Lcom/mojang/serialization/DataResult;

Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
Riley Park
2021-01-29 17:54:03 +01:00
parent b01c811c2f
commit 66779f5c86
103 changed files with 4975 additions and 392 deletions

View File

@@ -61,6 +61,18 @@ public class CraftBlockCommandSender extends ServerCommandSender implements Bloc
return this.block.getTextName();
}
// Paper start
@Override
public void sendMessage(net.kyori.adventure.identity.Identity identity, net.kyori.adventure.text.Component message, net.kyori.adventure.audience.MessageType type) {
block.source.sendSystemMessage(io.papermc.paper.adventure.PaperAdventure.asVanilla(message));
}
@Override
public net.kyori.adventure.text.Component name() {
return io.papermc.paper.adventure.PaperAdventure.asAdventure(this.block.getDisplayName());
}
// Paper end
@Override
public boolean isOp() {
return CraftBlockCommandSender.SHARED_PERM.isOp();

View File

@@ -46,6 +46,13 @@ public class CraftConsoleCommandSender extends ServerCommandSender implements Co
return "CONSOLE";
}
// Paper start
@Override
public net.kyori.adventure.text.Component name() {
return net.kyori.adventure.text.Component.text(this.getName());
}
// Paper end
@Override
public boolean isOp() {
return true;
@@ -80,4 +87,11 @@ public class CraftConsoleCommandSender extends ServerCommandSender implements Co
public boolean isConversing() {
return this.conversationTracker.isConversing();
}
// Paper start
@Override
public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) {
this.sendRawMessage(net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().serialize(message));
}
// Paper end
}

View File

@@ -39,6 +39,13 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme
return "Rcon";
}
// Paper start
@Override
public net.kyori.adventure.text.Component name() {
return net.kyori.adventure.text.Component.text(this.getName());
}
// Paper end
@Override
public boolean isOp() {
return true;

View File

@@ -67,6 +67,13 @@ public class ProxiedNativeCommandSender implements ProxiedCommandSender {
return this.getCallee().getName();
}
// Paper start
@Override
public net.kyori.adventure.text.Component name() {
return this.getCallee().name();
}
// Paper end
@Override
public boolean isPermissionSet(String name) {
return this.getCaller().isPermissionSet(name);

View File

@@ -13,6 +13,7 @@ import org.bukkit.plugin.Plugin;
public abstract class ServerCommandSender implements CommandSender {
private final PermissibleBase perm;
private net.kyori.adventure.pointer.Pointers adventure$pointers; // Paper - implement pointers
protected ServerCommandSender() {
this.perm = new PermissibleBase(this);
@@ -130,4 +131,18 @@ public abstract class ServerCommandSender implements CommandSender {
return this.spigot;
}
// Spigot end
// Paper start - implement pointers
@Override
public net.kyori.adventure.pointer.Pointers pointers() {
if (this.adventure$pointers == null) {
this.adventure$pointers = net.kyori.adventure.pointer.Pointers.builder()
.withDynamic(net.kyori.adventure.identity.Identity.DISPLAY_NAME, this::name)
.withStatic(net.kyori.adventure.permission.PermissionChecker.POINTER, this::permissionValue)
.build();
}
return this.adventure$pointers;
}
// Paper end
}