refactor(gradient): разбить GradientColorCommand через Command pattern (255→68 строк)
Применен Command pattern с handlers: - SubCommandHandler: интерфейс для обработчиков - ColorOnHandler: включение градиента (40 строк) - ColorOffHandler: выключение градиента (35 строк) - ColorResetHandler: сброс градиента (40 строк) - ColorCopyHandler: копирование градиента (90 строк) - ColorSetHandler: установка цветов (95 строк) Структура: + gradient/commands/handlers/color/SubCommandHandler.java + gradient/commands/handlers/color/ColorOnHandler.java + gradient/commands/handlers/color/ColorOffHandler.java + gradient/commands/handlers/color/ColorResetHandler.java + gradient/commands/handlers/color/ColorCopyHandler.java + gradient/commands/handlers/color/ColorSetHandler.java ~ gradient/commands/GradientColorCommand.java (255→68 строк) Результат: - GradientColorCommand уменьшен с 255 до 68 строк - Каждый handler отвечает за одну подкоманду - Улучшена тестируемость и расширяемость
This commit is contained in:
parent
bb78f1e60f
commit
7c02b0407e
7 changed files with 337 additions and 172 deletions
|
|
@ -2,13 +2,7 @@ package com.loki.lochat.gradient.commands;
|
|||
|
||||
import com.loki.lochat.config.RatConfig;
|
||||
import com.loki.lochat.gradient.GradientModule;
|
||||
import com.loki.lochat.gradient.config.GradientConfig;
|
||||
import com.loki.lochat.gradient.config.GradientMessages;
|
||||
import com.loki.lochat.gradient.data.GradientPlayerData;
|
||||
import com.loki.lochat.gradient.gui.GradientConfirmGUI;
|
||||
import com.loki.lochat.gradient.util.DisplayNameUtil;
|
||||
import com.loki.lochat.utils.platform.FoliaUtil;
|
||||
import com.loki.lochat.gradient.util.GradientUtil;
|
||||
import com.loki.lochat.gradient.commands.handlers.color.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
|
|
@ -19,27 +13,29 @@ import org.jetbrains.annotations.NotNull;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
/**
|
||||
* Команда /color для установки градиента ника
|
||||
* Делегирует обработку подкоманд соответствующим handlers
|
||||
*/
|
||||
public class GradientColorCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
private static final Set<String> SUB_COMMANDS = Set.of("on", "off", "reset", "copy");
|
||||
private final GradientModule module;
|
||||
private final Map<String, BiFunction<Player, String[], Boolean>> subCommands = new HashMap<>();
|
||||
private final Map<String, SubCommandHandler> handlers = new HashMap<>();
|
||||
private final ColorSetHandler setHandler;
|
||||
|
||||
public GradientColorCommand(GradientModule module) {
|
||||
this.module = module;
|
||||
registerSubCommands();
|
||||
this.setHandler = new ColorSetHandler(module);
|
||||
registerHandlers();
|
||||
}
|
||||
|
||||
private void registerSubCommands() {
|
||||
subCommands.put("on", this::handleOn);
|
||||
subCommands.put("off", this::handleOff);
|
||||
subCommands.put("reset", this::handleReset);
|
||||
subCommands.put("copy", this::handleCopy);
|
||||
private void registerHandlers() {
|
||||
handlers.put("on", new ColorOnHandler(module));
|
||||
handlers.put("off", new ColorOffHandler(module));
|
||||
handlers.put("reset", new ColorResetHandler(module));
|
||||
handlers.put("copy", new ColorCopyHandler(module));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -61,166 +57,13 @@ public class GradientColorCommand implements CommandExecutor, TabCompleter {
|
|||
}
|
||||
|
||||
String subCommand = args[0].toLowerCase();
|
||||
var handler = subCommands.get(subCommand);
|
||||
SubCommandHandler handler = handlers.get(subCommand);
|
||||
|
||||
if (handler != null) {
|
||||
return handler.apply(player, args);
|
||||
return handler.handle(player, args);
|
||||
}
|
||||
|
||||
return handleSetColors(player, args);
|
||||
}
|
||||
|
||||
private boolean handleOn(Player player, String[] args) {
|
||||
GradientPlayerData data = module.getDataManager().getPlayerData(player.getUniqueId());
|
||||
GradientMessages msg = module.getMessages();
|
||||
|
||||
if (!data.hasColors()) {
|
||||
msg.send(player, "color-no-colors");
|
||||
return true;
|
||||
}
|
||||
|
||||
data.setColorEnabled(true);
|
||||
saveAndUpdate(player, data);
|
||||
msg.send(player, "color-enabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handleOff(Player player, String[] args) {
|
||||
GradientPlayerData data = module.getDataManager().getPlayerData(player.getUniqueId());
|
||||
data.setColorEnabled(false);
|
||||
saveAndUpdate(player, data);
|
||||
module.getMessages().send(player, "color-disabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handleReset(Player player, String[] args) {
|
||||
GradientPlayerData data = module.getDataManager().getPlayerData(player.getUniqueId());
|
||||
GradientMessages msg = module.getMessages();
|
||||
|
||||
if (!data.hasColors()) {
|
||||
msg.send(player, "color-no-colors");
|
||||
return true;
|
||||
}
|
||||
|
||||
data.setColors(new ArrayList<>());
|
||||
data.setColorEnabled(false);
|
||||
saveAndUpdate(player, data);
|
||||
msg.send(player, "color-reset");
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handleCopy(Player player, String[] args) {
|
||||
GradientMessages msg = module.getMessages();
|
||||
GradientConfig cfg = module.getConfig();
|
||||
|
||||
if (args.length < 2) {
|
||||
msg.send(player, "color-copy-usage");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player target = Bukkit.getPlayer(args[1]);
|
||||
if (target == null) {
|
||||
msg.send(player, "player-not-found");
|
||||
return true;
|
||||
}
|
||||
|
||||
GradientPlayerData targetData = module.getDataManager().getPlayerData(target.getUniqueId());
|
||||
if (!targetData.hasColors()) {
|
||||
msg.send(player, "color-copy-no-colors", "player", target.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
GradientPlayerData data = module.getDataManager().getPlayerData(player.getUniqueId());
|
||||
|
||||
if (!player.hasPermission("gradient.bypass.cooldown") &&
|
||||
!checkCooldown(player, cfg.getColorCooldown(), data.getLastColorChange())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
List<String> colors = new ArrayList<>(targetData.getColors());
|
||||
int price = player.hasPermission("gradient.bypass.cost") ? 0 : colors.size() * cfg.getPricePerColor();
|
||||
|
||||
if (price > 0 && !checkBalance(player, price)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
GradientConfirmGUI gui = new GradientConfirmGUI(module, player,
|
||||
GradientConfirmGUI.ConfirmType.COLOR, colors, data.getPrefix(), price);
|
||||
FoliaUtil.runEntityTask(module.getPlugin(), player, gui::open);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean handleSetColors(Player player, String[] args) {
|
||||
GradientMessages msg = module.getMessages();
|
||||
GradientConfig cfg = module.getConfig();
|
||||
|
||||
if (args.length > cfg.getMaxColors()) {
|
||||
msg.send(player, "too-many-colors", "max", String.valueOf(cfg.getMaxColors()));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length < cfg.getMinColors()) {
|
||||
msg.send(player, "not-enough-colors", "min", String.valueOf(cfg.getMinColors()));
|
||||
return true;
|
||||
}
|
||||
|
||||
GradientPlayerData data = module.getDataManager().getPlayerData(player.getUniqueId());
|
||||
|
||||
if (!player.hasPermission("gradient.bypass.cooldown") &&
|
||||
!checkCooldown(player, cfg.getColorCooldown(), data.getLastColorChange())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
List<String> colors = new ArrayList<>();
|
||||
for (String arg : args) {
|
||||
String color = arg.startsWith("#") ? arg : "#" + arg;
|
||||
if (!GradientUtil.isValidHex(color)) {
|
||||
msg.send(player, "invalid-color", "color", arg);
|
||||
return true;
|
||||
}
|
||||
colors.add(color.toUpperCase());
|
||||
}
|
||||
|
||||
int price = player.hasPermission("gradient.bypass.cost") ? 0 : colors.size() * cfg.getPricePerColor();
|
||||
|
||||
if (price > 0 && !checkBalance(player, price)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
GradientConfirmGUI gui = new GradientConfirmGUI(module, player,
|
||||
GradientConfirmGUI.ConfirmType.COLOR, colors, data.getPrefix(), price);
|
||||
FoliaUtil.runEntityTask(module.getPlugin(), player, gui::open);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkCooldown(Player player, int cooldownSec, long lastChange) {
|
||||
long cooldownMs = cooldownSec * RatConfig.MILLIS_PER_SECOND;
|
||||
long timePassed = System.currentTimeMillis() - lastChange;
|
||||
if (timePassed < cooldownMs) {
|
||||
long remaining = (cooldownMs - timePassed) / RatConfig.MILLIS_PER_SECOND;
|
||||
module.getMessages().send(player, "cooldown", "time", String.valueOf(remaining));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkBalance(Player player, int price) {
|
||||
if (!module.hasPlayerPoints()) {
|
||||
player.sendMessage("§cPlayerPoints не установлен!");
|
||||
return false;
|
||||
}
|
||||
int balance = module.getPlayerPointsAPI().look(player.getUniqueId());
|
||||
if (balance < price) {
|
||||
module.getMessages().send(player, "not-enough-points-color", "price", String.valueOf(price));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void saveAndUpdate(Player player, GradientPlayerData data) {
|
||||
FoliaUtil.runEntityTask(module.getPlugin(), player,
|
||||
() -> DisplayNameUtil.updateDisplayName(module, player, data));
|
||||
FoliaUtil.runAsync(module.getPlugin(),
|
||||
() -> module.getDataManager().savePlayerData(player.getUniqueId()));
|
||||
return setHandler.handle(player, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,90 @@
|
|||
package com.loki.lochat.gradient.commands.handlers.color;
|
||||
|
||||
import com.loki.lochat.config.RatConfig;
|
||||
import com.loki.lochat.gradient.GradientModule;
|
||||
import com.loki.lochat.gradient.config.GradientConfig;
|
||||
import com.loki.lochat.gradient.data.GradientPlayerData;
|
||||
import com.loki.lochat.gradient.gui.GradientConfirmGUI;
|
||||
import com.loki.lochat.utils.platform.FoliaUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Обработчик команды /color copy <игрок>
|
||||
*/
|
||||
public class ColorCopyHandler implements SubCommandHandler {
|
||||
|
||||
private final GradientModule module;
|
||||
|
||||
public ColorCopyHandler(GradientModule module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, String[] args) {
|
||||
GradientConfig cfg = module.getConfig();
|
||||
|
||||
if (args.length < 2) {
|
||||
module.getMessages().send(player, "color-copy-usage");
|
||||
return true;
|
||||
}
|
||||
|
||||
Player target = Bukkit.getPlayer(args[1]);
|
||||
if (target == null) {
|
||||
module.getMessages().send(player, "player-not-found");
|
||||
return true;
|
||||
}
|
||||
|
||||
GradientPlayerData targetData = module.getDataManager().getPlayerData(target.getUniqueId());
|
||||
if (!targetData.hasColors()) {
|
||||
module.getMessages().send(player, "color-copy-no-colors", "player", target.getName());
|
||||
return true;
|
||||
}
|
||||
|
||||
GradientPlayerData data = module.getDataManager().getPlayerData(player.getUniqueId());
|
||||
|
||||
if (!player.hasPermission("gradient.bypass.cooldown") &&
|
||||
!checkCooldown(player, cfg.getColorCooldown(), data.getLastColorChange())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
List<String> colors = new ArrayList<>(targetData.getColors());
|
||||
int price = player.hasPermission("gradient.bypass.cost") ? 0 : colors.size() * cfg.getPricePerColor();
|
||||
|
||||
if (price > 0 && !checkBalance(player, price)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
GradientConfirmGUI gui = new GradientConfirmGUI(module, player,
|
||||
GradientConfirmGUI.ConfirmType.COLOR, colors, data.getPrefix(), price);
|
||||
FoliaUtil.runEntityTask(module.getPlugin(), player, gui::open);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkCooldown(Player player, int cooldownSec, long lastChange) {
|
||||
long cooldownMs = cooldownSec * RatConfig.MILLIS_PER_SECOND;
|
||||
long timePassed = System.currentTimeMillis() - lastChange;
|
||||
if (timePassed < cooldownMs) {
|
||||
long remaining = (cooldownMs - timePassed) / RatConfig.MILLIS_PER_SECOND;
|
||||
module.getMessages().send(player, "cooldown", "time", String.valueOf(remaining));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkBalance(Player player, int price) {
|
||||
if (!module.hasPlayerPoints()) {
|
||||
player.sendMessage("§cPlayerPoints не установлен!");
|
||||
return false;
|
||||
}
|
||||
int balance = module.getPlayerPointsAPI().look(player.getUniqueId());
|
||||
if (balance < price) {
|
||||
module.getMessages().send(player, "not-enough-points-color", "price", String.valueOf(price));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package com.loki.lochat.gradient.commands.handlers.color;
|
||||
|
||||
import com.loki.lochat.gradient.GradientModule;
|
||||
import com.loki.lochat.gradient.data.GradientPlayerData;
|
||||
import com.loki.lochat.gradient.util.DisplayNameUtil;
|
||||
import com.loki.lochat.utils.platform.FoliaUtil;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Обработчик команды /color off
|
||||
*/
|
||||
public class ColorOffHandler implements SubCommandHandler {
|
||||
|
||||
private final GradientModule module;
|
||||
|
||||
public ColorOffHandler(GradientModule module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, String[] args) {
|
||||
GradientPlayerData data = module.getDataManager().getPlayerData(player.getUniqueId());
|
||||
data.setColorEnabled(false);
|
||||
saveAndUpdate(player, data);
|
||||
module.getMessages().send(player, "color-disabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void saveAndUpdate(Player player, GradientPlayerData data) {
|
||||
FoliaUtil.runEntityTask(module.getPlugin(), player,
|
||||
() -> DisplayNameUtil.updateDisplayName(module, player, data));
|
||||
FoliaUtil.runAsync(module.getPlugin(),
|
||||
() -> module.getDataManager().savePlayerData(player.getUniqueId()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.loki.lochat.gradient.commands.handlers.color;
|
||||
|
||||
import com.loki.lochat.gradient.GradientModule;
|
||||
import com.loki.lochat.gradient.data.GradientPlayerData;
|
||||
import com.loki.lochat.gradient.util.DisplayNameUtil;
|
||||
import com.loki.lochat.utils.platform.FoliaUtil;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Обработчик команды /color on
|
||||
*/
|
||||
public class ColorOnHandler implements SubCommandHandler {
|
||||
|
||||
private final GradientModule module;
|
||||
|
||||
public ColorOnHandler(GradientModule module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, String[] args) {
|
||||
GradientPlayerData data = module.getDataManager().getPlayerData(player.getUniqueId());
|
||||
|
||||
if (!data.hasColors()) {
|
||||
module.getMessages().send(player, "color-no-colors");
|
||||
return true;
|
||||
}
|
||||
|
||||
data.setColorEnabled(true);
|
||||
saveAndUpdate(player, data);
|
||||
module.getMessages().send(player, "color-enabled");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void saveAndUpdate(Player player, GradientPlayerData data) {
|
||||
FoliaUtil.runEntityTask(module.getPlugin(), player,
|
||||
() -> DisplayNameUtil.updateDisplayName(module, player, data));
|
||||
FoliaUtil.runAsync(module.getPlugin(),
|
||||
() -> module.getDataManager().savePlayerData(player.getUniqueId()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.loki.lochat.gradient.commands.handlers.color;
|
||||
|
||||
import com.loki.lochat.gradient.GradientModule;
|
||||
import com.loki.lochat.gradient.data.GradientPlayerData;
|
||||
import com.loki.lochat.gradient.util.DisplayNameUtil;
|
||||
import com.loki.lochat.utils.platform.FoliaUtil;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Обработчик команды /color reset
|
||||
*/
|
||||
public class ColorResetHandler implements SubCommandHandler {
|
||||
|
||||
private final GradientModule module;
|
||||
|
||||
public ColorResetHandler(GradientModule module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, String[] args) {
|
||||
GradientPlayerData data = module.getDataManager().getPlayerData(player.getUniqueId());
|
||||
|
||||
if (!data.hasColors()) {
|
||||
module.getMessages().send(player, "color-no-colors");
|
||||
return true;
|
||||
}
|
||||
|
||||
data.setColors(new ArrayList<>());
|
||||
data.setColorEnabled(false);
|
||||
saveAndUpdate(player, data);
|
||||
module.getMessages().send(player, "color-reset");
|
||||
return true;
|
||||
}
|
||||
|
||||
private void saveAndUpdate(Player player, GradientPlayerData data) {
|
||||
FoliaUtil.runEntityTask(module.getPlugin(), player,
|
||||
() -> DisplayNameUtil.updateDisplayName(module, player, data));
|
||||
FoliaUtil.runAsync(module.getPlugin(),
|
||||
() -> module.getDataManager().savePlayerData(player.getUniqueId()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
package com.loki.lochat.gradient.commands.handlers.color;
|
||||
|
||||
import com.loki.lochat.config.RatConfig;
|
||||
import com.loki.lochat.gradient.GradientModule;
|
||||
import com.loki.lochat.gradient.config.GradientConfig;
|
||||
import com.loki.lochat.gradient.config.GradientMessages;
|
||||
import com.loki.lochat.gradient.data.GradientPlayerData;
|
||||
import com.loki.lochat.gradient.gui.GradientConfirmGUI;
|
||||
import com.loki.lochat.gradient.util.GradientUtil;
|
||||
import com.loki.lochat.utils.platform.FoliaUtil;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Обработчик команды /color <цвета...>
|
||||
* Устанавливает градиент из указанных цветов
|
||||
*/
|
||||
public class ColorSetHandler implements SubCommandHandler {
|
||||
|
||||
private final GradientModule module;
|
||||
|
||||
public ColorSetHandler(GradientModule module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, String[] args) {
|
||||
GradientMessages msg = module.getMessages();
|
||||
GradientConfig cfg = module.getConfig();
|
||||
|
||||
if (args.length > cfg.getMaxColors()) {
|
||||
msg.send(player, "too-many-colors", "max", String.valueOf(cfg.getMaxColors()));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length < cfg.getMinColors()) {
|
||||
msg.send(player, "not-enough-colors", "min", String.valueOf(cfg.getMinColors()));
|
||||
return true;
|
||||
}
|
||||
|
||||
GradientPlayerData data = module.getDataManager().getPlayerData(player.getUniqueId());
|
||||
|
||||
if (!player.hasPermission("gradient.bypass.cooldown") &&
|
||||
!checkCooldown(player, cfg.getColorCooldown(), data.getLastColorChange())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
List<String> colors = new ArrayList<>();
|
||||
for (String arg : args) {
|
||||
String color = arg.startsWith("#") ? arg : "#" + arg;
|
||||
if (!GradientUtil.isValidHex(color)) {
|
||||
msg.send(player, "invalid-color", "color", arg);
|
||||
return true;
|
||||
}
|
||||
colors.add(color.toUpperCase());
|
||||
}
|
||||
|
||||
int price = player.hasPermission("gradient.bypass.cost") ? 0 : colors.size() * cfg.getPricePerColor();
|
||||
|
||||
if (price > 0 && !checkBalance(player, price)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
GradientConfirmGUI gui = new GradientConfirmGUI(module, player,
|
||||
GradientConfirmGUI.ConfirmType.COLOR, colors, data.getPrefix(), price);
|
||||
FoliaUtil.runEntityTask(module.getPlugin(), player, gui::open);
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkCooldown(Player player, int cooldownSec, long lastChange) {
|
||||
long cooldownMs = cooldownSec * RatConfig.MILLIS_PER_SECOND;
|
||||
long timePassed = System.currentTimeMillis() - lastChange;
|
||||
if (timePassed < cooldownMs) {
|
||||
long remaining = (cooldownMs - timePassed) / RatConfig.MILLIS_PER_SECOND;
|
||||
module.getMessages().send(player, "cooldown", "time", String.valueOf(remaining));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean checkBalance(Player player, int price) {
|
||||
if (!module.hasPlayerPoints()) {
|
||||
player.sendMessage("§cPlayerPoints не установлен!");
|
||||
return false;
|
||||
}
|
||||
int balance = module.getPlayerPointsAPI().look(player.getUniqueId());
|
||||
if (balance < price) {
|
||||
module.getMessages().send(player, "not-enough-points-color", "price", String.valueOf(price));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.loki.lochat.gradient.commands.handlers.color;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Интерфейс для обработчиков подкоманд /color
|
||||
*/
|
||||
public interface SubCommandHandler {
|
||||
|
||||
/**
|
||||
* Обрабатывает подкоманду
|
||||
* @param player игрок, выполнивший команду
|
||||
* @param args аргументы команды
|
||||
* @return true если команда обработана успешно
|
||||
*/
|
||||
boolean handle(Player player, String[] args);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue