From 7a97332b92d6f1311d7cdbbdb5e9d7022d6e4076 Mon Sep 17 00:00:00 2001
From: moo <48740106+moom0o@users.noreply.github.com>
Date: Fri, 30 Jul 2021 19:43:51 -0400
Subject: [PATCH] allow spoofing filesize
---
README.md | 1 +
pom.xml | 2 +-
src/main/java/me/moomoo/worldstats/Commands.java | 2 ++
src/main/java/me/moomoo/worldstats/Expansions.java | 3 +++
src/main/resources/config.yml | 2 ++
5 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 3a4b362..c3a1249 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,7 @@ setting in config.yml to the epoch.
# PlaceholderAPI
* %worldstats_filesize% - Get the cached file size.
+* %worldstats_filesizespoof% - Get the spoofed file size, useful for when you shrink your world.
* %worldstats_players% - Get the cached unique players amount.
* %worldstats_days% - Get how old the map is in DAYS
diff --git a/pom.xml b/pom.xml
index 079110a..dd027a5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
me.moomoo
worldstats
- 1.7
+ 1.8
jar
Worldstats
diff --git a/src/main/java/me/moomoo/worldstats/Commands.java b/src/main/java/me/moomoo/worldstats/Commands.java
index 3711521..ff2170e 100644
--- a/src/main/java/me/moomoo/worldstats/Commands.java
+++ b/src/main/java/me/moomoo/worldstats/Commands.java
@@ -40,6 +40,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
.replace("%months%", String.valueOf(mMonth))
.replace("%days%", String.valueOf(mDay))
.replace("%fileSize%", new DecimalFormat("#.##").format(plugin.size))
+ .replace("%fileSize_spoof%", new DecimalFormat("#.##").format(plugin.size + plugin.getConfig().getLong("spoofsize")))
.replace("%totalPlayers%", String.valueOf(plugin.offlinePlayers))));
} else {
sender.sendMessage(ChatColor.translateAlternateColorCodes('&', s)
@@ -47,6 +48,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
.replace("%months%", String.valueOf(mMonth))
.replace("%days%", String.valueOf(mDay))
.replace("%fileSize%", new DecimalFormat("#.##").format(plugin.size))
+ .replace("%fileSize_spoof%", new DecimalFormat("#.##").format(plugin.size + plugin.getConfig().getLong("spoofsize")))
.replace("%totalPlayers%", String.valueOf(plugin.offlinePlayers)));
}
}
diff --git a/src/main/java/me/moomoo/worldstats/Expansions.java b/src/main/java/me/moomoo/worldstats/Expansions.java
index 4dc18c9..8e451b0 100644
--- a/src/main/java/me/moomoo/worldstats/Expansions.java
+++ b/src/main/java/me/moomoo/worldstats/Expansions.java
@@ -44,6 +44,9 @@ public String onPlaceholderRequest(Player player, @NotNull String identifier) {
if (identifier.equals("filesize")) {
return String.valueOf(new DecimalFormat("#.##").format(plugin.size));
}
+ if (identifier.equals("filesizespoof")) {
+ return String.valueOf(new DecimalFormat("#.##").format(plugin.size + plugin.getConfig().getLong("spoofsize")));
+ }
if (identifier.equals("players")) {
return String.valueOf(plugin.offlinePlayers);
}
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index 1a98a35..23f76a5 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -5,7 +5,9 @@ message:
- '&3The World is &6%years% years, %months% months and %days% days old &3and has a file
size of &6%fileSize% GB'
- '&7-----------------------------------------------------'
+# %fileSize_spoof% for spoofed filesize
filesizeupdate_in_ticks: 72000
+spoofsize: 0 # Specify how many gb should be added on top of the filesize, will be %fileSize_spoof%. Useful for if you shrink your world (deleting useless chunks)
Worlds:
- "./world/region"
- "./world_nether/DIM-1/region"