Compare commits

..

3 Commits

Author SHA1 Message Date
hyperdefined
11d6a5bf91 add new stuff to readme 2026-04-06 14:27:57 -04:00
hyperdefined
df4fadb1f0 remove dupe comment 2026-04-06 12:20:09 -04:00
hyperdefined
c5deb0f7fd config updater 17 2026-04-06 12:19:11 -04:00
6 changed files with 89 additions and 19 deletions

View File

@@ -25,9 +25,13 @@ Here is everything it tracks:
* Flight time with elytras.
* Critical strikes for melee weapons.
* Times trident thrown.
* Logs stripped.
The best part is, this data is stored on the item itself.
This plugin also has compatibility for:
* [RoseStacker](https://modrinth.com/plugin/rosestacker)
If item lore is ever incorrect/missing, you can run `/toolstats reset`. This command fixes the lore on whatever item you are holding.
![Image](https://docs.hyper.lol/plugins/toolstats/assets/image.png)

View File

@@ -37,7 +37,7 @@ import java.io.File;
public final class ToolStats extends JavaPlugin {
public final int CONFIG_VERSION = 16;
public final int CONFIG_VERSION = 17;
public final ComponentLogger logger = this.getComponentLogger();
public final File configFile = new File(this.getDataFolder(), "config.yml");
public boolean tokens = false;

View File

@@ -15,23 +15,6 @@
* along with ToolStats. If not, see <https://www.gnu.org/licenses/>.
*/
/*
* This file is part of ToolStats.
*
* ToolStats is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ToolStats is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ToolStats. If not, see <https://www.gnu.org/licenses/>.
*/
package lol.hyper.toolstats.support.rosestacker;
import dev.rosewood.rosestacker.api.RoseStackerAPI;

View File

@@ -43,6 +43,7 @@ public class ConfigUpdater {
case 13 -> new Version14(toolStats).update(); // 13 to 14
case 14 -> new Version15(toolStats).update(); // 14 to 15
case 15 -> new Version16(toolStats).update(); // 15 to 16
case 16 -> new Version17(toolStats).update(); // 16 to 17
}
}
}

View File

@@ -0,0 +1,82 @@
/*
* This file is part of ToolStats.
*
* ToolStats is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ToolStats is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ToolStats. If not, see <https://www.gnu.org/licenses/>.
*/
package lol.hyper.toolstats.tools.config.versions;
import lol.hyper.toolstats.ToolStats;
import java.io.File;
import java.io.IOException;
import java.util.List;
public class Version17 {
private final ToolStats toolStats;
/**
* Used for updating from version 16 to 17.
*
* @param toolStats ToolStats instance.
*/
public Version17(ToolStats toolStats) {
this.toolStats = toolStats;
}
/**
* Perform the config update.
*/
public void update() {
// save the old config first
try {
toolStats.config.save("plugins" + File.separator + "ToolStats" + File.separator + "config-16.yml");
} catch (IOException exception) {
toolStats.logger.error("Unable to save config-16.yml!", exception);
}
toolStats.logger.info("Updating config.yml to version 17.");
toolStats.config.set("config-version", 17);
toolStats.logger.info("Adding new token to config: logs-stripped");
toolStats.config.set("tokens.data.logs-stripped.title", "&7ToolStats: &8Logs Stripped Token");
toolStats.config.set("tokens.data.logs-stripped.lore", List.of(
"&8Combine with an axe in an anvil to track logs stripped.",
"&8Uses &7{levels} &8level."
));
toolStats.config.set("tokens.data.logs-stripped.levels", 1);
toolStats.config.set("tokens.data.logs-stripped.material", "PAPER");
toolStats.config.set("tokens.data.logs-stripped.custom-model-data.enabled", false);
toolStats.config.set("tokens.data.logs-stripped.custom-model-data.type", "float");
toolStats.config.set("tokens.data.logs-stripped.custom-model-data.value", 1001);
toolStats.logger.info("Adding enabled.logs-stripped");
toolStats.config.set("enabled.logs-stripped", true);
toolStats.logger.info("Adding messages.logs-stripped");
toolStats.config.set("messages.logs-stripped", "&7Logs stripped: &8{logs}");
// save the config and reload it
try {
toolStats.config.save("plugins" + File.separator + "ToolStats" + File.separator + "config.yml");
} catch (IOException exception) {
toolStats.logger.error("Unable to save config.yml!", exception);
}
toolStats.loadConfig();
toolStats.logger.info("Config has been updated to version 17. A copy of version 16 has been saved as config-16.yml");
}
}

View File

@@ -437,4 +437,4 @@ world-limit:
- world_1
- world_2
config-version: 16
config-version: 17