9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-28 11:19:24 +00:00

Fix tab complete for RPGRegionsIntegration commands

This commit is contained in:
SamB440
2023-03-19 12:56:47 +00:00
parent a437000227
commit 801a3f57c5

View File

@@ -52,7 +52,7 @@ public class RPGRegionsIntegrationCommand extends BaseCommand {
}
@Subcommand("info")
@CommandCompletion("@regions")
@CommandCompletion("@integration-regions")
public void onInfo(final CommandSender sender, final String name) {
RPGRegionsIntegration integration = (RPGRegionsIntegration) plugin.getManagers().getIntegrationManager();
Optional<RPGRegionsRegion> region = integration.getRegion(name);
@@ -74,7 +74,7 @@ public class RPGRegionsIntegrationCommand extends BaseCommand {
}
@Subcommand("create")
@CommandCompletion("@regions @region-types @worlds")
@CommandCompletion("@integration-regions @region-types @worlds")
public void onCreate(final CommandSender sender, final String name, final String regionType,
@co.aikar.commands.annotation.Optional @Nullable String worldName) {
// If worldName is null, try to get from sender if they are a player, else overworld, else worldName world
@@ -100,7 +100,7 @@ public class RPGRegionsIntegrationCommand extends BaseCommand {
}
@Subcommand("delete")
@CommandCompletion("@regions")
@CommandCompletion("@integration-regions")
public void onDelete(final CommandSender sender, final RPGRegionsRegion region) {
RPGRegionsIntegration integration = (RPGRegionsIntegration) plugin.getManagers().getIntegrationManager();
integration.removeRegion(region);
@@ -108,9 +108,14 @@ public class RPGRegionsIntegrationCommand extends BaseCommand {
}
@Subcommand("addpos")
@CommandCompletion("@regions")
public void onAddPos(final CommandSender sender, final RPGRegionsRegion region, @co.aikar.commands.annotation.Optional World world, Double x, Double y, Double z) {
if (sender instanceof Player player && world == null && x != null && y != null && z != null) {
@CommandCompletion("@integration-regions")
public void onAddPos(final CommandSender sender, final RPGRegionsRegion region,
@co.aikar.commands.annotation.Optional World world,
@co.aikar.commands.annotation.Optional Double x,
@co.aikar.commands.annotation.Optional Double y,
@co.aikar.commands.annotation.Optional Double z) {
System.out.println("world: " + world + ", x:" + x + ", y:" + y + ", z:" + z);
if (sender instanceof Player player && x == null && y == null && z == null) {
region.addPoint(player.getLocation());
player.sendMessage(ChatColor.GREEN + "Added point to " + region.getName() + ".");
} else {
@@ -126,14 +131,14 @@ public class RPGRegionsIntegrationCommand extends BaseCommand {
}
@Subcommand("setpriority")
@CommandCompletion("@regions @range:20")
@CommandCompletion("@integration-regions @range:20")
public void onSetPriority(final Player player, final RPGRegionsRegion region, final int priority) {
region.setPriority(priority);
player.sendMessage(ChatColor.GREEN + "Set priority of " + region.getName() + " to " + priority + ".");
}
@Subcommand("setworld")
@CommandCompletion("@regions @worlds")
@CommandCompletion("@integration-regions @worlds")
public void onSetWorld(final CommandSender sender, final RPGRegionsRegion region, final String worldName) {
final World world = Bukkit.getWorld(worldName);
if (world == null) {