mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2026-04-23 03:21:22 +00:00
Compare commits
3 Commits
27427c9ee6
...
2.0.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11d6a5bf91 | ||
|
|
df4fadb1f0 | ||
|
|
c5deb0f7fd |
@@ -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.
|
||||
|
||||

|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -437,4 +437,4 @@ world-limit:
|
||||
- world_1
|
||||
- world_2
|
||||
|
||||
config-version: 16
|
||||
config-version: 17
|
||||
Reference in New Issue
Block a user