Switch to translateable captions

This commit is contained in:
dordsor21 2020-10-09 17:47:51 +01:00
parent 76b992509b
commit 4d51dc9b6c
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B
2 changed files with 12 additions and 10 deletions

View File

@ -28,7 +28,6 @@ package com.plotsquared.core.util;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.StaticCaption;
import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.configuration.caption.TranslatableCaption;
import com.plotsquared.core.inject.factory.ProgressSubscriberFactory; import com.plotsquared.core.inject.factory.ProgressSubscriberFactory;
import com.plotsquared.core.location.Location; import com.plotsquared.core.location.Location;
@ -66,7 +65,8 @@ public abstract class RegionManager {
private final GlobalBlockQueue blockQueue; private final GlobalBlockQueue blockQueue;
private final ProgressSubscriberFactory subscriberFactory; private final ProgressSubscriberFactory subscriberFactory;
@Inject public RegionManager(@Nonnull WorldUtil worldUtil, @Nonnull GlobalBlockQueue blockQueue, @Nonnull ProgressSubscriberFactory subscriberFactory) { @Inject
public RegionManager(@Nonnull WorldUtil worldUtil, @Nonnull GlobalBlockQueue blockQueue, @Nonnull ProgressSubscriberFactory subscriberFactory) {
this.worldUtil = worldUtil; this.worldUtil = worldUtil;
this.blockQueue = blockQueue; this.blockQueue = blockQueue;
this.subscriberFactory = subscriberFactory; this.subscriberFactory = subscriberFactory;
@ -189,15 +189,15 @@ public abstract class RegionManager {
copyFromTo(pos1, pos2, relX, relZ, oldWorld, copyFrom, copyTo, false); copyFromTo(pos1, pos2, relX, relZ, oldWorld, copyFrom, copyTo, false);
copyFrom.setCompleteTask(copyTo::enqueue); copyFrom.setCompleteTask(copyTo::enqueue);
if (actor != null && Settings.QUEUE.NOTIFY_PROGRESS) { if (actor != null && Settings.QUEUE.NOTIFY_PROGRESS) {
copyFrom.addProgressSubscriber(subscriberFactory.createFull(actor, Settings.QUEUE.NOTIFY_INTERVAL, Settings.QUEUE.NOTIFY_WAIT, copyFrom.addProgressSubscriber(subscriberFactory
StaticCaption.of("<prefix><gray>Current copy progress: </gray><gold><progress></gold><gray>%</gray>"))); .createFull(actor, Settings.QUEUE.NOTIFY_INTERVAL, Settings.QUEUE.NOTIFY_WAIT, TranslatableCaption.of("swap.progress_region_copy")));
} }
copyFrom copyFrom
.addReadChunks(new CuboidRegion(BlockVector3.at(pos1.getX(), 0, pos1.getZ()), BlockVector3.at(pos2.getX(), 0, pos2.getZ())).getChunks()); .addReadChunks(new CuboidRegion(BlockVector3.at(pos1.getX(), 0, pos1.getZ()), BlockVector3.at(pos2.getX(), 0, pos2.getZ())).getChunks());
copyTo.setCompleteTask(whenDone); copyTo.setCompleteTask(whenDone);
if (actor != null && Settings.QUEUE.NOTIFY_PROGRESS) { if (actor != null && Settings.QUEUE.NOTIFY_PROGRESS) {
copyTo.addProgressSubscriber(subscriberFactory.createFull(actor, Settings.QUEUE.NOTIFY_INTERVAL, Settings.QUEUE.NOTIFY_WAIT, copyTo.addProgressSubscriber(subscriberFactory
StaticCaption.of("<prefix><gray>Current paste progress: </gray><gold><progress></gold><gray>%</gray>"))); .createFull(actor, Settings.QUEUE.NOTIFY_INTERVAL, Settings.QUEUE.NOTIFY_WAIT, TranslatableCaption.of("swap.progress_region_paste")));
} }
return copyFrom.enqueue(); return copyFrom.enqueue();
} }
@ -247,13 +247,13 @@ public abstract class RegionManager {
copyFromTo(pos1, pos2, relX, relZ, world1, fromQueue2, toQueue1, true); copyFromTo(pos1, pos2, relX, relZ, world1, fromQueue2, toQueue1, true);
fromQueue1.setCompleteTask(fromQueue2::enqueue); fromQueue1.setCompleteTask(fromQueue2::enqueue);
if (actor != null && Settings.QUEUE.NOTIFY_PROGRESS) { if (actor != null && Settings.QUEUE.NOTIFY_PROGRESS) {
fromQueue1.addProgressSubscriber(subscriberFactory.createFull(actor, Settings.QUEUE.NOTIFY_INTERVAL, Settings.QUEUE.NOTIFY_WAIT, fromQueue1.addProgressSubscriber(subscriberFactory
TranslatableCaption.of("swap.progress_region1_copy"))); .createFull(actor, Settings.QUEUE.NOTIFY_INTERVAL, Settings.QUEUE.NOTIFY_WAIT, TranslatableCaption.of("swap.progress_region1_copy")));
} }
fromQueue2.setCompleteTask(toQueue1::enqueue); fromQueue2.setCompleteTask(toQueue1::enqueue);
if (actor != null && Settings.QUEUE.NOTIFY_PROGRESS) { if (actor != null && Settings.QUEUE.NOTIFY_PROGRESS) {
fromQueue2.addProgressSubscriber(subscriberFactory.createFull(actor, Settings.QUEUE.NOTIFY_INTERVAL, Settings.QUEUE.NOTIFY_WAIT, fromQueue2.addProgressSubscriber(subscriberFactory
TranslatableCaption.of("swap.progress_region2_copy"))); .createFull(actor, Settings.QUEUE.NOTIFY_INTERVAL, Settings.QUEUE.NOTIFY_WAIT, TranslatableCaption.of("swap.progress_region2_copy")));
} }
toQueue1.setCompleteTask(toQueue2::enqueue); toQueue1.setCompleteTask(toQueue2::enqueue);
if (actor != null && Settings.QUEUE.NOTIFY_PROGRESS) { if (actor != null && Settings.QUEUE.NOTIFY_PROGRESS) {

View File

@ -78,6 +78,8 @@
"swap.progress_region2_copy": "<prefix><gray>Current region 2 copy progress: </gray><gold><progress></gold><gray>%</gray", "swap.progress_region2_copy": "<prefix><gray>Current region 2 copy progress: </gray><gold><progress></gold><gray>%</gray",
"swap.progress_region1_paste": "<prefix><gray>Current region 1 paste progress: </gray><gold><progress></gold><gray>%</gray>", "swap.progress_region1_paste": "<prefix><gray>Current region 1 paste progress: </gray><gold><progress></gold><gray>%</gray>",
"swap.progress_region2_paste": "<prefix><gray>Current region 2 paste progress: </gray><gold><progress></gold><gray>%</gray>", "swap.progress_region2_paste": "<prefix><gray>Current region 2 paste progress: </gray><gold><progress></gold><gray>%</gray>",
"swap.progress_region_copy": "<prefix><gray>Current copy progress: </gray><gold><progress></gold><gray>%</gray>",
"swap.progress_region_paste": "<prefix><gray>Current paste progress: </gray><gold><progress></gold><gray>%</gray>",
"comment.inbox_notification": "<prefix><dark_aqua><amount> </dark_aqua><gray>unread messages. Use <command>.</gray>", "comment.inbox_notification": "<prefix><dark_aqua><amount> </dark_aqua><gray>unread messages. Use <command>.</gray>",
"comment.not_valid_inbox_index": "<prefix><gray>No comment at index <number>.</gray>", "comment.not_valid_inbox_index": "<prefix><gray>No comment at index <number>.</gray>",