mirror of
https://github.com/bloodmc/GriefDefender.git
synced 2024-11-28 13:15:23 +01:00
Fix claim option command adding wrong context.
The claim option command should no longer add a claim context when using default or override contexts. * Fix invalid value error when using 'undefined' to unset an option using claim option commands.
This commit is contained in:
parent
99d0085d96
commit
44fc1c94e6
@ -217,7 +217,7 @@ public void execute(Player player, String[] args) throws InvalidCommandArgument
|
||||
showOptionPermissions(src, (GDClaim) claim, MenuType.CLAIM);
|
||||
return;
|
||||
} else if (option != null && value != null) {
|
||||
if (!((GDOption) option).validateStringValue(value, false)) {
|
||||
if (!value.equalsIgnoreCase("undefined") && !((GDOption) option).validateStringValue(value, false)) {
|
||||
GriefDefenderPlugin.sendMessage(player, MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.OPTION_INVALID_VALUE,
|
||||
ImmutableMap.of(
|
||||
"value", value,
|
||||
@ -227,17 +227,23 @@ public void execute(Player player, String[] args) throws InvalidCommandArgument
|
||||
}
|
||||
|
||||
MenuType type = MenuType.DEFAULT;
|
||||
boolean useClaimContext = true;
|
||||
for (Context context : contextSet) {
|
||||
if (context.getKey().equals(ContextKeys.CLAIM_DEFAULT)) {
|
||||
useClaimContext = false;
|
||||
break;
|
||||
}
|
||||
if (context.getKey().equals(ContextKeys.CLAIM)) {
|
||||
type = MenuType.CLAIM;
|
||||
break;
|
||||
}
|
||||
if (context.getKey().equals(ContextKeys.CLAIM_OVERRIDE)) {
|
||||
type = MenuType.OVERRIDE;
|
||||
useClaimContext = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!option.isGlobal()) {
|
||||
if (!option.isGlobal() && useClaimContext) {
|
||||
contextSet.add(claim.getContext());
|
||||
if (contextSet.isEmpty() ) {
|
||||
type = MenuType.CLAIM;
|
||||
|
@ -217,7 +217,7 @@ public void execute(Player player, String[] args) throws InvalidCommandArgument
|
||||
showOptionPermissions(src, (GDClaim) claim, MenuType.CLAIM);
|
||||
return;
|
||||
} else if (option != null && value != null) {
|
||||
if (!((GDOption) option).validateStringValue(value, false)) {
|
||||
if (!value.equalsIgnoreCase("undefined") && !((GDOption) option).validateStringValue(value, false)) {
|
||||
GriefDefenderPlugin.sendMessage(player, MessageStorage.MESSAGE_DATA.getMessage(MessageStorage.OPTION_INVALID_VALUE,
|
||||
ImmutableMap.of(
|
||||
"value", value,
|
||||
@ -227,17 +227,23 @@ public void execute(Player player, String[] args) throws InvalidCommandArgument
|
||||
}
|
||||
|
||||
MenuType type = MenuType.DEFAULT;
|
||||
boolean useClaimContext = true;
|
||||
for (Context context : contextSet) {
|
||||
if (context.getKey().equals(ContextKeys.CLAIM_DEFAULT)) {
|
||||
useClaimContext = false;
|
||||
break;
|
||||
}
|
||||
if (context.getKey().equals(ContextKeys.CLAIM)) {
|
||||
type = MenuType.CLAIM;
|
||||
break;
|
||||
}
|
||||
if (context.getKey().equals(ContextKeys.CLAIM_OVERRIDE)) {
|
||||
type = MenuType.OVERRIDE;
|
||||
useClaimContext = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!option.isGlobal()) {
|
||||
if (!option.isGlobal() && useClaimContext) {
|
||||
contextSet.add(claim.getContext());
|
||||
if (contextSet.isEmpty() ) {
|
||||
type = MenuType.CLAIM;
|
||||
|
Loading…
Reference in New Issue
Block a user