mirror of
https://gitlab.com/SamB440/rpgregions-2.git
synced 2026-01-06 15:41:35 +00:00
Add setting to icon commands to run via console
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package net.islandearth.rpgregions.command;
|
||||
|
||||
public record IconCommand(String command, CommandClickType clickType, int cooldown) {
|
||||
public record IconCommand(String command, CommandClickType clickType, boolean console, int cooldown) {
|
||||
|
||||
public enum CommandClickType {
|
||||
DISCOVERED,
|
||||
|
||||
@@ -302,9 +302,13 @@ public class DiscoveryGUI extends RPGRegionsGUI {
|
||||
return;
|
||||
}
|
||||
|
||||
player.performCommand(iconCommand.command()
|
||||
.replace("%region%", configuredRegion.getId())
|
||||
.replace("%player%", player.getName()));
|
||||
final String command = iconCommand.command().replace("%region%", configuredRegion.getId())
|
||||
.replace("%player%", player.getName());
|
||||
if (iconCommand.console()) {
|
||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||
} else {
|
||||
player.performCommand(command);
|
||||
}
|
||||
|
||||
if (iconCommand.cooldown() != 0) {
|
||||
account.getCooldowns().add(RPGRegionsAccount.AccountCooldown.ICON_COMMAND);
|
||||
|
||||
@@ -123,7 +123,7 @@ public class RPGRegionsManagers implements IRPGRegionsManagers {
|
||||
Collections.singletonList(new ItemStackBuilder(Material.IRON_CHESTPLATE).build())));
|
||||
|
||||
final ConfiguredRegion configuredRegion = createExampleRegion(rewards, effects);
|
||||
configuredRegion.getIconCommand().add(new IconCommand("say", IconCommand.CommandClickType.DISCOVERED, 0));
|
||||
configuredRegion.getIconCommand().add(new IconCommand("say", IconCommand.CommandClickType.DISCOVERED, false, 0));
|
||||
configuredRegion.save(plugin);
|
||||
|
||||
Stream<Path> files = Files.walk(Paths.get(folder.getPath()));
|
||||
|
||||
Reference in New Issue
Block a user