9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2025-12-29 11:49:08 +00:00

Add /rpgri setworld command

This commit is contained in:
SamB440
2022-11-13 14:39:26 +00:00
parent 8c887ab045
commit 5d7a736dc0
2 changed files with 17 additions and 1 deletions

View File

@@ -11,7 +11,7 @@ import java.util.UUID;
public abstract class RPGRegionsRegion {
private final String name;
private final UUID world;
private UUID world;
private final List<Location> points;
private int priority;
@@ -30,6 +30,10 @@ public abstract class RPGRegionsRegion {
return world;
}
public void setWorld(UUID world) {
this.world = world;
}
public int getPriority() {
return priority;
}

View File

@@ -119,4 +119,16 @@ public class RPGRegionsIntegrationCommand extends BaseCommand {
region.setPriority(priority);
player.sendMessage(ChatColor.GREEN + "Set priority of " + region.getName() + " to " + priority + ".");
}
@Subcommand("setworld")
@CommandCompletion("@regions @worlds")
public void onSetWorld(final CommandSender sender, final RPGRegionsRegion region, final String worldName) {
final World world = Bukkit.getWorld(worldName);
if (world == null) {
sender.sendMessage(ChatColor.RED + "That world could not be found.");
return;
}
region.setWorld(world.getUID());
sender.sendMessage(ChatColor.GREEN + "Set region '" + region.getName() + "' world to '" + world.getName() + "'.");
}
}