Fix pvp user flag definition.

* Show active result for user flag gui.
* Improve layout for active result.
This commit is contained in:
bloodshot 2020-05-06 02:09:00 -04:00
parent 9116bf5722
commit 7c9df62c44
4 changed files with 26 additions and 18 deletions

View File

@ -747,15 +747,16 @@ private Component getCustomClickableText(GDPermissionUser src, GDClaim claim, GD
.append("=", TextColor.WHITE)
.append(value.replace("minecraft:", ""), TextColor.GRAY);
}
if (customFlag.isAdmin()) {
// show active value
final GDActiveFlagData activeData = this.getActiveDefinitionResult(claim, customFlag, flagData);
hoverBuilder.append("\n\nActive Result", TextColor.AQUA)
.append("\nvalue=", TextColor.WHITE)
.append(activeData.getValue().name().toLowerCase(), TextColor.GOLD)
.append("\ntype=", TextColor.WHITE)
.append(activeData.getType().name(), activeData.getColor());
}
// show active value
final GDActiveFlagData activeData = this.getActiveDefinitionResult(claim, customFlag, flagData);
hoverBuilder.append("\nActive Result: ")
.append("\nvalue", TextColor.DARK_AQUA)
.append("=", TextColor.WHITE)
.append(activeData.getValue().name().toLowerCase(), TextColor.GOLD)
.append("\ntype", TextColor.DARK_AQUA)
.append("=", TextColor.WHITE)
.append(activeData.getType().name() + "\n", activeData.getColor());
}
hasHover = true;

View File

@ -826,6 +826,9 @@ public void registerDefaults() {
.build())
.build());
flagContexts = new HashSet<>();
flagContexts.add(FlagContexts.SOURCE_PLAYER);
flagContexts.add(FlagContexts.TARGET_PLAYER);
this.registerCustomType(
definitionBuilder
.reset()

View File

@ -747,15 +747,16 @@ private Component getCustomClickableText(GDPermissionUser src, GDClaim claim, GD
.append("=", TextColor.WHITE)
.append(value.replace("minecraft:", ""), TextColor.GRAY);
}
if (customFlag.isAdmin()) {
// show active value
final GDActiveFlagData activeData = this.getActiveDefinitionResult(claim, customFlag, flagData);
hoverBuilder.append("\n\nActive Result", TextColor.AQUA)
.append("\nvalue=", TextColor.WHITE)
.append(activeData.getValue().name().toLowerCase(), TextColor.GOLD)
.append("\ntype=", TextColor.WHITE)
.append(activeData.getType().name(), activeData.getColor());
}
// show active value
final GDActiveFlagData activeData = this.getActiveDefinitionResult(claim, customFlag, flagData);
hoverBuilder.append("\nActive Result: ")
.append("\nvalue", TextColor.DARK_AQUA)
.append("=", TextColor.WHITE)
.append(activeData.getValue().name().toLowerCase(), TextColor.GOLD)
.append("\ntype", TextColor.DARK_AQUA)
.append("=", TextColor.WHITE)
.append(activeData.getType().name() + "\n", activeData.getColor());
}
hasHover = true;

View File

@ -826,6 +826,9 @@ public void registerDefaults() {
.build())
.build());
flagContexts = new HashSet<>();
flagContexts.add(FlagContexts.SOURCE_PLAYER);
flagContexts.add(FlagContexts.TARGET_PLAYER);
this.registerCustomType(
definitionBuilder
.reset()