Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added unique name check to set name command. #1713

Merged
merged 2 commits into from
May 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ class MfFactionSetNameCommand(private val plugin: MedievalFactions) : CommandExe
player.sendMessage("$RED${plugin.language["CommandFactionSetNameNoFactionPermission"]}")
return@Runnable
}
if (factionService.getFaction(name) != null) {
player.sendMessage("$RED${plugin.language["CommandFactionSetNameFactionAlreadyExists"]}")
return@Runnable
}
val updatedFaction = factionService.save(faction.copy(name = name)).onFailure {
player.sendMessage("$RED${plugin.language["CommandFactionSetNameFailedToSaveFaction"]}")
plugin.logger.log(Level.SEVERE, "Failed to save faction: ${it.reason.message}", it.reason.cause)
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/lang/lang_de_DE.properties
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ CommandFactionSetNameNameTooLong=Dein Fraktionsname darf nicht l
CommandFactionSetNameNoFactionPermission=Deine Rolle in dieser Fraktion gibt dir nicht die Erlaubnis, ihren Namen zu �ndern.
CommandFactionSetNameFailedToSaveFaction=Fraktion konnte nicht gespeichert werden.
CommandFactionSetNameSuccess=Fraktion-Name auf {0} gesetzt.
CommandFactionSetNameFactionAlreadyExists=Eine Fraktion mit diesem Namen existiert bereits.
CommandFactionSetPrefixNotAPlayer=Du hast nicht die Erlaubnis, den Pr�fix deiner Fraktion zu setzen.
CommandFactionSetPrefixOperationCancelled=Operation abgebrochen.
CommandFactionSetPrefixPrefixPrompt=Gib den neuen Pr�fix der Fraktion ein oder gib ''{0}'' ein, um abzubrechen.
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/lang/lang_en_GB.properties
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ CommandFactionSetNameNameTooLong=You cannot have a faction name longer than {0}
CommandFactionSetNameNoFactionPermission=Your role in this faction does not grant you permission to change its name.
CommandFactionSetNameFailedToSaveFaction=Failed to save faction.
CommandFactionSetNameSuccess=Faction name set to {0}.
CommandFactionSetNameFactionAlreadyExists=A faction by that name already exists.
CommandFactionSetPrefixNotAPlayer=You must be a player in order to set your faction''s prefix
CommandFactionSetPrefixOperationCancelled=Operation cancelled.
CommandFactionSetPrefixPrefixPrompt=Enter the new prefix of the faction, or type ''{0}'' to cancel.
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/lang/lang_en_US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ CommandFactionSetNameNameTooLong=You cannot have a faction name longer than {0}
CommandFactionSetNameNoFactionPermission=Your role in this faction does not grant you permission to change its name.
CommandFactionSetNameFailedToSaveFaction=Failed to save faction.
CommandFactionSetNameSuccess=Faction name set to {0}.
CommandFactionSetNameFactionAlreadyExists=A faction by that name already exists.
CommandFactionSetPrefixNotAPlayer=You must be a player in order to set your faction''s prefix
CommandFactionSetPrefixOperationCancelled=Operation cancelled.
CommandFactionSetPrefixPrefixPrompt=Enter the new prefix of the faction, or type ''{0}'' to cancel.
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/lang/lang_fr_FR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ CommandFactionSetNameNameTooLong=Le nom de votre faction ne peut pas d
CommandFactionSetNameNoFactionPermission=Votre r�le dans cette faction ne vous donne pas le droit de changer son nom.
CommandFactionSetNameFailedToSaveFaction=�chec de l''enregistrement de la faction.
CommandFactionSetNameSuccess=Le nom de la faction est r�gl� sur {0}.
CommandFactionSetNameFactionAlreadyExists=Une faction de ce nom existe d�j�.
CommandFactionSetPrefixNotAPlayer=Vous devez �tre un joueur pour pouvoir d�finir le pr�fixe de votre faction.
CommandFactionSetPrefixOperationCancelled=Op�ration annul�e.
CommandFactionSetPrefixPrefixPrompt=Entrez le nouveau pr�fixe de la faction, ou tapez ''{0}'' pour annuler.
Expand Down