organisation and hologram interaction

This commit is contained in:
NK 2022-12-04 11:56:52 +00:00
parent f8d85374c9
commit 8441c06a17
19 changed files with 495 additions and 454 deletions

View file

@ -2,12 +2,14 @@ package me.night.nullvalkyrie;
import com.mongodb.client.MongoDatabase;
import io.github.cdimascio.dotenv.Dotenv;
import me.night.nullvalkyrie.events.listeners.CustomItemEvents;
import me.night.nullvalkyrie.events.listeners.DamageEffectEvents;
import me.night.nullvalkyrie.events.listeners.NPCEvents;
import me.night.nullvalkyrie.events.listeners.ServerEvents;
import me.night.nullvalkyrie.ui.inventory.InventoryListener;
import me.night.nullvalkyrie.database.NPCDataManager;
import me.night.nullvalkyrie.discord.DiscordClientManager;
import me.night.nullvalkyrie.enchantments.EnchantmentManager;
import me.night.nullvalkyrie.events.*;
import me.night.nullvalkyrie.npc.*;
import me.night.nullvalkyrie.ui.ScoreboardListener;
import me.night.nullvalkyrie.util.*;
import me.night.nullvalkyrie.commands.*;

View file

@ -1,7 +1,7 @@
package me.night.nullvalkyrie.commands;
import me.night.nullvalkyrie.database.RankDataManager;
import me.night.nullvalkyrie.ui.Rank;
import me.night.nullvalkyrie.enums.Rank;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;

View file

