mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2025-12-24 18:25:08 +00:00
Compare commits
9 Commits
1.9.2
...
71f3a3ea10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71f3a3ea10 | ||
|
|
3f850aaef7 | ||
|
|
427628da6e | ||
|
|
820c1dce51 | ||
|
|
ad1a4fe26e | ||
|
|
ceb1dbd297 | ||
|
|
49f4727100 | ||
|
|
cb5345bd14 | ||
|
|
eeb6038b66 |
6
pom.xml
6
pom.xml
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<groupId>lol.hyper</groupId>
|
<groupId>lol.hyper</groupId>
|
||||||
<artifactId>toolstats</artifactId>
|
<artifactId>toolstats</artifactId>
|
||||||
<version>1.9.2</version>
|
<version>1.9.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>ToolStats</name>
|
<name>ToolStats</name>
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>auto-clean</id>
|
<id>auto-clean</id>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
<version>3.14.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>${java.version}</source>
|
<source>${java.version}</source>
|
||||||
<target>${java.version}</target>
|
<target>${java.version}</target>
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package lol.hyper.toolstats;
|
|||||||
|
|
||||||
import lol.hyper.githubreleaseapi.GitHubRelease;
|
import lol.hyper.githubreleaseapi.GitHubRelease;
|
||||||
import lol.hyper.githubreleaseapi.GitHubReleaseAPI;
|
import lol.hyper.githubreleaseapi.GitHubReleaseAPI;
|
||||||
|
import lol.hyper.githubreleaseapi.ReleaseNotFoundException;
|
||||||
import lol.hyper.toolstats.commands.CommandToolStats;
|
import lol.hyper.toolstats.commands.CommandToolStats;
|
||||||
import lol.hyper.toolstats.events.*;
|
import lol.hyper.toolstats.events.*;
|
||||||
import lol.hyper.toolstats.tools.*;
|
import lol.hyper.toolstats.tools.*;
|
||||||
@@ -251,12 +252,14 @@ public final class ToolStats extends JavaPlugin {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GitHubRelease current = api.getReleaseByTag(this.getPluginMeta().getVersion());
|
GitHubRelease current;
|
||||||
GitHubRelease latest = api.getLatestVersion();
|
try {
|
||||||
if (current == null) {
|
current = api.getReleaseByTag(this.getPluginMeta().getVersion());
|
||||||
|
} catch (ReleaseNotFoundException e) {
|
||||||
logger.warning("You are running a version that does not exist on GitHub. If you are in a dev environment, you can ignore this. Otherwise, this is a bug!");
|
logger.warning("You are running a version that does not exist on GitHub. If you are in a dev environment, you can ignore this. Otherwise, this is a bug!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
GitHubRelease latest = api.getLatestVersion();
|
||||||
int buildsBehind = api.getBuildsBehind(current);
|
int buildsBehind = api.getBuildsBehind(current);
|
||||||
if (buildsBehind == 0) {
|
if (buildsBehind == 0) {
|
||||||
logger.info("You are running the latest version.");
|
logger.info("You are running the latest version.");
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ package lol.hyper.toolstats.events;
|
|||||||
|
|
||||||
import lol.hyper.toolstats.ToolStats;
|
import lol.hyper.toolstats.ToolStats;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -119,17 +120,32 @@ public class EntityDamage implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isMain = shootingPlayerInventory.getItemInMainHand().getType() == Material.BOW || shootingPlayerInventory.getItemInMainHand().getType() == Material.CROSSBOW;
|
||||||
|
boolean isOffHand = shootingPlayerInventory.getItemInOffHand().getType() == Material.BOW || shootingPlayerInventory.getItemInOffHand().getType() == Material.CROSSBOW;
|
||||||
|
|
||||||
// player is shooting another player
|
// player is shooting another player
|
||||||
if (mobBeingAttacked instanceof Player) {
|
if (mobBeingAttacked instanceof Player) {
|
||||||
ItemMeta newItem = toolStats.itemLore.updatePlayerKills(heldBow, 1);
|
ItemMeta newBow = toolStats.itemLore.updatePlayerKills(heldBow, 1);
|
||||||
if (newItem != null) {
|
if (newBow != null) {
|
||||||
shootingPlayerInventory.getItemInMainHand().setItemMeta(newItem);
|
if (isMain && isOffHand) {
|
||||||
|
shootingPlayerInventory.getItemInMainHand().setItemMeta(newBow);
|
||||||
|
} else if (isMain) {
|
||||||
|
shootingPlayerInventory.getItemInMainHand().setItemMeta(newBow);
|
||||||
|
} else if (isOffHand) {
|
||||||
|
shootingPlayerInventory.getItemInOffHand().setItemMeta(newBow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// player is shooting a mob
|
// player is shooting a mob
|
||||||
ItemMeta newItem = toolStats.itemLore.updateMobKills(heldBow, 1);
|
ItemMeta newBow = toolStats.itemLore.updateMobKills(heldBow, 1);
|
||||||
if (newItem != null) {
|
if (newBow != null) {
|
||||||
shootingPlayerInventory.getItemInMainHand().setItemMeta(newItem);
|
if (isMain && isOffHand) {
|
||||||
|
shootingPlayerInventory.getItemInMainHand().setItemMeta(newBow);
|
||||||
|
} else if (isMain) {
|
||||||
|
shootingPlayerInventory.getItemInMainHand().setItemMeta(newBow);
|
||||||
|
} else if (isOffHand) {
|
||||||
|
shootingPlayerInventory.getItemInOffHand().setItemMeta(newBow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
trackedMobs.add(mobBeingAttacked.getUniqueId());
|
trackedMobs.add(mobBeingAttacked.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,9 @@ public class PlayerFish implements Listener {
|
|||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
boolean isMain = inventory.getItemInMainHand().getType() == Material.FISHING_ROD;
|
boolean isMain = inventory.getItemInMainHand().getType() == Material.FISHING_ROD;
|
||||||
boolean isOffHand = inventory.getItemInOffHand().getType() == Material.FISHING_ROD;
|
boolean isOffHand = inventory.getItemInOffHand().getType() == Material.FISHING_ROD;
|
||||||
if (isMain) {
|
if (isMain && isOffHand) {
|
||||||
|
inventory.getItemInMainHand().setItemMeta(newFishingRod);
|
||||||
|
} else if (isMain) {
|
||||||
inventory.getItemInMainHand().setItemMeta(newFishingRod);
|
inventory.getItemInMainHand().setItemMeta(newFishingRod);
|
||||||
} else if (isOffHand) {
|
} else if (isOffHand) {
|
||||||
inventory.getItemInOffHand().setItemMeta(newFishingRod);
|
inventory.getItemInOffHand().setItemMeta(newFishingRod);
|
||||||
|
|||||||
@@ -65,15 +65,17 @@ public class SheepShear implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update the stats
|
// update the stats
|
||||||
ItemMeta newItem = toolStats.itemLore.updateSheepSheared(heldShears, 1);
|
ItemMeta newShears = toolStats.itemLore.updateSheepSheared(heldShears, 1);
|
||||||
if (newItem != null) {
|
if (newShears != null) {
|
||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
boolean isMain = inventory.getItemInMainHand().getType() == Material.SHEARS;
|
boolean isMain = inventory.getItemInMainHand().getType() == Material.SHEARS;
|
||||||
boolean isOffHand = inventory.getItemInOffHand().getType() == Material.SHEARS;
|
boolean isOffHand = inventory.getItemInOffHand().getType() == Material.SHEARS;
|
||||||
if (isMain) {
|
if (isMain && isOffHand) {
|
||||||
inventory.getItemInMainHand().setItemMeta(newItem);
|
inventory.getItemInMainHand().setItemMeta(newShears);
|
||||||
|
} else if (isMain) {
|
||||||
|
inventory.getItemInMainHand().setItemMeta(newShears);
|
||||||
} else if (isOffHand) {
|
} else if (isOffHand) {
|
||||||
inventory.getItemInOffHand().setItemMeta(newItem);
|
inventory.getItemInOffHand().setItemMeta(newShears);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,15 +56,17 @@ public class ShootBow implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemMeta newItem = toolStats.itemLore.updateArrowsShot(heldBow, 1);
|
ItemMeta newBow = toolStats.itemLore.updateArrowsShot(heldBow, 1);
|
||||||
if (newItem != null) {
|
if (newBow != null) {
|
||||||
PlayerInventory inventory = player.getInventory();
|
PlayerInventory inventory = player.getInventory();
|
||||||
boolean isMain = inventory.getItemInMainHand().getType() == Material.BOW || inventory.getItemInMainHand().getType() == Material.CROSSBOW;
|
boolean isMain = inventory.getItemInMainHand().getType() == Material.BOW || inventory.getItemInMainHand().getType() == Material.CROSSBOW;
|
||||||
boolean isOffHand = inventory.getItemInOffHand().getType() == Material.BOW || inventory.getItemInOffHand().getType() == Material.CROSSBOW;
|
boolean isOffHand = inventory.getItemInOffHand().getType() == Material.BOW || inventory.getItemInOffHand().getType() == Material.CROSSBOW;
|
||||||
if (isMain) {
|
if (isMain && isOffHand) {
|
||||||
inventory.getItemInMainHand().setItemMeta(newItem);
|
inventory.getItemInMainHand().setItemMeta(newBow);
|
||||||
|
} else if (isMain) {
|
||||||
|
inventory.getItemInMainHand().setItemMeta(newBow);
|
||||||
} else if (isOffHand) {
|
} else if (isOffHand) {
|
||||||
inventory.getItemInOffHand().setItemMeta(newItem);
|
inventory.getItemInOffHand().setItemMeta(newBow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,6 +220,9 @@ public class ItemChecker {
|
|||||||
// if the player is holding a bow in their main hand, use that one
|
// if the player is holding a bow in their main hand, use that one
|
||||||
// if the bow is in their offhand instead, use that one after checking main hand
|
// if the bow is in their offhand instead, use that one after checking main hand
|
||||||
// Minecraft prioritizes main hand if the player holds in both hands
|
// Minecraft prioritizes main hand if the player holds in both hands
|
||||||
|
if (isMain && isOffHand) {
|
||||||
|
return main;
|
||||||
|
}
|
||||||
if (isMain) {
|
if (isMain) {
|
||||||
return main;
|
return main;
|
||||||
}
|
}
|
||||||
@@ -246,6 +249,9 @@ public class ItemChecker {
|
|||||||
// if the player is holding shears in their main hand, use that one
|
// if the player is holding shears in their main hand, use that one
|
||||||
// if the shears are in their offhand instead, use that one after checking main hand
|
// if the shears are in their offhand instead, use that one after checking main hand
|
||||||
// Minecraft prioritizes main hand if the player holds in both hands
|
// Minecraft prioritizes main hand if the player holds in both hands
|
||||||
|
if (isMain && isOffHand) {
|
||||||
|
return main;
|
||||||
|
}
|
||||||
if (isMain) {
|
if (isMain) {
|
||||||
return main;
|
return main;
|
||||||
}
|
}
|
||||||
@@ -272,6 +278,9 @@ public class ItemChecker {
|
|||||||
// if the player is holding a fishing rod in their main hand, use that one
|
// if the player is holding a fishing rod in their main hand, use that one
|
||||||
// if the fishing rod is in their offhand instead, use that one after checking main hand
|
// if the fishing rod is in their offhand instead, use that one after checking main hand
|
||||||
// Minecraft prioritizes main hand if the player holds in both hands
|
// Minecraft prioritizes main hand if the player holds in both hands
|
||||||
|
if (isMain && isOffHand) {
|
||||||
|
return main;
|
||||||
|
}
|
||||||
if (isMain) {
|
if (isMain) {
|
||||||
return main;
|
return main;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user