diff --git a/cloud-minecraft/README.md b/cloud-minecraft/README.md index efafd233..a09bd218 100644 --- a/cloud-minecraft/README.md +++ b/cloud-minecraft/README.md @@ -8,6 +8,7 @@ This directory hosts Minecraft specific implementations of cloud. Their features | `cloud-paper` | Bukkit, Spigot, Paper | 1.8+ | Via Paper for MC 1.15+, Via commodore for MC 1.13+ | | `cloud-bungee` | BungeeCord | 1.8+ | No | | `cloud-velocity` | Velocity 1.1.0 | 1.7+ | Yes | +| `cloud-cloudburst` | CloudBurst 1.0.0 | Bedrock 1.16.20+ | No | ## cloud-bukkit Bukkit mappings for cloud. If `commodore` is present on the classpath and the server is running at least version 1.13+, Brigadier mappings will be available. diff --git a/cloud-minecraft/cloud-cloudburst-test/pom.xml b/cloud-minecraft/cloud-cloudburst-test/pom.xml new file mode 100644 index 00000000..2b411179 --- /dev/null +++ b/cloud-minecraft/cloud-cloudburst-test/pom.xml @@ -0,0 +1,92 @@ + + + + + + cloud + com.intellectualsites + 1.0-SNAPSHOT + ../../pom.xml + + + 4.0.0 + cloud-cloudburst-test + 0.2.0-SNAPSHOT + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.2.4 + + + package + + shade + + + false + + + + + + + + + + nukkit-repo + https://repo.nukkitx.com/maven-snapshots + + + jitpack + https://jitpack.io + + + + + + com.intellectualsites + cloud-cloudburst + 0.2.0-SNAPSHOT + + + com.intellectualsites + cloud-annotations + 0.2.0-SNAPSHOT + + + org.cloudburstmc + cloudburst-server + 1.0.0-SNAPSHOT + provided + + + diff --git a/cloud-minecraft/cloud-cloudburst-test/src/main/java/com/intellectualsites/commands/cloudburst/CloudCloudburstTest.java b/cloud-minecraft/cloud-cloudburst-test/src/main/java/com/intellectualsites/commands/cloudburst/CloudCloudburstTest.java new file mode 100644 index 00000000..298acbd1 --- /dev/null +++ b/cloud-minecraft/cloud-cloudburst-test/src/main/java/com/intellectualsites/commands/cloudburst/CloudCloudburstTest.java @@ -0,0 +1,73 @@ +// +// MIT License +// +// Copyright (c) 2020 Alexander Söderberg +// +// 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 com.intellectualsites.commands.cloudburst; + +import com.intellectualsites.commands.annotations.AnnotationParser; +import com.intellectualsites.commands.annotations.Argument; +import com.intellectualsites.commands.annotations.CommandMethod; +import com.intellectualsites.commands.annotations.specifier.Range; +import com.intellectualsites.commands.execution.CommandExecutionCoordinator; +import com.intellectualsites.commands.meta.SimpleCommandMeta; +import org.cloudburstmc.server.command.CommandSender; +import org.cloudburstmc.server.plugin.PluginBase; +import org.cloudburstmc.server.utils.TextFormat; + +import javax.annotation.Nonnull; +import java.util.function.Function; + +/** + * Cloudburst test plugin + */ +public final class CloudCloudburstTest extends PluginBase { + + @Override + public void onLoad() { + setEnabled(true); + } + + @Override + public void onEnable() { + final CloudburstCommandManager cloudburstCommandManager = new CloudburstCommandManager<>( + this, + CommandExecutionCoordinator.simpleCoordinator(), + Function.identity(), + Function.identity() + ); + final AnnotationParser annotationParser = new AnnotationParser<>(cloudburstCommandManager, + CommandSender.class, + p -> SimpleCommandMeta.empty()); + annotationParser.parse(this); + } + + @CommandMethod("test [str]") + private void testCommand(@Nonnull @Argument(value = "str", defaultValue = "potato") final String string, + @Nonnull final CommandSender source, + @Argument("num") @Range(min = "10", max = "33") final int num) { + source.sendMessage(TextFormat.RED + "You said: " + + TextFormat.GOLD + string + + TextFormat.RED + " & " + + TextFormat.GOLD + num); + } + +} diff --git a/cloud-minecraft/cloud-cloudburst-test/src/main/java/com/intellectualsites/commands/cloudburst/package-info.java b/cloud-minecraft/cloud-cloudburst-test/src/main/java/com/intellectualsites/commands/cloudburst/package-info.java new file mode 100644 index 00000000..cfc51c7f --- /dev/null +++ b/cloud-minecraft/cloud-cloudburst-test/src/main/java/com/intellectualsites/commands/cloudburst/package-info.java @@ -0,0 +1,28 @@ +// +// MIT License +// +// Copyright (c) 2020 Alexander Söderberg +// +// 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. +// + +/** + * Cloudburst test plugin + */ +package com.intellectualsites.commands.cloudburst; diff --git a/cloud-minecraft/cloud-cloudburst-test/src/main/resources/plugin.yml b/cloud-minecraft/cloud-cloudburst-test/src/main/resources/plugin.yml new file mode 100644 index 00000000..30a5cfd6 --- /dev/null +++ b/cloud-minecraft/cloud-cloudburst-test/src/main/resources/plugin.yml @@ -0,0 +1,5 @@ +name: CloudTest +main: com.intellectualsites.commands.cloudburst.CloudCloudburstTest +version: 0.2.0-SNAPSHOT +load: POSTWORLD +api: ["2.0.0"] diff --git a/cloud-minecraft/cloud-cloudburst/pom.xml b/cloud-minecraft/cloud-cloudburst/pom.xml index 6e8b236e..c90fec39 100644 --- a/cloud-minecraft/cloud-cloudburst/pom.xml +++ b/cloud-minecraft/cloud-cloudburst/pom.xml @@ -54,7 +54,7 @@ org.cloudburstmc cloudburst-server - 0.0.1-SNAPSHOT + 1.0.0-SNAPSHOT provided diff --git a/cloud-minecraft/cloud-cloudburst/src/main/java/com/intellectualsites/commands/cloudburst/CloudburstCommand.java b/cloud-minecraft/cloud-cloudburst/src/main/java/com/intellectualsites/commands/cloudburst/CloudburstCommand.java index 602a4d2b..8f5b29ae 100644 --- a/cloud-minecraft/cloud-cloudburst/src/main/java/com/intellectualsites/commands/cloudburst/CloudburstCommand.java +++ b/cloud-minecraft/cloud-cloudburst/src/main/java/com/intellectualsites/commands/cloudburst/CloudburstCommand.java @@ -32,13 +32,13 @@ import com.intellectualsites.commands.exceptions.NoSuchCommandException; import org.cloudburstmc.server.command.CommandSender; import org.cloudburstmc.server.command.PluginCommand; import org.cloudburstmc.server.command.data.CommandData; -import org.cloudburstmc.server.plugin.PluginContainer; +import org.cloudburstmc.server.plugin.Plugin; import javax.annotation.Nonnull; import java.util.List; import java.util.concurrent.CompletionException; -final class CloudburstCommand extends PluginCommand { +final class CloudburstCommand extends PluginCommand { private static final String MESSAGE_NO_PERMS = "I'm sorry, but you do not have permission to perform this command. " @@ -54,7 +54,7 @@ final class CloudburstCommand extends PluginCommand { @Nonnull final com.intellectualsites.commands.Command cloudCommand, @Nonnull final CommandArgument command, @Nonnull final CloudburstCommandManager manager) { - super(manager.getOwningPlugin(), null, CommandData.builder(label) + super(manager.getOwningPlugin(), CommandData.builder(label) .addAliases(aliases.toArray(new String[0])) .addPermission(cloudCommand.getCommandPermission()) .setDescription(cloudCommand.getCommandMeta().getOrDefault("description", "")) diff --git a/cloud-minecraft/cloud-cloudburst/src/main/java/com/intellectualsites/commands/cloudburst/CloudburstCommandManager.java b/cloud-minecraft/cloud-cloudburst/src/main/java/com/intellectualsites/commands/cloudburst/CloudburstCommandManager.java index 62844d2f..d048854e 100644 --- a/cloud-minecraft/cloud-cloudburst/src/main/java/com/intellectualsites/commands/cloudburst/CloudburstCommandManager.java +++ b/cloud-minecraft/cloud-cloudburst/src/main/java/com/intellectualsites/commands/cloudburst/CloudburstCommandManager.java @@ -29,7 +29,7 @@ import com.intellectualsites.commands.execution.CommandExecutionCoordinator; import com.intellectualsites.commands.meta.CommandMeta; import com.intellectualsites.commands.meta.SimpleCommandMeta; import org.cloudburstmc.server.command.CommandSender; -import org.cloudburstmc.server.plugin.PluginContainer; +import org.cloudburstmc.server.plugin.Plugin; import javax.annotation.Nonnull; import java.util.function.Function; @@ -44,7 +44,7 @@ public class CloudburstCommandManager extends CommandManager { private final Function commandSenderMapper; private final Function backwardsCommandSenderMapper; - private final PluginContainer owningPlugin; + private final Plugin owningPlugin; /** * Construct a new Cloudburst command manager @@ -53,13 +53,12 @@ public class CloudburstCommandManager extends CommandManager { * @param commandExecutionCoordinator Coordinator provider * @param commandSenderMapper Function that maps {@link CommandSender} to the command sender type * @param backwardsCommandSenderMapper Function that maps the command sender type to {@link CommandSender} - * @throws Exception If the construction of the manager fails */ - public CloudburstCommandManager(@Nonnull final PluginContainer owningPlugin, + public CloudburstCommandManager(@Nonnull final Plugin owningPlugin, @Nonnull final Function, CommandExecutionCoordinator> commandExecutionCoordinator, @Nonnull final Function commandSenderMapper, - @Nonnull final Function backwardsCommandSenderMapper) throws Exception { + @Nonnull final Function backwardsCommandSenderMapper) { super(commandExecutionCoordinator, new CloudburstPluginRegistrationHandler<>()); ((CloudburstPluginRegistrationHandler) this.getCommandRegistrationHandler()).initialize(this); this.commandSenderMapper = commandSenderMapper; @@ -90,7 +89,7 @@ public class CloudburstCommandManager extends CommandManager { * @return Owning plugin */ @Nonnull - public final PluginContainer getOwningPlugin() { + public final Plugin getOwningPlugin() { return this.owningPlugin; } diff --git a/cloud-minecraft/cloud-cloudburst/src/main/java/com/intellectualsites/commands/cloudburst/CloudburstPluginRegistrationHandler.java b/cloud-minecraft/cloud-cloudburst/src/main/java/com/intellectualsites/commands/cloudburst/CloudburstPluginRegistrationHandler.java index 0d998802..25c1f4ab 100644 --- a/cloud-minecraft/cloud-cloudburst/src/main/java/com/intellectualsites/commands/cloudburst/CloudburstPluginRegistrationHandler.java +++ b/cloud-minecraft/cloud-cloudburst/src/main/java/com/intellectualsites/commands/cloudburst/CloudburstPluginRegistrationHandler.java @@ -28,7 +28,7 @@ import com.intellectualsites.commands.arguments.CommandArgument; import com.intellectualsites.commands.arguments.StaticArgument; import com.intellectualsites.commands.internal.CommandRegistrationHandler; import org.cloudburstmc.server.Server; -import org.cloudburstmc.server.plugin.PluginContainer; +import org.cloudburstmc.server.plugin.Plugin; import javax.annotation.Nonnull; import java.util.HashMap; @@ -54,7 +54,7 @@ class CloudburstPluginRegistrationHandler implements CommandRegistrationHandl if (this.registeredCommands.containsKey(commandArgument)) { return false; } - final PluginContainer plugin = this.cloudburstCommandManager.getOwningPlugin(); + final Plugin plugin = this.cloudburstCommandManager.getOwningPlugin(); final CloudburstCommand cloudburstCommand = new CloudburstCommand<>( commandArgument.getName(), ((StaticArgument) commandArgument).getAlternativeAliases(), diff --git a/pom.xml b/pom.xml index 23ebf88e..525d80a4 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,7 @@ cloud-minecraft/cloud-velocity cloud-minecraft/cloud-minecraft-extras cloud-minecraft/cloud-cloudburst + cloud-minecraft/cloud-cloudburst-test pom 2020