Skip to content

Commit

Permalink
Fix zh_HK not being loaded due to case.
Browse files Browse the repository at this point in the history
* Add more translations for flag and option UI.
* Add new config setting 'claim-block-task-move-threshold' to control
  the mininum threshold of movement (in blocks) required to receive
  accrued claim blocks.
  • Loading branch information
bloodmc committed Dec 31, 2020
1 parent 15b2531 commit c419c83
Show file tree
Hide file tree
Showing 19 changed files with 141 additions and 36 deletions.
18 changes: 18 additions & 0 deletions bukkit/src/main/java/com/griefdefender/cache/MessageCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ public static MessageCache getInstance() {
public Component FLAG_UI_CLICK_ALLOW;
public Component FLAG_UI_CLICK_DENY;
public Component FLAG_UI_CLICK_REMOVE;
public Component FLAG_UI_EVENT_CANCEL;
public Component FLAG_UI_HOVER_ACTIVE_RESULT;
public Component FLAG_UI_HOVER_DEFAULT_VALUE;
public Component FLAG_UI_HOVER_DEFINITION_CONTEXTS;
public Component FLAG_UI_HOVER_PARTIAL;
public Component FLAG_UI_INFO_CLAIM;
public Component FLAG_UI_INFO_DEFAULT;
public Component FLAG_UI_INFO_INHERIT;
Expand Down Expand Up @@ -407,6 +412,7 @@ public static MessageCache getInstance() {
public Component OPTION_DESCRIPTION_TAX_EXPIRATION_DAYS_KEEP;
public Component OPTION_DESCRIPTION_TAX_RATE;
public Component OPTION_UI_CLICK_REMOVE;
public Component OPTION_UI_NOT_DEFINED;
public Component OWNER_ADMIN;
public Component PERMISSION_ASSIGN_WITHOUT_HAVING;
public Component PERMISSION_CLAIM_CREATE;
Expand Down Expand Up @@ -514,9 +520,12 @@ public static MessageCache getInstance() {
public Component UI_CLICK_ADD_GROUP;
public Component UI_CLICK_ADD_PLAYER;
public Component UI_CLICK_CONFIRM;
public Component UI_CLICK_RECORD_CHAT;
public Component UI_CLICK_REMOVE;
public Component UI_CLICK_VIEW_TRANSACTIONS;
public Component UI_CONFLICT_DATA;
public Component UI_PAY_NEXT_DUE_DATE;
public Component UI_RECORD_CHAT;
public Component UNTRUST_NO_CLAIMS;
public Component UNTRUST_SELF;

Expand Down Expand Up @@ -771,6 +780,11 @@ public void loadCache() {
FLAG_UI_CLICK_ALLOW = MessageStorage.MESSAGE_DATA.getMessage("flag-ui-click-allow");
FLAG_UI_CLICK_DENY = MessageStorage.MESSAGE_DATA.getMessage("flag-ui-click-deny");
FLAG_UI_CLICK_REMOVE = MessageStorage.MESSAGE_DATA.getMessage("flag-ui-click-remove");
FLAG_UI_EVENT_CANCEL = MessageStorage.MESSAGE_DATA.getMessage("flag-ui-event-cancel");
FLAG_UI_HOVER_ACTIVE_RESULT = MessageStorage.MESSAGE_DATA.getMessage("flag-ui-hover-active-result");
FLAG_UI_HOVER_DEFAULT_VALUE = MessageStorage.MESSAGE_DATA.getMessage("flag-ui-hover-default-value");
FLAG_UI_HOVER_DEFINITION_CONTEXTS = MessageStorage.MESSAGE_DATA.getMessage("flag-ui-hover-definition-contexts");
FLAG_UI_HOVER_PARTIAL = MessageStorage.MESSAGE_DATA.getMessage("flag-ui-hover-partial");
FLAG_UI_INFO_CLAIM = MessageStorage.MESSAGE_DATA.getMessage("flag-ui-info-claim");
FLAG_UI_INFO_DEFAULT = MessageStorage.MESSAGE_DATA.getMessage("flag-ui-info-default");
FLAG_UI_INFO_INHERIT = MessageStorage.MESSAGE_DATA.getMessage("flag-ui-info-inherit");
Expand Down Expand Up @@ -880,6 +894,7 @@ public void loadCache() {
OPTION_DESCRIPTION_TAX_EXPIRATION_DAYS_KEEP = MessageStorage.MESSAGE_DATA.getMessage("option-description-tax-expiration-days-keep");
OPTION_DESCRIPTION_TAX_RATE = MessageStorage.MESSAGE_DATA.getMessage("option-description-tax-rate");
OPTION_UI_CLICK_REMOVE = MessageStorage.MESSAGE_DATA.getMessage("option-ui-click-remove");
OPTION_UI_NOT_DEFINED = MessageStorage.MESSAGE_DATA.getMessage("option-ui-not-defined");
OWNER_ADMIN = MessageStorage.MESSAGE_DATA.getMessage("owner-admin");
PERMISSION_ASSIGN_WITHOUT_HAVING = MessageStorage.MESSAGE_DATA.getMessage("permission-assign-without-having");
PERMISSION_CLAIM_CREATE = MessageStorage.MESSAGE_DATA.getMessage("permission-claim-create");
Expand Down Expand Up @@ -987,9 +1002,12 @@ public void loadCache() {
UI_CLICK_ADD_GROUP = MessageStorage.MESSAGE_DATA.getMessage("ui-click-add-group");
UI_CLICK_ADD_PLAYER = MessageStorage.MESSAGE_DATA.getMessage("ui-click-add-player");
UI_CLICK_CONFIRM = MessageStorage.MESSAGE_DATA.getMessage("ui-click-confirm");
UI_CLICK_RECORD_CHAT = MessageStorage.MESSAGE_DATA.getMessage("ui-click-record-chat");
UI_CLICK_REMOVE = MessageStorage.MESSAGE_DATA.getMessage("ui-click-remove");
UI_CLICK_VIEW_TRANSACTIONS = MessageStorage.MESSAGE_DATA.getMessage("ui-click-view-transactions");
UI_CONFLICT_DATA = MessageStorage.MESSAGE_DATA.getMessage("ui-conflict-data");
UI_PAY_NEXT_DUE_DATE = MessageStorage.MESSAGE_DATA.getMessage("ui-pay-next-due-date");
UI_RECORD_CHAT = MessageStorage.MESSAGE_DATA.getMessage("ui-record-chat");
UNTRUST_NO_CLAIMS = MessageStorage.MESSAGE_DATA.getMessage("untrust-no-claims");
UNTRUST_SELF = MessageStorage.MESSAGE_DATA.getMessage("untrust-self");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ protected void showCustomFlags(GDPermissionUser src, GDClaim claim, String flagG
Component footer = null;
if (player.hasPermission(GDPermissions.ADVANCED_FLAGS)) {
footer = TextComponent.builder().append(whiteOpenBracket)
.append(TextComponent.of("PRESET").color(TextColor.GOLD)).append(whiteCloseBracket)
.append(MessageCache.getInstance().TITLE_PRESET.color(TextColor.GOLD)).append(whiteCloseBracket)
.append(" ")
.append(TextComponent.builder()
.append(TextComponent.of("ADVANCED").color(TextColor.GRAY)
.append(MessageCache.getInstance().TITLE_ADVANCED.color(TextColor.GRAY)
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createClaimFlagConsumer(src, claim, lastActiveMenu)))))
.build())
.build();
Expand Down Expand Up @@ -681,14 +681,14 @@ private Component getCustomClickableText(GDPermissionUser src, GDClaim claim, GD
TextComponent.Builder valueBuilder = TextComponent.builder();
if (!properResult) {
if (hasEditPermission) {
hoverBuilder.append("Conflict Data : \n");
hoverBuilder.append(MessageCache.getInstance().UI_CONFLICT_DATA).append(" : ").append("\n");
for (GDActiveFlagData definitionFlagData : definitionResults) {
hoverBuilder.append(definitionFlagData.getComponent(flagGroup))
.append("\n");
}
hasHover = true;
}
valueBuilder.append("partial");
valueBuilder.append(MessageCache.getInstance().FLAG_UI_HOVER_PARTIAL);
defaultResult = null;
} else {
TextColor valueColor = TextColor.GRAY;
Expand All @@ -715,7 +715,7 @@ private Component getCustomClickableText(GDPermissionUser src, GDClaim claim, GD
hasHover = true;

if (properResult) {
hoverBuilder.append("\nDefault Value: ", TextColor.AQUA);
hoverBuilder.append("\n").append(MessageCache.getInstance().FLAG_UI_HOVER_DEFAULT_VALUE.color(TextColor.AQUA)).append(": ");
final Tristate defaultValue = customFlag.getDefaultValue();
if (defaultValue == Tristate.UNDEFINED) {
hoverBuilder.append(customFlag.getDefaultValue().toString().toLowerCase(), TextColor.GRAY);
Expand All @@ -727,7 +727,7 @@ private Component getCustomClickableText(GDPermissionUser src, GDClaim claim, GD

if (src.getInternalPlayerData().canManageAdminClaims) {
if (!customFlag.getContexts().isEmpty()) {
hoverBuilder.append("\nDefinition Contexts: ");
hoverBuilder.append("\n").append(MessageCache.getInstance().FLAG_UI_HOVER_DEFINITION_CONTEXTS).append(": ");
hoverBuilder.append("\ngd_claim", TextColor.AQUA)
.append("=", TextColor.WHITE)
.append(claim.getUniqueId().toString(), TextColor.GRAY);
Expand Down Expand Up @@ -761,11 +761,11 @@ private Component getCustomClickableText(GDPermissionUser src, GDClaim claim, GD

if (src.getInternalPlayerData().canManageAdminClaims) {
for (FlagData flagData : customFlag.getFlagData()) {
hoverBuilder.append("\nFlag: ")
hoverBuilder.append("\n").append(MessageCache.getInstance().LABEL_FLAG).append(": ")
.append(flagData.getFlag().getName(), TextColor.GREEN);

if (!flagData.getContexts().isEmpty()) {
hoverBuilder.append("\nContexts: ");
hoverBuilder.append("\n").append(MessageCache.getInstance().LABEL_CONTEXT).append(": ");
}
for (Context context : flagData.getContexts()) {
hoverBuilder.append("\n");
Expand All @@ -779,7 +779,7 @@ private Component getCustomClickableText(GDPermissionUser src, GDClaim claim, GD

// show active value
final GDActiveFlagData activeData = this.getActiveDefinitionResult(claim, customFlag, flagData);
hoverBuilder.append("\nActive Result: ")
hoverBuilder.append("\n").append(MessageCache.getInstance().FLAG_UI_HOVER_ACTIVE_RESULT).append(": ")
.append("\nvalue", TextColor.DARK_AQUA)
.append("=", TextColor.WHITE)
.append(activeData.getValue().name().toLowerCase(), TextColor.GOLD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ private Component getHoverContextComponent(Set<Context> contexts) {
}

TextComponent.Builder builder = TextComponent.builder()
.append("\n\nContexts: \n");
.append("\n\n").append(MessageCache.getInstance().LABEL_CONTEXT).append(": \n");

for (Context context : contexts) {
final String key = context.getKey();
Expand Down Expand Up @@ -794,7 +794,7 @@ private Consumer<CommandSender> newOptionValueConsumer(GDPermissionUser src, GDC
Integer value = getMenuTypeValue(TypeToken.of(Integer.class), currentValue);
if (leftArrow) {
if (value == null || value < 1) {
TextAdapter.sendComponent(src.getOnlinePlayer(), TextComponent.of("This value is NOT defined and cannot go any lower."));
TextAdapter.sendComponent(src.getOnlinePlayer(), MessageCache.getInstance().OPTION_UI_NOT_DEFINED.color(TextColor.RED));
} else {
if ((option == Options.MIN_LEVEL || option == Options.MAX_LEVEL || option == Options.MIN_SIZE_Y || option == Options.MAX_SIZE_Y) && value == 1) {
value = null;
Expand Down Expand Up @@ -826,7 +826,7 @@ private Consumer<CommandSender> newOptionValueConsumer(GDPermissionUser src, GDC
Double value = getMenuTypeValue(TypeToken.of(Double.class), currentValue);
if (leftArrow) {
if (value == null || value < 0) {
TextAdapter.sendComponent(src.getOnlinePlayer(), TextComponent.of("This value is NOT defined and cannot go any lower."));
TextAdapter.sendComponent(src.getOnlinePlayer(), MessageCache.getInstance().OPTION_UI_NOT_DEFINED.color(TextColor.RED));
} else {
value -= 0.1;
if (option == Options.ABANDON_RETURN_RATIO && value <= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public class ClaimCategory extends ConfigCategory {
public List<String> explosionEntitySurfaceBlacklist = new ArrayList<>();
@Setting(value = "explosion-surface-block-level", comment = "The 'Y' block level that is considered the surface for explosions. (Default: 63)")
public int explosionSurfaceBlockLevel = 63;
@Setting(value = "claim-block-task-move-threshold", comment = "The minimum threshold of movement (in blocks) required to receive accrued claim blocks. (Default: 0)"
+ "\nNote: The claim block task runs every 5 minutes which is the time each player will get to move the required amount of blocks.")
public int claimBlockTaskMoveThreshold = 0;
@Setting(value = "piston-protection-in-claims", comment = "Whether piston protection should be enabled within claims. Note: This does not affect pistons crossing into another claim, that is always protected. This only determines whether or not GD should process pistons if it doesn't cross into another claim.")
public boolean pistonProtectionInClaims = false;
@Setting(value = "auto-chest-claim-block-radius", comment = "Radius used (in blocks) for auto-created claim when a chest is placed. Set to -1 to disable chest claim creation.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public ClaimBlockTask() {
@Override
public void run() {
for (World world : Bukkit.getServer().getWorlds()) {
final int blockMoveThreshold = GriefDefenderPlugin.getActiveConfig(world).getConfig().claim.claimBlockTaskMoveThreshold;
for (Player player : world.getPlayers()) {
final GDPlayerData playerData = GriefDefenderPlugin.getInstance().dataStore.getOrCreatePlayerData(player.getWorld(), player.getUniqueId());
final GDClaim claim = GriefDefenderPlugin.getInstance().dataStore.getClaimAtPlayer(playerData, player.getLocation());
Expand All @@ -60,7 +61,7 @@ public void run() {
Location lastLocation = playerData.lastAfkCheckLocation;
// if he's not in a vehicle and has moved at least three blocks since the last check and he's not being pushed around by fluids
if (player.getVehicle() == null &&
(lastLocation == null || lastLocation.getWorld() != player.getWorld() || lastLocation.distanceSquared(player.getLocation()) >= 0) &&
(lastLocation == null || lastLocation.getWorld() != player.getWorld() || lastLocation.distanceSquared(player.getLocation()) > (blockMoveThreshold * blockMoveThreshold)) &&
!NMSUtil.getInstance().isBlockWater(player.getLocation().getBlock())) {
int accruedBlocks = playerData.getBlocksAccruedPerHour() / 12;
if (accruedBlocks < 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public Component createRecordChatComponent(Player player, GDClaim claim, GDPlaye
final Component chatSettings = TextComponent.builder()
.append(TextComponent.builder()
.append(whiteOpenBracket)
.append("RECORD-CHAT").color(TextColor.GOLD).append(whiteCloseBracket)
.append(MessageCache.getInstance().UI_RECORD_CHAT).color(TextColor.GOLD).append(whiteCloseBracket)
.clickEvent(ClickEvent.runCommand(GDCallbackHolder.getInstance().createCallbackRunCommand(createChatSettingsConsumer(player, claim, command, returnComponent))))
.hoverEvent(HoverEvent.showText(TextComponent.of("Click here to see recorded chat.")))
.hoverEvent(HoverEvent.showText(MessageCache.getInstance().UI_CLICK_RECORD_CHAT))
.build())
.append(TextComponent.builder()
.append(" ")
Expand Down
9 changes: 9 additions & 0 deletions common/src/main/resources/assets/lang/de_DE.conf
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,11 @@ GriefDefender {
flag-ui-click-deny="Klicke hier, um die Einstellung auf Verboten zu setzen."
flag-ui-click-remove="Klicke hier, um die Einstellung zu entfernen."
flag-ui-click-toggle="Klicke hier, um zwischen den Einstellungen für {flag}&f zu wechseln."
flag-ui-event-cancel="Die Einstellungen konnten nicht geändert werden, das Event wurde von einem Plugin blockiert."
flag-ui-hover-active-result="Resultado Activo"
flag-ui-hover-default-value="Valor por defecto"
flag-ui-hover-definition-contexts="Contextos de definición"
flag-ui-hover-partial="parcial"
flag-ui-info-claim="Das Grundstück überschreibt Standardeinstellungen, um spezifische Einstellungen zu ermöglichen."
flag-ui-info-default="Standardeinstellungen werden zuletzt überprüft. Grundstücke und Überschreibende Einstellungen haben Priorität."
flag-ui-info-inherit="Vererbte Einstellungen können nicht abgeändert werden."
Expand Down Expand Up @@ -629,6 +634,7 @@ GriefDefender {
option-set-target="&aSetze {type}&a für Option &b{option}&a auf {value}&a mit dem Kontext &7{contexts}&a für &6{target}&a."
option-ui-click-toggle="Klicke hier, um {option}&f umzuschalten."
option-ui-inherit-parent="Diese Option wird vererbt von {name}&f und &nkann nicht&f geändert werde."
option-ui-not-defined="Este valor NO está definido y no puede ser reducido."
option-ui-overridden="&cFehler. Die Option &f{option}&c wurde von einem Admin überschrieben."
option-ui-override-no-permission="Diese Option wurde von einem Admin überschrieben und kann &n&cNICHT&f geändert werden."
owner-admin="einem Administrator"
Expand Down Expand Up @@ -829,10 +835,13 @@ GriefDefender {
ui-click-add-target="Klicke hier, um &6{target}&f hinzuzufügen"
ui-click-confirm="Bestätigen"
ui-click-filter-type="Filtern nach: {type}&f"
ui-click-record-chat="Click aquí para ver el chat guardado."
ui-click-remove="Klicke hier, um den Eintrag zu entfernen"
ui-click-return-command="&bZurück zu &6{command}"
ui-click-view="Zum Anzeigen von {target} hier klicken"
ui-click-view-transactions="Click here to view transactions."
ui-conflict-data="Información conflictiva"
ui-record-chat="GUARDAR-CHAT"
untrust-individual-all-claims="&6{target}&a Erlaubnisse für deine Grundstücke zurückgenommen. Um Berechtigungen einzelner Grundstücke zu entfernen, stelle dich drauf und nutze: &f/untrust&a."
untrust-individual-single-claim="&6{target}&a Erlaubnis für dieses Grundstück entfernt. Um Berechtigungen für alle Grundstücke zu entfernen, nutze: &f/untrustall&a."
untrust-no-claims="&cDu hast keine Grundstücke mit Rechten für andere Spieler."
Expand Down
Loading

0 comments on commit c419c83

Please sign in to comment.