Initial commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
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">
|
||||
<parent>
|
||||
<artifactId>ProjectCranked</artifactId>
|
||||
<groupId>net.crankedpvp</groupId>
|
||||
<version>1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>KillCounters</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.crankedpvp</groupId>
|
||||
<artifactId>Utils</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,92 @@
|
||||
package net.crankedpvp.killcounters;
|
||||
|
||||
import de.tr7zw.nbtapi.NBTItem;
|
||||
import net.crankedpvp.crankedutils.utils.CC;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class KillCounterAPI {
|
||||
|
||||
public static ItemStack addOrbToItem(ItemStack itemStack) {
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
List<String> lore = meta.hasLore() ? meta.getLore() : new ArrayList<>();
|
||||
KillCounterPlugin.getInstance().getConfig().getStringList("Applied.Lore").forEach(line -> lore.add(CC.translate(line.replace("%kills%", "0"))));
|
||||
meta.setLore(lore);
|
||||
itemStack.setItemMeta(meta);
|
||||
NBTItem nbtItem = new NBTItem(itemStack);
|
||||
nbtItem.setBoolean("killCounterApplied", true);
|
||||
nbtItem.setInteger("killCount", 0);
|
||||
return nbtItem.getItem();
|
||||
}
|
||||
|
||||
public static ItemStack incrementKillsOnCounter(ItemStack itemStack, int amount) {
|
||||
if(itemStack == null) return null;
|
||||
NBTItem nbtItem = new NBTItem(itemStack);
|
||||
if(!nbtItem.getBoolean("killCounterApplied")) return null;
|
||||
if(!nbtItem.hasKey("killCount")) return null;
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
List<String> lore = meta.getLore();
|
||||
KillCounterPlugin.getInstance().getConfig().getStringList("Applied.Lore").forEach(configLine -> {
|
||||
configLine = configLine.replace("%kills%", String.valueOf(nbtItem.getInteger("killCount")));
|
||||
String finalConfigLine = configLine;
|
||||
lore.removeIf(line -> CC.translate(line).equals(CC.translate(finalConfigLine)));
|
||||
});
|
||||
KillCounterPlugin.getInstance().getConfig().getStringList("Applied.Lore").forEach(configLine -> {
|
||||
lore.add(CC.translate(configLine.replace("%kills%", String.valueOf(nbtItem.getInteger("killCount") + amount))));
|
||||
});
|
||||
meta.setLore(lore);
|
||||
|
||||
itemStack.setItemMeta(meta);
|
||||
|
||||
NBTItem nbtItem1 = new NBTItem(itemStack);
|
||||
nbtItem1.setInteger("killCount", nbtItem1.getInteger("killCount") + amount);
|
||||
return nbtItem1.getItem();
|
||||
}
|
||||
|
||||
public static ItemStack removeKillsOnCounter(ItemStack itemStack, int amount) {
|
||||
if(itemStack == null) return null;
|
||||
NBTItem nbtItem = new NBTItem(itemStack);
|
||||
if(!nbtItem.getBoolean("killCounterApplied")) return null;
|
||||
if(!nbtItem.hasKey("killCount")) return null;
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
List<String> lore = meta.getLore();
|
||||
KillCounterPlugin.getInstance().getConfig().getStringList("Applied.Lore").forEach(configLine -> {
|
||||
configLine = configLine.replace("%kills%", String.valueOf(nbtItem.getInteger("killCount")));
|
||||
String finalConfigLine = configLine;
|
||||
lore.removeIf(line -> CC.translate(line).equals(CC.translate(finalConfigLine)));
|
||||
});
|
||||
KillCounterPlugin.getInstance().getConfig().getStringList("Applied.Lore").forEach(configLine -> {
|
||||
lore.add(CC.translate(configLine.replace("%kills%", String.valueOf(nbtItem.getInteger("killCount") - amount))));
|
||||
});
|
||||
meta.setLore(lore);
|
||||
|
||||
itemStack.setItemMeta(meta);
|
||||
|
||||
NBTItem nbtItem1 = new NBTItem(itemStack);
|
||||
nbtItem1.setInteger("killCount", nbtItem1.getInteger("killCount") + amount);
|
||||
return nbtItem1.getItem();
|
||||
}
|
||||
|
||||
public static ItemStack deleteKillCounterFromItem(ItemStack itemStack) {
|
||||
if(itemStack == null) return null;
|
||||
NBTItem nbtItem = new NBTItem(itemStack);
|
||||
if(!nbtItem.getBoolean("killCounterApplied")) return null;
|
||||
if(!nbtItem.hasKey("killCount")) return null;
|
||||
ItemMeta meta = itemStack.getItemMeta();
|
||||
List<String> lore = meta.getLore();
|
||||
KillCounterPlugin.getInstance().getConfig().getStringList("Applied.Lore").forEach(configLine -> {
|
||||
configLine = configLine.replace("%kills%", String.valueOf(nbtItem.getInteger("killCount")));
|
||||
String finalConfigLine = configLine;
|
||||
lore.removeIf(line -> CC.translate(line).equals(CC.translate(finalConfigLine)));
|
||||
});
|
||||
itemStack.setItemMeta(meta);
|
||||
NBTItem nbtItem1 = new NBTItem(itemStack);
|
||||
nbtItem1.removeKey("killCount");
|
||||
nbtItem1.removeKey("killCounterApplied");
|
||||
return nbtItem1.getItem();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package net.crankedpvp.killcounters;
|
||||
|
||||
|
||||
import de.tr7zw.nbtapi.NBTItem;
|
||||
import me.mattstudios.mf.base.CommandManager;
|
||||
import net.crankedpvp.crankedutils.utils.items.ItemBuilder;
|
||||
import net.crankedpvp.killcounters.commands.KillCounterCommand;
|
||||
import net.crankedpvp.killcounters.file.FileHandler;
|
||||
import net.crankedpvp.killcounters.listeners.CounterApplyListener;
|
||||
import net.crankedpvp.killcounters.listeners.DeathEventListener;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class KillCounterPlugin extends JavaPlugin {
|
||||
|
||||
private static KillCounterPlugin instance;
|
||||
private CommandManager commandManager;
|
||||
private ItemStack killCounterOrbItemStack;
|
||||
private FileHandler fileHandler;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
saveDefaultConfig();
|
||||
setupKillCounterOrbItemStack();
|
||||
this.fileHandler = new FileHandler(this);
|
||||
this.fileHandler.load();
|
||||
this.commandManager = new CommandManager(this);
|
||||
this.commandManager.register(new KillCounterCommand(this));
|
||||
this.registerListeners();
|
||||
}
|
||||
|
||||
private void setupKillCounterOrbItemStack() {
|
||||
ConfigurationSection configurationSection = this.getConfig().getConfigurationSection("Item");
|
||||
ItemStack itemStack = new ItemBuilder(Material.getMaterial(configurationSection.getString("Material")))
|
||||
.setName(configurationSection.getString("Name"))
|
||||
.setLore(configurationSection.getStringList("Lore"))
|
||||
.colorize()
|
||||
.build();
|
||||
NBTItem nbtItem = new NBTItem(itemStack);
|
||||
nbtItem.setString("savageCustomItem", "killCounter");
|
||||
this.killCounterOrbItemStack = nbtItem.getItem();
|
||||
}
|
||||
|
||||
private void registerListeners() {
|
||||
PluginManager pluginManager = this.getServer().getPluginManager();
|
||||
pluginManager.registerEvents(new CounterApplyListener(this), this);
|
||||
pluginManager.registerEvents(new DeathEventListener(), this);
|
||||
}
|
||||
|
||||
public ItemStack getKillCounterOrbItemStack() {
|
||||
return this.killCounterOrbItemStack;
|
||||
}
|
||||
|
||||
public static KillCounterPlugin getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public FileHandler getFileHandler() {
|
||||
return fileHandler;
|
||||
}
|
||||
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package net.crankedpvp.killcounters.commands;
|
||||
|
||||
import de.tr7zw.nbtapi.NBTItem;
|
||||
import me.mattstudios.mf.annotations.*;
|
||||
import me.mattstudios.mf.base.CommandBase;
|
||||
import net.crankedpvp.crankedutils.utils.CC;
|
||||
import net.crankedpvp.killcounters.KillCounterAPI;
|
||||
import net.crankedpvp.killcounters.KillCounterPlugin;
|
||||
import net.crankedpvp.killcounters.file.Language;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
@Command("killcounter")
|
||||
@Alias({"astrokillcounter", "savagekillcounter"})
|
||||
public class KillCounterCommand extends CommandBase {
|
||||
|
||||
private final KillCounterPlugin plugin;
|
||||
public KillCounterCommand(KillCounterPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
|
||||
@Default
|
||||
@Permission("killcounter.*")
|
||||
public void defaultCommand(final CommandSender commandSender) {
|
||||
commandSender.sendMessage(CC.translate("&c/killcounter give <player>"));
|
||||
}
|
||||
|
||||
@SubCommand("give")
|
||||
@Permission("killcounter.*")
|
||||
@WrongUsage("&cCranked&fPvP &8| &7Usage: /killcounter give <player>")
|
||||
public void giveKillCounter(final CommandSender commandSender, @Completion("#players") Player player) {
|
||||
Player sender = (Player) commandSender;
|
||||
if(this.plugin.getKillCounterOrbItemStack() == null) return;
|
||||
player.getInventory().addItem(this.plugin.getKillCounterOrbItemStack());
|
||||
player.sendMessage(CC.translate(Language.KILLCOUNTER_RECEIVED.getValue().replace("%giving%", sender.getName()).replace("%receiving%", player.getName())));
|
||||
sender.sendMessage(CC.translate(Language.KILLCOUNTER_GIVEN.getValue().replace("%giving%", sender.getName()).replace("%receiving%", player.getName())));
|
||||
}
|
||||
|
||||
@SubCommand("addkills")
|
||||
@Permission("killcounter.*")
|
||||
@WrongUsage("&cCranked&fPvP &8| &7Usage: /killcounter addkills <amount>")
|
||||
public void addKills(final CommandSender commandSender, Integer amount) {
|
||||
Player sender = (Player) commandSender;
|
||||
ItemStack itemStack = sender.getItemInHand();
|
||||
if(itemStack == null) return;
|
||||
NBTItem nbtItem = new NBTItem(itemStack);
|
||||
if(!nbtItem.getBoolean("killCounterApplied")) return;
|
||||
if(!nbtItem.hasKey("killCount")) return;
|
||||
sender.setItemInHand(KillCounterAPI.incrementKillsOnCounter(sender.getItemInHand(), amount));
|
||||
sender.sendMessage(CC.translate(Language.KILLCOUNTER_INCREMENTED.getValue().replace("%amount%", String.valueOf(amount))));
|
||||
}
|
||||
|
||||
@SubCommand("removekills")
|
||||
@Permission("killcounter.*")
|
||||
@WrongUsage("&cCranked&fPvP &8| &7Usage: /killcounter removekills <amount>")
|
||||
public void removeKills(final CommandSender commandSender, Integer amount) {
|
||||
Player sender = (Player) commandSender;
|
||||
ItemStack itemStack = sender.getItemInHand();
|
||||
if(itemStack == null) return;
|
||||
NBTItem nbtItem = new NBTItem(itemStack);
|
||||
if(!nbtItem.getBoolean("killCounterApplied")) return;
|
||||
if(!nbtItem.hasKey("killCount")) return;
|
||||
sender.setItemInHand(KillCounterAPI.removeKillsOnCounter(sender.getItemInHand(), amount));
|
||||
sender.sendMessage(CC.translate(Language.KILLCOUNTER_REMOVED.getValue().replace("%amount%", String.valueOf(amount))));
|
||||
}
|
||||
|
||||
@SubCommand("deletecounter")
|
||||
@Permission("killcounter.*")
|
||||
@WrongUsage("&cCranked&fPvP &8| &7Usage: /killcounter deletecounter")
|
||||
public void deleteCounter(final CommandSender commandSender) {
|
||||
Player sender = (Player) commandSender;
|
||||
ItemStack itemStack = sender.getItemInHand();
|
||||
if(itemStack == null) return;
|
||||
NBTItem nbtItem = new NBTItem(itemStack);
|
||||
if(!nbtItem.getBoolean("killCounterApplied")) return;
|
||||
if(!nbtItem.hasKey("killCount")) return;
|
||||
sender.setItemInHand(KillCounterAPI.deleteKillCounterFromItem(sender.getItemInHand()));
|
||||
Language.KILLCOUNTER_DELETED.send(sender);
|
||||
}
|
||||
|
||||
@SubCommand("reload")
|
||||
@Permission("killcounter.*")
|
||||
@WrongUsage("&cCranked&fPvP &8| &7Usage: /killcounter reload")
|
||||
public void reload(final CommandSender commandSender) {
|
||||
Player sender = (Player) commandSender;
|
||||
plugin.saveConfig();
|
||||
plugin.getFileHandler().load();
|
||||
Language.KILLCOUNTER_RELOADED.send(sender);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package net.crankedpvp.killcounters.file;
|
||||
|
||||
import net.crankedpvp.killcounters.KillCounterPlugin;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public final class FileHandler {
|
||||
|
||||
private final KillCounterPlugin pluginDelegate;
|
||||
|
||||
public FileHandler(KillCounterPlugin pluginDelegate) {
|
||||
this.pluginDelegate = pluginDelegate;
|
||||
}
|
||||
|
||||
public void load() {
|
||||
loadLanguage();
|
||||
}
|
||||
|
||||
|
||||
private void loadLanguage() {
|
||||
File file = new File(pluginDelegate.getDataFolder(), "language.yml");
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
|
||||
if (!file.exists()) {
|
||||
file.getParentFile().mkdir();
|
||||
pluginDelegate.saveResource(file.getName(),false);
|
||||
}
|
||||
|
||||
try {
|
||||
config.load(file);
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
for (Language entry : Language.values()) {
|
||||
String path = entry.getPath();
|
||||
if (config.isList(path)) {
|
||||
entry.setValue(config.getStringList(path));
|
||||
continue;
|
||||
}
|
||||
entry.setValue(config.getString(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package net.crankedpvp.killcounters.file;
|
||||
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.crankedpvp.crankedutils.utils.CC;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.UnaryOperator;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public enum Language {
|
||||
KILLCOUNTER_GIVEN("Messages.Given"),
|
||||
KILLCOUNTER_RECEIVED("Messages.Received"),
|
||||
KILLCOUNTER_APPLIED("Messages.Applied"),
|
||||
KILLCOUNTER_ALREADY_APPLIED("Messages.Already.Applied"),
|
||||
KILLCOUNTER_INCREMENTED("Messages.Incremented"),
|
||||
KILLCOUNTER_REMOVED("Messages.Removed"),
|
||||
KILLCOUNTER_DELETED("Messages.Deleted"),
|
||||
KILLCOUNTER_RELOADED("Messages.Reloaded")
|
||||
|
||||
;
|
||||
|
||||
|
||||
private final String path;
|
||||
private String value;
|
||||
private ImmutableList<String> valueList;
|
||||
|
||||
Language(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value != null ? value : path;
|
||||
}
|
||||
|
||||
public String getValue(UnaryOperator<String> function) {
|
||||
return value != null ? function.apply(value) : path;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public ImmutableList<String> getValuesAsList() {
|
||||
return valueList;
|
||||
}
|
||||
|
||||
void setValue(String value) {
|
||||
this.value = CC.translate(value);
|
||||
|
||||
List<String> tempList = Arrays.stream(StringUtils.split(value, System.lineSeparator()))
|
||||
.map(CC::translate)
|
||||
.collect(Collectors.toList());
|
||||
valueList = ImmutableList.copyOf(tempList);
|
||||
}
|
||||
|
||||
void setValue(List<String> valueList) {
|
||||
value = CC.translate(valueList.parallelStream().collect(Collectors.joining(System.lineSeparator())));
|
||||
|
||||
List<String> tempList = valueList.stream()
|
||||
.map(CC::translate)
|
||||
.collect(Collectors.toList());
|
||||
this.valueList = ImmutableList.copyOf(tempList);
|
||||
}
|
||||
|
||||
public void send(CommandSender sender, UnaryOperator<String> function) {
|
||||
sender.sendMessage(CC.translate(getValue(function)));
|
||||
}
|
||||
|
||||
public void send(CommandSender sender) {
|
||||
sender.sendMessage(CC.translate(getValue()));
|
||||
}
|
||||
|
||||
public void send(Player player) {
|
||||
player.sendMessage(CC.translate(getValue()));
|
||||
}
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package net.crankedpvp.killcounters.listeners;
|
||||
|
||||
import de.tr7zw.nbtapi.NBTItem;
|
||||
import net.crankedpvp.killcounters.KillCounterAPI;
|
||||
import net.crankedpvp.killcounters.KillCounterPlugin;
|
||||
import net.crankedpvp.killcounters.file.Language;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class CounterApplyListener implements Listener {
|
||||
|
||||
private final KillCounterPlugin plugin;
|
||||
public CounterApplyListener(KillCounterPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void applyKillCounterOrb(InventoryClickEvent event) {
|
||||
if(event.getCursor() == null || event.getCurrentItem() == null || event.getCursor().getType() == Material.AIR || event.getCurrentItem().getType() == Material.AIR) return;
|
||||
if(!itemIsWeapon(event.getCurrentItem())) return;
|
||||
final NBTItem nbtClickedItem = new NBTItem(event.getCurrentItem());
|
||||
final NBTItem nbtCursorItem = new NBTItem(event.getCursor());
|
||||
if(!nbtCursorItem.hasKey("savageCustomItem")) return;
|
||||
if(!nbtCursorItem.getString("savageCustomItem").equals("killCounter")) return;
|
||||
event.setCancelled(true);
|
||||
if(nbtClickedItem.hasKey("killCounterApplied")) {
|
||||
Language.KILLCOUNTER_ALREADY_APPLIED.send(event.getWhoClicked());
|
||||
((Player) event.getWhoClicked()).getPlayer().playSound(event.getWhoClicked().getLocation(), Sound.ANVIL_LAND, 3F, 1.2F);
|
||||
return;
|
||||
}
|
||||
event.setCursor(removeHeldItem(event.getCursor(), 1));
|
||||
event.setCurrentItem(KillCounterAPI.addOrbToItem(event.getCurrentItem()));
|
||||
String displayName = event.getCurrentItem().getItemMeta().hasDisplayName() ? event.getCurrentItem().getItemMeta().getDisplayName() : event.getCurrentItem().getType().name();
|
||||
event.getWhoClicked().sendMessage(Language.KILLCOUNTER_APPLIED.getValue().replace("%item%", displayName));
|
||||
((Player) event.getWhoClicked()).getPlayer().playSound(event.getWhoClicked().getLocation(), Sound.SUCCESSFUL_HIT, 5F, 1.2F);
|
||||
}
|
||||
|
||||
private boolean itemIsWeapon(ItemStack itemStack) {
|
||||
return itemStack.getType().name().endsWith("_SWORD") || itemStack.getType().name().endsWith("_AXE") || itemStack.getType().name().endsWith("_HOE");
|
||||
}
|
||||
|
||||
private ItemStack removeHeldItem(ItemStack itemStack, int amount) {
|
||||
if (itemStack.getAmount() > amount) {
|
||||
itemStack.setAmount(itemStack.getAmount() - amount);
|
||||
return itemStack;
|
||||
}
|
||||
return new ItemStack(Material.AIR);
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package net.crankedpvp.killcounters.listeners;
|
||||
|
||||
import de.tr7zw.nbtapi.NBTItem;
|
||||
import net.crankedpvp.killcounters.KillCounterAPI;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
public class DeathEventListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void killCounterIncrement(EntityDeathEvent event) {
|
||||
if(event.getEntity() == null) return;
|
||||
if(event.getEntity().getKiller() == null) return;
|
||||
if(!(event.getEntity() instanceof Player)) return;
|
||||
|
||||
|
||||
ItemStack itemStack = event.getEntity().getKiller().getItemInHand();
|
||||
|
||||
if(itemStack == null || itemStack.getType() == Material.AIR) return;
|
||||
NBTItem nbtItem = new NBTItem(itemStack);
|
||||
if(!nbtItem.getBoolean("killCounterApplied")) return;
|
||||
if(!nbtItem.hasKey("killCount")) return;
|
||||
|
||||
event.getEntity().getKiller().setItemInHand(KillCounterAPI.incrementKillsOnCounter(itemStack, 1));
|
||||
event.getEntity().getKiller().playSound(event.getEntity().getKiller().getLocation(), Sound.ORB_PICKUP, 2.0F, 2.0F);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
Item:
|
||||
Material: SLIME_BALL
|
||||
Name: "&6&lKill Counter Orb &7(Apply)"
|
||||
Lore:
|
||||
- "&7Drag n' Drop this orb onto any &fweapon"
|
||||
- "&7to start &ftracking &7the amount of kills"
|
||||
- "&7you get while wielding it!"
|
||||
Applied:
|
||||
Lore:
|
||||
- "&f&l(&c&l*&f&l) &cKill Count: &f%kills%"
|
||||
# Use %kills% as a place holder for the amount of kills the kill counter has
|
||||
@@ -0,0 +1,19 @@
|
||||
Messages:
|
||||
Given: "&cCranked&fPvP &8| &7You have given a kill counter orb to %receiving%"
|
||||
# Use %giving% as a placeholder for the player that is running the command
|
||||
# Use %receiving% as a placeholder for the player that is receiving the item
|
||||
Received: "&cCranked&fPvP &8| &7You have received a kill counter orb from %giving%"
|
||||
# Use %giving% as a placeholder for the player that has given the item (defaulted to Console)
|
||||
# Use %receiving% as a placeholder for the player that is receiving the item
|
||||
Applied: "&cCranked&fPvP &8| &7You have applied a kill counter orb to your weapon"
|
||||
# Use %item% as a placeholder for the name of the item being equipped to
|
||||
Incremented: "&cCranked&fPvP &8| &7Your items kill counter has been incremented by %amount%"
|
||||
# Use %amount% as the amount the kill counter has been increased by
|
||||
Removed: "&cCranked&fPvP &8| &7Your items kill counter has had %amount% kills removed from it"
|
||||
# Use %amount% as the amount the kill counter has been decreased by
|
||||
Deleted: "&cCranked&fPvP &8| &7Your items kill counter has been deleted"
|
||||
|
||||
Reloaded: "&cCranked&fPvP &8| &7Kill counters language.yml reloaded."
|
||||
|
||||
Already:
|
||||
Applied: "&cCranked&fPvP &8| &7This item already has a kill counter applied"
|
||||
@@ -0,0 +1,7 @@
|
||||
name: CrankedKillCounters
|
||||
main: net.crankedpvp.killcounters.KillCounterPlugin
|
||||
version: ${git.total.commit.count}.0
|
||||
description: "§fCommit ID: §a${git.commit.id.abbrev}"
|
||||
website: https://crankedpvp.net/
|
||||
depend:
|
||||
- CrankedUtils
|
||||
Reference in New Issue
Block a user