/* * Copyright (C) 2025 Minecon724 * Tweaks724 is licensed under the GNU General Public License. See the LICENSE.md file * in the project root for the full license text. */ package eu.m724.tweaks.module.durability; import eu.m724.tweaks.Language; import net.md_5.bungee.api.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.jetbrains.annotations.NotNull; public class DurabilityCommands implements CommandExecutor { private final DPlayerProperties properties; public DurabilityCommands(DPlayerProperties properties) { this.properties = properties; } @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) { if (!(sender instanceof Player player)) { sender.sendMessage("Only players can use this command"); return true; } if (properties.isPlayerEnabled(player)) { properties.disableForPlayer(player); sender.spigot().sendMessage(Language.getComponent("durabilityDisabled", ChatColor.GRAY)); } else { properties.enableForPlayer(player); sender.spigot().sendMessage(Language.getComponent("durabilityEnabled", ChatColor.GRAY)); } return true; } }