mirror of
https://github.com/hyperdefined/ToolStats.git
synced 2025-12-08 13:44:59 +00:00
more various stuff
This commit is contained in:
17
pom.xml
17
pom.xml
@@ -1,4 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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/>.
|
||||||
|
-->
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* 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.events;
|
package lol.hyper.toolstats.events;
|
||||||
|
|
||||||
import lol.hyper.toolstats.ToolStats;
|
import lol.hyper.toolstats.ToolStats;
|
||||||
@@ -13,9 +30,11 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
import org.bukkit.persistence.PersistentDataContainer;
|
import org.bukkit.persistence.PersistentDataContainer;
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class BlocksMined implements Listener {
|
public class BlocksMined implements Listener {
|
||||||
|
|
||||||
@@ -71,18 +90,18 @@ public class BlocksMined implements Listener {
|
|||||||
for (int x = 0; x < lore.size(); x++) {
|
for (int x = 0; x < lore.size(); x++) {
|
||||||
if (lore.get(x).contains("Blocks mined")) {
|
if (lore.get(x).contains("Blocks mined")) {
|
||||||
hasLore = true;
|
hasLore = true;
|
||||||
lore.set(x, blocksMinedLore.replace("X", Integer.toString(blocksMined)));
|
lore.set(x, blocksMinedLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(blocksMined))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if the item has lore but doesn't have the tag, add it
|
// if the item has lore but doesn't have the tag, add it
|
||||||
if (!hasLore) {
|
if (!hasLore) {
|
||||||
lore.add(blocksMinedLore.replace("X", Integer.toString(blocksMined)));
|
lore.add(blocksMinedLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(blocksMined))));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if the item has no lore, create a new list and add the string
|
// if the item has no lore, create a new list and add the string
|
||||||
lore = new ArrayList<>();
|
lore = new ArrayList<>();
|
||||||
lore.add(blocksMinedLore.replace("X", Integer.toString(blocksMined)));
|
lore.add(blocksMinedLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(blocksMined))));
|
||||||
}
|
}
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
itemStack.setItemMeta(meta);
|
itemStack.setItemMeta(meta);
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* 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.events;
|
package lol.hyper.toolstats.events;
|
||||||
|
|
||||||
import lol.hyper.toolstats.ToolStats;
|
import lol.hyper.toolstats.ToolStats;
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* 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.events;
|
package lol.hyper.toolstats.events;
|
||||||
|
|
||||||
import lol.hyper.toolstats.ToolStats;
|
import lol.hyper.toolstats.ToolStats;
|
||||||
@@ -18,6 +35,7 @@ import org.bukkit.persistence.PersistentDataType;
|
|||||||
|
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
import java.text.NumberFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class EntityDamage implements Listener {
|
public class EntityDamage implements Listener {
|
||||||
@@ -116,18 +134,18 @@ public class EntityDamage implements Listener {
|
|||||||
for (int x = 0; x < lore.size(); x++) {
|
for (int x = 0; x < lore.size(); x++) {
|
||||||
if (lore.get(x).contains("Player kills")) {
|
if (lore.get(x).contains("Player kills")) {
|
||||||
hasLore = true;
|
hasLore = true;
|
||||||
lore.set(x, playerKillsLore.replace("X", Integer.toString(playerKills)));
|
lore.set(x, playerKillsLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(playerKills))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if the item has lore but doesn't have the tag, add it
|
// if the item has lore but doesn't have the tag, add it
|
||||||
if (!hasLore) {
|
if (!hasLore) {
|
||||||
lore.add(playerKillsLore.replace("X", Integer.toString(playerKills)));
|
lore.add(playerKillsLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(playerKills))));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if the item has no lore, create a new list and add the string
|
// if the item has no lore, create a new list and add the string
|
||||||
lore = new ArrayList<>();
|
lore = new ArrayList<>();
|
||||||
lore.add(playerKillsLore.replace("X", Integer.toString(playerKills)));
|
lore.add(playerKillsLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(playerKills))));
|
||||||
}
|
}
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
finalItem.setItemMeta(meta);
|
finalItem.setItemMeta(meta);
|
||||||
@@ -162,18 +180,18 @@ public class EntityDamage implements Listener {
|
|||||||
for (int x = 0; x < lore.size(); x++) {
|
for (int x = 0; x < lore.size(); x++) {
|
||||||
if (lore.get(x).contains("Mob kills")) {
|
if (lore.get(x).contains("Mob kills")) {
|
||||||
hasLore = true;
|
hasLore = true;
|
||||||
lore.set(x, mobKillsLore.replace("X", Integer.toString(mobKills)));
|
lore.set(x, mobKillsLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(mobKills))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if the item has lore but doesn't have the tag, add it
|
// if the item has lore but doesn't have the tag, add it
|
||||||
if (!hasLore) {
|
if (!hasLore) {
|
||||||
lore.add(mobKillsLore.replace("X", Integer.toString(mobKills)));
|
lore.add(mobKillsLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(mobKills))));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if the item has no lore, create a new list and add the string
|
// if the item has no lore, create a new list and add the string
|
||||||
lore = new ArrayList<>();
|
lore = new ArrayList<>();
|
||||||
lore.add(mobKillsLore.replace("X", Integer.toString(mobKills)));
|
lore.add(mobKillsLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(mobKills))));
|
||||||
}
|
}
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
finalItem.setItemMeta(meta);
|
finalItem.setItemMeta(meta);
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* 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.events;
|
package lol.hyper.toolstats.events;
|
||||||
|
|
||||||
import lol.hyper.toolstats.ToolStats;
|
import lol.hyper.toolstats.ToolStats;
|
||||||
@@ -12,8 +29,10 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
import org.bukkit.persistence.PersistentDataContainer;
|
import org.bukkit.persistence.PersistentDataContainer;
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class PlayerFish implements Listener {
|
public class PlayerFish implements Listener {
|
||||||
|
|
||||||
@@ -65,18 +84,18 @@ public class PlayerFish implements Listener {
|
|||||||
for (int x = 0; x < lore.size(); x++) {
|
for (int x = 0; x < lore.size(); x++) {
|
||||||
if (lore.get(x).contains("Fish caught")) {
|
if (lore.get(x).contains("Fish caught")) {
|
||||||
hasLore = true;
|
hasLore = true;
|
||||||
lore.set(x, fishCaughtLore.replace("X", Integer.toString(fishCaught)));
|
lore.set(x, fishCaughtLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(fishCaught))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if the item has lore but doesn't have the tag, add it
|
// if the item has lore but doesn't have the tag, add it
|
||||||
if (!hasLore) {
|
if (!hasLore) {
|
||||||
lore.add(fishCaughtLore.replace("X", Integer.toString(fishCaught)));
|
lore.add(fishCaughtLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(fishCaught))));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if the item has no lore, create a new list and add the string
|
// if the item has no lore, create a new list and add the string
|
||||||
lore = new ArrayList<>();
|
lore = new ArrayList<>();
|
||||||
lore.add(fishCaughtLore.replace("X", Integer.toString(fishCaught)));
|
lore.add(fishCaughtLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(fishCaught))));
|
||||||
}
|
}
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
itemStack.setItemMeta(meta);
|
itemStack.setItemMeta(meta);
|
||||||
|
|||||||
@@ -1,3 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* 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.events;
|
package lol.hyper.toolstats.events;
|
||||||
|
|
||||||
import lol.hyper.toolstats.ToolStats;
|
import lol.hyper.toolstats.ToolStats;
|
||||||
@@ -14,8 +31,10 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
import org.bukkit.persistence.PersistentDataContainer;
|
import org.bukkit.persistence.PersistentDataContainer;
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class SheepShear implements Listener {
|
public class SheepShear implements Listener {
|
||||||
|
|
||||||
@@ -70,18 +89,18 @@ public class SheepShear implements Listener {
|
|||||||
for (int x = 0; x < lore.size(); x++) {
|
for (int x = 0; x < lore.size(); x++) {
|
||||||
if (lore.get(x).contains("Sheep sheared")) {
|
if (lore.get(x).contains("Sheep sheared")) {
|
||||||
hasLore = true;
|
hasLore = true;
|
||||||
lore.set(x, sheepShearLore.replace("X", Integer.toString(sheepSheared)));
|
lore.set(x, sheepShearLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(sheepSheared))));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if the item has lore but doesn't have the tag, add it
|
// if the item has lore but doesn't have the tag, add it
|
||||||
if (!hasLore) {
|
if (!hasLore) {
|
||||||
lore.add(sheepShearLore.replace("X", Integer.toString(sheepSheared)));
|
lore.add(sheepShearLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(sheepSheared))));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if the item has no lore, create a new list and add the string
|
// if the item has no lore, create a new list and add the string
|
||||||
lore = new ArrayList<>();
|
lore = new ArrayList<>();
|
||||||
lore.add(sheepShearLore.replace("X", Integer.toString(sheepSheared)));
|
lore.add(sheepShearLore.replace("X", NumberFormat.getNumberInstance(Locale.US).format(Integer.toString(sheepSheared))));
|
||||||
}
|
}
|
||||||
meta.setLore(lore);
|
meta.setLore(lore);
|
||||||
itemStack.setItemMeta(meta);
|
itemStack.setItemMeta(meta);
|
||||||
|
|||||||
Reference in New Issue
Block a user