From 10eccf3493265cb85f90b559a7444c87ad506fb0 Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Mon, 19 Jul 2021 09:05:11 +0100 Subject: [PATCH 01/12] Bug fixes to support Velocity 3.0.0 - Changed imports to adventure - Changed TextComponent.of to Component.text - Changed TextColor to NamedTextColor --- .../buycraft/plugin/velocity/BuycraftCommand.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftCommand.java b/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftCommand.java index cfb3e749..227456ca 100644 --- a/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftCommand.java +++ b/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftCommand.java @@ -3,9 +3,9 @@ import com.velocitypowered.api.command.Command; import com.velocitypowered.api.command.CommandSource; import net.buycraft.plugin.velocity.command.Subcommand; -import net.kyori.text.TextComponent; -import net.kyori.text.format.TextColor; -import net.kyori.text.format.TextDecoration; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.format.TextDecoration; import java.util.Arrays; import java.util.LinkedHashMap; @@ -22,7 +22,7 @@ public BuycraftCommand(BuycraftPlugin plugin) { @Override public void execute(CommandSource sender, String[] args) { if (!sender.hasPermission("buycraft.admin")) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("no_permission")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("no_permission")).color(NamedTextColor.RED)); return; } @@ -43,9 +43,9 @@ public void execute(CommandSource sender, String[] args) { } private void showHelp(CommandSource sender) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("usage")).color(TextColor.DARK_AQUA).decoration(TextDecoration.BOLD, true)); + sender.sendMessage(Component.text(plugin.getI18n().get("usage")).color(NamedTextColor.DARK_AQUA).decoration(TextDecoration.BOLD, true)); for (Map.Entry entry : subcommandMap.entrySet()) { - sender.sendMessage(TextComponent.of("/tebex " + entry.getKey()).color(TextColor.GREEN).append(TextComponent.of(": " + entry.getValue().getDescription()))); + sender.sendMessage(Component.text("/tebex " + entry.getKey()).color(NamedTextColor.GREEN).append(Component.text(": " + entry.getValue().getDescription()))); } } From 40db12735d58369a6c908b53a320cdf5076ddce7 Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Mon, 19 Jul 2021 09:09:26 +0100 Subject: [PATCH 02/12] Bug fix for Velocity 3.0.0 support - Changed imports to adventure - Changed previous TextComponent.of to Component.text - Changed TextColor to NamedTextColor --- .../net/buycraft/plugin/velocity/util/VersionCheck.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/velocity/src/main/java/net/buycraft/plugin/velocity/util/VersionCheck.java b/velocity/src/main/java/net/buycraft/plugin/velocity/util/VersionCheck.java index 6a98ed6d..bfc9bfea 100644 --- a/velocity/src/main/java/net/buycraft/plugin/velocity/util/VersionCheck.java +++ b/velocity/src/main/java/net/buycraft/plugin/velocity/util/VersionCheck.java @@ -5,8 +5,8 @@ import net.buycraft.plugin.data.responses.Version; import net.buycraft.plugin.shared.util.VersionUtil; import net.buycraft.plugin.velocity.BuycraftPlugin; -import net.kyori.text.TextComponent; -import net.kyori.text.format.TextColor; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; import java.io.IOException; import java.util.concurrent.TimeUnit; @@ -50,7 +50,7 @@ public void verify() throws IOException { public void onPlayerJoin(final PostLoginEvent event) { if (event.getPlayer().hasPermission("buycraft.admin") && !upToDate) { plugin.getPlatform().executeAsyncLater(() -> - event.getPlayer().sendMessage(TextComponent.of(plugin.getI18n().get("update_available", lastKnownVersion.getVersion())).color(TextColor.YELLOW)), 3, TimeUnit.SECONDS); + event.getPlayer().sendMessage(Component.text(plugin.getI18n().get("update_available", lastKnownVersion.getVersion())).color(NamedTextColor.YELLOW)), 3, TimeUnit.SECONDS); } } From 9d90436589f95aab52f00ebf704eb549884a9e15 Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Mon, 19 Jul 2021 09:12:44 +0100 Subject: [PATCH 03/12] Bug fixing for Velocity 3.0.0 support - Changed imports to adventure - Changed previous TextComponent.of to Component.text - Changed TextColor to NamedTextColor --- .../velocity/command/SecretSubcommand.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/velocity/src/main/java/net/buycraft/plugin/velocity/command/SecretSubcommand.java b/velocity/src/main/java/net/buycraft/plugin/velocity/command/SecretSubcommand.java index f27c8572..01358e98 100644 --- a/velocity/src/main/java/net/buycraft/plugin/velocity/command/SecretSubcommand.java +++ b/velocity/src/main/java/net/buycraft/plugin/velocity/command/SecretSubcommand.java @@ -4,8 +4,8 @@ import net.buycraft.plugin.BuyCraftAPI; import net.buycraft.plugin.data.responses.ServerInformation; import net.buycraft.plugin.velocity.BuycraftPlugin; -import net.kyori.text.TextComponent; -import net.kyori.text.format.TextColor; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; import java.io.IOException; import java.util.logging.Level; @@ -20,12 +20,12 @@ public SecretSubcommand(final BuycraftPlugin plugin) { @Override public void execute(final CommandSource sender, final String[] args) { if (!sender.equals(plugin.getServer().getConsoleCommandSource())) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("secret_console_only")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("secret_console_only")).color(NamedTextColor.RED)); return; } if (args.length != 1) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("secret_need_key")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("secret_need_key")).color(NamedTextColor.RED)); return; } @@ -35,7 +35,7 @@ public void execute(final CommandSource sender, final String[] args) { plugin.updateInformation(client); } catch (IOException e) { plugin.getLogger().error("Unable to verify secret", e); - sender.sendMessage(TextComponent.of(plugin.getI18n().get("secret_does_not_work")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("secret_does_not_work")).color(NamedTextColor.RED)); return; } @@ -45,11 +45,11 @@ public void execute(final CommandSource sender, final String[] args) { try { plugin.saveConfiguration(); } catch (IOException e) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("secret_cant_be_saved")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("secret_cant_be_saved")).color(NamedTextColor.RED)); } - sender.sendMessage(TextComponent.of(plugin.getI18n().get("secret_success", - information.getServer().getName(), information.getAccount().getName())).color(TextColor.GREEN)); + sender.sendMessage(Component.text(plugin.getI18n().get("secret_success", + information.getServer().getName(), information.getAccount().getName())).color(NamedTextColor.GREEN)); plugin.getPlatform().executeAsync(plugin.getDuePlayerFetcher()); }); } From 9e5bb13f2e059770282e0a59cd6124728042ea76 Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Mon, 19 Jul 2021 09:14:54 +0100 Subject: [PATCH 04/12] Bug fixing for Velocity 3.0.0 support - Changed imports to adventure - Changed previous TextComponent.of to Component.text - Changed TextColor to NamedTextColor --- .../plugin/velocity/command/ReportCommand.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/velocity/src/main/java/net/buycraft/plugin/velocity/command/ReportCommand.java b/velocity/src/main/java/net/buycraft/plugin/velocity/command/ReportCommand.java index 852a7d51..8b964a5f 100644 --- a/velocity/src/main/java/net/buycraft/plugin/velocity/command/ReportCommand.java +++ b/velocity/src/main/java/net/buycraft/plugin/velocity/command/ReportCommand.java @@ -3,8 +3,8 @@ import com.velocitypowered.api.command.CommandSource; import net.buycraft.plugin.shared.util.ReportBuilder; import net.buycraft.plugin.velocity.BuycraftPlugin; -import net.kyori.text.TextComponent; -import net.kyori.text.format.TextColor; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; import java.io.BufferedWriter; import java.io.IOException; @@ -25,7 +25,7 @@ public ReportCommand(BuycraftPlugin plugin) { @Override public void execute(final CommandSource sender, String[] args) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("report_wait")).color(TextColor.YELLOW)); + sender.sendMessage(Component.text(plugin.getI18n().get("report_wait")).color(NamedTextColor.YELLOW)); plugin.getPlatform().executeAsync(() -> { InetSocketAddress listener = plugin.getServer().getBoundAddress(); @@ -45,9 +45,9 @@ public void execute(final CommandSource sender, String[] args) { String generated = builder.generate(); try (BufferedWriter w = Files.newBufferedWriter(p, StandardCharsets.UTF_8, StandardOpenOption.CREATE_NEW)) { w.write(generated); - sender.sendMessage(TextComponent.of(plugin.getI18n().get("report_saved", p.toAbsolutePath().toString())).color(TextColor.YELLOW)); + sender.sendMessage(Component.text(plugin.getI18n().get("report_saved", p.toAbsolutePath().toString())).color(NamedTextColor.YELLOW)); } catch (IOException e) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("report_cant_save")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("report_cant_save")).color(NamedTextColor.RED)); plugin.getLogger().info(generated); } }); From fa7a5fac250b94ef5180fbad5062a11f1dfef888 Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Mon, 19 Jul 2021 09:17:24 +0100 Subject: [PATCH 05/12] Bug fixing for Velocity 3.0.0 - Changed imports to adventure - Changed previous TextComponent.of to Component.text - Changed TextColor to NamedTextColor --- .../command/InformationSubcommand.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/velocity/src/main/java/net/buycraft/plugin/velocity/command/InformationSubcommand.java b/velocity/src/main/java/net/buycraft/plugin/velocity/command/InformationSubcommand.java index 955f3f85..a803a298 100644 --- a/velocity/src/main/java/net/buycraft/plugin/velocity/command/InformationSubcommand.java +++ b/velocity/src/main/java/net/buycraft/plugin/velocity/command/InformationSubcommand.java @@ -2,8 +2,8 @@ import com.velocitypowered.api.command.CommandSource; import net.buycraft.plugin.velocity.BuycraftPlugin; -import net.kyori.text.TextComponent; -import net.kyori.text.format.TextColor; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; public class InformationSubcommand implements Subcommand { private final BuycraftPlugin plugin; @@ -15,28 +15,28 @@ public InformationSubcommand(final BuycraftPlugin plugin) { @Override public void execute(CommandSource sender, String[] args) { if (args.length != 0) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("no_params")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("no_params")).color(NamedTextColor.RED)); return; } if (plugin.getApiClient() == null) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("need_secret_key")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("need_secret_key")).color(NamedTextColor.RED)); return; } if (plugin.getServerInformation() == null) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("information_no_server")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("information_no_server")).color(NamedTextColor.RED)); return; } - sender.sendMessage(TextComponent.of(plugin.getI18n().get("information_title")).color(TextColor.GRAY)); - sender.sendMessage(TextComponent.of(plugin.getI18n().get("information_server", + sender.sendMessage(Component.text(plugin.getI18n().get("information_title")).color(NamedTextColor.GRAY)); + sender.sendMessage(Component.text(plugin.getI18n().get("information_server", plugin.getServerInformation().getServer().getName(), - plugin.getServerInformation().getAccount().getName())).color(TextColor.GRAY)); - sender.sendMessage(TextComponent.of(plugin.getI18n().get("information_currency", - plugin.getServerInformation().getAccount().getCurrency().getIso4217())).color(TextColor.GRAY)); - sender.sendMessage(TextComponent.of(plugin.getI18n().get("information_domain", - plugin.getServerInformation().getAccount().getDomain())).color(TextColor.GRAY)); + plugin.getServerInformation().getAccount().getName())).color(NamedTextColor.GRAY)); + sender.sendMessage(Component.text(plugin.getI18n().get("information_currency", + plugin.getServerInformation().getAccount().getCurrency().getIso4217())).color(NamedTextColor.GRAY)); + sender.sendMessage(Component.text(plugin.getI18n().get("information_domain", + plugin.getServerInformation().getAccount().getDomain())).color(NamedTextColor.GRAY)); } @Override From 76620d331ff73353e0c0f7fecf7c356f60ddf390 Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Mon, 19 Jul 2021 09:19:50 +0100 Subject: [PATCH 06/12] Bug fixing for Velocity 3.0.0 - Changed imports to adventure - Changed previous TextComponent.of to Component.text - Changed TextColor to NamedTextColor --- .../velocity/command/ForceCheckSubcommand.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/velocity/src/main/java/net/buycraft/plugin/velocity/command/ForceCheckSubcommand.java b/velocity/src/main/java/net/buycraft/plugin/velocity/command/ForceCheckSubcommand.java index c3117c32..f2bdc0a8 100644 --- a/velocity/src/main/java/net/buycraft/plugin/velocity/command/ForceCheckSubcommand.java +++ b/velocity/src/main/java/net/buycraft/plugin/velocity/command/ForceCheckSubcommand.java @@ -2,8 +2,8 @@ import com.velocitypowered.api.command.CommandSource; import net.buycraft.plugin.velocity.BuycraftPlugin; -import net.kyori.text.TextComponent; -import net.kyori.text.format.TextColor; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; public class ForceCheckSubcommand implements Subcommand { private final BuycraftPlugin plugin; @@ -15,22 +15,22 @@ public ForceCheckSubcommand(final BuycraftPlugin plugin) { @Override public void execute(CommandSource sender, String[] args) { if (args.length != 0) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("no_params")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("no_params")).color(NamedTextColor.RED)); return; } if (plugin.getApiClient() == null) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("need_secret_key")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("need_secret_key")).color(NamedTextColor.RED)); return; } if (plugin.getDuePlayerFetcher().inProgress()) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("already_checking_for_purchases")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("already_checking_for_purchases")).color(NamedTextColor.RED)); return; } plugin.getPlatform().executeAsync(() -> plugin.getDuePlayerFetcher().run(false)); - sender.sendMessage(TextComponent.of(plugin.getI18n().get("forcecheck_queued")).color(TextColor.GREEN)); + sender.sendMessage(Component.text(plugin.getI18n().get("forcecheck_queued")).color(NamedTextColor.GREEN)); } @Override From ea12dcca87615ee4bd80fe5a0df66f640cae8bd0 Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Mon, 19 Jul 2021 09:22:15 +0100 Subject: [PATCH 07/12] Bug fixing for Velocity 3.0.0 - Changed imports to adventure - Changed previous TextComponent.of to Component.text - Changed TextColor to NamedTextColor --- .../velocity/command/CouponSubcommand.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/velocity/src/main/java/net/buycraft/plugin/velocity/command/CouponSubcommand.java b/velocity/src/main/java/net/buycraft/plugin/velocity/command/CouponSubcommand.java index 578c6fba..263eb1fb 100644 --- a/velocity/src/main/java/net/buycraft/plugin/velocity/command/CouponSubcommand.java +++ b/velocity/src/main/java/net/buycraft/plugin/velocity/command/CouponSubcommand.java @@ -4,8 +4,8 @@ import net.buycraft.plugin.data.Coupon; import net.buycraft.plugin.shared.util.CouponUtil; import net.buycraft.plugin.velocity.BuycraftPlugin; -import net.kyori.text.TextComponent; -import net.kyori.text.format.TextColor; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.format.NamedTextColor; import java.io.IOException; import java.util.Arrays; @@ -22,7 +22,7 @@ public CouponSubcommand(final BuycraftPlugin plugin) { @Override public void execute(CommandSource sender, String[] args) { if (args.length == 0) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("usage_coupon_subcommands")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("usage_coupon_subcommands")).color(NamedTextColor.RED)); return; } @@ -34,7 +34,7 @@ public void execute(CommandSource sender, String[] args) { deleteCoupon(sender, args); break; default: - sender.sendMessage(TextComponent.of(plugin.getI18n().get("usage_coupon_subcommands")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("usage_coupon_subcommands")).color(NamedTextColor.RED)); break; } } @@ -45,23 +45,23 @@ private void createCoupon(final CommandSource sender, String[] args) { try { coupon = CouponUtil.parseArguments(stripped); } catch (Exception e) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("coupon_creation_arg_parse_failure", e.getMessage())).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("coupon_creation_arg_parse_failure", e.getMessage())).color(NamedTextColor.RED)); return; } plugin.getPlatform().executeAsync(() -> { try { plugin.getApiClient().createCoupon(coupon).execute().body(); - sender.sendMessage(TextComponent.of(plugin.getI18n().get("coupon_creation_success", coupon.getCode())).color(TextColor.GREEN)); + sender.sendMessage(Component.text(plugin.getI18n().get("coupon_creation_success", coupon.getCode())).color(NamedTextColor.GREEN)); } catch (IOException e) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("generic_api_operation_error")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("generic_api_operation_error")).color(NamedTextColor.RED)); } }); } private void deleteCoupon(final CommandSource sender, String[] args) { if (args.length != 2) { - sender.sendMessage(TextComponent.of(plugin.getI18n().get("no_coupon_specified")).color(TextColor.RED)); + sender.sendMessage(Component.text(plugin.getI18n().get("no_coupon_specified")).color(NamedTextColor.RED)); return; } @@ -69,9 +69,9 @@ private void deleteCoupon(final CommandSource sender, String[] args) { plugin.getPlatform().executeAsync(() -> { try { plugin.getApiClient().deleteCoupon(code).execute().body(); - sender.sendMessage(TextComponent.of(plugin.getI18n().get("coupon_deleted")).color(TextColor.GREEN)); + sender.sendMessage(Component.text(plugin.getI18n().get("coupon_deleted")).color(NamedTextColor.GREEN)); } catch (IOException e) { - sender.sendMessage(TextComponent.of(e.getMessage()).color(TextColor.RED)); + sender.sendMessage(Component.text(e.getMessage()).color(NamedTextColor.RED)); } }); } From bed6b3450cfb9e8b8e0758e880ca148cb8eb66ad Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Mon, 19 Jul 2021 09:45:08 +0100 Subject: [PATCH 08/12] Bump Velocity version to 3.0.0 --- velocity/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/velocity/pom.xml b/velocity/pom.xml index fc3ee991..2e846465 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -127,7 +127,7 @@ com.velocitypowered velocity-api - 1.0.0-SNAPSHOT + 3.0.0 provided @@ -138,4 +138,4 @@ - \ No newline at end of file + From 3d2485c01cb11090aea86ce936dc55c405378ac1 Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Wed, 21 Jul 2021 15:14:21 +0100 Subject: [PATCH 09/12] Change from Command to SimpleCommand --- .../java/net/buycraft/plugin/velocity/BuycraftCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftCommand.java b/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftCommand.java index 227456ca..216ef5a4 100644 --- a/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftCommand.java +++ b/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftCommand.java @@ -1,6 +1,6 @@ package net.buycraft.plugin.velocity; -import com.velocitypowered.api.command.Command; +import com.velocitypowered.api.command.SimpleCommand; import com.velocitypowered.api.command.CommandSource; import net.buycraft.plugin.velocity.command.Subcommand; import net.kyori.adventure.text.Component; @@ -11,7 +11,7 @@ import java.util.LinkedHashMap; import java.util.Map; -public class BuycraftCommand implements Command { +public class BuycraftCommand implements SimpleCommand { private final Map subcommandMap = new LinkedHashMap<>(); private final BuycraftPlugin plugin; From 80e2a096bbc54df771f42951b2f3a51b4df88dde Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Wed, 21 Jul 2021 15:17:00 +0100 Subject: [PATCH 10/12] Change old execute function params to Invocation Added additional variables to work around old code --- .../net/buycraft/plugin/velocity/BuycraftCommand.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftCommand.java b/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftCommand.java index 216ef5a4..9e71adf6 100644 --- a/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftCommand.java +++ b/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftCommand.java @@ -20,12 +20,17 @@ public BuycraftCommand(BuycraftPlugin plugin) { } @Override - public void execute(CommandSource sender, String[] args) { + public void execute(Invocation invocation) { + + CommandSource sender = invocation.source(); + if (!sender.hasPermission("buycraft.admin")) { sender.sendMessage(Component.text(plugin.getI18n().get("no_permission")).color(NamedTextColor.RED)); return; } - + + String[] args = invocation.arguments(); + if (args.length == 0) { showHelp(sender); return; From e606675b063c30762a3d6a928728ae38c6489958 Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Wed, 21 Jul 2021 15:23:01 +0100 Subject: [PATCH 11/12] Command registration change with Velocity 3.0.0 --- .../main/java/net/buycraft/plugin/velocity/BuycraftPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftPlugin.java b/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftPlugin.java index 56c1d943..26da582b 100644 --- a/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftPlugin.java +++ b/velocity/src/main/java/net/buycraft/plugin/velocity/BuycraftPlugin.java @@ -187,7 +187,7 @@ public void onEnable(ProxyInitializeEvent event) { command.getSubcommandMap().put("info", new InformationSubcommand(this)); command.getSubcommandMap().put("report", new ReportCommand(this)); command.getSubcommandMap().put("coupon", new CouponSubcommand(this)); - getServer().getCommandManager().register(command, "tebex", "buycraft"); + getServer().getCommandManager().register("tebex", command, "buycraft"); // Send data to Keen IO if (serverInformation != null) { From 4e35ccfb06221efb6cdcae6637eb919dd7e0f67d Mon Sep 17 00:00:00 2001 From: Ben Foster Date: Wed, 21 Jul 2021 15:24:08 +0100 Subject: [PATCH 12/12] Command dispatch change to async --- .../net/buycraft/plugin/velocity/VelocityBuycraftPlatform.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/velocity/src/main/java/net/buycraft/plugin/velocity/VelocityBuycraftPlatform.java b/velocity/src/main/java/net/buycraft/plugin/velocity/VelocityBuycraftPlatform.java index 9a9a1096..6abf5993 100644 --- a/velocity/src/main/java/net/buycraft/plugin/velocity/VelocityBuycraftPlatform.java +++ b/velocity/src/main/java/net/buycraft/plugin/velocity/VelocityBuycraftPlatform.java @@ -45,7 +45,7 @@ public PlaceholderManager getPlaceholderManager() { @Override public void dispatchCommand(String command) { - plugin.getServer().getCommandManager().execute(plugin.getServer().getConsoleCommandSource(), command); + plugin.getServer().getCommandManager().executeAsync(plugin.getServer().getConsoleCommandSource(), command); } @Override