mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2025-12-25 10:45:07 +00:00
1.9.11 (spear support)
This commit is contained in:
4
pom.xml
4
pom.xml
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<groupId>lol.hyper</groupId>
|
<groupId>lol.hyper</groupId>
|
||||||
<artifactId>toolstats</artifactId>
|
<artifactId>toolstats</artifactId>
|
||||||
<version>1.9.10</version>
|
<version>1.9.11</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>ToolStats</name>
|
<name>ToolStats</name>
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.papermc.paper</groupId>
|
<groupId>io.papermc.paper</groupId>
|
||||||
<artifactId>paper-api</artifactId>
|
<artifactId>paper-api</artifactId>
|
||||||
<version>1.21.10-R0.1-SNAPSHOT</version>
|
<version>1.21.11-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public final class ToolStats extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
public final NamespacedKey originType = new NamespacedKey(this, "origin");
|
public final NamespacedKey originType = new NamespacedKey(this, "origin");
|
||||||
|
|
||||||
public final int CONFIG_VERSION = 13;
|
public final int CONFIG_VERSION = 14;
|
||||||
public final ComponentLogger logger = this.getComponentLogger();
|
public final ComponentLogger logger = this.getComponentLogger();
|
||||||
public final File configFile = new File(this.getDataFolder(), "config.yml");
|
public final File configFile = new File(this.getDataFolder(), "config.yml");
|
||||||
public boolean tokens = false;
|
public boolean tokens = false;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class ItemChecker {
|
|||||||
mineItems.add(material);
|
mineItems.add(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lowerCase.contains("_sword") || lowerCase.contains("_axe")) {
|
if (lowerCase.contains("_sword") || lowerCase.contains("_axe") || lowerCase.contains("_spear")) {
|
||||||
meleeItems.add(material);
|
meleeItems.add(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ public class ConfigTools {
|
|||||||
case "trident" -> toolStats.config.getBoolean("enabled." + configName + ".trident");
|
case "trident" -> toolStats.config.getBoolean("enabled." + configName + ".trident");
|
||||||
case "fishing-rod" -> toolStats.config.getBoolean("enabled." + configName + ".fishing-rod");
|
case "fishing-rod" -> toolStats.config.getBoolean("enabled." + configName + ".fishing-rod");
|
||||||
case "mace" -> toolStats.config.getBoolean("enabled." + configName + ".mace");
|
case "mace" -> toolStats.config.getBoolean("enabled." + configName + ".mace");
|
||||||
|
case "spear" -> toolStats.config.getBoolean("enabled." + configName + ".spear");
|
||||||
case "helmet", "chestplate", "leggings", "boots" ->
|
case "helmet", "chestplate", "leggings", "boots" ->
|
||||||
toolStats.config.getBoolean("enabled." + configName + ".armor");
|
toolStats.config.getBoolean("enabled." + configName + ".armor");
|
||||||
default -> false;
|
default -> false;
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public class ConfigUpdater {
|
|||||||
case 10 -> new Version11(toolStats).update(); // 10 to 11
|
case 10 -> new Version11(toolStats).update(); // 10 to 11
|
||||||
case 11 -> new Version12(toolStats).update(); // 11 to 12
|
case 11 -> new Version12(toolStats).update(); // 11 to 12
|
||||||
case 12 -> new Version13(toolStats).update(); // 12 to 13
|
case 12 -> new Version13(toolStats).update(); // 12 to 13
|
||||||
|
case 13 -> new Version14(toolStats).update(); // 13 to 14
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* 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 Version14 {
|
||||||
|
|
||||||
|
private final ToolStats toolStats;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for updating from version 13 to 14.
|
||||||
|
*
|
||||||
|
* @param toolStats ToolStats instance.
|
||||||
|
*/
|
||||||
|
public Version14(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-13.yml");
|
||||||
|
} catch (IOException exception) {
|
||||||
|
toolStats.logger.error("Unable to save config-13.yml!", exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
toolStats.logger.info("Updating config.yml to version 14.");
|
||||||
|
toolStats.config.set("config-version", 14);
|
||||||
|
|
||||||
|
// add spear to sections to be a toggle
|
||||||
|
toolStats.config.set("enabled.crafted-by.spear", true);
|
||||||
|
toolStats.logger.info("Adding enabled.crafted-by.spear");
|
||||||
|
|
||||||
|
toolStats.config.set("enabled.crafted-on.spear", true);
|
||||||
|
toolStats.logger.info("Adding enabled.crafted-on.spear");
|
||||||
|
|
||||||
|
toolStats.config.set("enabled.looted-by.spear", true);
|
||||||
|
toolStats.logger.info("Adding enabled.looted-by.spear");
|
||||||
|
|
||||||
|
toolStats.config.set("enabled.looted-on.spear", true);
|
||||||
|
toolStats.logger.info("Adding enabled.looted-on.spear");
|
||||||
|
|
||||||
|
toolStats.config.set("enabled.damage-done.spear", true);
|
||||||
|
toolStats.logger.info("Adding enabled.damage-done.spear");
|
||||||
|
|
||||||
|
toolStats.config.set("enabled.player-kills.spear", true);
|
||||||
|
toolStats.logger.info("Adding enabled.player-kills.spear");
|
||||||
|
|
||||||
|
toolStats.config.set("enabled.mob-kills.spear", true);
|
||||||
|
toolStats.logger.info("Adding enabled.mob-kills.spear");
|
||||||
|
|
||||||
|
toolStats.config.set("enabled.spawned-in-by.spear", true);
|
||||||
|
toolStats.logger.info("Adding enabled.spawned-in-by.spear");
|
||||||
|
|
||||||
|
toolStats.config.set("enabled.spawned-in-on.spear", true);
|
||||||
|
toolStats.logger.info("Adding enabled.spawned-in-on.spear");
|
||||||
|
|
||||||
|
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 14. A copy of version 13 has been saved as config-13.yml");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -150,6 +150,7 @@ enabled:
|
|||||||
armor: true
|
armor: true
|
||||||
mace: true
|
mace: true
|
||||||
fishing-rod: true
|
fishing-rod: true
|
||||||
|
spear: true
|
||||||
# Will show "Crafted on <date>"
|
# Will show "Crafted on <date>"
|
||||||
crafted-on:
|
crafted-on:
|
||||||
pickaxe: true
|
pickaxe: true
|
||||||
@@ -162,6 +163,7 @@ enabled:
|
|||||||
armor: true
|
armor: true
|
||||||
mace: true
|
mace: true
|
||||||
fishing-rod: true
|
fishing-rod: true
|
||||||
|
spear: true
|
||||||
# Will show "Fished by <player>"
|
# Will show "Fished by <player>"
|
||||||
fished-by:
|
fished-by:
|
||||||
pickaxe: true
|
pickaxe: true
|
||||||
@@ -195,6 +197,7 @@ enabled:
|
|||||||
bow: true
|
bow: true
|
||||||
armor: true
|
armor: true
|
||||||
fishing-rod: true
|
fishing-rod: true
|
||||||
|
spear: true
|
||||||
# Will show "Found on <date>"
|
# Will show "Found on <date>"
|
||||||
looted-on:
|
looted-on:
|
||||||
pickaxe: true
|
pickaxe: true
|
||||||
@@ -206,6 +209,7 @@ enabled:
|
|||||||
bow: true
|
bow: true
|
||||||
armor: true
|
armor: true
|
||||||
fishing-rod: true
|
fishing-rod: true
|
||||||
|
spear: true
|
||||||
# Will show "Traded by <player>"
|
# Will show "Traded by <player>"
|
||||||
traded-by:
|
traded-by:
|
||||||
pickaxe: true
|
pickaxe: true
|
||||||
@@ -234,18 +238,21 @@ enabled:
|
|||||||
trident: true
|
trident: true
|
||||||
bow: true
|
bow: true
|
||||||
mace: true
|
mace: true
|
||||||
|
spear: true
|
||||||
player-kills:
|
player-kills:
|
||||||
sword: true
|
sword: true
|
||||||
axe: true
|
axe: true
|
||||||
trident: true
|
trident: true
|
||||||
bow: true
|
bow: true
|
||||||
mace: true
|
mace: true
|
||||||
|
spear: true
|
||||||
mob-kills:
|
mob-kills:
|
||||||
sword: true
|
sword: true
|
||||||
axe: true
|
axe: true
|
||||||
trident: true
|
trident: true
|
||||||
bow: true
|
bow: true
|
||||||
mace: true
|
mace: true
|
||||||
|
spear: true
|
||||||
blocks-mined:
|
blocks-mined:
|
||||||
pickaxe: true
|
pickaxe: true
|
||||||
shovel: true
|
shovel: true
|
||||||
@@ -264,6 +271,7 @@ enabled:
|
|||||||
armor: true
|
armor: true
|
||||||
mace: true
|
mace: true
|
||||||
fishing-rod: true
|
fishing-rod: true
|
||||||
|
spear: true
|
||||||
# Will show "Spawned in on <date>"
|
# Will show "Spawned in on <date>"
|
||||||
spawned-in-on:
|
spawned-in-on:
|
||||||
pickaxe: true
|
pickaxe: true
|
||||||
@@ -276,6 +284,7 @@ enabled:
|
|||||||
armor: true
|
armor: true
|
||||||
mace: true
|
mace: true
|
||||||
fishing-rod: true
|
fishing-rod: true
|
||||||
|
spear: true
|
||||||
fish-caught: true
|
fish-caught: true
|
||||||
sheep-sheared: true
|
sheep-sheared: true
|
||||||
armor-damage: true
|
armor-damage: true
|
||||||
@@ -346,4 +355,4 @@ normalize-time-creation: false
|
|||||||
# Allows stats and origins to be tracked if the player is in creative mode.
|
# Allows stats and origins to be tracked if the player is in creative mode.
|
||||||
allow-creative: false
|
allow-creative: false
|
||||||
|
|
||||||
config-version: 13
|
config-version: 14
|
||||||
Reference in New Issue
Block a user