@ -15,7 +15,7 @@ import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
import java.util.UUID;
import static me.night.nullvalkyrie.npc.NPCManager.*;
import static me.night.nullvalkyrie.entities.npcs.NPCManager.*;
public class NPCDataManager {

View file

@ -2,7 +2,7 @@ package me.night.nullvalkyrie.database;
import com.mongodb.client.MongoCursor;
import com.mongodb.client.model.Filters;
import me.night.nullvalkyrie.ui.Rank;
import me.night.nullvalkyrie.enums.Rank;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.bukkit.Bukkit;

View file

@ -1,4 +1,4 @@
package me.night.nullvalkyrie.npc;
package me.night.nullvalkyrie.entities.npcs;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;

View file

@ -1,4 +1,4 @@
package me.night.nullvalkyrie.npc;
package me.night.nullvalkyrie.entities.npcs;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
@ -11,8 +11,8 @@ import java.io.InputStreamReader;
import java.net.URL;
public class Skin {
private String texture;
private String signature;
private final String texture;
private final String signature;
public Skin(String texture, String signature) {
this.texture = texture;
this.signature = signature;

View file

@ -1,4 +1,4 @@
package me.night.nullvalkyrie.ui;
package me.night.nullvalkyrie.enums;
import org.bukkit.ChatColor;

View file

@ -1,47 +1,38 @@
package me.night.nullvalkyrie.items;
import org.bukkit.ChatColor;
public enum Rarity {
COMMON(ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON", ChatColor.WHITE.toString()),
UNCOMMON(net.md_5.bungee.api.ChatColor.of("#31ff09").toString() + ChatColor.BOLD + "UNCOMMON", net.md_5.bungee.api.ChatColor.of("#31ff09").toString()),
RARE(net.md_5.bungee.api.ChatColor.of("#2f57ae").toString() + ChatColor.BOLD + "RARE", net.md_5.bungee.api.ChatColor.of("#2f57ae").toString()),
EPIC(net.md_5.bungee.api.ChatColor.of("#b201b2").toString() + ChatColor.BOLD + "EPIC", net.md_5.bungee.api.ChatColor.of("#b201b2").toString()),
LEGENDARY(net.md_5.bungee.api.ChatColor.of("#ffa21b").toString() + ChatColor.BOLD + "LEGENDARY", net.md_5.bungee.api.ChatColor.of("#ffa21b").toString()),
MYTHIC(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC", net.md_5.bungee.api.ChatColor.of("#ff23ff").toString()),
ULTRA(ChatColor.RED.toString() + ChatColor.BOLD + "ULTRA", ChatColor.RED.toString()),
GRAND(net.md_5.bungee.api.ChatColor.of("#00fdff").toString() + ChatColor.BOLD + "GRAND", net.md_5.bungee.api.ChatColor.of("#00fdff").toString());
private String display;
private String color;
Rarity(String display, String color) {
this.display = display;
this.color = color;
}
public String getDisplay() {
return display;
}
public String getColor() {
return color;
}
public static Rarity getRarity(String str) {
switch(str) {
case "COMMON":
return COMMON;
case "UNCOMMON":
return UNCOMMON;
case "RARE":
return RARE;
case "EPIC":
return EPIC;
case "LEGENDARY":
return LEGENDARY;
case "MYTHIC":
return MYTHIC;
case "ULTRA":
return ULTRA;
case "GRAND":
return GRAND;
default:
return COMMON;
}
}
}
package me.night.nullvalkyrie.enums;
import org.bukkit.ChatColor;
public enum Rarity {
COMMON(ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON", ChatColor.WHITE.toString()),
UNCOMMON(net.md_5.bungee.api.ChatColor.of("#31ff09").toString() + ChatColor.BOLD + "UNCOMMON", net.md_5.bungee.api.ChatColor.of("#31ff09").toString()),
RARE(net.md_5.bungee.api.ChatColor.of("#2f57ae").toString() + ChatColor.BOLD + "RARE", net.md_5.bungee.api.ChatColor.of("#2f57ae").toString()),
EPIC(net.md_5.bungee.api.ChatColor.of("#b201b2").toString() + ChatColor.BOLD + "EPIC", net.md_5.bungee.api.ChatColor.of("#b201b2").toString()),
LEGENDARY(net.md_5.bungee.api.ChatColor.of("#ffa21b").toString() + ChatColor.BOLD + "LEGENDARY", net.md_5.bungee.api.ChatColor.of("#ffa21b").toString()),
MYTHIC(net.md_5.bungee.api.ChatColor.of("#ff23ff").toString() + ChatColor.BOLD + "MYTHIC", net.md_5.bungee.api.ChatColor.of("#ff23ff").toString()),
ULTRA(ChatColor.RED.toString() + ChatColor.BOLD + "ULTRA", ChatColor.RED.toString()),
GRAND(net.md_5.bungee.api.ChatColor.of("#00fdff").toString() + ChatColor.BOLD + "GRAND", net.md_5.bungee.api.ChatColor.of("#00fdff").toString());
private String display;
private String color;
Rarity(String display, String color) {
this.display = display;
this.color = color;
}
public String getDisplay() {
return display;
}
public String getColor() {
return color;
}
public static Rarity getRarity(String str) {
return switch (str) {
case "COMMON" -> COMMON;
case "UNCOMMON" -> UNCOMMON;
case "RARE" -> RARE;
case "EPIC" -> EPIC;
case "LEGENDARY" -> LEGENDARY;
case "MYTHIC" -> MYTHIC;
case "ULTRA" -> ULTRA;
case "GRAND" -> GRAND;
default -> COMMON;
};
}
}

View file

@ -0,0 +1,41 @@
package me.night.nullvalkyrie.events.custom;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class InteractHologramEvent extends Event implements Cancellable {
private boolean isCancelled;
public Player player;
public ArmorStand hologram;
private static final HandlerList HANDLERS = new HandlerList();
public InteractHologramEvent(Player player, ArmorStand hologram) {
this.player = player;
this.hologram = hologram;
}
public Player getPlayer() {
return player;
}
public ArmorStand getHologram() {
return hologram;
}
@Override
public boolean isCancelled() {
return isCancelled;
}
@Override
public void setCancelled(boolean cancel) {
isCancelled = cancel;
}
@NotNull
@Override
public HandlerList getHandlers() {
return HANDLERS;
}
public static HandlerList getHandlerList() { return HANDLERS; }
}

View file

@ -1,4 +1,4 @@
package me.night.nullvalkyrie.npc;
package me.night.nullvalkyrie.events.custom;
import net.minecraft.server.level.EntityPlayer;
import org.bukkit.entity.Player;
@ -7,12 +7,12 @@ import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;
public class RightClickNPC extends Event implements Cancellable {
public class RightClickNPCEvent extends Event implements Cancellable {
private final Player player;
private final EntityPlayer npc;
private boolean isCancelled;
private static final HandlerList HANDLERS = new HandlerList();
public RightClickNPC(Player player, EntityPlayer npc) {
public RightClickNPCEvent(Player player, EntityPlayer npc) {
this.player = player;
this.npc = npc;
}

View file

@ -1,366 +1,356 @@
package me.night.nullvalkyrie.events;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.BlockPosition;
import me.night.nullvalkyrie.items.CustomItemManager;
import me.night.nullvalkyrie.items.Pickaxe;
import me.night.nullvalkyrie.items.Rarity;
import me.night.nullvalkyrie.Main;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.*;
import org.bukkit.event.player.*;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Merchant;
import org.bukkit.inventory.MerchantRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
public class CustomItemEvents implements Listener {
private final Main main;
public CustomItemEvents(Main main) {
this.main = main;
}
@EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
if (e.getDamager().getType().equals(EntityType.SNOWBALL)) {
Snowball sb = (Snowball) e.getDamager();
Player pl = (Player) sb.getShooter();
if (pl.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = pl.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (name.equalsIgnoreCase(Rarity.ULTRA.getColor() + "Snow Gun")) {
((Snowball) e.getDamager()).setShooter(pl.getPlayer());
e.setDamage(2000);
} else if (name.equalsIgnoreCase("AA-12")) {
e.setDamage(7);
} else {
e.setDamage(0);
}
}
}
}
@EventHandler
public void onPlayerFish(PlayerFishEvent e) {
Player player = e.getPlayer();
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (name.equalsIgnoreCase(Rarity.RARE.getColor() + "Grappling Hook")) {
if (e.getState().equals(PlayerFishEvent.State.REEL_IN)) {
Location change = e.getHook().getLocation().subtract(player.getLocation());
player.setVelocity(change.toVector().multiply(0.4));
}
}
}
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
Player player = e.getPlayer();
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
if (name.equalsIgnoreCase(Rarity.GRAND.getColor() + "Teleport Door")) {
Block block = player.getTargetBlock(null, 12);
Location l = block.getLocation();
l.add(0, 1, 0);
float yaw = player.getEyeLocation().getYaw();
float pitch = player.getEyeLocation().getPitch();
l.setYaw(yaw);
l.setPitch(pitch);
player.teleport(l);
player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 10, 10);
} else if (name.equalsIgnoreCase(Rarity.ULTRA.getColor() + "Snow Gun")) {
Snowball s = player.launchProjectile(Snowball.class, player.getLocation().getDirection());
s.setVelocity(player.getLocation().getDirection().multiply(10));
ItemStack weapon = player.getInventory().getItemInMainHand();
ItemMeta weaponMeta = weapon.getItemMeta();
if (weaponMeta != null) {
PersistentDataContainer container = weaponMeta.getPersistentDataContainer();
NamespacedKey ammoKey = CustomItemManager.keys.get(name + ".ammo");
int ammo = container.get(ammoKey, PersistentDataType.INTEGER);
container.set(ammoKey, PersistentDataType.INTEGER, ammo - 1);
int max = container.get(CustomItemManager.keys.get(name + ".maxload"), PersistentDataType.INTEGER);
weapon.setItemMeta(weaponMeta);
e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', "&6AK-47 ( " + (ammo - 1) + "/ " + max + " )")));
}
} else if (name.equalsIgnoreCase(Rarity.MYTHIC.getColor() + "Terminator")) {
Arrow arrow = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
arrow.setVelocity(arrow.getVelocity().multiply(5));
arrow.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
arrow.setShooter(player);
arrow.setDamage(50);
Arrow a1 = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
a1.setVelocity(arrow.getVelocity().rotateAroundY(Math.toRadians(5)).multiply(5));
a1.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
a1.setShooter(player);
a1.setDamage(50);
Arrow a2 = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
a2.setVelocity(arrow.getVelocity().rotateAroundY(Math.toRadians(-5)).multiply(5));
a2.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
a2.setShooter(player);
a2.setDamage(50);
e.setCancelled(true);
} else if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Explosive Bow")) {
Arrow arrow = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
arrow.setVelocity(arrow.getVelocity().multiply(5));
arrow.setShooter(player);
arrow.setDamage(50);
e.setCancelled(true);
}
} else if (e.getAction().equals(Action.LEFT_CLICK_AIR) || e.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
if (name.equalsIgnoreCase(Rarity.MYTHIC.getColor() + "Terminator")) {
Arrow arrow = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
arrow.setVelocity(arrow.getVelocity().multiply(5));
arrow.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
arrow.setShooter(player);
arrow.setDamage(50);
Arrow a1 = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
a1.setVelocity(arrow.getVelocity().rotateAroundY(Math.toRadians(5)).multiply(5));
a1.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
a1.setShooter(player);
a1.setDamage(50);
Arrow a2 = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
a2.setVelocity(arrow.getVelocity().rotateAroundY(Math.toRadians(-5)).multiply(5));
a2.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
a2.setShooter(player);
a2.setDamage(50);
e.setCancelled(true);
} else if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Explosive Bow")) {
Arrow arrow = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
arrow.setVelocity(arrow.getVelocity().multiply(5));
arrow.setShooter(player);
arrow.setDamage(50);
e.setCancelled(true);
}
}
}
}
@EventHandler
public void onEntityShoot(EntityShootBowEvent e) {
if (e.getProjectile() instanceof Arrow) {
if (e.getEntity() instanceof Player) {
Player player = (Player) e.getEntity();
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (name.equalsIgnoreCase(Rarity.MYTHIC.getColor() + "Terminator")) {
e.setCancelled(true);
} else if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Explosive Bow")) {
e.setCancelled(true);
}
}
}
}
}
@EventHandler
public void onProjectileHit(ProjectileHitEvent e) {
if (e.getEntity().getShooter() instanceof Player) {
Player shooter = (Player) e.getEntity().getShooter();
if (shooter.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = shooter.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Frag Grenade")) {
if (e.getHitBlock() == null) {
Location l = e.getHitEntity().getLocation();
e.getEntity().setShooter(shooter);
e.getHitEntity().getWorld().createExplosion(l.getX(), l.getY(), l.getZ(), 100, false, false);
} else if (e.getHitEntity() == null) {
Location l = e.getHitBlock().getLocation();
e.getHitBlock().getWorld().createExplosion(l.getX(), l.getY(), l.getZ(), 100, false, false);
}
} else if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Explosive Bow")) {
Arrow arrow = (Arrow) e.getEntity();
Location al = arrow.getLocation();
arrow.setShooter(shooter);
shooter.getWorld().createExplosion(al, 100, false, false);
}
}
}
}
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent event) {
if (event.getSpawnReason() == CreatureSpawnEvent.SpawnReason.EGG) {
event.setCancelled(true);
}
}
@EventHandler
public void Projectile(ProjectileLaunchEvent e) {
if (e.getEntity().getShooter() instanceof Player) {
Player player = (Player) e.getEntity().getShooter();
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Frag Grenade")) {
Egg s = (Egg) e.getEntity();
s.setVelocity(player.getLocation().getDirection().multiply(10));
}
}
}
}
@EventHandler
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent e) {
int x = e.getBlockClicked().getX() + e.getBlockFace().getModX();
int y = e.getBlockClicked().getY() + e.getBlockFace().getModY();
int z = e.getBlockClicked().getZ() + e.getBlockFace().getModZ();
Player player = e.getPlayer();
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (name.equalsIgnoreCase(Rarity.EPIC.getColor() + "Infinite Water Bucket")) {
e.getPlayer().getWorld().getBlockAt(x, y, z).setType(Material.WATER);
e.setCancelled(true);
} else if (name.equalsIgnoreCase(Rarity.EPIC.getColor() + "Infinite Lava Bucket")) {
e.getPlayer().getWorld().getBlockAt(x, y, z).setType(Material.LAVA);
e.setCancelled(true);
}
}
}
@EventHandler
public void onDamage(EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof Player) {
Player player = (Player) e.getEntity();
// if ((player.getHealth() - e.getDamage()) <= 0) {
// e.setCancelled(true);
// Location loc = player.getWorld().getBlockAt(-3, 23, -3).getLocation();
// player.teleport(loc);
// for (Player p : Bukkit.getOnlinePlayers()) {
// p.sendMessage(e.getDamager() instanceof Player
// ? ChatColor.RED + player.getName() + " has been killed by " + e.getDamager().getName()
// : ChatColor.RED + player.getName() + " died");
// p.hidePlayer(player);
// }
// new BukkitRunnable() {
// @Override
// public void run() {
// for (Player p : Bukkit.getOnlinePlayers()) {
// p.showPlayer(player);
// }
// player.setHealth(20);
// player.teleport(generateRandomCoord(9, Bukkit.getWorld("world")));
// }
// }.runTaskLater(main, 100L);
// countDown(player, new int[]{5});
// }
}
}
private int taskID;
public void countDown(Player player, int[] a) {
taskID = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(main, () -> {
player.sendTitle(ChatColor.RED + "YOU DIED!", ChatColor.GREEN + "You will revive in " + a[0] + " seconds", 0, 20, 0);
a[0]--;
if (a[0] == 0) {
Bukkit.getScheduler().cancelTask(taskID);
}
}, 0L, 20L);
}
private final Map<UUID, Merchant> villagerlist = new HashMap<>();
@EventHandler
public void onClick(PlayerInteractEntityEvent e) {
Player p = e.getPlayer();
Entity clickedEntity = e.getRightClicked();
if (clickedEntity instanceof Creeper) {
if (p.getInventory().getItemInMainHand().getType() != Material.STICK) return;
clickedEntity.remove();
Location loc = clickedEntity.getLocation();
Villager villager = (Villager) p.getWorld().spawnEntity(loc, EntityType.VILLAGER);
villager.setProfession(Villager.Profession.TOOLSMITH);
List<MerchantRecipe> recipes = new ArrayList<>();
MerchantRecipe bread = new MerchantRecipe(new ItemStack(Material.BREAD, 3), 10);
bread.addIngredient(new ItemStack(Material.EMERALD, 10));
recipes.add(bread);
MerchantRecipe tntStick = new MerchantRecipe(CustomItemManager.produceItem("Terminator"), 10);
tntStick.addIngredient(CustomItemManager.produceItem("Widow Sword"));
recipes.add(tntStick);
Merchant merchant = Bukkit.createMerchant("Exchange here");
merchant.setRecipes(recipes);
villagerlist.put(villager.getUniqueId(), merchant);
p.spawnParticle(Particle.END_ROD, loc, 30, 0, 1, 0, 0.2);
p.openMerchant(merchant, true);
}
if (e.getRightClicked() instanceof Villager) {
Merchant merchant = villagerlist.get(clickedEntity.getUniqueId());
if (merchant == null) return;
e.setCancelled(true);
p.openMerchant(merchant, true);
}
}
// For hologram clicks to change page
// @EventHandler
// public void onEntityInteract(EntityInteractEvent e) {
// System.out.println(e.getEntity().getLocation());
// e.getEntity().setCustomName(ChatColor.RED + "Changed name since you ust clicked lol");
// }
private final HashMap<Location, Integer> blockStages = new HashMap<>();
private final HashMap<UUID, Long> miningCooldown = new HashMap<>();
@EventHandler
public void onAnimationEvent(PlayerAnimationEvent e) { //Material blockType, int mineInterval, Pickaxe x
Player player = e.getPlayer();
UUID uuid = player.getUniqueId();
if (!player.getGameMode().equals(GameMode.SURVIVAL)) return;
if (miningCooldown.containsKey(uuid) && (miningCooldown.get(uuid) > System.currentTimeMillis())) return;
else miningCooldown.remove(uuid);
if (!e.getAnimationType().equals(PlayerAnimationType.ARM_SWING)) return;
Block block = player.getTargetBlockExact(4);
if (block == null) return;
Pickaxe pickaxe = new Pickaxe(player.getInventory().getItemInMainHand());
List<Material> materialsThatCanBeMinedFast = pickaxe.multimap.get(pickaxe.getMaterial()); // to get all materials that the pickaxe can mine
if (!materialsThatCanBeMinedFast.contains(block.getType())) return;
long miningPerPhase = pickaxe.getMiningPerPhase(block.getType());
miningCooldown.put(uuid, System.currentTimeMillis() + miningPerPhase);
int blockStage = blockStages.getOrDefault(block.getLocation(), 0);
blockStage = blockStage == 10 ? 0 : blockStage + 1;
blockStages.put(block.getLocation(), blockStage);
sendBlockDamage(player, block);
if (blockStage == 0) {
blockStages.remove(block.getLocation());
block.breakNaturally();
}
}
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
public void sendBlockDamage(Player player, Block block) {
Location location = block.getLocation();
int locationId = location.getBlockX() + location.getBlockY() + location.getBlockZ();
PacketContainer packet = manager.createPacket(PacketType.Play.Server.BLOCK_BREAK_ANIMATION);
packet.getIntegers().write(0, locationId); // set entity ID to the location
packet.getBlockPositionModifier().write(0, new BlockPosition(location.toVector())); // set the block location
packet.getIntegers().write(1, blockStages.get(location)); // set the damage to blockStage
try {
manager.sendServerPacket(player, packet);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
package me.night.nullvalkyrie.events.listeners;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.BlockPosition;
import me.night.nullvalkyrie.items.CustomItemManager;
import me.night.nullvalkyrie.items.Pickaxe;
import me.night.nullvalkyrie.enums.Rarity;
import me.night.nullvalkyrie.Main;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.*;
import org.bukkit.event.player.*;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.Merchant;
import org.bukkit.inventory.MerchantRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
public class CustomItemEvents implements Listener {
private final Main main;
public CustomItemEvents(Main main) {
this.main = main;
}
@EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent e) {
if (e.getDamager().getType().equals(EntityType.SNOWBALL)) {
Snowball sb = (Snowball) e.getDamager();
Player pl = (Player) sb.getShooter();
if (pl.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = pl.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (name.equalsIgnoreCase(Rarity.ULTRA.getColor() + "Snow Gun")) {
((Snowball) e.getDamager()).setShooter(pl.getPlayer());
e.setDamage(2000);
} else if (name.equalsIgnoreCase("AA-12")) {
e.setDamage(7);
} else {
e.setDamage(0);
}
}
}
}
@EventHandler
public void onPlayerFish(PlayerFishEvent e) {
Player player = e.getPlayer();
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (name.equalsIgnoreCase(Rarity.RARE.getColor() + "Grappling Hook")) {
if (e.getState().equals(PlayerFishEvent.State.REEL_IN)) {
Location change = e.getHook().getLocation().subtract(player.getLocation());
player.setVelocity(change.toVector().multiply(0.4));
}
}
}
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
Player player = e.getPlayer();
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
if (name.equalsIgnoreCase(Rarity.GRAND.getColor() + "Teleport Door")) {
Block block = player.getTargetBlock(null, 12);
Location l = block.getLocation();
l.add(0, 1, 0);
float yaw = player.getEyeLocation().getYaw();
float pitch = player.getEyeLocation().getPitch();
l.setYaw(yaw);
l.setPitch(pitch);
player.teleport(l);
player.playSound(player.getLocation(), Sound.ENTITY_ENDERMAN_TELEPORT, 10, 10);
} else if (name.equalsIgnoreCase(Rarity.ULTRA.getColor() + "Snow Gun")) {
Snowball s = player.launchProjectile(Snowball.class, player.getLocation().getDirection());
s.setVelocity(player.getLocation().getDirection().multiply(10));
ItemStack weapon = player.getInventory().getItemInMainHand();
ItemMeta weaponMeta = weapon.getItemMeta();
if (weaponMeta != null) {
PersistentDataContainer container = weaponMeta.getPersistentDataContainer();
NamespacedKey ammoKey = CustomItemManager.keys.get(name + ".ammo");
int ammo = container.get(ammoKey, PersistentDataType.INTEGER);
container.set(ammoKey, PersistentDataType.INTEGER, ammo - 1);
int max = container.get(CustomItemManager.keys.get(name + ".maxload"), PersistentDataType.INTEGER);
weapon.setItemMeta(weaponMeta);
e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.translateAlternateColorCodes('&', "&6AK-47 ( " + (ammo - 1) + "/ " + max + " )")));
}
} else if (name.equalsIgnoreCase(Rarity.MYTHIC.getColor() + "Terminator")) {
Arrow arrow = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
arrow.setVelocity(arrow.getVelocity().multiply(5));
arrow.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
arrow.setShooter(player);
arrow.setDamage(50);
Arrow a1 = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
a1.setVelocity(arrow.getVelocity().rotateAroundY(Math.toRadians(5)).multiply(5));
a1.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
a1.setShooter(player);
a1.setDamage(50);
Arrow a2 = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
a2.setVelocity(arrow.getVelocity().rotateAroundY(Math.toRadians(-5)).multiply(5));
a2.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
a2.setShooter(player);
a2.setDamage(50);
e.setCancelled(true);
} else if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Explosive Bow")) {
Arrow arrow = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
arrow.setVelocity(arrow.getVelocity().multiply(5));
arrow.setShooter(player);
arrow.setDamage(50);
e.setCancelled(true);
}
} else if (e.getAction().equals(Action.LEFT_CLICK_AIR) || e.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
if (name.equalsIgnoreCase(Rarity.MYTHIC.getColor() + "Terminator")) {
Arrow arrow = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
arrow.setVelocity(arrow.getVelocity().multiply(5));
arrow.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
arrow.setShooter(player);
arrow.setDamage(50);
Arrow a1 = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
a1.setVelocity(arrow.getVelocity().rotateAroundY(Math.toRadians(5)).multiply(5));
a1.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
a1.setShooter(player);
a1.setDamage(50);
Arrow a2 = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
a2.setVelocity(arrow.getVelocity().rotateAroundY(Math.toRadians(-5)).multiply(5));
a2.setPickupStatus(Arrow.PickupStatus.DISALLOWED);
a2.setShooter(player);
a2.setDamage(50);
e.setCancelled(true);
} else if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Explosive Bow")) {
Arrow arrow = player.launchProjectile(Arrow.class, player.getEyeLocation().getDirection());
arrow.setVelocity(arrow.getVelocity().multiply(5));
arrow.setShooter(player);
arrow.setDamage(50);
e.setCancelled(true);
}
}
}
}
@EventHandler
public void onEntityShoot(EntityShootBowEvent e) {
if (e.getProjectile() instanceof Arrow) {
if (e.getEntity() instanceof Player player) {
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (name.equalsIgnoreCase(Rarity.MYTHIC.getColor() + "Terminator")) {
e.setCancelled(true);
} else if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Explosive Bow")) {
e.setCancelled(true);
}
}
}
}
}
@EventHandler
public void onProjectileHit(ProjectileHitEvent e) {
if (e.getEntity().getShooter() instanceof Player shooter) {
if (shooter.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = shooter.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Frag Grenade")) {
if (e.getHitBlock() == null) {
Location l = e.getHitEntity().getLocation();
e.getEntity().setShooter(shooter);
e.getHitEntity().getWorld().createExplosion(l.getX(), l.getY(), l.getZ(), 100, false, false);
} else if (e.getHitEntity() == null) {
Location l = e.getHitBlock().getLocation();
e.getHitBlock().getWorld().createExplosion(l.getX(), l.getY(), l.getZ(), 100, false, false);
}
} else if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Explosive Bow")) {
Arrow arrow = (Arrow) e.getEntity();
Location al = arrow.getLocation();
arrow.setShooter(shooter);
shooter.getWorld().createExplosion(al, 100, false, false);
}
}
}
}
@EventHandler
public void onCreatureSpawn(CreatureSpawnEvent event) {
if (event.getSpawnReason() == CreatureSpawnEvent.SpawnReason.EGG) {
event.setCancelled(true);
}
}
@EventHandler
public void Projectile(ProjectileLaunchEvent e) {
if (e.getEntity().getShooter() instanceof Player player) {
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Frag Grenade")) {
Egg s = (Egg) e.getEntity();
s.setVelocity(player.getLocation().getDirection().multiply(10));
}
}
}
}
@EventHandler
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent e) {
int x = e.getBlockClicked().getX() + e.getBlockFace().getModX();
int y = e.getBlockClicked().getY() + e.getBlockFace().getModY();
int z = e.getBlockClicked().getZ() + e.getBlockFace().getModZ();
Player player = e.getPlayer();
if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
if (name.equalsIgnoreCase(Rarity.EPIC.getColor() + "Infinite Water Bucket")) {
e.getPlayer().getWorld().getBlockAt(x, y, z).setType(Material.WATER);
e.setCancelled(true);
} else if (name.equalsIgnoreCase(Rarity.EPIC.getColor() + "Infinite Lava Bucket")) {
e.getPlayer().getWorld().getBlockAt(x, y, z).setType(Material.LAVA);
e.setCancelled(true);
}
}
}
@EventHandler
public void onDamage(EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof Player) {
Player player = (Player) e.getEntity();
// if ((player.getHealth() - e.getDamage()) <= 0) {
// e.setCancelled(true);
// Location loc = player.getWorld().getBlockAt(-3, 23, -3).getLocation();
// player.teleport(loc);
// for (Player p : Bukkit.getOnlinePlayers()) {
// p.sendMessage(e.getDamager() instanceof Player
// ? ChatColor.RED + player.getName() + " has been killed by " + e.getDamager().getName()
// : ChatColor.RED + player.getName() + " died");
// p.hidePlayer(player);
// }
// new BukkitRunnable() {
// @Override
// public void run() {
// for (Player p : Bukkit.getOnlinePlayers()) {
// p.showPlayer(player);
// }
// player.setHealth(20);
// player.teleport(generateRandomCoord(9, Bukkit.getWorld("world")));
// }
// }.runTaskLater(main, 100L);
// countDown(player, new int[]{5});
// }
}
}
private int taskID;
public void countDown(Player player, int[] a) {
taskID = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(main, () -> {
player.sendTitle(ChatColor.RED + "YOU DIED!", ChatColor.GREEN + "You will revive in " + a[0] + " seconds", 0, 20, 0);
a[0]--;
if (a[0] == 0) {
Bukkit.getScheduler().cancelTask(taskID);
}
}, 0L, 20L);
}
private final Map<UUID, Merchant> villagerlist = new HashMap<>();
@EventHandler
public void onClick(PlayerInteractEntityEvent e) {
Player p = e.getPlayer();
Entity clickedEntity = e.getRightClicked();
if (clickedEntity instanceof Creeper) {
if (p.getInventory().getItemInMainHand().getType() != Material.STICK) return;
clickedEntity.remove();
Location loc = clickedEntity.getLocation();
Villager villager = (Villager) p.getWorld().spawnEntity(loc, EntityType.VILLAGER);
villager.setProfession(Villager.Profession.TOOLSMITH);
List<MerchantRecipe> recipes = new ArrayList<>();
MerchantRecipe bread = new MerchantRecipe(new ItemStack(Material.BREAD, 3), 10);
bread.addIngredient(new ItemStack(Material.EMERALD, 10));
recipes.add(bread);
MerchantRecipe tntStick = new MerchantRecipe(CustomItemManager.produceItem("Terminator"), 10);
tntStick.addIngredient(CustomItemManager.produceItem("Widow Sword"));
recipes.add(tntStick);
Merchant merchant = Bukkit.createMerchant("Exchange here");
merchant.setRecipes(recipes);
villagerlist.put(villager.getUniqueId(), merchant);
p.spawnParticle(Particle.END_ROD, loc, 30, 0, 1, 0, 0.2);
p.openMerchant(merchant, true);
}
if (e.getRightClicked() instanceof Villager) {
Merchant merchant = villagerlist.get(clickedEntity.getUniqueId());
if (merchant == null) return;
e.setCancelled(true);
p.openMerchant(merchant, true);
}
}
private final HashMap<Location, Integer> blockStages = new HashMap<>();
private final HashMap<UUID, Long> miningCooldown = new HashMap<>();
@EventHandler
public void onAnimationEvent(PlayerAnimationEvent e) { //Material blockType, int mineInterval, Pickaxe x
Player player = e.getPlayer();
UUID uuid = player.getUniqueId();
if (!player.getGameMode().equals(GameMode.SURVIVAL)) return;
if (miningCooldown.containsKey(uuid) && (miningCooldown.get(uuid) > System.currentTimeMillis())) return;
else miningCooldown.remove(uuid);
if (!e.getAnimationType().equals(PlayerAnimationType.ARM_SWING)) return;
Block block = player.getTargetBlockExact(4);
if (block == null) return;
Pickaxe pickaxe = new Pickaxe(player.getInventory().getItemInMainHand());
List<Material> materialsThatCanBeMinedFast = pickaxe.multimap.get(pickaxe.getMaterial()); // to get all materials that the pickaxe can mine
if (!materialsThatCanBeMinedFast.contains(block.getType())) return;
long miningPerPhase = pickaxe.getMiningPerPhase(block.getType());
miningCooldown.put(uuid, System.currentTimeMillis() + miningPerPhase);
int blockStage = blockStages.getOrDefault(block.getLocation(), 0);
blockStage = blockStage == 10 ? 0 : blockStage + 1;
blockStages.put(block.getLocation(), blockStage);
sendBlockDamage(player, block);
if (blockStage == 0) {
blockStages.remove(block.getLocation());
block.breakNaturally();
}
}
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
public void sendBlockDamage(Player player, Block block) {
Location location = block.getLocation();
int locationId = location.getBlockX() + location.getBlockY() + location.getBlockZ();
PacketContainer packet = manager.createPacket(PacketType.Play.Server.BLOCK_BREAK_ANIMATION);
packet.getIntegers().write(0, locationId); // set entity ID to the location
packet.getBlockPositionModifier().write(0, new BlockPosition(location.toVector())); // set the block location
packet.getIntegers().write(1, blockStages.get(location)); // set the damage to blockStage
try {
manager.sendServerPacket(player, packet);
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}

View file

@ -1,4 +1,4 @@
package me.night.nullvalkyrie.events;
package me.night.nullvalkyrie.events.listeners;
import me.night.nullvalkyrie.Main;
import me.night.nullvalkyrie.util.Util;

View file

@ -1,5 +1,7 @@
package me.night.nullvalkyrie.npc;
package me.night.nullvalkyrie.events.listeners;
import me.night.nullvalkyrie.events.custom.RightClickNPCEvent;
import me.night.nullvalkyrie.entities.npcs.NPCManager;
import me.night.nullvalkyrie.util.Util;
import net.minecraft.network.protocol.game.PacketPlayOutEntity;
import net.minecraft.network.protocol.game.PacketPlayOutEntityHeadRotation;
@ -13,7 +15,7 @@ import org.bukkit.event.player.PlayerMoveEvent;
public class NPCEvents implements Listener {
@EventHandler
public void onClick(RightClickNPC e) {
public void onClick(RightClickNPCEvent e) {
Player player = e.getPlayer();
if (e.getNPC().getBukkitEntity().getName().equalsIgnoreCase(Util.color("&1&lRB18"))) {
player.sendMessage(Util.color("Hi"));

View file

@ -1,6 +1,7 @@
package me.night.nullvalkyrie.events;
package me.night.nullvalkyrie.events.listeners;
import me.night.nullvalkyrie.npc.PacketInjector;
import me.night.nullvalkyrie.events.custom.InteractHologramEvent;
import me.night.nullvalkyrie.packets.PacketInjector;
import me.night.nullvalkyrie.util.Util;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -37,6 +38,11 @@ public class ServerEvents implements Listener {
} catch (Exception ee) {
ee.printStackTrace();
}
}
@EventHandler
public void onClickHologram(InteractHologramEvent e) {
if (e.getHologram().getCustomName().equals(ChatColor.GOLD + "Click me to change!!!")) {
System.out.println(true);
}
}
}

View file

@ -1,6 +1,7 @@
package me.night.nullvalkyrie.items;
import me.night.nullvalkyrie.Main;
import me.night.nullvalkyrie.enums.Rarity;
import me.night.nullvalkyrie.util.Util;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@ -13,8 +14,6 @@ import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import java.io.File;
import java.io.IOException;
@ -102,7 +101,6 @@ public class CustomItemManager {
return item;
}
public static void setItemRecipe(NamespacedKey key, ItemStack i, int ingredient, String shape1, String shape2, String shape3, List<Material> ingredients) {
// ShapedRecipe wither_sword_recipe = new ShapedRecipe(new NamespacedKey(main, "widow_sword"), widow_sword);
// wither_sword_recipe.shape(" A ", " A "," B ");
@ -111,20 +109,6 @@ public class CustomItemManager {
// Bukkit.addRecipe(wither_sword_recipe);
}
public static YamlConfiguration loadConfig(String path) {
File f = new File(Main.getPlugin(Main.class).getDataFolder(), path);
if (!f.exists()) {
try {
f.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
return YamlConfiguration.loadConfiguration(f);
}
public static void updateYamlFilesToPlugin(String path) {
File file = new File(Main.getPlugin(Main.class).getDataFolder(), path);
if (!file.exists()) Main.getPlugin(Main.class).saveResource(path, true);

View file

@ -1,47 +1,70 @@
package me.night.nullvalkyrie.npc;
package me.night.nullvalkyrie.packets;
import io.netty.channel.ChannelDuplexHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
import me.night.nullvalkyrie.Main;
import me.night.nullvalkyrie.entities.npcs.NPCManager;
import me.night.nullvalkyrie.events.custom.InteractHologramEvent;
import me.night.nullvalkyrie.events.custom.RightClickNPCEvent;
import net.minecraft.network.protocol.game.PacketPlayInUseEntity;
import net.minecraft.server.level.EntityPlayer;
import org.bukkit.Bukkit;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import java.lang.reflect.Field;
public class PacketHandler extends ChannelDuplexHandler {
private final Player player;
public PacketHandler(Player player) {
this.player = player;
}
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
super.write(ctx, msg, promise);
}
@Override
public void channelRead(ChannelHandlerContext c, Object packet) throws Exception {
if (packet.getClass().getSimpleName().equalsIgnoreCase("PacketPlayInUseEntity")) {
PacketPlayInUseEntity pk = (PacketPlayInUseEntity) packet;
int entityID = (int) PacketInjector.getFieldValue(packet, "a");
boolean sneak = (boolean) PacketInjector.getFieldValue(packet, "c");
Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getPlugin(Main.class), new Runnable() {
@Override
public void run() {
for (Entity entity : Bukkit.getWorld("world").getEntities()) {
if (entity.getEntityId() == entityID && entity.getType() == EntityType.ARMOR_STAND){
Bukkit.getPluginManager().callEvent(new InteractHologramEvent(player, (ArmorStand) entity));
}
}
}
}, 0);
Field type = pk.getClass().getDeclaredField("b");
type.setAccessible(true);
Object data = type.get(pk);
if (data.toString().split("\\$")[1].charAt(0) == 'e') { return; }
if (data.toString().split("\\$")[1].charAt(0) == 'e') {
return;
}
try {
Field hand = data.getClass().getDeclaredField("a");
hand.setAccessible(true);
if (!hand.get(data).toString().equals("MAIN_HAND")) { return; }
if (!hand.get(data).toString().equals("MAIN_HAND")) {
return;
}
//Right Click
for (EntityPlayer npcs : NPCManager.getNPCs()) {
if (npcs.ae() == entityID && sneak) {
Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getPlugin(Main.class), new Runnable() {
@Override
public void run() {
Bukkit.getPluginManager().callEvent(new RightClickNPC(player, npcs));
Bukkit.getPluginManager().callEvent(new RightClickNPCEvent(player, npcs));
}
}, 0);

View file

@ -1,4 +1,4 @@
package me.night.nullvalkyrie.npc;
package me.night.nullvalkyrie.packets;
import io.netty.channel.Channel;
import net.minecraft.server.level.EntityPlayer;

View file

@ -1,6 +1,7 @@
package me.night.nullvalkyrie.ui;
import me.night.nullvalkyrie.database.RankDataManager;
import me.night.nullvalkyrie.enums.Rank;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.*;

View file

@ -2,7 +2,8 @@ package me.night.nullvalkyrie.ui;
import me.night.nullvalkyrie.Main;
import me.night.nullvalkyrie.database.RankDataManager;
import me.night.nullvalkyrie.npc.NPCManager;
import me.night.nullvalkyrie.enums.Rank;
import me.night.nullvalkyrie.entities.npcs.NPCManager;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;