Compare commits

..

8 Commits

Author SHA1 Message Date
hyperdefined
1176b57886 update java 2026-04-02 16:24:48 -04:00
hyperdefined
5c54182301 check for baby sheep here 2026-04-02 16:23:57 -04:00
hyperdefined
47846df0e4 Merge pull request #121 from hyperdefined/dependabot/maven/com.github.hyperdefined-hyperlib-1.0.10
Bump com.github.hyperdefined:hyperlib from 1.0.9 to 1.0.10
2026-04-02 07:25:17 -04:00
dependabot[bot]
b666323c4a Bump com.github.hyperdefined:hyperlib from 1.0.9 to 1.0.10
Bumps [com.github.hyperdefined:hyperlib](https://github.com/hyperdefined/hyperlib) from 1.0.9 to 1.0.10.
- [Release notes](https://github.com/hyperdefined/hyperlib/releases)
- [Commits](https://github.com/hyperdefined/hyperlib/compare/1.0.9...1.0.10)

---
updated-dependencies:
- dependency-name: com.github.hyperdefined:hyperlib
  dependency-version: 1.0.10
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-02 11:05:22 +00:00
hyperdefined
b484b772cb bump config 2026-03-06 21:04:52 -05:00
hyperdefined
d56eda6512 added more missing config values 2026-03-06 20:59:17 -05:00
hyperdefined
c7a784920d 2.0.2 2026-03-06 20:51:17 -05:00
hyperdefined
e029c1af3b fix #119 2026-03-06 20:50:32 -05:00
10 changed files with 125 additions and 8 deletions

View File

@@ -16,10 +16,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
java-version: 25
- name: Build with Maven
run: mvn -B package --file pom.xml

View File

@@ -23,13 +23,13 @@
<groupId>lol.hyper</groupId>
<artifactId>toolstats</artifactId>
<version>2.0.1</version>
<version>2.0.2</version>
<packaging>jar</packaging>
<name>ToolStats</name>
<properties>
<java.version>21</java.version>
<java.version>25</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -87,7 +87,7 @@
<dependency>
<groupId>com.github.hyperdefined</groupId>
<artifactId>hyperlib</artifactId>
<version>1.0.9</version>
<version>1.0.10</version>
<scope>provided</scope>
</dependency>
</dependencies>

View File

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

View File

@@ -30,7 +30,7 @@ public class ToolStatsLoader implements PluginLoader {
MavenLibraryResolver resolver = new MavenLibraryResolver();
resolver.addRepository(new RemoteRepository.Builder("jitpack", "default", "https://jitpack.io").build());
resolver.addDependency(new Dependency(new DefaultArtifact("com.github.hyperdefined:hyperlib:1.0.9"), null));
resolver.addDependency(new Dependency(new DefaultArtifact("com.github.hyperdefined:hyperlib:1.0.10"), null));
classpathBuilder.addLibrary(resolver);
}

View File

@@ -113,6 +113,29 @@ public class BlockDispenseEvent implements Listener {
lore = new ArrayList<>();
}
// by request
if (newItem.getType() == Material.ELYTRA) {
if (!toolStats.config.getBoolean("enabled.elytra-tag")) {
return null;
}
Component creationDate = toolStats.itemLore.formatCreationTime(timeCreated, 4, newItem);
if (creationDate != null) {
container.set(toolStats.toolStatsKeys.getTimeCreated(), PersistentDataType.LONG, timeCreated);
container.set(toolStats.toolStatsKeys.getOriginType(), PersistentDataType.INTEGER, 4);
lore.add(creationDate);
meta.lore(lore);
}
Component itemOwner = toolStats.itemLore.formatOwner(owner.getName(), 4, newItem);
if (itemOwner != null) {
container.set(toolStats.toolStatsKeys.getItemOwner(), new UUIDDataType(), owner.getUniqueId());
container.set(toolStats.toolStatsKeys.getOriginType(), PersistentDataType.INTEGER, 4);
lore.add(itemOwner);
meta.lore(lore);
}
}
// if creation date is enabled, add it
Component creationDate = toolStats.itemLore.formatCreationTime(timeCreated, 2, newItem);
if (creationDate != null) {

View File

@@ -62,6 +62,11 @@ public class SheepShear implements Listener {
return;
}
// make sure they are not a baby
if (!sheep.isAdult()) {
return;
}
// make sure the sheep is not sheared
if (sheep.isSheared()) {
return;

View File

@@ -53,7 +53,7 @@ public class ConfigTools {
String itemName = material.toString().toLowerCase();
String itemType = null;
// hardcode these
if (material == Material.BOW || material == Material.CROSSBOW || material == Material.SHEARS || material == Material.TRIDENT || material == Material.FISHING_ROD) {
if (material == Material.BOW || material == Material.CROSSBOW || material == Material.SHEARS || material == Material.TRIDENT || material == Material.FISHING_ROD || material == Material.SHIELD) {
switch (material) {
case CROSSBOW:
case BOW: {
@@ -72,6 +72,10 @@ public class ConfigTools {
itemType = "fishing-rod";
break;
}
case SHIELD: {
itemType = "shield";
break;
}
}
} else {
itemType = itemName.substring(itemName.indexOf('_') + 1);
@@ -88,6 +92,7 @@ public class ConfigTools {
case "fishing-rod" -> toolStats.config.getBoolean("enabled." + configName + ".fishing-rod");
case "mace" -> toolStats.config.getBoolean("enabled." + configName + ".mace");
case "spear" -> toolStats.config.getBoolean("enabled." + configName + ".spear");
case "shield" -> toolStats.config.getBoolean("enabled." + configName + ".shield");
case "helmet", "chestplate", "leggings", "boots" ->
toolStats.config.getBoolean("enabled." + configName + ".armor");
default -> false;

View File

@@ -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
}
}
}

View File

@@ -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");
}
}

View File

@@ -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
@@ -242,6 +244,7 @@ enabled:
armor: true
fishing-rod: true
spear: true
shield: true
# Will show "Found on <date>"
looted-on:
pickaxe: true
@@ -254,6 +257,7 @@ enabled:
armor: true
fishing-rod: true
spear: true
shield: true
# Will show "Traded by <player>"
traded-by:
pickaxe: true
@@ -265,6 +269,7 @@ enabled:
bow: true
armor: true
fishing-rod: true
shield: true
# Will show "Traded on <date>"
traded-on:
pickaxe: true
@@ -276,6 +281,7 @@ enabled:
bow: true
armor: true
fishing-rod: true
shield: true
damage-done:
sword: true
axe: true