Small fixes

This commit is contained in:
drekamor
2024-03-22 00:20:06 +00:00
parent e9eda48b1a
commit 912652d55c

View File

@@ -10,6 +10,7 @@ import java.util.Map;
import java.util.UUID;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextColor;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@@ -44,7 +45,7 @@ public class DeleteGroup extends BaseCommandMiddle {
//player could have lost delete permission in the mean time
if (!NameAPI.getGroupManager().hasAccess(gD, uuid, PermissionType.getPermission("DELETE"))){
p.sendMessage(Component.text("You do not have permission to run that command.").color(TextColor.color(255, 0, 0)));
p.sendMessage(Component.text("You do not have permission to run that command.").color(NamedTextColor.RED));
return;
}
Date now = new Date(System.currentTimeMillis() - 15000);
@@ -53,15 +54,15 @@ public class DeleteGroup extends BaseCommandMiddle {
{
//good to go delete the group
if(gm.deleteGroup(gD.getName()))
p.sendMessage(Component.text("Group was successfully deleted.").color(TextColor.color(0, 255, 0)));
p.sendMessage(Component.text("Group was successfully deleted.").color(NamedTextColor.GREEN));
else
p.sendMessage(Component.text("Group is now disciplined. Check back later to see if group is deleted.").color(TextColor.color(0, 255, 0)));
p.sendMessage(Component.text("Group is now disciplined. Check back later to see if group is deleted.").color(NamedTextColor.GREEN));
confirmDeleteGroup.remove(uuid);
return;
}
else{
p.sendMessage(Component.text("You did not do /nldg %s fast enough, you will need to start over".formatted(confirm)).color(TextColor.color(255, 0, 0)));
p.sendMessage(Component.text("You did not do /nldg %s_%s fast enough, you will need to start over".formatted(confirm, gD.getName())).color(NamedTextColor.RED));
confirmDeleteGroup.remove(uuid);
return;
}
@@ -75,23 +76,23 @@ public class DeleteGroup extends BaseCommandMiddle {
return;
}
if (!NameAPI.getGroupManager().hasAccess(g, uuid, PermissionType.getPermission("DELETE"))){
p.sendMessage(Component.text("You do not have permission to run that command.").color(TextColor.color(255, 0, 0)));
p.sendMessage(Component.text("You do not have permission to run that command.").color(NamedTextColor.RED));
return;
}
PlayerType pType = g.getPlayerType(uuid);
if (pType == null && !p.hasPermission("namelayer.admin")){
p.sendMessage(Component.text("You are not on that group.").color(TextColor.color(255, 0, 0)));
p.sendMessage(Component.text("You are not on that group.").color(NamedTextColor.RED));
return;
}
if (g.isDisciplined() && !p.hasPermission("namelayer.admin")){
p.sendMessage(Component.text("Group is disiplined.").color(TextColor.color(255, 0, 0)));
p.sendMessage(Component.text("Group is disiplined.").color(NamedTextColor.RED));
return;
}
//set that user can confirm group in 15 seconds
Date date = new Date();
Long dateString = date.getTime();
String[] groupDate = new String[] {g.getName(), dateString.toString()};
p.sendMessage(Component.text("To confirm the IRREVERSIBLE deletion of the group '%s' along with ALL reinforcements, bastions and snitches on it:\nType /nldg %s_%s within 15 seconds.".formatted(g.getName(), confirm, g.getName())).color(TextColor.color(255, 0, 0)));
p.sendMessage(Component.text("To confirm the IRREVERSIBLE deletion of the group '%s' along with ALL reinforcements, bastions and snitches on it:\nType /nldg %s_%s within 15 seconds.".formatted(g.getName(), confirm, g.getName())).color(NamedTextColor.RED));
confirmDeleteGroup.put(uuid, groupDate);
return;
}