mirror of
https://gitlab.com/SamB440/rpgregions-2.git
synced 2025-12-27 10:49:08 +00:00
Merge branch 'set_name_by_command' into 'master'
Added new command "setname" which allows to set the custom name with a console command. See merge request SamB440/rpgregions-2!4
This commit is contained in:
@@ -126,6 +126,20 @@ public class RPGRegionsCommand extends BaseCommand {
|
||||
plugin.getManagers().getRegionsCache().addConfiguredRegion(configuredRegion);
|
||||
}
|
||||
|
||||
@Subcommand("setname")
|
||||
@CommandPermission("rpgregions.setname")
|
||||
@CommandCompletion("@regions")
|
||||
public void onSetName(CommandSender sender, String region, String regionName) {
|
||||
Optional<ConfiguredRegion> configuredRegion = plugin.getManagers().getRegionsCache().getConfiguredRegion(region);
|
||||
if (configuredRegion.isEmpty()) {
|
||||
sender.sendMessage(StringUtils.colour("&cRegion '" + region + "' does not exist yet, create it first."));
|
||||
return;
|
||||
}
|
||||
configuredRegion.get().setCustomName(regionName);
|
||||
sender.sendMessage(StringUtils.colour("&aSet name of region '" + region + "' to: " + regionName));
|
||||
}
|
||||
|
||||
|
||||
@Subcommand("remove")
|
||||
@CommandPermission("rpgregions.remove")
|
||||
@CommandCompletion("@regions")
|
||||
|
||||
Reference in New Issue
Block a user