Skip to content

Commit

Permalink
Update BetterPvPNoPvPCommand.java
Browse files Browse the repository at this point in the history
  • Loading branch information
staFF6773 committed Mar 31, 2024
1 parent f335716 commit 8edfb10
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ public class BetterPvPNoPvPCommand extends BaseCommand implements Listener {
private boolean pvpEnabled = true;

public BetterPvPNoPvPCommand(final BetterPvP betterPvP) {
// Set the command name and permissions
super("pvp", new ArrayList<>(), "", true);
super("pvp", new ArrayList<>(), "betterpvp.pvp", true);
this.betterPvP = betterPvP;

// Registrar el evento para manejar el daño
PluginManager pluginManager = betterPvP.getServer().getPluginManager();
pluginManager.registerEvents(this, betterPvP);
}
Expand All @@ -37,7 +35,6 @@ public BetterPvPNoPvPCommand(final BetterPvP betterPvP) {
public void execute(CommandSender sender, String[] args) {
// Verify whether the "on" or "off" argument was provided.
if (args.length == 1 && (args[0].equalsIgnoreCase("on") || args[0].equalsIgnoreCase("off"))) {
// Verificar permisos del jugador
if (hasPermission(sender)) {
if (args[0].equalsIgnoreCase("off") && sender instanceof Player) {
Player player = (Player) sender;
Expand All @@ -58,13 +55,11 @@ public void execute(CommandSender sender, String[] args) {
// Replace "%status%" with the status provided in the command
pvpToggleMessage = pvpToggleMessage.replace("%status%", args[0]);

// Actualizar el estado del PvP
pvpEnabled = args[0].equalsIgnoreCase("on");

// Send success message
sender.sendMessage(ChatColorUtil.colorize(BetterPvP.prefix + " " + pvpToggleMessage));
} else {
// Enviar mensaje de falta de permisos
sendNoPermissionMessage(sender);
}
} else {
Expand Down

0 comments on commit 8edfb10

Please sign in to comment.