Skip to content

Commit 82e9538

Browse files
committed
Implement regenroad and regenallroads messages
1 parent c60b15c commit 82e9538

6 files changed

Lines changed: 17 additions & 14 deletions

File tree

src/main/java/ms/kevi/plotplugin/PlotPlugin.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,8 @@ public void onEnable() {
9999
try(final InputStreamReader inputReader = new InputStreamReader(this.getResource("lang"));
100100
final BufferedReader bufferedReader = new BufferedReader(inputReader)) {
101101
String line;
102-
while((line = bufferedReader.readLine()) != null) {
103-
System.out.println("LINE: " + line);
102+
while((line = bufferedReader.readLine()) != null)
104103
this.saveResource("lang/" + line);
105-
}
106104
} catch(Exception e) {
107105
this.getLogger().error("Could not find the language resources of this plugin!", e);
108106
return;

src/main/java/ms/kevi/plotplugin/command/defaults/RegenAllRoadsCommand.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,24 @@ public boolean execute(Player player, String[] args) {
5050
}
5151

5252
final int chunkRadius = Utils.parseInteger(args.length > 0 ? args[0] : "32", 32);
53-
final int fullSize = (chunkRadius * 2 * chunkRadius * 2) + 4;
5453
final Level level = player.getLevel();
5554
final PlotGenerator plotGenerator = (PlotGenerator) level.getGenerator();
5655

5756
final int pChunkX = player.getChunkX();
5857
final int pChunkZ = player.getChunkZ();
5958

6059
TaskExecutor.executeAsync(() -> {
61-
final long start = System.currentTimeMillis();
62-
int index = 0;
6360
for(int chunkX = -chunkRadius; chunkX <= chunkRadius; chunkX++) {
6461
for(int chunkZ = -chunkRadius; chunkZ <= chunkRadius; chunkZ++) {
65-
index++;
6662
final FullChunk fullChunk = level.getChunk(pChunkX + chunkX, pChunkZ + chunkZ, false);
6763
if(fullChunk != null) plotGenerator.regenerateChunk(plotManager, fullChunk, true);
6864
}
69-
if(index % 5 == 0)
70-
System.out.println("REGENALLROADS STATUS: [" + ((int) (Math.abs((float) index / fullSize) * 100)) + "/100 %] (" + (System.currentTimeMillis() - start) + "ms)");
7165
}
7266

73-
System.out.println("REGENALLROADS FINISHED Took " + (System.currentTimeMillis() - start) + "ms!");
74-
player.sendMessage("Finished Regenallroads Task!");
67+
player.sendMessage(this.translate(player, TranslationKey.REGENALLROADS_FINISHED));
7568
});
7669

77-
player.sendMessage("Starting Regenallroads Task!");
70+
player.sendMessage(this.translate(player, TranslationKey.REGENALLROADS_START));
7871
return true;
7972
}
8073

src/main/java/ms/kevi/plotplugin/command/defaults/RegenRoadCommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ public boolean execute(Player player, String[] args) {
5454
TaskExecutor.executeAsync(() -> {
5555
final FullChunk fullChunk = level.getChunk(pChunkX, pChunkZ, false);
5656
if(fullChunk != null) plotGenerator.regenerateChunk(plotManager, fullChunk, true);
57-
player.sendMessage("Finished Regenroad Task!");
57+
player.sendMessage(this.translate(player, TranslationKey.REGENROAD_FINISHED));
5858
});
5959

60-
player.sendMessage("Starting Regenroad Task!");
60+
player.sendMessage(this.translate(player, TranslationKey.REGENROAD_START));
6161
return true;
6262
}
6363

src/main/java/ms/kevi/plotplugin/lang/TranslationKey.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ public enum TranslationKey {
120120
PLAYER_SELF,
121121
PLOT_POPUP_NO_OWNER,
122122
PLOT_POPUP_OWNER,
123+
REGENALLROADS_FINISHED,
124+
REGENALLROADS_START,
125+
REGENROAD_FINISHED,
126+
REGENROAD_START,
123127
RELOAD_FAILURE,
124128
RELOAD_SUCCESS,
125129
REMOVED_HELPER,

src/main/resources/lang/de_DE.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,7 @@ unlink-failure=&6&lCitybuild &8&l» &r&cDie Grundstücke konnten leider nicht vo
112112
teleport-form-title=Wähle eine Plot Welt aus
113113
teleport-no-plot-world=&6&lCitybuild &8&l» &r&cDie Welt ist keine Grundstückswelt!
114114
teleport-success=&6&lCitybuild &8&l» &r&aDu wurdest erfolgreich in die &6{0}&r&a Grundstückswelt teleportiert!
115+
regenroad-start=&6&lCitybuild &8&l» &r&aGeneriere diesen Weg erneut...
116+
regenroad-finished=&6&lCitybuild &8&l» &r&aDieser Weg wurden erfolgreich neu generiert!
117+
regenallroads-start=&6&lCitybuild &8&l» &r&aGeneriere alle Wege erneut...
118+
regenallroads-finished=&6&lCitybuild &8&l» &r&aAlle Wege wurden erfolgreich neu generiert!

src/main/resources/lang/en_US.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,7 @@ unlink-failure=&6&lCitybuild &8&l» &r&cUnfortunately, the plots could not be se
114114
teleport-form-title=Select a plot world
115115
teleport-no-plot-world=&6&lCitybuild &8&l» &r&cThe world is not a plot world!
116116
teleport-success=&6&lCitybuild &8&l» &r&aYou have been successfully teleported to the plot world &6{0}&r&a!
117+
regenroad-start=&6&lCitybuild &8&l» &r&aRegenerate this road...
118+
regenroad-finished=&6&lCitybuild &8&l» &r&aSuccessfully regenerated this road!
119+
regenallroads-start=&6&lCitybuild &8&l» &r&aRegenerate all roads...
120+
regenallroads-finished=&6&lCitybuild &8&l» &r&aSuccessfully regenerated all roads!

0 commit comments

Comments
 (0)