Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bukkit-post-1.13/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>BuycraftX</artifactId>
<groupId>net.buycraft</groupId>
<version>12.0.8</version>
<version>12.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bukkit-pre-1.13/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>BuycraftX</artifactId>
<groupId>net.buycraft</groupId>
<version>12.0.8</version>
<version>12.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bukkit-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>BuycraftX</artifactId>
<groupId>net.buycraft</groupId>
<version>12.0.8</version>
<version>12.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion bungeecord/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>BuycraftX</artifactId>
<groupId>net.buycraft</groupId>
<version>12.0.8</version>
<version>12.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>BuycraftX</artifactId>
<groupId>net.buycraft</groupId>
<version>12.0.8</version>
<version>12.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion nukkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>BuycraftX</artifactId>
<groupId>net.buycraft</groupId>
<version>12.0.8</version>
<version>12.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion plugin-shared/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>BuycraftX</artifactId>
<groupId>net.buycraft</groupId>
<version>12.0.8</version>
<version>12.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>net.buycraft</groupId>
<artifactId>BuycraftX</artifactId>
<packaging>pom</packaging>
<version>12.0.8</version>
<version>12.1.0</version>
<modules>
<module>common</module>
<module>bukkit-shared</module>
Expand Down
2 changes: 1 addition & 1 deletion sponge/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>BuycraftX</artifactId>
<groupId>net.buycraft</groupId>
<version>12.0.8</version>
<version>12.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
6 changes: 3 additions & 3 deletions velocity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>BuycraftX</artifactId>
<groupId>net.buycraft</groupId>
<version>12.0.8</version>
<version>12.1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -127,13 +127,13 @@
<dependency>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>de.icongmbh.oss.maven.plugins</groupId>
<artifactId>javassist-maven-plugin</artifactId>
<version>1.1.0</version>
<version>2.0.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
package net.buycraft.plugin.velocity;

import com.velocitypowered.api.command.BrigadierCommand;
import com.velocitypowered.api.command.Command;
import com.velocitypowered.api.command.CommandSource;
import com.velocitypowered.api.command.SimpleCommand;
import com.velocitypowered.api.proxy.Player;
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.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.text.format.TextDecoration;

import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;

public class BuycraftCommand implements Command {
public class BuycraftCommand implements SimpleCommand {
private final Map<String, Subcommand> subcommandMap = new LinkedHashMap<>();
private final BuycraftPlugin plugin;

public BuycraftCommand(BuycraftPlugin plugin) {
this.plugin = plugin;
}


@Override
public void execute(CommandSource sender, String[] args) {
public void execute(SimpleCommand.Invocation invocation) {
CommandSource sender = invocation.source();
String[] args = invocation.arguments();
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;
}

Expand All @@ -43,9 +51,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<String, Subcommand> 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())));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("buycraft", command, "tebex");

// Send data to Keen IO
if (serverInformation != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
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.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;

import java.io.IOException;
import java.util.Arrays;
Expand All @@ -22,7 +24,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;
}

Expand All @@ -34,7 +36,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;
}
}
Expand All @@ -45,33 +47,33 @@ 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;
}

final String code = args[1];
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));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

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.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;

public class ForceCheckSubcommand implements Subcommand {
private final BuycraftPlugin plugin;
Expand All @@ -15,22 +17,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

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.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;

public class InformationSubcommand implements Subcommand {
private final BuycraftPlugin plugin;
Expand All @@ -15,28 +17,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
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.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;

import java.io.BufferedWriter;
import java.io.IOException;
Expand All @@ -25,7 +27,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();
Expand All @@ -45,9 +47,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);
}
});
Expand Down
Loading