Implement Profile Regions

This commit is contained in:
Kam committed 2025-02-19 18:15:05 -05:00
1 parent db330d0038
commit cf6e6dd655
14 files changed
+486 -283

No files matched your search

@@ -2,72 +2,90 @@ package kamkeel.npcs.command.profile;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentTranslation;
import java.lang.reflect.Method;
import java.util.Map.Entry;
import static kamkeel.npcs.util.ColorUtil.sendError;
import static kamkeel.npcs.util.ColorUtil.sendMessage;
import noppes.npcs.CustomNpcsPermissions;
public class CommandHelpProfile extends CommandProfileBase {
private CommandProfile parent;
private CommandProfile parent;
public CommandHelpProfile(CommandProfile parent){
this.parent = parent;
}
public CommandHelpProfile(CommandProfile parent){
this.parent = parent;
}
@Override
public String getCommandName() {
return "help";
}
@Override
public String getCommandName() {
return "help";
}
@Override
public String getDescription() {
return "help [command]";
}
@Override
public String getDescription() {
return "help [command]";
}
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
if(args.length == 0){
sendMessage(sender, "\u00A78------ \u00A7aProfile Commands \u00A78------");
for(Entry<String, CommandProfileBase> entry : parent.map.entrySet()){
sendMessage(sender, "\u00A77> " + "\u00A7e" + entry.getKey() + "\u00A78: \u00A77" + entry.getValue().getCommandUsage(sender));
}
return;
}
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
if(args.length == 0){
sendMessage(sender, "\u00A78------ \u00A7aProfile Commands \u00A78------");
for(Entry<String, CommandProfileBase> entry : parent.map.entrySet()){
sendMessage(sender, "\u00A77> " + "\u00A7e" + entry.getKey() + "\u00A78: \u00A77"
+ entry.getValue().getCommandUsage(sender));
}
return;
}
CommandProfileBase command = parent.getCommand(args);
if(command == null){
sendError(sender, "Unknown command " + args[0]);
return;
}
if(command == null){
sendError(sender, "Unknown command " + args[0]);
return;
}
if(command.subcommands.isEmpty()){
sender.addChatMessage(new ChatComponentTranslation(command.getCommandUsage(sender)));
return;
}
if(command.subcommands.isEmpty()){
sender.addChatMessage(new ChatComponentTranslation(command.getCommandUsage(sender)));
return;
}
Method m = null;
if(args.length > 1){
m = command.subcommands.get(args[1].toLowerCase());
}
if(m == null){
sendMessage(sender, "\u00A78------ \u00A7a" + command.getCommandName().toUpperCase() + " SubCommands \u00A78------");
sendMessage(sender, "\u00A77Usage: \u00A76" + command.getUsage());
for(Entry<String, Method> entry : command.subcommands.entrySet()){
sender.addChatMessage(new ChatComponentTranslation("\u00A77> " + "\u00A7e" + entry.getKey() + "\u00A78: \u00A77" + entry.getValue().getAnnotation(SubCommand.class).desc()));
}
sender.addChatMessage(new ChatComponentTranslation("\u00A78Permission:\u00A77 " + CommandProfile.getCommandPermission(command.getCommandName())));
}
else{
sendMessage(sender, "\u00A78------ \u00A7b" + command.getCommandName().toUpperCase() + "." + args[1].toUpperCase() + " Command \u00A78------");
SubCommand sc = m.getAnnotation(SubCommand.class);
sender.addChatMessage(new ChatComponentTranslation("\u00A77" + sc.desc()));
if(!sc.usage().isEmpty())
sender.addChatMessage(new ChatComponentTranslation("\u00A77Usage: \u00A76" + sc.usage()));
sender.addChatMessage(new ChatComponentTranslation("\u00A78Permission:\u00A77 " + getSubCommandPermission(args[1])));
}
}
Method m = null;
if(args.length > 1){
m = command.subcommands.get(args[1].toLowerCase());
}
if(m == null){
sendMessage(sender, "\u00A78------ \u00A7a" + command.getCommandName().toUpperCase()
+ " SubCommands \u00A78------");
sendMessage(sender, "\u00A77Usage: \u00A76" + command.getUsage());
for(Entry<String, Method> entry : command.subcommands.entrySet()){
SubCommand sc = entry.getValue().getAnnotation(SubCommand.class);
// For players, only list subcommands if they have permission; for console, show all.
if(!(sender instanceof EntityPlayer) || command.canSendCommand(sender, sc, entry.getKey())){
sender.addChatMessage(new ChatComponentTranslation("\u00A77> "
+ "\u00A7e" + entry.getKey()
+ "\u00A78: \u00A77" + sc.desc()));
}
}
// Show permission node only if sender is console or has permission.
if(!(sender instanceof EntityPlayer) ||
CustomNpcsPermissions.hasPermission((EntityPlayer)sender, CustomNpcsPermissions.PROFILE_ADMIN)){
sender.addChatMessage(new ChatComponentTranslation("\u00A78Permission:\u00A77 "
+ CommandProfile.getCommandPermission(command.getCommandName())));
}
}
else{
sendMessage(sender, "\u00A78------ \u00A7b" + command.getCommandName().toUpperCase()
+ "." + args[1].toUpperCase() + " Command \u00A78------");
SubCommand sc = m.getAnnotation(SubCommand.class);
sender.addChatMessage(new ChatComponentTranslation("\u00A77" + sc.desc()));
if(!sc.usage().isEmpty()){
sender.addChatMessage(new ChatComponentTranslation("\u00A77Usage: \u00A76" + sc.usage()));
}
if(!(sender instanceof EntityPlayer) ||
CustomNpcsPermissions.hasPermission((EntityPlayer)sender, CustomNpcsPermissions.PROFILE_ADMIN)){
sender.addChatMessage(new ChatComponentTranslation("\u00A78Permission:\u00A77 "
+ getSubCommandPermission(args[1])));
}
}
}
}
@@ -26,6 +26,7 @@ public class CommandProfile extends CommandBase {
registerCommand(new CommandProfileCreate());
registerCommand(new CommandProfileRemove());
registerCommand(new CommandProfileAdmin());
registerCommand(new CommandProfileRegion());
registerCommand(new CommandProfileList());
registerCommand(new CommandProfileRename());
}
@@ -3,11 +3,11 @@ package kamkeel.npcs.command.profile;
import kamkeel.npcs.controllers.ProfileController;
import kamkeel.npcs.controllers.data.Profile;
import kamkeel.npcs.controllers.data.ProfileOperation;
import kamkeel.npcs.controllers.data.EnumProfileOperation;
import kamkeel.npcs.controllers.data.Slot;
import noppes.npcs.LogWriter;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import java.io.File;
import java.util.Map;
import java.util.UUID;
@@ -51,26 +51,15 @@ public class CommandProfileAdmin extends CommandProfileBase {
}
boolean temporary = (args.length >= 5 && args[4].equalsIgnoreCase("temp"));
ProfileOperation result = ProfileController.cloneSlot(sourcePlayer, sourceSlot, destinationSlot, temporary);
switch(result) {
case SUCCESS:
sendResult(sender, "Successfully cloned slot %d from %s to slot %d for %s.", sourceSlot, sourcePlayer, destinationSlot, destinationPlayer);
break;
case NEW_SLOT_CREATED:
sendResult(sender, "Successfully cloned slot %d from %s to NEW slot %d for %s.", sourceSlot, sourcePlayer, destinationSlot, destinationPlayer);
break;
case LOCKED:
sendError(sender, "Profile is locked. Please try again later.");
break;
case VERIFICATION_FAILED:
sendError(sender, "Profile verification failed. Change not permitted.");
break;
case PLAYER_NOT_FOUND:
sendError(sender, "Player profile not found.");
break;
case ERROR:
default:
sendError(sender, "Error cloning slot.");
break;
if(result.getResult() == EnumProfileOperation.SUCCESS) {
sendResult(sender, "Successfully cloned slot %d from %s to slot %d for %s.", sourceSlot, sourcePlayer, destinationSlot, destinationPlayer);
} else if(result.getResult() == EnumProfileOperation.LOCKED) {
// Detail message for admins – note: using result.getMessage() for further details.
sendError(sender, "Clone failed for %s: Profile is locked. Details: %s", sourcePlayer, result.getMessage());
} else if(result.getResult() == EnumProfileOperation.ERROR) {
sendError(sender, "Error cloning slot for %s: %s", sourcePlayer, result.getMessage());
} else {
sendError(sender, "Unexpected error cloning slot: %s", result.getMessage());
}
}
@@ -92,20 +81,17 @@ public class CommandProfileAdmin extends CommandProfileBase {
return;
}
ProfileOperation result = ProfileController.removeSlot(targetPlayer, slotId);
switch(result) {
case SUCCESS:
sendResult(sender, "Successfully removed slot %d from %s.", slotId, targetPlayer);
break;
case LOCKED:
sendError(sender, "Profile for %s is locked. Please try again later.", targetPlayer);
break;
default:
sendError(sender, "Error removing slot %d from %s.", slotId, targetPlayer);
break;
if(result.getResult() == EnumProfileOperation.SUCCESS) {
sendResult(sender, "Successfully removed slot %d from %s.", slotId, targetPlayer);
} else if(result.getResult() == EnumProfileOperation.LOCKED) {
sendError(sender, "Remove failed for %s: Profile is locked. Details: %s", targetPlayer, result.getMessage());
} else if(result.getResult() == EnumProfileOperation.ERROR) {
sendError(sender, "Error removing slot %d from %s: %s", slotId, targetPlayer, result.getMessage());
} else {
sendError(sender, "Unexpected error during removal: %s", result.getMessage());
}
}
// Existing change subcommand update:
@SubCommand(
desc = "Change a specified player's active slot.",
usage = "<targetPlayer> <newSlotId>"
@@ -124,28 +110,17 @@ public class CommandProfileAdmin extends CommandProfileBase {
return;
}
ProfileOperation result = ProfileController.changeSlot(targetPlayer, newSlotId);
switch(result) {
case SUCCESS:
sendResult(sender, "Successfully changed %s's active slot to %d.", targetPlayer, newSlotId);
break;
case NEW_SLOT_CREATED:
sendResult(sender, "Switched %s to NEW slot %d (new profile created).", targetPlayer, newSlotId);
break;
case ALREADY_ACTIVE:
sendError(sender, "Slot %d is already active for %s.", newSlotId, targetPlayer);
break;
case LOCKED:
sendError(sender, "Profile for %s is locked. Please try again later.", targetPlayer);
break;
case VERIFICATION_FAILED:
sendError(sender, "Profile verification failed for %s.", targetPlayer);
break;
default:
sendError(sender, "Error changing active slot for %s.", targetPlayer);
if(result.getResult() == EnumProfileOperation.SUCCESS) {
sendResult(sender, "Successfully changed %s's active slot to %d.", targetPlayer, newSlotId);
} else if(result.getResult() == EnumProfileOperation.LOCKED) {
sendError(sender, "Change failed for %s: Profile is locked. Details: %s", targetPlayer, result.getMessage());
} else if(result.getResult() == EnumProfileOperation.ERROR) {
sendError(sender, "Error changing active slot for %s: %s", targetPlayer, result.getMessage());
} else {
sendError(sender, "Unexpected error during change: %s", result.getMessage());
}
}
// New admin create subcommand:
@SubCommand(
desc = "Create a new slot for a specified player's profile.",
usage = "<targetPlayer>"
@@ -158,25 +133,18 @@ public class CommandProfileAdmin extends CommandProfileBase {
String targetPlayer = args[0];
Profile profile = ProfileController.getProfile(targetPlayer);
if(profile == null) {
sendError(sender, "Profile not found for player: " + targetPlayer);
sendError(sender, "Profile not found for player: %s", targetPlayer);
return;
}
ProfileOperation result = ProfileController.createSlotInternal(profile);
switch(result) {
case NEW_SLOT_CREATED:
sendResult(sender, "New slot created successfully for %s.", targetPlayer);
break;
case MAX_SLOTS:
sendError(sender, "Player %s has reached maximum allowed slots.", targetPlayer);
break;
case LOCKED:
sendError(sender, "Profile for %s is locked. Please try again later.", targetPlayer);
break;
case VERIFICATION_FAILED:
sendError(sender, "Profile verification failed for %s.", targetPlayer);
break;
default:
sendError(sender, "Error creating new slot for %s.", targetPlayer);
if(result.getResult() == EnumProfileOperation.SUCCESS) {
sendResult(sender, "New slot created successfully for %s.", targetPlayer);
} else if(result.getResult() == EnumProfileOperation.LOCKED) {
sendError(sender, "Create failed for %s: Profile is locked. Details: %s", targetPlayer, result.getMessage());
} else if(result.getResult() == EnumProfileOperation.ERROR) {
sendError(sender, "Error creating new slot for %s: %s", targetPlayer, result.getMessage());
} else {
sendError(sender, "Unexpected error during slot creation: %s", result.getMessage());
}
}
@@ -192,7 +160,7 @@ public class CommandProfileAdmin extends CommandProfileBase {
String targetPlayer = args[0];
Profile profile = ProfileController.getProfile(targetPlayer);
if(profile == null) {
sendError(sender, "Profile not found for player: " + targetPlayer);
sendError(sender, "Profile not found for player: %s", targetPlayer);
return;
}
sendMessage(sender, "Profile Slots for %s:", targetPlayer);
@@ -236,7 +204,7 @@ public class CommandProfileAdmin extends CommandProfileBase {
}
Profile profile = ProfileController.getProfile(targetPlayer);
if(profile == null) {
sendError(sender, "Profile not found for player: " + targetPlayer);
sendError(sender, "Profile not found for player: %s", targetPlayer);
return;
}
if(profile.locked) {
@@ -268,7 +236,7 @@ public class CommandProfileAdmin extends CommandProfileBase {
return;
}
String targetPlayer = args[0];
String backupFileName = args[1] += ".dat";
String backupFileName = args[1] + ".dat";
File backupDir = new File(ProfileController.getBackupDir(), ProfileController.getProfile(targetPlayer).player.getUniqueID().toString());
File backupFile = new File(backupDir, backupFileName);
if(!backupFile.exists()){
@@ -2,11 +2,11 @@ package kamkeel.npcs.command.profile;
import kamkeel.npcs.controllers.ProfileController;
import kamkeel.npcs.controllers.data.ProfileOperation;
import kamkeel.npcs.controllers.data.EnumProfileOperation;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import static kamkeel.npcs.util.ColorUtil.sendError;
import static kamkeel.npcs.util.ColorUtil.sendResult;
import static kamkeel.npcs.util.ColorUtil.*;
public class CommandProfileChange extends CommandProfileBase {
@@ -49,24 +49,14 @@ public class CommandProfileChange extends CommandProfileBase {
}
EntityPlayer player = (EntityPlayer)sender;
ProfileOperation result = ProfileController.changeSlot(player, slotId);
switch(result) {
case SUCCESS:
sendResult(sender, "Successfully changed profile slot to %d.", slotId);
break;
case NEW_SLOT_CREATED:
sendResult(sender, "Switched to new slot %d (new profile created).", slotId);
break;
case ALREADY_ACTIVE:
sendError(sender, "Slot %d is already active.", slotId);
break;
case LOCKED:
sendError(sender, "Profile is locked. Please try again later.");
break;
case VERIFICATION_FAILED:
sendError(sender, "Profile verification failed. Change not permitted.");
break;
default:
sendError(sender, "Error occurred while changing your profile slot.");
if(result.getResult() == EnumProfileOperation.SUCCESS) {
sendResult(sender, "Successfully changed profile slot to %d.", slotId);
} else if(result.getResult() == EnumProfileOperation.LOCKED) {
sendError(sender, "Profile is locked. Details: %s", result.getMessage());
} else if(result.getResult() == EnumProfileOperation.ERROR) {
sendError(sender, "Error changing your profile slot: %s", result.getMessage());
} else {
sendError(sender, "Unexpected error: %s", result.getMessage());
}
}
}
@@ -1,13 +1,12 @@
package kamkeel.npcs.command.profile;
import kamkeel.npcs.controllers.ProfileController;
import kamkeel.npcs.controllers.data.Profile;
import kamkeel.npcs.controllers.data.ProfileOperation;
import kamkeel.npcs.controllers.data.EnumProfileOperation;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import static kamkeel.npcs.util.ColorUtil.sendError;
import static kamkeel.npcs.util.ColorUtil.sendResult;
import static kamkeel.npcs.util.ColorUtil.*;
public class CommandProfileCreate extends CommandProfileBase {
@@ -38,27 +37,19 @@ public class CommandProfileCreate extends CommandProfileBase {
return;
}
EntityPlayer player = (EntityPlayer)sender;
Profile profile = ProfileController.getProfile(player);
if(profile == null) {
if(ProfileController.getProfile(player) == null) {
sendError(sender, "Profile not found.");
return;
}
ProfileOperation result = ProfileController.createSlotInternal(profile);
switch(result) {
case NEW_SLOT_CREATED:
sendResult(sender, "New profile slot created successfully.");
break;
case MAX_SLOTS:
sendError(sender, "You have reached the maximum allowed slots.");
break;
case LOCKED:
sendError(sender, "Profile is locked. Please try again later.");
break;
case VERIFICATION_FAILED:
sendError(sender, "Profile verification failed. Creation not permitted.");
break;
default:
sendError(sender, "Error occurred while creating a new profile slot.");
ProfileOperation result = ProfileController.createSlotInternal(ProfileController.getProfile(player));
if(result.getResult() == EnumProfileOperation.SUCCESS) {
sendResult(sender, "New profile slot created successfully.");
} else if(result.getResult() == EnumProfileOperation.LOCKED) {
sendError(sender, "Profile is locked. Details: %s", result.getMessage());
} else if(result.getResult() == EnumProfileOperation.ERROR) {
sendError(sender, "Error creating new profile slot: %s", result.getMessage());
} else {
sendError(sender, "Unexpected error: %s", result.getMessage());
}
}
}
@@ -0,0 +1,160 @@
package kamkeel.npcs.command.profile;
import noppes.npcs.config.ConfigMain;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import java.util.ArrayList;
import java.util.List;
import static kamkeel.npcs.util.ColorUtil.sendError;
import static kamkeel.npcs.util.ColorUtil.sendMessage;
import static kamkeel.npcs.util.ColorUtil.sendResult;
public class CommandProfileRegion extends CommandProfileBase {
@Override
public String getCommandName() {
return "region";
}
@Override
public String getDescription() {
return "Manage profile region switching and restricted regions";
}
@Override
public String getUsage() {
return "<subcommand>";
}
@SubCommand(
desc = "Enable region-based profile switching",
usage = ""
)
public void enable(ICommandSender sender, String[] args) throws CommandException {
ConfigMain.RegionProfileSwitching = true;
ConfigMain.RegionProfileSwitchingProperty.set(true);
if(ConfigMain.config.hasChanged()){
ConfigMain.config.save();
}
sendResult(sender, "Profile region switching enabled.");
}
@SubCommand(
desc = "Disable region-based profile switching",
usage = ""
)
public void disable(ICommandSender sender, String[] args) throws CommandException {
ConfigMain.RegionProfileSwitching = false;
ConfigMain.RegionProfileSwitchingProperty.set(false);
if(ConfigMain.config.hasChanged()){
ConfigMain.config.save();
}
sendResult(sender, "Profile region switching disabled.");
}
@SubCommand(
desc = "Add a new region. Format: DIM, X1, Y1, Z1, X2, Y2, Z2",
usage = "<dim> <x1> <y1> <z1> <x2> <y2> <z2>"
)
public void add(ICommandSender sender, String[] args) throws CommandException {
if(args.length < 1){
sendError(sender, "Usage: /profile region add <DIM, X1, Y1, Z1, X2, Y2, Z2>");
return;
}
// Combine args in case the region data was split by spaces
String regionStr = String.join(" ", args).trim();
String[] parts = regionStr.split(",");
if(parts.length != 7){
sendError(sender, "Invalid region format. Must contain 7 integers separated by commas.");
return;
}
List<Integer> regionList = new ArrayList<>();
try {
for(String part : parts){
regionList.add(Integer.parseInt(part.trim()));
}
} catch(NumberFormatException e){
sendError(sender, "Invalid number format in region data.");
return;
}
ConfigMain.RestrictedProfileRegions.add(regionList);
// Update config property value
List<String> regionStrings = new ArrayList<>();
for(List<Integer> region : ConfigMain.RestrictedProfileRegions) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < region.size(); i++) {
if(i > 0) sb.append(", ");
sb.append(region.get(i));
}
regionStrings.add(sb.toString());
}
ConfigMain.RestrictedProfileRegionsProperty.set(regionStrings.toArray(new String[0]));
if(ConfigMain.config.hasChanged()){
ConfigMain.config.save();
}
sendResult(sender, "Region added successfully.");
}
@SubCommand(
desc = "Remove a region by its index (1-based).",
usage = "<index>"
)
public void remove(ICommandSender sender, String[] args) throws CommandException {
if(args.length < 1){
sendError(sender, "Usage: /profile region remove <index>");
return;
}
int index;
try {
index = Integer.parseInt(args[0]);
} catch(NumberFormatException e){
sendError(sender, "Index must be a number.");
return;
}
index = index - 1; // Convert to 0-based index
if(index < 0 || index >= ConfigMain.RestrictedProfileRegions.size()){
sendError(sender, "Invalid index. Must be between 1 and " + ConfigMain.RestrictedProfileRegions.size());
return;
}
ConfigMain.RestrictedProfileRegions.remove(index);
// Update config property value
List<String> regionStrings = new ArrayList<>();
for(List<Integer> region : ConfigMain.RestrictedProfileRegions) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < region.size(); i++) {
if(i > 0) sb.append(", ");
sb.append(region.get(i));
}
regionStrings.add(sb.toString());
}
ConfigMain.RestrictedProfileRegionsProperty.set(regionStrings.toArray(new String[0]));
if(ConfigMain.config.hasChanged()){
ConfigMain.config.save();
}
sendResult(sender, "Region removed successfully.");
}
@SubCommand(
desc = "List all restricted profile regions.",
usage = ""
)
public void list(ICommandSender sender, String[] args) throws CommandException {
if(ConfigMain.RestrictedProfileRegions.isEmpty()){
sendMessage(sender, "No restricted profile regions configured.");
return;
}
sendMessage(sender, "Restricted Profile Regions:");
int i = 1;
for(List<Integer> region : ConfigMain.RestrictedProfileRegions) {
StringBuilder sb = new StringBuilder();
sb.append(i).append(": ");
for (int j = 0; j < region.size(); j++) {
if(j > 0) sb.append(", ");
sb.append(region.get(j));
}
sendMessage(sender, sb.toString());
i++;
}
}
}
@@ -2,11 +2,11 @@ package kamkeel.npcs.command.profile;
import kamkeel.npcs.controllers.ProfileController;
import kamkeel.npcs.controllers.data.ProfileOperation;
import kamkeel.npcs.controllers.data.EnumProfileOperation;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.player.EntityPlayer;
import static kamkeel.npcs.util.ColorUtil.sendError;
import static kamkeel.npcs.util.ColorUtil.sendResult;
import static kamkeel.npcs.util.ColorUtil.*;
public class CommandProfileRemove extends CommandProfileBase {
@@ -49,18 +49,14 @@ public class CommandProfileRemove extends CommandProfileBase {
}
EntityPlayer player = (EntityPlayer)sender;
ProfileOperation result = ProfileController.removeSlot(player, slotId);
switch(result) {
case SUCCESS:
sendResult(sender, "Successfully removed slot %d from your profile.", slotId);
break;
case LOCKED:
sendError(sender, "Profile is locked. Please try again later.");
break;
case ERROR:
sendError(sender, "Error removing slot. Ensure the slot exists and is not your active slot.");
break;
default:
sendError(sender, "Operation could not be completed.");
if(result.getResult() == EnumProfileOperation.SUCCESS) {
sendResult(sender, "Successfully removed slot %d from your profile.", slotId);
} else if(result.getResult() == EnumProfileOperation.LOCKED) {
sendError(sender, "Profile is locked. Details: %s", result.getMessage());
} else if(result.getResult() == EnumProfileOperation.ERROR) {
sendError(sender, "Error removing slot: %s", result.getMessage());
} else {
sendError(sender, "Unexpected error: %s", result.getMessage());
}
}
}