Merge pull request #551 from mxson/disband-arg-less-locale-message

Specify group being disbanded to improve error message
This commit is contained in:
Daniel Saukel 2019-03-23 00:12:37 +01:00 committed by GitHub
commit bdf897b64d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -59,7 +59,7 @@ public class GroupCommand extends DCommand {
if (args.length == 2) { if (args.length == 2) {
if (args[1].equalsIgnoreCase("disband")) { if (args[1].equalsIgnoreCase("disband")) {
disbandGroup(dGroup); disbandGroup(dGroup, null);
return; return;
} else if (args[1].equalsIgnoreCase("show")) { } else if (args[1].equalsIgnoreCase("show")) {
@ -90,7 +90,7 @@ public class GroupCommand extends DCommand {
return; return;
} else if (args[1].equalsIgnoreCase("disband") && DPermission.hasPermission(sender, DPermission.GROUP_ADMIN)) { } else if (args[1].equalsIgnoreCase("disband") && DPermission.hasPermission(sender, DPermission.GROUP_ADMIN)) {
disbandGroup(DGroup.getByName(args[2])); disbandGroup(DGroup.getByName(args[2]), args[2]);
return; return;
} else if (args[1].equalsIgnoreCase("join")) { } else if (args[1].equalsIgnoreCase("join")) {
@ -135,9 +135,11 @@ public class GroupCommand extends DCommand {
} }
} }
public void disbandGroup(DGroup dGroup) { public void disbandGroup(DGroup dGroup, String name) {
if (dGroup == null) { if (dGroup == null) { // only gets here
MessageUtil.sendMessage(sender, DMessage.ERROR_NO_SUCH_GROUP.getMessage()); MessageUtil.sendMessage(sender,
name == null ? DMessage.ERROR_SELF_NOT_IN_GROUP.getMessage()
: DMessage.ERROR_NO_SUCH_GROUP.getMessage(name));
return; return;
} }

View File

@ -87,6 +87,7 @@ public enum DMessage implements Message {
ERROR_NO_PROTECTED_BLOCK("Error_NoDXLBlock", "&4This is not a block protected by DungeonsXL!"), ERROR_NO_PROTECTED_BLOCK("Error_NoDXLBlock", "&4This is not a block protected by DungeonsXL!"),
ERROR_NO_REWARDS_LEFT("Error_NoRewardsLeft", "&4You do not have any item rewards left."), ERROR_NO_REWARDS_LEFT("Error_NoRewardsLeft", "&4You do not have any item rewards left."),
ERROR_NO_REWARDS_TIME("error.noRewardsTime", "&4You cannot receive rewards before &6&v1&4."), ERROR_NO_REWARDS_TIME("error.noRewardsTime", "&4You cannot receive rewards before &6&v1&4."),
ERROR_SELF_NOT_IN_GROUP("Error_SelfNoGroup", "&4You are not in any group."),
ERROR_NO_SUCH_GROUP("Error_NoSuchGroup", "&4The group &6&v1&4 does not exist!"), ERROR_NO_SUCH_GROUP("Error_NoSuchGroup", "&4The group &6&v1&4 does not exist!"),
ERROR_NO_SUCH_MAP("Error_NoSuchMap", "&4The world &6&v1&4 does not exist!"), ERROR_NO_SUCH_MAP("Error_NoSuchMap", "&4The world &6&v1&4 does not exist!"),
ERROR_NO_SUCH_PLAYER("Error_NoSuchPlayer", "&4The player &6&v1&4 does not exist!"), ERROR_NO_SUCH_PLAYER("Error_NoSuchPlayer", "&4The player &6&v1&4 does not exist!"),