From b77c2f160178cb50b05538d33efc633aa1e095bc Mon Sep 17 00:00:00 2001 From: broccoli Date: Sat, 3 Aug 2024 16:33:09 +0100 Subject: [PATCH 1/3] feat(paper): add a provided sender mapper modern paper manager requires the use of CommandSourceStack which doesn't have built in ways to require a Player or Console sender. this adds a built-in way for common behaviour. --- .../cloud/paper/sender/ConsoleSender.java | 42 ++++++++++++ .../cloud/paper/sender/GenericSender.java | 51 ++++++++++++++ .../sender/ModernProvidedSenderMapper.java | 67 +++++++++++++++++++ .../cloud/paper/sender/PlayerSender.java | 41 ++++++++++++ .../incendo/cloud/paper/sender/Sender.java | 46 +++++++++++++ .../cloud/paper/sender/package-info.java | 4 ++ .../cloud/examples/paper/PaperPlugin.java | 7 +- .../cloud/examples/paper/PluginBootstrap.java | 31 +++++++-- 8 files changed, 280 insertions(+), 9 deletions(-) create mode 100644 cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ConsoleSender.java create mode 100644 cloud-paper/src/main/java/org/incendo/cloud/paper/sender/GenericSender.java create mode 100644 cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ModernProvidedSenderMapper.java create mode 100644 cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PlayerSender.java create mode 100644 cloud-paper/src/main/java/org/incendo/cloud/paper/sender/Sender.java create mode 100644 cloud-paper/src/main/java/org/incendo/cloud/paper/sender/package-info.java diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ConsoleSender.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ConsoleSender.java new file mode 100644 index 00000000..1e0cc645 --- /dev/null +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ConsoleSender.java @@ -0,0 +1,42 @@ +// +// MIT License +// +// Copyright (c) 2024 Incendo +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package org.incendo.cloud.paper.sender; + +import io.papermc.paper.command.brigadier.CommandSourceStack; +import org.bukkit.command.ConsoleCommandSender; +import org.checkerframework.checker.nullness.qual.NonNull; + +@SuppressWarnings("UnstableApiUsage") +public final class ConsoleSender extends GenericSender { + + ConsoleSender(final CommandSourceStack commandSourceStack) { + super(commandSourceStack); + } + + @Override + public @NonNull ConsoleCommandSender sender() { + return (ConsoleCommandSender) super.sender(); + } + +} diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/GenericSender.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/GenericSender.java new file mode 100644 index 00000000..49f2ec5c --- /dev/null +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/GenericSender.java @@ -0,0 +1,51 @@ +// +// MIT License +// +// Copyright (c) 2024 Incendo +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package org.incendo.cloud.paper.sender; + +import io.papermc.paper.command.brigadier.CommandSourceStack; +import org.bukkit.command.CommandSender; +import org.checkerframework.checker.nullness.qual.NonNull; + +@SuppressWarnings("UnstableApiUsage") +public class GenericSender implements Sender { + + private final CommandSourceStack commandSourceStack; + + GenericSender(final @NonNull CommandSourceStack commandSourceStack) { + this.commandSourceStack = commandSourceStack; + } + + @Override + public final @NonNull CommandSourceStack commandSourceStack() { + return this.commandSourceStack; + } + + /** + * @see Sender#sender() + */ + @Override + public @NonNull CommandSender sender() { + return this.commandSourceStack.getSender(); + } +} diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ModernProvidedSenderMapper.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ModernProvidedSenderMapper.java new file mode 100644 index 00000000..230266cd --- /dev/null +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ModernProvidedSenderMapper.java @@ -0,0 +1,67 @@ +// +// MIT License +// +// Copyright (c) 2024 Incendo +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package org.incendo.cloud.paper.sender; + +import io.papermc.paper.command.brigadier.CommandSourceStack; +import org.bukkit.command.CommandSender; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.incendo.cloud.SenderMapper; + +@SuppressWarnings("UnstableApiUsage") +public final class ModernProvidedSenderMapper implements SenderMapper { + + /** + * Create a new instance of {@link ModernProvidedSenderMapper}. + * + * @return a new instance of {@link ModernProvidedSenderMapper} + */ + public static @NonNull ModernProvidedSenderMapper providedSenderMapper() { + return new ModernProvidedSenderMapper(); + } + + ModernProvidedSenderMapper() { + } + + @Override + public @NonNull Sender map(final @NonNull CommandSourceStack base) { + CommandSender commandSender = base.getSender(); + + if (commandSender instanceof ConsoleCommandSender) { + return new ConsoleSender(base); + } + + if (commandSender instanceof Player) { + return new PlayerSender(base); + } + + return new GenericSender(base); + } + + @Override + public @NonNull CommandSourceStack reverse(final @NonNull Sender mapped) { + return mapped.commandSourceStack(); + } +} diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PlayerSender.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PlayerSender.java new file mode 100644 index 00000000..e7e55ef8 --- /dev/null +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PlayerSender.java @@ -0,0 +1,41 @@ +// +// MIT License +// +// Copyright (c) 2024 Incendo +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package org.incendo.cloud.paper.sender; + +import io.papermc.paper.command.brigadier.CommandSourceStack; +import org.bukkit.entity.Player; +import org.checkerframework.checker.nullness.qual.NonNull; + +@SuppressWarnings("UnstableApiUsage") +public final class PlayerSender extends GenericSender { + + PlayerSender(final CommandSourceStack commandSourceStack) { + super(commandSourceStack); + } + + @Override + public @NonNull Player sender() { + return (Player) super.sender(); + } +} diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/Sender.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/Sender.java new file mode 100644 index 00000000..74ee64a7 --- /dev/null +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/Sender.java @@ -0,0 +1,46 @@ +// +// MIT License +// +// Copyright (c) 2024 Incendo +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package org.incendo.cloud.paper.sender; + +import io.papermc.paper.command.brigadier.CommandSourceStack; +import org.bukkit.command.CommandSender; +import org.checkerframework.checker.nullness.qual.NonNull; + +@SuppressWarnings("UnstableApiUsage") +public interface Sender { + + /** + * Gets the command source stack. + * + * @return the command source stack + */ + @NonNull CommandSourceStack commandSourceStack(); + + /** + * Gets the underlying command sender from the command source stack. + * + * @return the sender. + */ + @NonNull CommandSender sender(); +} diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/package-info.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/package-info.java new file mode 100644 index 00000000..a37709aa --- /dev/null +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/package-info.java @@ -0,0 +1,4 @@ +/** + * Built in CommandSender mappings for Modern Paper. + */ +package org.incendo.cloud.paper.sender; diff --git a/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PaperPlugin.java b/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PaperPlugin.java index 3ac7fe68..b78010fb 100644 --- a/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PaperPlugin.java +++ b/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PaperPlugin.java @@ -23,18 +23,17 @@ // package org.incendo.cloud.examples.paper; -import io.papermc.paper.command.brigadier.CommandSourceStack; import org.bukkit.plugin.java.JavaPlugin; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.framework.qual.DefaultQualifier; import org.incendo.cloud.paper.PaperCommandManager; +import org.incendo.cloud.paper.sender.Sender; -@SuppressWarnings("UnstableApiUsage") @DefaultQualifier(NonNull.class) public final class PaperPlugin extends JavaPlugin { - private final PaperCommandManager.Bootstrapped commandManager; + private final PaperCommandManager.Bootstrapped commandManager; - public PaperPlugin(final PaperCommandManager.Bootstrapped commandManager) { + public PaperPlugin(final PaperCommandManager.Bootstrapped commandManager) { this.commandManager = commandManager; } diff --git a/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PluginBootstrap.java b/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PluginBootstrap.java index 53b0634e..def123a6 100644 --- a/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PluginBootstrap.java +++ b/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PluginBootstrap.java @@ -23,15 +23,20 @@ // package org.incendo.cloud.examples.paper; -import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.plugin.bootstrap.BootstrapContext; import io.papermc.paper.plugin.bootstrap.PluginProviderContext; +import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.framework.qual.DefaultQualifier; import org.incendo.cloud.execution.ExecutionCoordinator; import org.incendo.cloud.paper.PaperCommandManager; +import org.incendo.cloud.paper.sender.ConsoleSender; +import org.incendo.cloud.paper.sender.ModernProvidedSenderMapper; +import org.incendo.cloud.paper.sender.PlayerSender; +import org.incendo.cloud.paper.sender.Sender; import org.incendo.cloud.setting.ManagerSetting; import static org.incendo.cloud.parser.standard.StringParser.stringParser; @@ -39,12 +44,12 @@ @SuppressWarnings("UnstableApiUsage") @DefaultQualifier(NonNull.class) public final class PluginBootstrap implements io.papermc.paper.plugin.bootstrap.PluginBootstrap { - private PaperCommandManager.@MonotonicNonNull Bootstrapped commandManager; + private PaperCommandManager.@MonotonicNonNull Bootstrapped commandManager; @Override public void bootstrap(final BootstrapContext context) { - final PaperCommandManager.Bootstrapped mgr = - PaperCommandManager.builder() + final PaperCommandManager.Bootstrapped mgr = + PaperCommandManager.builder(ModernProvidedSenderMapper.providedSenderMapper()) .executionCoordinator(ExecutionCoordinator.simpleCoordinator()) .buildBootstrapped(context); @@ -58,7 +63,7 @@ public void bootstrap(final BootstrapContext context) { final String name = ctx.get("name"); mgr.command( mgr.commandBuilder(name).handler(ctx1 -> { - ctx1.sender().getSender().sendMessage("HI"); + ctx1.sender().sender().sendMessage("HI"); }) ); }) @@ -71,6 +76,22 @@ public void bootstrap(final BootstrapContext context) { mgr.deleteRootCommand(name); }) ); + mgr.command( + mgr.commandBuilder("player_command") + .senderType(PlayerSender.class) + .handler(ctx -> { + final Player player = ctx.sender().sender(); + player.sendMessage("hello player!"); + }) + ); + mgr.command( + mgr.commandBuilder("console_command") + .senderType(ConsoleSender.class) + .handler(ctx -> { + final ConsoleCommandSender console = ctx.sender().sender(); + console.sendMessage("hello console!"); + }) + ); } @Override From b1ee8d1c548fd8bbff99f94a2502b32bdb5f6e7c Mon Sep 17 00:00:00 2001 From: broccoli Date: Sat, 3 Aug 2024 20:15:44 +0100 Subject: [PATCH 2/3] feat(paper): add EntitySource and rename *Sender types to *Source --- ...{ConsoleSender.java => ConsoleSource.java} | 8 ++-- .../cloud/paper/sender/EntitySource.java | 41 +++++++++++++++++++ ...{GenericSender.java => GenericSource.java} | 18 +++++--- ...pper.java => PaperSimpleSenderMapper.java} | 29 +++++++------ .../{PlayerSender.java => PlayerSource.java} | 8 ++-- .../paper/sender/{Sender.java => Source.java} | 14 +++++-- .../cloud/examples/paper/PaperPlugin.java | 6 +-- .../cloud/examples/paper/PluginBootstrap.java | 24 +++++------ 8 files changed, 105 insertions(+), 43 deletions(-) rename cloud-paper/src/main/java/org/incendo/cloud/paper/sender/{ConsoleSender.java => ConsoleSource.java} (86%) create mode 100644 cloud-paper/src/main/java/org/incendo/cloud/paper/sender/EntitySource.java rename cloud-paper/src/main/java/org/incendo/cloud/paper/sender/{GenericSender.java => GenericSource.java} (75%) rename cloud-paper/src/main/java/org/incendo/cloud/paper/sender/{ModernProvidedSenderMapper.java => PaperSimpleSenderMapper.java} (68%) rename cloud-paper/src/main/java/org/incendo/cloud/paper/sender/{PlayerSender.java => PlayerSource.java} (87%) rename cloud-paper/src/main/java/org/incendo/cloud/paper/sender/{Sender.java => Source.java} (85%) diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ConsoleSender.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ConsoleSource.java similarity index 86% rename from cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ConsoleSender.java rename to cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ConsoleSource.java index 1e0cc645..e64a95ae 100644 --- a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ConsoleSender.java +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ConsoleSource.java @@ -28,15 +28,15 @@ import org.checkerframework.checker.nullness.qual.NonNull; @SuppressWarnings("UnstableApiUsage") -public final class ConsoleSender extends GenericSender { +public final class ConsoleSource extends GenericSource { - ConsoleSender(final CommandSourceStack commandSourceStack) { + ConsoleSource(final CommandSourceStack commandSourceStack) { super(commandSourceStack); } @Override - public @NonNull ConsoleCommandSender sender() { - return (ConsoleCommandSender) super.sender(); + public @NonNull ConsoleCommandSender source() { + return (ConsoleCommandSender) super.source(); } } diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/EntitySource.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/EntitySource.java new file mode 100644 index 00000000..5db5d641 --- /dev/null +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/EntitySource.java @@ -0,0 +1,41 @@ +// +// MIT License +// +// Copyright (c) 2024 Incendo +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +// +package org.incendo.cloud.paper.sender; + +import io.papermc.paper.command.brigadier.CommandSourceStack; +import org.bukkit.entity.Entity; +import org.checkerframework.checker.nullness.qual.NonNull; + +@SuppressWarnings("UnstableApiUsage") +public final class EntitySource extends GenericSource { + + EntitySource(final CommandSourceStack commandSourceStack) { + super(commandSourceStack); + } + + @Override + public @NonNull Entity source() { + return (Entity) super.source(); + } +} diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/GenericSender.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/GenericSource.java similarity index 75% rename from cloud-paper/src/main/java/org/incendo/cloud/paper/sender/GenericSender.java rename to cloud-paper/src/main/java/org/incendo/cloud/paper/sender/GenericSource.java index 49f2ec5c..bb5d39c1 100644 --- a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/GenericSender.java +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/GenericSource.java @@ -24,28 +24,36 @@ package org.incendo.cloud.paper.sender; import io.papermc.paper.command.brigadier.CommandSourceStack; +import net.kyori.adventure.audience.Audience; import org.bukkit.command.CommandSender; +import org.bukkit.entity.Entity; import org.checkerframework.checker.nullness.qual.NonNull; @SuppressWarnings("UnstableApiUsage") -public class GenericSender implements Sender { +public class GenericSource implements Source { private final CommandSourceStack commandSourceStack; - GenericSender(final @NonNull CommandSourceStack commandSourceStack) { + GenericSource(final @NonNull CommandSourceStack commandSourceStack) { this.commandSourceStack = commandSourceStack; } @Override - public final @NonNull CommandSourceStack commandSourceStack() { + public final @NonNull CommandSourceStack stack() { return this.commandSourceStack; } /** - * @see Sender#sender() + * @see Source#source() */ @Override - public @NonNull CommandSender sender() { + public @NonNull CommandSender source() { return this.commandSourceStack.getSender(); } + + @Override + public final @NonNull Audience audience() { + Entity executor = this.commandSourceStack.getExecutor(); + return executor == null ? this.commandSourceStack.getSender() : executor; + } } diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ModernProvidedSenderMapper.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PaperSimpleSenderMapper.java similarity index 68% rename from cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ModernProvidedSenderMapper.java rename to cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PaperSimpleSenderMapper.java index 230266cd..89241d84 100644 --- a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ModernProvidedSenderMapper.java +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PaperSimpleSenderMapper.java @@ -26,42 +26,47 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; +import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.checkerframework.checker.nullness.qual.NonNull; import org.incendo.cloud.SenderMapper; @SuppressWarnings("UnstableApiUsage") -public final class ModernProvidedSenderMapper implements SenderMapper { +public final class PaperSimpleSenderMapper implements SenderMapper { /** - * Create a new instance of {@link ModernProvidedSenderMapper}. + * Create a new instance of {@link PaperSimpleSenderMapper}. * - * @return a new instance of {@link ModernProvidedSenderMapper} + * @return a new instance of {@link PaperSimpleSenderMapper} */ - public static @NonNull ModernProvidedSenderMapper providedSenderMapper() { - return new ModernProvidedSenderMapper(); + public static @NonNull PaperSimpleSenderMapper simpleSenderMapper() { + return new PaperSimpleSenderMapper(); } - ModernProvidedSenderMapper() { + PaperSimpleSenderMapper() { } @Override - public @NonNull Sender map(final @NonNull CommandSourceStack base) { + public @NonNull Source map(final @NonNull CommandSourceStack base) { CommandSender commandSender = base.getSender(); if (commandSender instanceof ConsoleCommandSender) { - return new ConsoleSender(base); + return new ConsoleSource(base); } if (commandSender instanceof Player) { - return new PlayerSender(base); + return new PlayerSource(base); } - return new GenericSender(base); + if (commandSender instanceof Entity) { + return new EntitySource(base); + } + + return new GenericSource(base); } @Override - public @NonNull CommandSourceStack reverse(final @NonNull Sender mapped) { - return mapped.commandSourceStack(); + public @NonNull CommandSourceStack reverse(final @NonNull Source mapped) { + return mapped.stack(); } } diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PlayerSender.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PlayerSource.java similarity index 87% rename from cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PlayerSender.java rename to cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PlayerSource.java index e7e55ef8..c2ba6e72 100644 --- a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PlayerSender.java +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PlayerSource.java @@ -28,14 +28,14 @@ import org.checkerframework.checker.nullness.qual.NonNull; @SuppressWarnings("UnstableApiUsage") -public final class PlayerSender extends GenericSender { +public final class PlayerSource extends GenericSource { - PlayerSender(final CommandSourceStack commandSourceStack) { + PlayerSource(final CommandSourceStack commandSourceStack) { super(commandSourceStack); } @Override - public @NonNull Player sender() { - return (Player) super.sender(); + public @NonNull Player source() { + return (Player) super.source(); } } diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/Sender.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/Source.java similarity index 85% rename from cloud-paper/src/main/java/org/incendo/cloud/paper/sender/Sender.java rename to cloud-paper/src/main/java/org/incendo/cloud/paper/sender/Source.java index 74ee64a7..408e8f96 100644 --- a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/Sender.java +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/Source.java @@ -24,23 +24,31 @@ package org.incendo.cloud.paper.sender; import io.papermc.paper.command.brigadier.CommandSourceStack; +import net.kyori.adventure.audience.Audience; import org.bukkit.command.CommandSender; import org.checkerframework.checker.nullness.qual.NonNull; @SuppressWarnings("UnstableApiUsage") -public interface Sender { +public interface Source { /** * Gets the command source stack. * * @return the command source stack */ - @NonNull CommandSourceStack commandSourceStack(); + @NonNull CommandSourceStack stack(); /** * Gets the underlying command sender from the command source stack. * * @return the sender. */ - @NonNull CommandSender sender(); + @NonNull CommandSender source(); + + /** + * Gets the audience of the source. + * + * @return the audience + */ + @NonNull Audience audience(); } diff --git a/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PaperPlugin.java b/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PaperPlugin.java index b78010fb..69bb9792 100644 --- a/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PaperPlugin.java +++ b/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PaperPlugin.java @@ -27,13 +27,13 @@ import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.framework.qual.DefaultQualifier; import org.incendo.cloud.paper.PaperCommandManager; -import org.incendo.cloud.paper.sender.Sender; +import org.incendo.cloud.paper.sender.Source; @DefaultQualifier(NonNull.class) public final class PaperPlugin extends JavaPlugin { - private final PaperCommandManager.Bootstrapped commandManager; + private final PaperCommandManager.Bootstrapped commandManager; - public PaperPlugin(final PaperCommandManager.Bootstrapped commandManager) { + public PaperPlugin(final PaperCommandManager.Bootstrapped commandManager) { this.commandManager = commandManager; } diff --git a/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PluginBootstrap.java b/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PluginBootstrap.java index def123a6..e09a05c6 100644 --- a/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PluginBootstrap.java +++ b/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PluginBootstrap.java @@ -33,10 +33,10 @@ import org.checkerframework.framework.qual.DefaultQualifier; import org.incendo.cloud.execution.ExecutionCoordinator; import org.incendo.cloud.paper.PaperCommandManager; -import org.incendo.cloud.paper.sender.ConsoleSender; -import org.incendo.cloud.paper.sender.ModernProvidedSenderMapper; -import org.incendo.cloud.paper.sender.PlayerSender; -import org.incendo.cloud.paper.sender.Sender; +import org.incendo.cloud.paper.sender.ConsoleSource; +import org.incendo.cloud.paper.sender.PaperSimpleSenderMapper; +import org.incendo.cloud.paper.sender.PlayerSource; +import org.incendo.cloud.paper.sender.Source; import org.incendo.cloud.setting.ManagerSetting; import static org.incendo.cloud.parser.standard.StringParser.stringParser; @@ -44,12 +44,12 @@ @SuppressWarnings("UnstableApiUsage") @DefaultQualifier(NonNull.class) public final class PluginBootstrap implements io.papermc.paper.plugin.bootstrap.PluginBootstrap { - private PaperCommandManager.@MonotonicNonNull Bootstrapped commandManager; + private PaperCommandManager.@MonotonicNonNull Bootstrapped commandManager; @Override public void bootstrap(final BootstrapContext context) { - final PaperCommandManager.Bootstrapped mgr = - PaperCommandManager.builder(ModernProvidedSenderMapper.providedSenderMapper()) + final PaperCommandManager.Bootstrapped mgr = + PaperCommandManager.builder(PaperSimpleSenderMapper.simpleSenderMapper()) .executionCoordinator(ExecutionCoordinator.simpleCoordinator()) .buildBootstrapped(context); @@ -63,7 +63,7 @@ public void bootstrap(final BootstrapContext context) { final String name = ctx.get("name"); mgr.command( mgr.commandBuilder(name).handler(ctx1 -> { - ctx1.sender().sender().sendMessage("HI"); + ctx1.sender().source().sendMessage("HI"); }) ); }) @@ -78,17 +78,17 @@ public void bootstrap(final BootstrapContext context) { ); mgr.command( mgr.commandBuilder("player_command") - .senderType(PlayerSender.class) + .senderType(PlayerSource.class) .handler(ctx -> { - final Player player = ctx.sender().sender(); + final Player player = ctx.sender().source(); player.sendMessage("hello player!"); }) ); mgr.command( mgr.commandBuilder("console_command") - .senderType(ConsoleSender.class) + .senderType(ConsoleSource.class) .handler(ctx -> { - final ConsoleCommandSender console = ctx.sender().sender(); + final ConsoleCommandSender console = ctx.sender().source(); console.sendMessage("hello console!"); }) ); From 75f14e2fcb2d020229fff7950ef400b6dabba041 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Sat, 3 Aug 2024 13:52:15 -0700 Subject: [PATCH 3/3] cleanup and javadoc --- .../cloud/paper/sender/package-info.java | 4 ---- .../{ => util}/sender/ConsoleSource.java | 6 ++++- .../paper/{ => util}/sender/EntitySource.java | 13 +++++++++-- .../{ => util}/sender/GenericSource.java | 16 ++++--------- .../sender/PaperSimpleSenderMapper.java | 14 ++++++++++- .../paper/{ => util}/sender/PlayerSource.java | 8 +++++-- .../cloud/paper/{ => util}/sender/Source.java | 23 +++++++++---------- .../cloud/paper/util/sender/package-info.java | 5 ++++ .../cloud/examples/paper/PaperPlugin.java | 2 +- .../cloud/examples/paper/PluginBootstrap.java | 8 +++---- 10 files changed, 61 insertions(+), 38 deletions(-) delete mode 100644 cloud-paper/src/main/java/org/incendo/cloud/paper/sender/package-info.java rename cloud-paper/src/main/java/org/incendo/cloud/paper/{ => util}/sender/ConsoleSource.java (89%) rename cloud-paper/src/main/java/org/incendo/cloud/paper/{ => util}/sender/EntitySource.java (83%) rename cloud-paper/src/main/java/org/incendo/cloud/paper/{ => util}/sender/GenericSource.java (81%) rename cloud-paper/src/main/java/org/incendo/cloud/paper/{ => util}/sender/PaperSimpleSenderMapper.java (74%) rename cloud-paper/src/main/java/org/incendo/cloud/paper/{ => util}/sender/PlayerSource.java (86%) rename cloud-paper/src/main/java/org/incendo/cloud/paper/{ => util}/sender/Source.java (78%) create mode 100644 cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/package-info.java diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/package-info.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/package-info.java deleted file mode 100644 index a37709aa..00000000 --- a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Built in CommandSender mappings for Modern Paper. - */ -package org.incendo.cloud.paper.sender; diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ConsoleSource.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/ConsoleSource.java similarity index 89% rename from cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ConsoleSource.java rename to cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/ConsoleSource.java index e64a95ae..ebafe437 100644 --- a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/ConsoleSource.java +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/ConsoleSource.java @@ -21,12 +21,16 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // -package org.incendo.cloud.paper.sender; +package org.incendo.cloud.paper.util.sender; import io.papermc.paper.command.brigadier.CommandSourceStack; import org.bukkit.command.ConsoleCommandSender; import org.checkerframework.checker.nullness.qual.NonNull; +/** + * Specialized variant of {@link Source}, for when the {@link CommandSourceStack#getSender() sender} is a + * {@link ConsoleCommandSender}. + */ @SuppressWarnings("UnstableApiUsage") public final class ConsoleSource extends GenericSource { diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/EntitySource.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/EntitySource.java similarity index 83% rename from cloud-paper/src/main/java/org/incendo/cloud/paper/sender/EntitySource.java rename to cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/EntitySource.java index 5db5d641..16f04305 100644 --- a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/EntitySource.java +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/EntitySource.java @@ -21,19 +21,28 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // -package org.incendo.cloud.paper.sender; +package org.incendo.cloud.paper.util.sender; import io.papermc.paper.command.brigadier.CommandSourceStack; import org.bukkit.entity.Entity; import org.checkerframework.checker.nullness.qual.NonNull; +/** + * Specialized variant of {@link Source}, for when the {@link CommandSourceStack#getSender() sender} is + * an {@link Entity}. + */ @SuppressWarnings("UnstableApiUsage") -public final class EntitySource extends GenericSource { +public class EntitySource extends GenericSource { EntitySource(final CommandSourceStack commandSourceStack) { super(commandSourceStack); } + /** + * {@inheritDoc} + * + * @return the source + */ @Override public @NonNull Entity source() { return (Entity) super.source(); diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/GenericSource.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/GenericSource.java similarity index 81% rename from cloud-paper/src/main/java/org/incendo/cloud/paper/sender/GenericSource.java rename to cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/GenericSource.java index bb5d39c1..221a8637 100644 --- a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/GenericSource.java +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/GenericSource.java @@ -21,16 +21,14 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // -package org.incendo.cloud.paper.sender; +package org.incendo.cloud.paper.util.sender; import io.papermc.paper.command.brigadier.CommandSourceStack; -import net.kyori.adventure.audience.Audience; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Entity; import org.checkerframework.checker.nullness.qual.NonNull; @SuppressWarnings("UnstableApiUsage") -public class GenericSource implements Source { +class GenericSource implements Source { private final CommandSourceStack commandSourceStack; @@ -44,16 +42,12 @@ public class GenericSource implements Source { } /** - * @see Source#source() + * {@inheritDoc} + * + * @return the source */ @Override public @NonNull CommandSender source() { return this.commandSourceStack.getSender(); } - - @Override - public final @NonNull Audience audience() { - Entity executor = this.commandSourceStack.getExecutor(); - return executor == null ? this.commandSourceStack.getSender() : executor; - } } diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PaperSimpleSenderMapper.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/PaperSimpleSenderMapper.java similarity index 74% rename from cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PaperSimpleSenderMapper.java rename to cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/PaperSimpleSenderMapper.java index 89241d84..455ecd53 100644 --- a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PaperSimpleSenderMapper.java +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/PaperSimpleSenderMapper.java @@ -21,7 +21,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // -package org.incendo.cloud.paper.sender; +package org.incendo.cloud.paper.util.sender; import io.papermc.paper.command.brigadier.CommandSourceStack; import org.bukkit.command.CommandSender; @@ -29,8 +29,20 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.checkerframework.checker.nullness.qual.NonNull; +import org.incendo.cloud.Command; import org.incendo.cloud.SenderMapper; +import org.incendo.cloud.paper.PaperCommandManager; +/** + * A simple {@link SenderMapper} implementation designed for use with {@link PaperCommandManager}. + * Allows for easily utilizing cloud's {@link Command.Builder#senderType(Class)} utilities despite the + * single {@link CommandSourceStack} implementation provided by Paper/Minecraft. + * + *

The {@link #map(CommandSourceStack)} implementation performs type dispatch based on the {@link CommandSourceStack#getSender() sender}, + * for example it will create a {@link PlayerSource} when {@link CommandSourceStack#getSender()} is a {@link Player}, and similar for + * {@link ConsoleSource} and {@link EntitySource}. Any other specific sender types do not currently have special handling + * and will fall back to a generic {@link Source} implementation.

+ */ @SuppressWarnings("UnstableApiUsage") public final class PaperSimpleSenderMapper implements SenderMapper { diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PlayerSource.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/PlayerSource.java similarity index 86% rename from cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PlayerSource.java rename to cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/PlayerSource.java index c2ba6e72..793177c0 100644 --- a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/PlayerSource.java +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/PlayerSource.java @@ -21,14 +21,18 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // -package org.incendo.cloud.paper.sender; +package org.incendo.cloud.paper.util.sender; import io.papermc.paper.command.brigadier.CommandSourceStack; import org.bukkit.entity.Player; import org.checkerframework.checker.nullness.qual.NonNull; +/** + * Specialized variant of {@link Source}, for when the {@link CommandSourceStack#getSender() sender} is a + * {@link Player}. + */ @SuppressWarnings("UnstableApiUsage") -public final class PlayerSource extends GenericSource { +public final class PlayerSource extends EntitySource { PlayerSource(final CommandSourceStack commandSourceStack) { super(commandSourceStack); diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/Source.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/Source.java similarity index 78% rename from cloud-paper/src/main/java/org/incendo/cloud/paper/sender/Source.java rename to cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/Source.java index 408e8f96..8ab0b9f8 100644 --- a/cloud-paper/src/main/java/org/incendo/cloud/paper/sender/Source.java +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/Source.java @@ -21,34 +21,33 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // -package org.incendo.cloud.paper.sender; +package org.incendo.cloud.paper.util.sender; import io.papermc.paper.command.brigadier.CommandSourceStack; -import net.kyori.adventure.audience.Audience; import org.bukkit.command.CommandSender; import org.checkerframework.checker.nullness.qual.NonNull; +/** + * A simple wrapper around {@link CommandSourceStack}. + * + * @see PaperSimpleSenderMapper + */ @SuppressWarnings("UnstableApiUsage") public interface Source { /** - * Gets the command source stack. + * Gets the {@link CommandSourceStack}. * * @return the command source stack */ @NonNull CommandSourceStack stack(); /** - * Gets the underlying command sender from the command source stack. + * Gets the underlying {@link CommandSourceStack#getSender() sender} from the {@link #stack() source stack}. * - * @return the sender. - */ - @NonNull CommandSender source(); - - /** - * Gets the audience of the source. + *

Specific implementations may override this method with a more specific return type.

* - * @return the audience + * @return the source */ - @NonNull Audience audience(); + @NonNull CommandSender source(); } diff --git a/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/package-info.java b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/package-info.java new file mode 100644 index 00000000..63401c7e --- /dev/null +++ b/cloud-paper/src/main/java/org/incendo/cloud/paper/util/sender/package-info.java @@ -0,0 +1,5 @@ +/** + * Built in command sender {@link org.incendo.cloud.paper.util.sender.Source types} and + * {@link org.incendo.cloud.paper.util.sender.PaperSimpleSenderMapper mappings} for modern Paper. + */ +package org.incendo.cloud.paper.util.sender; diff --git a/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PaperPlugin.java b/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PaperPlugin.java index 69bb9792..e2061c3b 100644 --- a/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PaperPlugin.java +++ b/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PaperPlugin.java @@ -27,7 +27,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.framework.qual.DefaultQualifier; import org.incendo.cloud.paper.PaperCommandManager; -import org.incendo.cloud.paper.sender.Source; +import org.incendo.cloud.paper.util.sender.Source; @DefaultQualifier(NonNull.class) public final class PaperPlugin extends JavaPlugin { diff --git a/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PluginBootstrap.java b/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PluginBootstrap.java index e09a05c6..175ab573 100644 --- a/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PluginBootstrap.java +++ b/examples/example-paper/src/main/java/org/incendo/cloud/examples/paper/PluginBootstrap.java @@ -33,10 +33,10 @@ import org.checkerframework.framework.qual.DefaultQualifier; import org.incendo.cloud.execution.ExecutionCoordinator; import org.incendo.cloud.paper.PaperCommandManager; -import org.incendo.cloud.paper.sender.ConsoleSource; -import org.incendo.cloud.paper.sender.PaperSimpleSenderMapper; -import org.incendo.cloud.paper.sender.PlayerSource; -import org.incendo.cloud.paper.sender.Source; +import org.incendo.cloud.paper.util.sender.ConsoleSource; +import org.incendo.cloud.paper.util.sender.PaperSimpleSenderMapper; +import org.incendo.cloud.paper.util.sender.PlayerSource; +import org.incendo.cloud.paper.util.sender.Source; import org.incendo.cloud.setting.ManagerSetting; import static org.incendo.cloud.parser.standard.StringParser.stringParser;