mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2026-03-08 09:21:59 +00:00
added more missing config values
This commit is contained in:
@@ -42,6 +42,7 @@ public class ConfigUpdater {
|
||||
case 12 -> new Version13(toolStats).update(); // 12 to 13
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
public class Version16 {
|
||||
|
||||
private final ToolStats toolStats;
|
||||
|
||||
/**
|
||||
* Used for updating from version 15 to 16.
|
||||
*
|
||||
* @param toolStats ToolStats instance.
|
||||
*/
|
||||
public Version16(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-15.yml");
|
||||
} catch (IOException exception) {
|
||||
toolStats.logger.error("Unable to save config-15.yml!", exception);
|
||||
}
|
||||
|
||||
// we make this super verbose so that admins can see what's being added
|
||||
toolStats.logger.info("Updating config.yml to version 16.");
|
||||
toolStats.config.set("config-version", 16);
|
||||
|
||||
toolStats.logger.info("Adding enabled.crafted-on.shield to config.yml.");
|
||||
toolStats.config.set("enabled.crafted-on.shield", true);
|
||||
toolStats.logger.info("Adding enabled.crafted-by.shield to config.yml.");
|
||||
toolStats.config.set("enabled.crafted-by.shield", true);
|
||||
|
||||
toolStats.logger.info("Adding enabled.traded-on.shield to config.yml.");
|
||||
toolStats.config.set("enabled.traded-on.shield", true);
|
||||
toolStats.logger.info("Adding enabled.traded-by.shield to config.yml.");
|
||||
toolStats.config.set("enabled.traded-by.shield", true);
|
||||
|
||||
toolStats.logger.info("Adding enabled.looted-on.shield to config.yml.");
|
||||
toolStats.config.set("enabled.looted-on.shield", true);
|
||||
toolStats.logger.info("Adding enabled.looted-by.shield to config.yml.");
|
||||
toolStats.config.set("enabled.looted-by.shield", true);
|
||||
|
||||
// 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 16. A copy of version 6 has been saved as config-15.yml");
|
||||
}
|
||||
}
|
||||
@@ -195,6 +195,7 @@ enabled:
|
||||
mace: true
|
||||
fishing-rod: true
|
||||
spear: true
|
||||
shield: true
|
||||
# Will show "Crafted on <date>"
|
||||
crafted-on:
|
||||
pickaxe: true
|
||||
@@ -208,6 +209,7 @@ enabled:
|
||||
mace: true
|
||||
fishing-rod: true
|
||||
spear: true
|
||||
shield: true
|
||||
# Will show "Fished by <player>"
|
||||
fished-by:
|
||||
pickaxe: true
|
||||
@@ -243,7 +245,6 @@ enabled:
|
||||
fishing-rod: true
|
||||
spear: true
|
||||
shield: true
|
||||
elytra: true
|
||||
# Will show "Found on <date>"
|
||||
looted-on:
|
||||
pickaxe: true
|
||||
@@ -257,7 +258,6 @@ enabled:
|
||||
fishing-rod: true
|
||||
spear: true
|
||||
shield: true
|
||||
elytra: true
|
||||
# Will show "Traded by <player>"
|
||||
traded-by:
|
||||
pickaxe: true
|
||||
@@ -269,6 +269,7 @@ enabled:
|
||||
bow: true
|
||||
armor: true
|
||||
fishing-rod: true
|
||||
shield: true
|
||||
# Will show "Traded on <date>"
|
||||
traded-on:
|
||||
pickaxe: true
|
||||
@@ -280,6 +281,7 @@ enabled:
|
||||
bow: true
|
||||
armor: true
|
||||
fishing-rod: true
|
||||
shield: true
|
||||
damage-done:
|
||||
sword: true
|
||||
axe: true
|
||||
|
||||
Reference in New Issue
Block a user