diff --git a/pom.xml b/pom.xml
index 6877d9a..8237f6f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- com.night
+ me.night
NullValkyrie
1.0.1
jar
@@ -51,7 +51,7 @@
maven-jar-plugin
2.4
- D:\Server\plugins
+ media/night0721/Data/Network/Lobby/plugins
@@ -109,7 +109,7 @@
org.spigotmc
- spigot
+ spigot-api
1.18.1-R0.1-SNAPSHOT
provided
diff --git a/src/main/java/com/night/nullvalkyrie/Chests/MenuListener.java b/src/main/java/me/night/nullvalkyrie/Chests/MenuListener.java
similarity index 89%
rename from src/main/java/com/night/nullvalkyrie/Chests/MenuListener.java
rename to src/main/java/me/night/nullvalkyrie/Chests/MenuListener.java
index 9305069..6a0ec94 100644
--- a/src/main/java/com/night/nullvalkyrie/Chests/MenuListener.java
+++ b/src/main/java/me/night/nullvalkyrie/Chests/MenuListener.java
@@ -1,37 +1,37 @@
-package com.night.nullvalkyrie.Chests;
-
-import com.night.nullvalkyrie.commands.MenuCommand;
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.inventory.InventoryClickEvent;
-public class MenuListener implements Listener {
-
- @EventHandler
- public void onClick(InventoryClickEvent e) {
- if(e.getInventory().equals(MenuCommand.inv) && e.getCurrentItem() != null) {
- e.setCancelled(true);
- Player player = (Player) e.getWhoClicked();
- switch (e.getRawSlot()) {
- case 0:
- break;
- case 20:
- player.setHealth(0);
- player.sendMessage(ChatColor.RED + "又做兵 抵死");
- break;
- case 22:
- break;
- case 24:
- player.closeInventory();
- player.openInventory(WitherChest.witherchest);
- return;
- default:
- return;
- }
-
-
- player.closeInventory();
- }else { return; }
- }
-}
+package me.night.nullvalkyrie.Chests;
+
+import me.night.nullvalkyrie.commands.MenuCommand;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.inventory.InventoryClickEvent;
+public class MenuListener implements Listener {
+
+ @EventHandler
+ public void onClick(InventoryClickEvent e) {
+ if(e.getInventory().equals(MenuCommand.inv) && e.getCurrentItem() != null) {
+ e.setCancelled(true);
+ Player player = (Player) e.getWhoClicked();
+ switch (e.getRawSlot()) {
+ case 0:
+ break;
+ case 20:
+ player.setHealth(0);
+ player.sendMessage(ChatColor.RED + "又做兵 抵死");
+ break;
+ case 22:
+ break;
+ case 24:
+ player.closeInventory();
+ player.openInventory(WitherChest.witherchest);
+ return;
+ default:
+ return;
+ }
+
+
+ player.closeInventory();
+ }else { return; }
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Chests/WitherChest.java b/src/main/java/me/night/nullvalkyrie/Chests/WitherChest.java
similarity index 83%
rename from src/main/java/com/night/nullvalkyrie/Chests/WitherChest.java
rename to src/main/java/me/night/nullvalkyrie/Chests/WitherChest.java
index 5889efc..1602a93 100644
--- a/src/main/java/com/night/nullvalkyrie/Chests/WitherChest.java
+++ b/src/main/java/me/night/nullvalkyrie/Chests/WitherChest.java
@@ -1,9 +1,9 @@
-package com.night.nullvalkyrie.Chests;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.inventory.Inventory;
-
-public class WitherChest {
- public static Inventory witherchest = Bukkit.createInventory(null,54, ChatColor.DARK_AQUA + "Whiter Chest");
-}
+package me.night.nullvalkyrie.Chests;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.inventory.Inventory;
+
+public class WitherChest {
+ public static Inventory witherchest = Bukkit.createInventory(null,54, ChatColor.DARK_AQUA + "Whiter Chest");
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Discord/DiscordClientManager.java b/src/main/java/me/night/nullvalkyrie/Discord/DiscordClientManager.java
similarity index 91%
rename from src/main/java/com/night/nullvalkyrie/Discord/DiscordClientManager.java
rename to src/main/java/me/night/nullvalkyrie/Discord/DiscordClientManager.java
index d9f7590..bbf9885 100644
--- a/src/main/java/com/night/nullvalkyrie/Discord/DiscordClientManager.java
+++ b/src/main/java/me/night/nullvalkyrie/Discord/DiscordClientManager.java
@@ -1,25 +1,25 @@
-package com.night.nullvalkyrie.Discord;
-import net.dv8tion.jda.api.JDA;
-import net.dv8tion.jda.api.JDABuilder;
-import net.dv8tion.jda.api.entities.Activity;
-
-import javax.security.auth.login.LoginException;
-
-
-public class DiscordClientManager {
- private JDA jda;
- public DiscordClientManager() {
- register();
- }
- public void register() {
- JDABuilder builder = JDABuilder.createDefault("OTk3ODczMzgyNjM0ODM2MDQ5.GTalga.2uMZE-S0t2yL-3jsglrpG9lMbIHHBMAedVZA4U");
- builder.setActivity(Activity.streaming("cath.exe", "https://www.youtube.com/watch?v=YSKDu1gKntY"));
- try {
- jda = builder.build();
- } catch (LoginException e) {
- e.printStackTrace();
- }
- }
-
-
-}
+package me.night.nullvalkyrie.Discord;
+import net.dv8tion.jda.api.JDA;
+import net.dv8tion.jda.api.JDABuilder;
+import net.dv8tion.jda.api.entities.Activity;
+
+import javax.security.auth.login.LoginException;
+
+
+public class DiscordClientManager {
+ private JDA jda;
+ public DiscordClientManager() {
+ register();
+ }
+ public void register() {
+ JDABuilder builder = JDABuilder.createDefault("OTk3ODczMzgyNjM0ODM2MDQ5.GTalga.2uMZE-S0t2yL-3jsglrpG9lMbIHHBMAedVZA4U");
+ builder.setActivity(Activity.streaming("cath.exe", "https://www.youtube.com/watch?v=YSKDu1gKntY"));
+ try {
+ jda = builder.build();
+ } catch (LoginException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Enchantments/CustomEnchantment.java b/src/main/java/me/night/nullvalkyrie/Enchantments/CustomEnchantment.java
similarity index 91%
rename from src/main/java/com/night/nullvalkyrie/Enchantments/CustomEnchantment.java
rename to src/main/java/me/night/nullvalkyrie/Enchantments/CustomEnchantment.java
index 5ec7522..5854ac5 100644
--- a/src/main/java/com/night/nullvalkyrie/Enchantments/CustomEnchantment.java
+++ b/src/main/java/me/night/nullvalkyrie/Enchantments/CustomEnchantment.java
@@ -1,56 +1,56 @@
-package com.night.nullvalkyrie.Enchantments;
-
-import org.bukkit.NamespacedKey;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.enchantments.EnchantmentTarget;
-import org.bukkit.inventory.ItemStack;
-
-public class CustomEnchantment extends Enchantment {
- private final String name;
- private final int maxlvl;
- public CustomEnchantment(String namespace, String name, int lvl) {
- super(NamespacedKey.minecraft(namespace));
- this.name = name;
- this.maxlvl = lvl;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public int getMaxLevel() {
- return maxlvl;
- }
-
- @Override
- public int getStartLevel() {
- return 1;
- }
-
- @Override
- public EnchantmentTarget getItemTarget() {
- return null;
- }
-
- @Override
- public boolean isTreasure() {
- return false;
- }
-
- @Override
- public boolean isCursed() {
- return false;
- }
-
- @Override
- public boolean conflictsWith(Enchantment other) {
- return false;
- }
-
- @Override
- public boolean canEnchantItem(ItemStack item) {
- return true;
- }
-}
+package me.night.nullvalkyrie.Enchantments;
+
+import org.bukkit.NamespacedKey;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.enchantments.EnchantmentTarget;
+import org.bukkit.inventory.ItemStack;
+
+public class CustomEnchantment extends Enchantment {
+ private final String name;
+ private final int maxlvl;
+ public CustomEnchantment(String namespace, String name, int lvl) {
+ super(NamespacedKey.minecraft(namespace));
+ this.name = name;
+ this.maxlvl = lvl;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public int getMaxLevel() {
+ return maxlvl;
+ }
+
+ @Override
+ public int getStartLevel() {
+ return 1;
+ }
+
+ @Override
+ public EnchantmentTarget getItemTarget() {
+ return null;
+ }
+
+ @Override
+ public boolean isTreasure() {
+ return false;
+ }
+
+ @Override
+ public boolean isCursed() {
+ return false;
+ }
+
+ @Override
+ public boolean conflictsWith(Enchantment other) {
+ return false;
+ }
+
+ @Override
+ public boolean canEnchantItem(ItemStack item) {
+ return true;
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Enchantments/EnchantmentManager.java b/src/main/java/me/night/nullvalkyrie/Enchantments/EnchantmentManager.java
similarity index 93%
rename from src/main/java/com/night/nullvalkyrie/Enchantments/EnchantmentManager.java
rename to src/main/java/me/night/nullvalkyrie/Enchantments/EnchantmentManager.java
index 458594c..4711693 100644
--- a/src/main/java/com/night/nullvalkyrie/Enchantments/EnchantmentManager.java
+++ b/src/main/java/me/night/nullvalkyrie/Enchantments/EnchantmentManager.java
@@ -1,38 +1,38 @@
-package com.night.nullvalkyrie.Enchantments;
-
-import org.bukkit.enchantments.Enchantment;
-
-import java.lang.reflect.Field;
-import java.util.Arrays;
-import java.util.stream.Collectors;
-
-public class EnchantmentManager {
- public EnchantmentManager() {
- register();
- }
- public static final Enchantment ThunderBolt = new CustomEnchantment("thunderbolt", "ThunderBolt", 5);
- public static final Enchantment SmeltingTouch = new CustomEnchantment("smelting-touch", "Smelting Touch", 1);
- public static void register() {
- boolean registered = Arrays.stream(Enchantment.values()).collect(Collectors.toList()).contains(ThunderBolt);
- if(!registered) {
- registerEnchantment(ThunderBolt);
- registerEnchantment(SmeltingTouch);
- }
-
- }
- public static void registerEnchantment(Enchantment en) {
- try {
- try {
- Field f = Enchantment.class.getDeclaredField("acceptingNew");
- f.setAccessible(true);
- f.set(null, true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- Enchantment.registerEnchantment(en);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
+package me.night.nullvalkyrie.Enchantments;
+
+import org.bukkit.enchantments.Enchantment;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.stream.Collectors;
+
+public class EnchantmentManager {
+ public EnchantmentManager() {
+ register();
+ }
+ public static final Enchantment ThunderBolt = new CustomEnchantment("thunderbolt", "ThunderBolt", 5);
+ public static final Enchantment SmeltingTouch = new CustomEnchantment("smelting-touch", "Smelting Touch", 1);
+ public static void register() {
+ boolean registered = Arrays.stream(Enchantment.values()).collect(Collectors.toList()).contains(ThunderBolt);
+ if(!registered) {
+ registerEnchantment(ThunderBolt);
+ registerEnchantment(SmeltingTouch);
+ }
+
+ }
+ public static void registerEnchantment(Enchantment en) {
+ try {
+ try {
+ Field f = Enchantment.class.getDeclaredField("acceptingNew");
+ f.setAccessible(true);
+ f.set(null, true);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ Enchantment.registerEnchantment(en);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Events/CustomItemEvents.java b/src/main/java/me/night/nullvalkyrie/Events/CustomItemEvents.java
similarity index 83%
rename from src/main/java/com/night/nullvalkyrie/Events/CustomItemEvents.java
rename to src/main/java/me/night/nullvalkyrie/Events/CustomItemEvents.java
index 74398f3..41051e9 100644
--- a/src/main/java/com/night/nullvalkyrie/Events/CustomItemEvents.java
+++ b/src/main/java/me/night/nullvalkyrie/Events/CustomItemEvents.java
@@ -1,281 +1,318 @@
-package com.night.nullvalkyrie.Events;
-
-import com.night.nullvalkyrie.Items.Rarity;
-import com.night.nullvalkyrie.Main;
-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.PlayerBucketEmptyEvent;
-import org.bukkit.event.player.PlayerFishEvent;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.scheduler.BukkitRunnable;
-
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static com.night.nullvalkyrie.Items.CustomItemManager.loadConfig;
-import static com.night.nullvalkyrie.commands.SpawnCommand.getRandomWithNeg;
-
-public class CustomItemEvents implements Listener {
- private 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);
- }
- }
- } else if (e.getDamager() instanceof Player) {
- Player player = (Player) e.getDamager();
- if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
- String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
- if(name.equalsIgnoreCase(Rarity.MYTHIC.getColor() + "Fabled Widow Sword")) {
- if (e.getEntity() instanceof Zombie) {
- int zombie = loadConfig("ItemData\\WidowSword.yml").getInt("zombie");
- e.setDamage(e.getDamage() * (1 + zombie / 100));
- } else if (e.getEntity() instanceof Skeleton) {
- int skeleton = loadConfig("ItemData\\WidowSword.yml").getInt("skeleton");
- e.setDamage(e.getDamage() * (1 + skeleton / 100));
- } else if (e.getEntity() instanceof Spider) {
- int spider = loadConfig("ItemData\\WidowSword.yml").getInt("spider");
- e.setDamage(e.getDamage() * (1 + spider / 100));
- }
- }
- }
- }
- }
-
- @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((Set) 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));
- } 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);
- }
- }
- }
- private Location l;
- private boolean spawnable = false;
- @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);
-// while(!spawnable) {
-// l = generateRandomCoord(9, Bukkit.getWorld("world"));
-// if(isSpawnable(l)) {
-// spawnable = true;
-// player.teleport(l);
-// }
-// }
- player.teleport(generateRandomCoord(9, Bukkit.getWorld("world")));
- }
- }.runTaskLater(main, 100L);
- run(player, new int[]{5});
- }
- }
-
- }
- public Location generateRandomCoord(int size, World world) {
- int ranX = getRandomWithNeg(size), ranZ = getRandomWithNeg(size);
- Block block = world.getHighestBlockAt(ranX, ranZ);
- return block.getLocation();
- }
- public boolean isSpawnable(Location loc) {
- Block feetBlock = loc.getBlock(), headBlock = loc.clone().add(0, 1, 0).getBlock(), upperBlock = loc.clone().add(0, 2, 0).getBlock();
- return feetBlock.isPassable() && !feetBlock.isLiquid() && headBlock.isPassable() && !headBlock.isLiquid() && upperBlock.isPassable() && !upperBlock.isLiquid();
- }
- private int taskID;
- public void run(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);
- }
-
+package me.night.nullvalkyrie.Events;
+
+import me.night.nullvalkyrie.Items.CustomItemManager;
+import me.night.nullvalkyrie.Items.Rarity;
+import me.night.nullvalkyrie.Main;
+import me.night.nullvalkyrie.commands.SpawnCommand;
+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.PlayerBucketEmptyEvent;
+import org.bukkit.event.player.PlayerFishEvent;
+import org.bukkit.event.player.PlayerInteractEntityEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.Merchant;
+import org.bukkit.inventory.MerchantRecipe;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import java.util.*;
+
+public class CustomItemEvents implements Listener {
+ private 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);
+ }
+ }
+ } else if (e.getDamager() instanceof Player) {
+ Player player = (Player) e.getDamager();
+ if (player.getInventory().getItemInMainHand().getItemMeta() != null) {
+ String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName();
+ if(name.equalsIgnoreCase(Rarity.MYTHIC.getColor() + "Fabled Widow Sword")) {
+ if (e.getEntity() instanceof Zombie) {
+ int zombie = CustomItemManager.loadConfig("ItemData\\WidowSword.yml").getInt("zombie");
+ e.setDamage(e.getDamage() * (1 + zombie / 100));
+ } else if (e.getEntity() instanceof Skeleton) {
+ int skeleton = CustomItemManager.loadConfig("ItemData\\WidowSword.yml").getInt("skeleton");
+ e.setDamage(e.getDamage() * (1 + skeleton / 100));
+ } else if (e.getEntity() instanceof Spider) {
+ int spider = CustomItemManager.loadConfig("ItemData\\WidowSword.yml").getInt("spider");
+ e.setDamage(e.getDamage() * (1 + spider / 100));
+ }
+ }
+ }
+ }
+ }
+
+ @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((Set) 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));
+ } 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);
+ }
+ }
+ }
+ private Location l;
+ private boolean spawnable = false;
+ @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);
+// while(!spawnable) {
+// l = generateRandomCoord(9, Bukkit.getWorld("world"));
+// if(isSpawnable(l)) {
+// spawnable = true;
+// player.teleport(l);
+// }
+// }
+ player.teleport(generateRandomCoord(9, Bukkit.getWorld("world")));
+ }
+ }.runTaskLater(main, 100L);
+ run(player, new int[]{5});
+ }
+ }
+
+ }
+ public Location generateRandomCoord(int size, World world) {
+ int ranX = SpawnCommand.getRandomWithNeg(size), ranZ = SpawnCommand.getRandomWithNeg(size);
+ Block block = world.getHighestBlockAt(ranX, ranZ);
+ return block.getLocation();
+ }
+ public boolean isSpawnable(Location loc) {
+ Block feetBlock = loc.getBlock(), headBlock = loc.clone().add(0, 1, 0).getBlock(), upperBlock = loc.clone().add(0, 2, 0).getBlock();
+ return feetBlock.isPassable() && !feetBlock.isLiquid() && headBlock.isPassable() && !headBlock.isLiquid() && upperBlock.isPassable() && !upperBlock.isLiquid();
+ }
+ private int taskID;
+ public void run(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 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 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.getItem("Terminator"), 10);
+ tntStick.addIngredient(CustomItemManager.getItem("Widow Sword"));
+ recipes.add(tntStick);
+ Merchant merchant = Bukkit.createMerchant("Yum Yum In The Tum Tum");
+ 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);
+ }
+ }
+
}
\ No newline at end of file
diff --git a/src/main/java/com/night/nullvalkyrie/Items/CustomItemManager.java b/src/main/java/me/night/nullvalkyrie/Items/CustomItemManager.java
similarity index 92%
rename from src/main/java/com/night/nullvalkyrie/Items/CustomItemManager.java
rename to src/main/java/me/night/nullvalkyrie/Items/CustomItemManager.java
index ec00b70..5acbad9 100644
--- a/src/main/java/com/night/nullvalkyrie/Items/CustomItemManager.java
+++ b/src/main/java/me/night/nullvalkyrie/Items/CustomItemManager.java
@@ -1,205 +1,206 @@
-package com.night.nullvalkyrie.Items;
-
-import com.night.nullvalkyrie.Main;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.NamespacedKey;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.attribute.AttributeModifier;
-import org.bukkit.configuration.MemorySection;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.inventory.EquipmentSlot;
-import org.bukkit.inventory.ItemFlag;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.ItemMeta;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-
-public class CustomItemManager {
- private static HashMap a = new HashMap<>();
- private static Main main;
- public CustomItemManager(Main main) {
- this.main = main;
- if(!main.getDataFolder().exists()) {
- main.getDataFolder().mkdir();
- }
- createItemDataDirectory("ItemData");
- createFilesFromConfig(main.getConfig());
- register();
- }
- public void register() {
- List hh = getAllFilesFromDirectory("ItemData");
- for(int kk = 0; kk < hh.size(); kk++) {
- FileConfiguration c = loadConfig("ItemData\\" + hh.get(kk));
- ItemStack i = new ItemStack(Material.matchMaterial(c.getString("material")));
- HashMap> d = new HashMap<>();
- List pr = new ArrayList<>();
- List ia = new ArrayList<>();
- HashMap aa = new HashMap<>();
- for (String key : c.getKeys(true)) {
- if (key.startsWith("enchants.")) {
- i.addUnsafeEnchantment(Enchantment.getByKey(NamespacedKey.minecraft(Arrays.asList(key.split("\\.")).get(1))), c.getInt(key));
- } else if (key.startsWith("lore.properties.")) {
- String property = Arrays.asList(key.split("\\.")).get(2);
- if (property.equals("damage") && c.getInt(key) > 0) {
- pr.add(ChatColor.GRAY + "Damage: " + ChatColor.RED + "+" + c.getInt(key));
- } else if (property.equals("speed") && c.getInt(key) > 0) {
- pr.add(ChatColor.GRAY + "Speed: " + ChatColor.RED + "+" + c.getInt(key));
- }
- } else if (key.startsWith("lore.ability.")) {
- String a = Arrays.asList(key.split("\\.")).get(2);
- if (a.equals("name")) {
- ia.add(ChatColor.GOLD + "Item Ability: " + c.getString(key));
- } else if (a.equals("details")) {
- for (Object line : c.getList(key)) {
- ia.add(ChatColor.GRAY.toString() + line);
- }
- }
- } else if (key.startsWith("attributes.")) {
- if (c.getDouble(key) > 0.0) {
- aa.put(Arrays.asList(key.split("\\.")).get(1), c.getDouble(key));
- }
- } else if (key.startsWith("recipe.")) {
-
- }
- }
- d.put("properties", pr);
- d.put("ability", ia);
- d.put("attributes", pr);
- ItemMeta im = i.getItemMeta();
- im.setDisplayName(Rarity.getRarity(c.getString("rarity")).getColor() + c.getString("name"));
- im.setUnbreakable(true);
- ArrayList l = new ArrayList<>();
- l.addAll(d.get("properties"));
- l.add("");
- ArrayList e = new ArrayList<>();
- for (Enchantment ee : i.getEnchantments().keySet()) {
- List splitted = Arrays.asList(Arrays.asList(ee.getKey().toString().split(":")).get(1).split("_"));
- StringBuilder n = new StringBuilder();
- for (String ii : splitted) {
- String s = ii.substring(0, 1).toUpperCase() + ii.substring(1);
- if (splitted.size() > 1) {
- if (ii.equals(splitted.get(splitted.size() - 1))) {
- n.append(s);
- } else {
- n.append(s);
- n.append(" ");
- }
- } else n.append(s);
- }
- e.add(n + " " + i.getEnchantmentLevel(ee));
- }
- l.add(ChatColor.BLUE + String.join(", ", e));
- l.add("");
- l.addAll(ia);
- l.add("");
- l.add(Rarity.getRarity(c.getString("rarity")).getDisplay());
- im.setLore(l);
- for (String q : aa.keySet()) {
- if (q.equals("damage")) {
- AttributeModifier p = new AttributeModifier(UUID.randomUUID(), "generic.attackDamage", aa.get(q), AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
- im.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, p);
- } else if (q.equals("moveSpeed")) {
- AttributeModifier s = new AttributeModifier(UUID.randomUUID(), "generic.movementSpeed", aa.get(q), AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
- im.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, s);
- }
- }
- im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
- i.setItemMeta(im);
- a.put(c.getString("name"), i);
- }
- }
- public static void setItemRecipe(NamespacedKey key, ItemStack i, int ingredient, String shape1, String shape2, String shape3, List ingredients) {
-// ShapedRecipe wither_sword_recipe = new ShapedRecipe(new NamespacedKey(main, "widow_sword"), widow_sword);
-// wither_sword_recipe.shape(" A ", " A "," B ");
-// wither_sword_recipe.setIngredient('A', Material.IRON_INGOT);
-// wither_sword_recipe.setIngredient('B', Material.STICK);
-// Bukkit.addRecipe(wither_sword_recipe);
- }
- public static YamlConfiguration loadConfig(String path) {
- File f = new File(main.getDataFolder(), path);
- if(!f.exists()) {
- try {
- f.createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
- return YamlConfiguration.loadConfiguration(f);
- }
- public static File loadFile(String path) {
- File f = new File(main.getDataFolder(), path);
- if(!f.exists()) {
- try {
- f.createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- }
- return f;
- }
- private static void createItemDataDirectory(String path) {
- File f = new File(main.getDataFolder(), path);
- if(!f.exists()) {
- try {
- if(!f.mkdir()) {
- try {
- f.mkdir();
- } catch (SecurityException e) {
- e.printStackTrace();
- }
- }
- } catch (SecurityException e) {
- e.printStackTrace();
- }
-
- }
- }
- public static List getAllFilesFromDirectory(String path) {
- ArrayList ns = new ArrayList<>();
- try {
- File f = new File(main.getDataFolder(), path);
- File[] files = f.listFiles();
- for (int i = 0; i < files.length; i++) {
- ns.add(files[i].getName());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return ns;
- }
- public void createFilesFromConfig(FileConfiguration config) {
- for(String a : config.getKeys(false)) {
- FileConfiguration c = loadConfig("ItemData\\" + a + ".yml");
- for(String b : config.getKeys(true)) {
- if(b.startsWith(a)) {
- List d = new ArrayList<>(Arrays.asList(b.split("\\.")));
- if(d.size() != 1) {
- d.remove(0);
- if(d.size() == 1) {
- c.set(d.get(0), config.get(b));
- } else {
- c.set(String.join(".", d), config.get(b));
- }
- try {
- c.save(loadFile("ItemData\\" + a + ".yml"));
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- }
- }
- }
- }
- public static ItemStack getItem(String name){
- return a.get(name);
- }
-}
+package me.night.nullvalkyrie.Items;
+
+import me.night.nullvalkyrie.Main;
+import org.bukkit.ChatColor;
+import org.bukkit.Material;
+import org.bukkit.NamespacedKey;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.attribute.AttributeModifier;
+import org.bukkit.configuration.MemorySection;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.inventory.EquipmentSlot;
+import org.bukkit.inventory.ItemFlag;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+
+
+public class CustomItemManager {
+ private static HashMap a = new HashMap<>();
+ private static Main main;
+ public CustomItemManager(Main main) {
+ this.main = main;
+ if(!main.getDataFolder().exists()) {
+ main.getDataFolder().mkdir();
+ }
+ createDirectoryInPluginFolder("ItemData");
+ createFilesFromConfig(main.getConfig());
+ register();
+ }
+ public void register() {
+ List hh = getAllFilesFromDirectory("ItemData");
+ for(int kk = 0; kk < hh.size(); kk++) {
+ FileConfiguration c = loadConfig("ItemData/" + hh.get(kk));
+ ItemStack i = new ItemStack(Material.matchMaterial(c.getString("material")));
+ HashMap> d = new HashMap<>();
+ List pr = new ArrayList<>();
+ List ia = new ArrayList<>();
+ HashMap aa = new HashMap<>();
+ for (String key : c.getKeys(true)) {
+ if (key.startsWith("enchants.")) {
+ i.addUnsafeEnchantment(Enchantment.getByKey(NamespacedKey.minecraft(Arrays.asList(key.split("\\.")).get(1))), c.getInt(key));
+ } else if (key.startsWith("lore.properties.")) {
+ String property = Arrays.asList(key.split("\\.")).get(2);
+ if (property.equals("damage") && c.getInt(key) > 0) {
+ pr.add(ChatColor.GRAY + "Damage: " + ChatColor.RED + "+" + c.getInt(key));
+ } else if (property.equals("speed") && c.getInt(key) > 0) {
+ pr.add(ChatColor.GRAY + "Speed: " + ChatColor.RED + "+" + c.getInt(key));
+ }
+ } else if (key.startsWith("lore.ability.")) {
+ String a = Arrays.asList(key.split("\\.")).get(2);
+ if (a.equals("name")) {
+ ia.add(ChatColor.GOLD + "Item Ability: " + c.getString(key));
+ } else if (a.equals("details")) {
+ for (Object line : c.getList(key)) {
+ ia.add(ChatColor.GRAY.toString() + line);
+ }
+ }
+ } else if (key.startsWith("attributes.")) {
+ if (c.getDouble(key) > 0.0) {
+ aa.put(Arrays.asList(key.split("\\.")).get(1), c.getDouble(key));
+ }
+ } else if (key.startsWith("recipe.")) {
+
+ }
+ }
+ d.put("properties", pr);
+ d.put("ability", ia);
+ d.put("attributes", pr);
+ ItemMeta im = i.getItemMeta();
+ im.setDisplayName(Rarity.getRarity(c.getString("rarity")).getColor() + c.getString("name"));
+ im.setUnbreakable(true);
+ ArrayList l = new ArrayList<>();
+ l.addAll(d.get("properties"));
+ l.add("");
+ ArrayList e = new ArrayList<>();
+ for (Enchantment ee : i.getEnchantments().keySet()) {
+ List splitted = Arrays.asList(Arrays.asList(ee.getKey().toString().split(":")).get(1).split("_"));
+ StringBuilder n = new StringBuilder();
+ for (String ii : splitted) {
+ String s = ii.substring(0, 1).toUpperCase() + ii.substring(1);
+ if (splitted.size() > 1) {
+ if (ii.equals(splitted.get(splitted.size() - 1))) {
+ n.append(s);
+ } else {
+ n.append(s);
+ n.append(" ");
+ }
+ } else n.append(s);
+ }
+ e.add(n + " " + i.getEnchantmentLevel(ee));
+ }
+ l.add(ChatColor.BLUE + String.join(", ", e));
+ l.add("");
+ l.addAll(ia);
+ l.add("");
+ l.add(Rarity.getRarity(c.getString("rarity")).getDisplay());
+ im.setLore(l);
+ for (String q : aa.keySet()) {
+ if (q.equals("damage")) {
+ AttributeModifier p = new AttributeModifier(UUID.randomUUID(), "generic.attackDamage", aa.get(q), AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
+ im.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, p);
+ } else if (q.equals("moveSpeed")) {
+ AttributeModifier s = new AttributeModifier(UUID.randomUUID(), "generic.movementSpeed", aa.get(q), AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND);
+ im.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, s);
+ }
+ }
+ im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
+ i.setItemMeta(im);
+ a.put(c.getString("name"), i);
+ }
+ }
+ public static void setItemRecipe(NamespacedKey key, ItemStack i, int ingredient, String shape1, String shape2, String shape3, List ingredients) {
+// ShapedRecipe wither_sword_recipe = new ShapedRecipe(new NamespacedKey(main, "widow_sword"), widow_sword);
+// wither_sword_recipe.shape(" A ", " A "," B ");
+// wither_sword_recipe.setIngredient('A', Material.IRON_INGOT);
+// wither_sword_recipe.setIngredient('B', Material.STICK);
+// Bukkit.addRecipe(wither_sword_recipe);
+ }
+ public static YamlConfiguration loadConfig(String path) {
+ File f = new File(main.getDataFolder(), path);
+ if(!f.exists()) {
+ try {
+ f.createNewFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+ return YamlConfiguration.loadConfiguration(f);
+ }
+ public static File loadFile(String path) {
+ File f = new File(main.getDataFolder(), path);
+ if(!f.exists()) {
+ try {
+ f.createNewFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+ return f;
+ }
+ public static void createDirectoryInPluginFolder(String path) {
+ File f = new File(main.getDataFolder(), path);
+ if(!f.exists()) {
+ try {
+ if(!f.mkdir()) {
+ try {
+ f.mkdir();
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ }
+ }
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ }
+
+ }
+ }
+ public static List getAllFilesFromDirectory(String path) {
+ ArrayList ns = new ArrayList<>();
+ try {
+ File f = new File(main.getDataFolder(), path);
+ File[] files = f.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ System.out.println(files[i].getName());
+ ns.add(files[i].getName());
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return ns;
+ }
+ public void createFilesFromConfig(FileConfiguration config) {
+ for(String a : config.getKeys(false)) {
+ FileConfiguration c = loadConfig("ItemData/" + a + ".yml");
+ for(String b : config.getKeys(true)) {
+ if(b.startsWith(a)) {
+ List d = new ArrayList<>(Arrays.asList(b.split("\\.")));
+ if(d.size() != 1) {
+ d.remove(0);
+ if(d.size() == 1) {
+ c.set(d.get(0), config.get(b));
+ } else {
+ c.set(String.join(".", d), config.get(b));
+ }
+ try {
+ c.save(loadFile("ItemData/" + a + ".yml"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ }
+ }
+ }
+ }
+ public static ItemStack getItem(String name){
+ return a.get(name);
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Items/Rarity.java b/src/main/java/me/night/nullvalkyrie/Items/Rarity.java
similarity index 96%
rename from src/main/java/com/night/nullvalkyrie/Items/Rarity.java
rename to src/main/java/me/night/nullvalkyrie/Items/Rarity.java
index 51bcccc..cd97e1a 100644
--- a/src/main/java/com/night/nullvalkyrie/Items/Rarity.java
+++ b/src/main/java/me/night/nullvalkyrie/Items/Rarity.java
@@ -1,47 +1,47 @@
-package com.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.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;
+ }
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Main.java b/src/main/java/me/night/nullvalkyrie/Main.java
similarity index 85%
rename from src/main/java/com/night/nullvalkyrie/Main.java
rename to src/main/java/me/night/nullvalkyrie/Main.java
index 7e2008f..aa99341 100644
--- a/src/main/java/com/night/nullvalkyrie/Main.java
+++ b/src/main/java/me/night/nullvalkyrie/Main.java
@@ -1,13 +1,13 @@
-package com.night.nullvalkyrie;
+package me.night.nullvalkyrie;
-import com.night.nullvalkyrie.Chests.MenuListener;
-import com.night.nullvalkyrie.Discord.DiscordClientManager;
-import com.night.nullvalkyrie.Enchantments.EnchantmentManager;
-import com.night.nullvalkyrie.Events.CustomItemEvents;
-import com.night.nullvalkyrie.Items.CustomItemManager;
-import com.night.nullvalkyrie.Rank.*;
-import com.night.nullvalkyrie.Util.Util;
-import com.night.nullvalkyrie.commands.*;
+import me.night.nullvalkyrie.Chests.MenuListener;
+import me.night.nullvalkyrie.Discord.DiscordClientManager;
+import me.night.nullvalkyrie.Enchantments.EnchantmentManager;
+import me.night.nullvalkyrie.Events.CustomItemEvents;
+import me.night.nullvalkyrie.Items.CustomItemManager;
+import me.night.nullvalkyrie.Rank.ScoreboardListener;
+import me.night.nullvalkyrie.Util.Util;
+import me.night.nullvalkyrie.commands.*;
import net.md_5.bungee.api.ChatMessageType;
import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.*;
@@ -45,6 +45,7 @@ public final class Main extends JavaPlugin implements Listener {
new RankCommand(this);
new UtilCommand(this);
new WeaponCommand(this);
+ new MinerCommand(this);
bossbar = Bukkit.createBossBar(ChatColor.GOLD + "Kuudra", BarColor.RED, BarStyle.SEGMENTED_12);
Bukkit.getPluginManager().registerEvents(this, this);
Bukkit.getPluginManager().registerEvents(new MenuListener(), this);
@@ -53,7 +54,6 @@ public final class Main extends JavaPlugin implements Listener {
Bukkit.getPluginManager().registerEvents(new SpawnCommand(this), this);
new EnchantmentManager();
new DiscordClientManager();
-
customItemManager = new CustomItemManager(this);
}
diff --git a/src/main/java/com/night/nullvalkyrie/Mobs/ModdedZombie.yml b/src/main/java/me/night/nullvalkyrie/Mobs/ModdedZombie.yml
similarity index 94%
rename from src/main/java/com/night/nullvalkyrie/Mobs/ModdedZombie.yml
rename to src/main/java/me/night/nullvalkyrie/Mobs/ModdedZombie.yml
index 5c9eaf4..b428ffb 100644
--- a/src/main/java/com/night/nullvalkyrie/Mobs/ModdedZombie.yml
+++ b/src/main/java/me/night/nullvalkyrie/Mobs/ModdedZombie.yml
@@ -1,3 +1,3 @@
-name: Zombie
-level: 69
+name: Zombie
+level: 69
health: 1000
\ No newline at end of file
diff --git a/src/main/java/com/night/nullvalkyrie/Rank/BelowNameManager.java b/src/main/java/me/night/nullvalkyrie/Rank/BelowNameManager.java
similarity index 91%
rename from src/main/java/com/night/nullvalkyrie/Rank/BelowNameManager.java
rename to src/main/java/me/night/nullvalkyrie/Rank/BelowNameManager.java
index 02ac5d8..8681693 100644
--- a/src/main/java/com/night/nullvalkyrie/Rank/BelowNameManager.java
+++ b/src/main/java/me/night/nullvalkyrie/Rank/BelowNameManager.java
@@ -1,18 +1,18 @@
-package com.night.nullvalkyrie.Rank;
-
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-import org.bukkit.scoreboard.DisplaySlot;
-import org.bukkit.scoreboard.Objective;
-import org.bukkit.scoreboard.Scoreboard;
-
-public class BelowNameManager {
- public void setBelowName(Player player) {
- Scoreboard board = player.getScoreboard();
- Objective obj = board.registerNewObjective("HealthBar", "health");
- obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
- obj.setDisplayName(ChatColor.RED + "❤");
- player.setScoreboard(board);
- player.setHealth(player.getHealth());
- }
-}
+package me.night.nullvalkyrie.Rank;
+
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+import org.bukkit.scoreboard.DisplaySlot;
+import org.bukkit.scoreboard.Objective;
+import org.bukkit.scoreboard.Scoreboard;
+
+public class BelowNameManager {
+ public void setBelowName(Player player) {
+ Scoreboard board = player.getScoreboard();
+ Objective obj = board.registerNewObjective("HealthBar", "health");
+ obj.setDisplaySlot(DisplaySlot.BELOW_NAME);
+ obj.setDisplayName(ChatColor.RED + "❤");
+ player.setScoreboard(board);
+ player.setHealth(player.getHealth());
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Rank/NameTagManager.java b/src/main/java/me/night/nullvalkyrie/Rank/NameTagManager.java
similarity index 84%
rename from src/main/java/com/night/nullvalkyrie/Rank/NameTagManager.java
rename to src/main/java/me/night/nullvalkyrie/Rank/NameTagManager.java
index 3b65e45..e58ed0d 100644
--- a/src/main/java/com/night/nullvalkyrie/Rank/NameTagManager.java
+++ b/src/main/java/me/night/nullvalkyrie/Rank/NameTagManager.java
@@ -1,47 +1,45 @@
-package com.night.nullvalkyrie.Rank;
-
-import com.night.nullvalkyrie.Main;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.scoreboard.DisplaySlot;
-import org.bukkit.scoreboard.Objective;
-import org.bukkit.scoreboard.Scoreboard;
-import org.bukkit.scoreboard.Team;
-
-import static com.night.nullvalkyrie.Rank.ScoreboardListener.rankManager;
-
-public class NameTagManager {
- private Main main;
-
- public NameTagManager(Main main) {
- this.main = main;
- }
- @SuppressWarnings("deprecation")
- public void setNametags(Player player) {
- Scoreboard newScoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
- Objective obj = newScoreboard.registerNewObjective("TabList", "dummy");
- obj.setDisplaySlot(DisplaySlot.PLAYER_LIST);
- player.setScoreboard(newScoreboard);
- for (Rank rank : Rank.values()) {
- Team team = player.getScoreboard().registerNewTeam(rank.name());
- team.setPrefix(rank.getDisplay() + " ");
- }
- for (Player target : Bukkit.getOnlinePlayers()) {
- if (player.getUniqueId() != target.getUniqueId()) {
- Rank rank = rankManager.getRank(target.getUniqueId());
- player.getScoreboard().getTeam(rank.name()).addEntry(target.getName());
- }
- }
- }
- public void newTag(Player player) {
- Rank rank = rankManager.getRank(player.getUniqueId());
- for(Player target : Bukkit.getOnlinePlayers()) {
- target.getScoreboard().getTeam(rank.name()).addEntry(player.getName());
- }
- }
- public void removeTag(Player player) {
- for(Player target : Bukkit.getOnlinePlayers()) {
- target.getScoreboard().getEntryTeam(player.getName()).removeEntry(player.getName());
- }
- }
-}
+package me.night.nullvalkyrie.Rank;
+
+import me.night.nullvalkyrie.Main;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+import org.bukkit.scoreboard.DisplaySlot;
+import org.bukkit.scoreboard.Objective;
+import org.bukkit.scoreboard.Scoreboard;
+import org.bukkit.scoreboard.Team;
+
+public class NameTagManager {
+ private Main main;
+
+ public NameTagManager(Main main) {
+ this.main = main;
+ }
+ @SuppressWarnings("deprecation")
+ public void setNametags(Player player) {
+ Scoreboard newScoreboard = Bukkit.getScoreboardManager().getNewScoreboard();
+ Objective obj = newScoreboard.registerNewObjective("TabList", "dummy");
+ obj.setDisplaySlot(DisplaySlot.PLAYER_LIST);
+ player.setScoreboard(newScoreboard);
+ for (Rank rank : Rank.values()) {
+ Team team = player.getScoreboard().registerNewTeam(rank.name());
+ team.setPrefix(rank.getDisplay() + " ");
+ }
+ for (Player target : Bukkit.getOnlinePlayers()) {
+ if (player.getUniqueId() != target.getUniqueId()) {
+ Rank rank = ScoreboardListener.rankManager.getRank(target.getUniqueId());
+ player.getScoreboard().getTeam(rank.name()).addEntry(target.getName());
+ }
+ }
+ }
+ public void newTag(Player player) {
+ Rank rank = ScoreboardListener.rankManager.getRank(player.getUniqueId());
+ for(Player target : Bukkit.getOnlinePlayers()) {
+ target.getScoreboard().getTeam(rank.name()).addEntry(player.getName());
+ }
+ }
+ public void removeTag(Player player) {
+ for(Player target : Bukkit.getOnlinePlayers()) {
+ target.getScoreboard().getEntryTeam(player.getName()).removeEntry(player.getName());
+ }
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Rank/Rank.java b/src/main/java/me/night/nullvalkyrie/Rank/Rank.java
similarity index 87%
rename from src/main/java/com/night/nullvalkyrie/Rank/Rank.java
rename to src/main/java/me/night/nullvalkyrie/Rank/Rank.java
index 72cf26c..5c45a47 100644
--- a/src/main/java/com/night/nullvalkyrie/Rank/Rank.java
+++ b/src/main/java/me/night/nullvalkyrie/Rank/Rank.java
@@ -1,20 +1,20 @@
-package com.night.nullvalkyrie.Rank;
-
-import org.bukkit.ChatColor;
-
-public enum Rank {
- OWNER(ChatColor.DARK_RED + "{OWNER}"),
- ADMIN(ChatColor.RED + "{ADMIN}"),
- SPECIAL(ChatColor.GOLD + "{SPECIAL}"),
- ROOKIE(ChatColor.DARK_GREEN + "{ROOKIE}");
-
- private String display;
-
- Rank(String display) {
- this.display = display;
- }
-
- public String getDisplay() {
- return display;
- }
-}
+package me.night.nullvalkyrie.Rank;
+
+import org.bukkit.ChatColor;
+
+public enum Rank {
+ OWNER(ChatColor.DARK_RED + "{OWNER}"),
+ ADMIN(ChatColor.RED + "{ADMIN}"),
+ SPECIAL(ChatColor.GOLD + "{SPECIAL}"),
+ ROOKIE(ChatColor.DARK_GREEN + "{ROOKIE}");
+
+ private String display;
+
+ Rank(String display) {
+ this.display = display;
+ }
+
+ public String getDisplay() {
+ return display;
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Rank/RankManager.java b/src/main/java/me/night/nullvalkyrie/Rank/RankManager.java
similarity index 86%
rename from src/main/java/com/night/nullvalkyrie/Rank/RankManager.java
rename to src/main/java/me/night/nullvalkyrie/Rank/RankManager.java
index a633a2c..41e22f0 100644
--- a/src/main/java/com/night/nullvalkyrie/Rank/RankManager.java
+++ b/src/main/java/me/night/nullvalkyrie/Rank/RankManager.java
@@ -1,52 +1,52 @@
-package com.night.nullvalkyrie.Rank;
-
-import com.night.nullvalkyrie.Main;
-import org.bukkit.Bukkit;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.entity.Player;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.UUID;
-
-import static com.night.nullvalkyrie.Rank.ScoreboardListener.nameTagManager;
-
-public class RankManager {
- private File file;
- private YamlConfiguration config;
-
- private Main main;
-
- public RankManager(Main main) {
- this.main = main;
- if(!main.getDataFolder().exists()) {
- main.getDataFolder().mkdir();
- }
- file = new File(main.getDataFolder(), "ranks.yml");
- if(!file.exists()) {
- try {
- file.createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- config = YamlConfiguration.loadConfiguration(file);
- }
- public void setRank(UUID uuid, Rank rank) {
- config.set(uuid.toString(), rank.name());
- try {
- config.save(file);
- } catch (IOException e) {
- e.printStackTrace();
- }
- for(Player player : Bukkit.getOnlinePlayers()) {
- if(player.hasPlayedBefore()) {
- nameTagManager.removeTag(player);
- nameTagManager.newTag(player);
- }
- }
- }
- public Rank getRank(UUID uuid) {
- return Rank.valueOf(config.getString(uuid.toString()));
- }
-}
+package me.night.nullvalkyrie.Rank;
+
+import me.night.nullvalkyrie.Main;
+import org.bukkit.Bukkit;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.entity.Player;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.UUID;
+
+import static me.night.nullvalkyrie.Rank.ScoreboardListener.nameTagManager;
+
+public class RankManager {
+ private File file;
+ private YamlConfiguration config;
+
+ private Main main;
+
+ public RankManager(Main main) {
+ this.main = main;
+ if(!main.getDataFolder().exists()) {
+ main.getDataFolder().mkdir();
+ }
+ file = new File(main.getDataFolder(), "ranks.yml");
+ if(!file.exists()) {
+ try {
+ file.createNewFile();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ config = YamlConfiguration.loadConfiguration(file);
+ }
+ public void setRank(UUID uuid, Rank rank) {
+ config.set(uuid.toString(), rank.name());
+ try {
+ config.save(file);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ for(Player player : Bukkit.getOnlinePlayers()) {
+ if(player.hasPlayedBefore()) {
+ nameTagManager.removeTag(player);
+ nameTagManager.newTag(player);
+ }
+ }
+ }
+ public Rank getRank(UUID uuid) {
+ return Rank.valueOf(config.getString(uuid.toString()));
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Rank/ScoreboardListener.java b/src/main/java/me/night/nullvalkyrie/Rank/ScoreboardListener.java
similarity index 94%
rename from src/main/java/com/night/nullvalkyrie/Rank/ScoreboardListener.java
rename to src/main/java/me/night/nullvalkyrie/Rank/ScoreboardListener.java
index 669aa90..205e3e5 100644
--- a/src/main/java/com/night/nullvalkyrie/Rank/ScoreboardListener.java
+++ b/src/main/java/me/night/nullvalkyrie/Rank/ScoreboardListener.java
@@ -1,61 +1,61 @@
-package com.night.nullvalkyrie.Rank;
-
-import com.night.nullvalkyrie.Main;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.PlayerDeathEvent;
-import org.bukkit.event.player.AsyncPlayerChatEvent;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-
-public class ScoreboardListener implements Listener {
-
- public static RankManager rankManager;
- public static NameTagManager nameTagManager;
- private SideBarManager sideBarManager;
- private BelowNameManager belowNameManager;
- public ScoreboardListener(Main main) {
- nameTagManager = new NameTagManager(main);
- rankManager = new RankManager(main);
- sideBarManager = new SideBarManager();
- belowNameManager = new BelowNameManager();
- }
-
- @EventHandler
- public void onJoin(PlayerJoinEvent e) {
- Player player = e.getPlayer();
- if(!player.hasPlayedBefore()) {
- e.getPlayer().sendTitle(ChatColor.RED + "Welcome to Matrix!", ChatColor.GREEN + "LOL", 20, 100, 20);
- rankManager.setRank(player.getUniqueId(), Rank.ROOKIE);
- }
- e.getPlayer().setPlayerListHeaderFooter(ChatColor.AQUA + "You are playing on " + ChatColor.GREEN + "127.0.0.1", ChatColor.GOLD + "Ranks, boosters, & more!" + ChatColor.AQUA + "127.0.0.1");
- nameTagManager.setNametags(player);
- nameTagManager.newTag(player);
- sideBarManager.setSideBar(player);
- belowNameManager.setBelowName(player);
- e.setJoinMessage(rankManager.getRank(e.getPlayer().getUniqueId()).getDisplay() + " " + e.getPlayer().getName() + ChatColor.WHITE + " joined the server!");
- }
-
- @EventHandler
- public void onQuit(PlayerQuitEvent e) {
- e.setQuitMessage(ChatColor.RED + "bozo " + e.getPlayer().getName() + " has left.");
- nameTagManager.removeTag(e.getPlayer());
- e.getPlayer().setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
- }
-
- @EventHandler
- public void onChat(AsyncPlayerChatEvent e) {
- e.setCancelled(true);
- Player player = e.getPlayer();
- Bukkit.broadcastMessage(rankManager.getRank(player.getUniqueId()).getDisplay() + " " + player.getName() + ChatColor.WHITE + ": " + e.getMessage());
- }
-
- //Death changing in sidebar
- @EventHandler
- public void onDeath(PlayerDeathEvent e) {
- sideBarManager.changeOnDeath(e.getEntity().getPlayer());
- }
-}
+package me.night.nullvalkyrie.Rank;
+
+import me.night.nullvalkyrie.Main;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.PlayerDeathEvent;
+import org.bukkit.event.player.AsyncPlayerChatEvent;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+
+public class ScoreboardListener implements Listener {
+
+ public static RankManager rankManager;
+ public static NameTagManager nameTagManager;
+ private SideBarManager sideBarManager;
+ private BelowNameManager belowNameManager;
+ public ScoreboardListener(Main main) {
+ nameTagManager = new NameTagManager(main);
+ rankManager = new RankManager(main);
+ sideBarManager = new SideBarManager();
+ belowNameManager = new BelowNameManager();
+ }
+
+ @EventHandler
+ public void onJoin(PlayerJoinEvent e) {
+ Player player = e.getPlayer();
+ if(!player.hasPlayedBefore()) {
+ e.getPlayer().sendTitle(ChatColor.RED + "Welcome to Matrix!", ChatColor.GREEN + "LOL", 20, 100, 20);
+ rankManager.setRank(player.getUniqueId(), Rank.ROOKIE);
+ }
+ e.getPlayer().setPlayerListHeaderFooter(ChatColor.AQUA + "You are playing on " + ChatColor.GREEN + "127.0.0.1", ChatColor.GOLD + "Ranks, boosters, & more!" + ChatColor.AQUA + "127.0.0.1");
+ nameTagManager.setNametags(player);
+ nameTagManager.newTag(player);
+ sideBarManager.setSideBar(player);
+ belowNameManager.setBelowName(player);
+ e.setJoinMessage(rankManager.getRank(e.getPlayer().getUniqueId()).getDisplay() + " " + e.getPlayer().getName() + ChatColor.WHITE + " joined the server!");
+ }
+
+ @EventHandler
+ public void onQuit(PlayerQuitEvent e) {
+ e.setQuitMessage(ChatColor.RED + "bozo " + e.getPlayer().getName() + " has left.");
+ nameTagManager.removeTag(e.getPlayer());
+ e.getPlayer().setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
+ }
+
+ @EventHandler
+ public void onChat(AsyncPlayerChatEvent e) {
+ e.setCancelled(true);
+ Player player = e.getPlayer();
+ Bukkit.broadcastMessage(rankManager.getRank(player.getUniqueId()).getDisplay() + " " + player.getName() + ChatColor.WHITE + ": " + e.getMessage());
+ }
+
+ //Death changing in sidebar
+ @EventHandler
+ public void onDeath(PlayerDeathEvent e) {
+ sideBarManager.changeOnDeath(e.getEntity().getPlayer());
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Rank/SideBarManager.java b/src/main/java/me/night/nullvalkyrie/Rank/SideBarManager.java
similarity index 95%
rename from src/main/java/com/night/nullvalkyrie/Rank/SideBarManager.java
rename to src/main/java/me/night/nullvalkyrie/Rank/SideBarManager.java
index 88bf723..db906cf 100644
--- a/src/main/java/com/night/nullvalkyrie/Rank/SideBarManager.java
+++ b/src/main/java/me/night/nullvalkyrie/Rank/SideBarManager.java
@@ -1,51 +1,50 @@
-package com.night.nullvalkyrie.Rank;
-
-import com.night.nullvalkyrie.Main;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-import org.bukkit.scoreboard.*;
-import org.bukkit.scoreboard.Scoreboard;
-
-import java.util.HashMap;
-import java.util.UUID;
-
-public class SideBarManager {
- private final HashMap deaths = new HashMap<>();
- @SuppressWarnings("deprecation")
- public void setSideBar(Player player) {
- Scoreboard board = player.getScoreboard();
- Objective obj = board.registerNewObjective("Pluto", "dummy");
- obj.setDisplaySlot(DisplaySlot.SIDEBAR);
- obj.setDisplayName(ChatColor.AQUA.toString() + ChatColor.BOLD + "Pluto");
- Score name = obj.getScore(ChatColor.BLUE + "Player Name: ");
- name.setScore(8);
- Score name2 = obj.getScore(ChatColor.WHITE + player.getName());
- name2.setScore(7);
- Score space1 = obj.getScore(" ");
- space1.setScore(6);
- Score players = obj.getScore(ChatColor.LIGHT_PURPLE + "Players Online:");
- players.setScore(5);
- Score playercount = obj.getScore(ChatColor.YELLOW.toString() + Bukkit.getServer().getOnlinePlayers().size());
- playercount.setScore(4);
- Score space2 = obj.getScore(" ");
- space2.setScore(2);
- Score website = obj.getScore(ChatColor.YELLOW + "cath.js.org");
- website.setScore(1);
-
- Team playersOnline = board.registerNewTeam("deathsTotal");
- playersOnline.addEntry(ChatColor.BOLD.toString());
- playersOnline.setPrefix(ChatColor.BLUE + "Deaths: ");
- playersOnline.setSuffix(ChatColor.YELLOW + "0");
- obj.getScore(ChatColor.BOLD.toString()).setScore(3);
- player.setScoreboard(board);
- deaths.put(player.getUniqueId(), 0);
- }
-
- public void changeOnDeath(Player player) {
- int amount = deaths.get(player.getUniqueId());
- amount++;
- deaths.put(player.getUniqueId(), amount++);
- player.getScoreboard().getTeam("deathsTotal").setSuffix(ChatColor.YELLOW.toString() + amount);
- }
-}
+package me.night.nullvalkyrie.Rank;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+import org.bukkit.scoreboard.*;
+import org.bukkit.scoreboard.Scoreboard;
+
+import java.util.HashMap;
+import java.util.UUID;
+
+public class SideBarManager {
+ private final HashMap deaths = new HashMap<>();
+ @SuppressWarnings("deprecation")
+ public void setSideBar(Player player) {
+ Scoreboard board = player.getScoreboard();
+ Objective obj = board.registerNewObjective("Pluto", "dummy");
+ obj.setDisplaySlot(DisplaySlot.SIDEBAR);
+ obj.setDisplayName(ChatColor.AQUA.toString() + ChatColor.BOLD + "Pluto");
+ Score name = obj.getScore(ChatColor.BLUE + "Player Name: ");
+ name.setScore(8);
+ Score name2 = obj.getScore(ChatColor.WHITE + player.getName());
+ name2.setScore(7);
+ Score space1 = obj.getScore(" ");
+ space1.setScore(6);
+ Score players = obj.getScore(ChatColor.LIGHT_PURPLE + "Players Online:");
+ players.setScore(5);
+ Score playercount = obj.getScore(ChatColor.YELLOW.toString() + Bukkit.getServer().getOnlinePlayers().size());
+ playercount.setScore(4);
+ Score space2 = obj.getScore(" ");
+ space2.setScore(2);
+ Score website = obj.getScore(ChatColor.YELLOW + "cath.js.org");
+ website.setScore(1);
+
+ Team playersOnline = board.registerNewTeam("deathsTotal");
+ playersOnline.addEntry(ChatColor.BOLD.toString());
+ playersOnline.setPrefix(ChatColor.BLUE + "Deaths: ");
+ playersOnline.setSuffix(ChatColor.YELLOW + "0");
+ obj.getScore(ChatColor.BOLD.toString()).setScore(3);
+ player.setScoreboard(board);
+ deaths.put(player.getUniqueId(), 0);
+ }
+
+ public void changeOnDeath(Player player) {
+ int amount = deaths.get(player.getUniqueId());
+ amount++;
+ deaths.put(player.getUniqueId(), amount++);
+ player.getScoreboard().getTeam("deathsTotal").setSuffix(ChatColor.YELLOW.toString() + amount);
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Util/Util.java b/src/main/java/me/night/nullvalkyrie/Util/Util.java
similarity index 90%
rename from src/main/java/com/night/nullvalkyrie/Util/Util.java
rename to src/main/java/me/night/nullvalkyrie/Util/Util.java
index 5645fc0..97cff62 100644
--- a/src/main/java/com/night/nullvalkyrie/Util/Util.java
+++ b/src/main/java/me/night/nullvalkyrie/Util/Util.java
@@ -1,17 +1,17 @@
-package com.night.nullvalkyrie.Util;
-
-public class Util {
- public static String centerText(String text, int lineLength) {
- StringBuilder builder = new StringBuilder();
- char space = ' ';
- int distance = (lineLength - text.length()) / 2;
- for (int ii = 0; ii < distance; ii++) {
- builder.append(space);
- }
- builder.append(text);
- for (int i = 0; i < distance; ++i) {
- builder.append(space);
- }
- return builder.toString();
- }
-}
+package me.night.nullvalkyrie.Util;
+
+public class Util {
+ public static String centerText(String text, int lineLength) {
+ StringBuilder builder = new StringBuilder();
+ char space = ' ';
+ int distance = (lineLength - text.length()) / 2;
+ for (int ii = 0; ii < distance; ii++) {
+ builder.append(space);
+ }
+ builder.append(text);
+ for (int i = 0; i < distance; ++i) {
+ builder.append(space);
+ }
+ return builder.toString();
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Util/Utils.java b/src/main/java/me/night/nullvalkyrie/Util/Utils.java
similarity index 94%
rename from src/main/java/com/night/nullvalkyrie/Util/Utils.java
rename to src/main/java/me/night/nullvalkyrie/Util/Utils.java
index ea54905..1dd3192 100644
--- a/src/main/java/com/night/nullvalkyrie/Util/Utils.java
+++ b/src/main/java/me/night/nullvalkyrie/Util/Utils.java
@@ -1,49 +1,49 @@
-package com.night.nullvalkyrie.Util;
-
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.inventory.ItemFlag;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.ItemMeta;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Utils {
- public static String color(String string) {
- return ChatColor.translateAlternateColorCodes('&', string);
- }
-
- public static ItemStack createItem(Material type, int amount, String name, String... lines) {
- ItemStack item = new ItemStack(type, amount);
- ItemMeta meta = item.getItemMeta();
- meta.setUnbreakable(true);
- meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
- if (name != null) meta.setDisplayName(color(name));
- if (lines != null) {
- List lore = new ArrayList<>();
- for (String line : lines) {
- lore.add(color(line));
- }
- meta.setLore(lore);
- }
- item.setItemMeta(meta);
- return item;
- }
-
- public static ItemStack enchantItem(ItemStack item, Enchantment enchant, int level) {
- item.addUnsafeEnchantment(enchant, level);
- return item;
- }
-
- public static ItemStack[] makeArmorSet(ItemStack helmet, ItemStack chestplate, ItemStack leggings, ItemStack boots) {
- ItemStack[] armor = new ItemStack[4];
- armor[3] = helmet;
- armor[2] = chestplate;
- armor[1] = leggings;
- armor[0] = boots;
- return armor;
- }
-
-}
+package me.night.nullvalkyrie.Util;
+
+import org.bukkit.ChatColor;
+import org.bukkit.Material;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.inventory.ItemFlag;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Utils {
+ public static String color(String string) {
+ return ChatColor.translateAlternateColorCodes('&', string);
+ }
+
+ public static ItemStack createItem(Material type, int amount, String name, String... lines) {
+ ItemStack item = new ItemStack(type, amount);
+ ItemMeta meta = item.getItemMeta();
+ meta.setUnbreakable(true);
+ meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE, ItemFlag.HIDE_ENCHANTS);
+ if (name != null) meta.setDisplayName(color(name));
+ if (lines != null) {
+ List lore = new ArrayList<>();
+ for (String line : lines) {
+ lore.add(color(line));
+ }
+ meta.setLore(lore);
+ }
+ item.setItemMeta(meta);
+ return item;
+ }
+
+ public static ItemStack enchantItem(ItemStack item, Enchantment enchant, int level) {
+ item.addUnsafeEnchantment(enchant, level);
+ return item;
+ }
+
+ public static ItemStack[] makeArmorSet(ItemStack helmet, ItemStack chestplate, ItemStack leggings, ItemStack boots) {
+ ItemStack[] armor = new ItemStack[4];
+ armor[3] = helmet;
+ armor[2] = chestplate;
+ armor[1] = leggings;
+ armor[0] = boots;
+ return armor;
+ }
+
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Util/components/CustomMob.java b/src/main/java/me/night/nullvalkyrie/Util/components/CustomMob.java
similarity index 93%
rename from src/main/java/com/night/nullvalkyrie/Util/components/CustomMob.java
rename to src/main/java/me/night/nullvalkyrie/Util/components/CustomMob.java
index 863e77c..af43309 100644
--- a/src/main/java/com/night/nullvalkyrie/Util/components/CustomMob.java
+++ b/src/main/java/me/night/nullvalkyrie/Util/components/CustomMob.java
@@ -1,111 +1,111 @@
-package com.night.nullvalkyrie.Util.components;
-
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.attribute.Attribute;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.inventory.EntityEquipment;
-import org.bukkit.inventory.ItemStack;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static com.night.nullvalkyrie.Util.Utils.color;
-import static com.night.nullvalkyrie.Util.Utils.*;
-
-public enum CustomMob {
-
- DESERT_RISEN(
- "&6Desert Risen",
- 2048,
- 60,
- EntityType.HUSK,
- null,
- null,
- new LootItem(createItem(Material.ROTTEN_FLESH, 1, "&fPreserved Flesh", "&7A preserved flesh from a rotting corpse", "&7Not sure what you'd want this for, though", "&7", "&9Foodstuff"), 1, 3, 100)),
-
- SKELETAL_MAGE(
- "&dSkeletal Mage",
- 2048,
- 15,
- EntityType.SKELETON,
- createItem(Material.BONE, 1, null), makeArmorSet(new ItemStack(Material.IRON_HELMET),
- null,
- null,
- null),
- new LootItem(createItem(Material.BONE, 1, "&dBone Wand", "&7A wand made from skeletal bones"), 30),
- new LootItem(new ItemStack(Material.BONE), 1, 3, 100)),
-
- ZOMBIE_SQUIRE(
- "&bZombie Squire",
- 2048,
- 12,
- EntityType.ZOMBIE,
- new ItemStack(Material.IRON_SWORD),
- makeArmorSet(new ItemStack(Material.CHAINMAIL_HELMET), new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_LEGGINGS), new ItemStack(Material.IRON_BOOTS)), new LootItem(new ItemStack(Material.CHAINMAIL_CHESTPLATE), 35), new LootItem(new ItemStack(Material.CHAINMAIL_LEGGINGS), 35), new LootItem(new ItemStack(Material.CHAINMAIL_HELMET), 35), new LootItem(new ItemStack(Material.IRON_BOOTS), 25), new LootItem(new ItemStack(Material.IRON_SWORD), 40)),
-
- CHARRED_ARCHER(
- "&8Charred Archer",
- 2048,
- 3,
- EntityType.WITHER_SKELETON,
- enchantItem(new ItemStack(Material.BOW), Enchantment.ARROW_KNOCKBACK, 2),
- null, new LootItem(enchantItem(enchantItem(createItem(Material.BOW, 1, "&cBurnt Bow", "&7This bow is burnt to a crisp but remains intact", "&8due to special enchantments"), Enchantment.ARROW_FIRE, 1), Enchantment.ARROW_KNOCKBACK, 2), 100),
- new LootItem(new ItemStack(Material.BONE), 1, 5, 100)),
- ;
-
- private String name;
- private double maxHealth, spawnChance;
- private EntityType type;
- private ItemStack mainItem;
- private ItemStack[] armor;
- private List lootTable;
-
- CustomMob(String name, double maxHealth, double spawnChance, EntityType type, ItemStack mainItem, ItemStack[] armor, LootItem... lootItems) {
- this.name = name;
- this.maxHealth = maxHealth;
- this.spawnChance = spawnChance;
- this.type = type;
- this.mainItem = mainItem;
- this.armor = armor;
- lootTable = Arrays.asList(lootItems);
- }
-
- public LivingEntity spawn(Location location) {
- LivingEntity entity = (LivingEntity) location.getWorld().spawnEntity(location, type);
- entity.setCustomNameVisible(true);
- entity.setCustomName(color(name + " &r&c" + (int) maxHealth + "/" + (int) maxHealth + "❤"));
- entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(maxHealth);
- entity.setHealth(maxHealth);
- EntityEquipment inv = entity.getEquipment();
- if (armor != null) inv.setArmorContents(armor);
- inv.setHelmetDropChance(0f);
- inv.setChestplateDropChance(0f);
- inv.setLeggingsDropChance(0f);
- inv.setBootsDropChance(0f);
- inv.setItemInMainHand(mainItem);
- inv.setItemInMainHandDropChance(0f);
- return entity;
- }
-
- public void tryDropLoot(Location location) {
- for (LootItem item : lootTable) {
- item.tryDropItem(location);
- }
- }
-
- public String getName() {
- return name;
- }
-
- public double getMaxHealth() {
- return maxHealth;
- }
-
- public double getSpawnChance() {
- return spawnChance;
- }
-
-}
+package me.night.nullvalkyrie.Util.components;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.attribute.Attribute;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.inventory.EntityEquipment;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static me.night.nullvalkyrie.Util.Utils.color;
+import static me.night.nullvalkyrie.Util.Utils.*;
+
+public enum CustomMob {
+
+ DESERT_RISEN(
+ "&6Desert Risen",
+ 2048,
+ 60,
+ EntityType.HUSK,
+ null,
+ null,
+ new LootItem(createItem(Material.ROTTEN_FLESH, 1, "&fPreserved Flesh", "&7A preserved flesh from a rotting corpse", "&7Not sure what you'd want this for, though", "&7", "&9Foodstuff"), 1, 3, 100)),
+
+ SKELETAL_MAGE(
+ "&dSkeletal Mage",
+ 2048,
+ 15,
+ EntityType.SKELETON,
+ createItem(Material.BONE, 1, null), makeArmorSet(new ItemStack(Material.IRON_HELMET),
+ null,
+ null,
+ null),
+ new LootItem(createItem(Material.BONE, 1, "&dBone Wand", "&7A wand made from skeletal bones"), 30),
+ new LootItem(new ItemStack(Material.BONE), 1, 3, 100)),
+
+ ZOMBIE_SQUIRE(
+ "&bZombie Squire",
+ 2048,
+ 12,
+ EntityType.ZOMBIE,
+ new ItemStack(Material.IRON_SWORD),
+ makeArmorSet(new ItemStack(Material.CHAINMAIL_HELMET), new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_LEGGINGS), new ItemStack(Material.IRON_BOOTS)), new LootItem(new ItemStack(Material.CHAINMAIL_CHESTPLATE), 35), new LootItem(new ItemStack(Material.CHAINMAIL_LEGGINGS), 35), new LootItem(new ItemStack(Material.CHAINMAIL_HELMET), 35), new LootItem(new ItemStack(Material.IRON_BOOTS), 25), new LootItem(new ItemStack(Material.IRON_SWORD), 40)),
+
+ CHARRED_ARCHER(
+ "&8Charred Archer",
+ 2048,
+ 3,
+ EntityType.WITHER_SKELETON,
+ enchantItem(new ItemStack(Material.BOW), Enchantment.ARROW_KNOCKBACK, 2),
+ null, new LootItem(enchantItem(enchantItem(createItem(Material.BOW, 1, "&cBurnt Bow", "&7This bow is burnt to a crisp but remains intact", "&8due to special enchantments"), Enchantment.ARROW_FIRE, 1), Enchantment.ARROW_KNOCKBACK, 2), 100),
+ new LootItem(new ItemStack(Material.BONE), 1, 5, 100)),
+ ;
+
+ private String name;
+ private double maxHealth, spawnChance;
+ private EntityType type;
+ private ItemStack mainItem;
+ private ItemStack[] armor;
+ private List lootTable;
+
+ CustomMob(String name, double maxHealth, double spawnChance, EntityType type, ItemStack mainItem, ItemStack[] armor, LootItem... lootItems) {
+ this.name = name;
+ this.maxHealth = maxHealth;
+ this.spawnChance = spawnChance;
+ this.type = type;
+ this.mainItem = mainItem;
+ this.armor = armor;
+ lootTable = Arrays.asList(lootItems);
+ }
+
+ public LivingEntity spawn(Location location) {
+ LivingEntity entity = (LivingEntity) location.getWorld().spawnEntity(location, type);
+ entity.setCustomNameVisible(true);
+ entity.setCustomName(color(name + " &r&c" + (int) maxHealth + "/" + (int) maxHealth + "❤"));
+ entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(maxHealth);
+ entity.setHealth(maxHealth);
+ EntityEquipment inv = entity.getEquipment();
+ if (armor != null) inv.setArmorContents(armor);
+ inv.setHelmetDropChance(0f);
+ inv.setChestplateDropChance(0f);
+ inv.setLeggingsDropChance(0f);
+ inv.setBootsDropChance(0f);
+ inv.setItemInMainHand(mainItem);
+ inv.setItemInMainHandDropChance(0f);
+ return entity;
+ }
+
+ public void tryDropLoot(Location location) {
+ for (LootItem item : lootTable) {
+ item.tryDropItem(location);
+ }
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public double getMaxHealth() {
+ return maxHealth;
+ }
+
+ public double getSpawnChance() {
+ return spawnChance;
+ }
+
+}
diff --git a/src/main/java/com/night/nullvalkyrie/Util/components/LootItem.java b/src/main/java/me/night/nullvalkyrie/Util/components/LootItem.java
similarity index 91%
rename from src/main/java/com/night/nullvalkyrie/Util/components/LootItem.java
rename to src/main/java/me/night/nullvalkyrie/Util/components/LootItem.java
index bbb79d5..374ae6d 100644
--- a/src/main/java/com/night/nullvalkyrie/Util/components/LootItem.java
+++ b/src/main/java/me/night/nullvalkyrie/Util/components/LootItem.java
@@ -1,36 +1,36 @@
-package com.night.nullvalkyrie.Util.components;
-
-import org.bukkit.Location;
-import org.bukkit.inventory.ItemStack;
-
-import java.util.Random;
-
-public class LootItem {
-
- private ItemStack item;
- private int min = 1, max = 1;
- private double dropRate;
- private static Random randomiser = new Random();
-
- public LootItem(ItemStack item, double dropRate) {
- this.item = item;
- this.dropRate = dropRate;
- }
-
- public LootItem(ItemStack item, int min, int max, double dropRate) {
- this.item = item;
- this.min = min;
- this.max = max;
- this.dropRate = dropRate;
- }
-
- public void tryDropItem(Location loc) {
- if (Math.random() * 101 > dropRate) return;
- int amount = randomiser.nextInt(max - min + 1) + min;
- if (amount == 0) return;
- ItemStack item = this.item.clone();
- item.setAmount(amount);
- loc.getWorld().dropItemNaturally(loc, item);
- }
-
-}
+package me.night.nullvalkyrie.Util.components;
+
+import org.bukkit.Location;
+import org.bukkit.inventory.ItemStack;
+
+import java.util.Random;
+
+public class LootItem {
+
+ private ItemStack item;
+ private int min = 1, max = 1;
+ private double dropRate;
+ private static Random randomiser = new Random();
+
+ public LootItem(ItemStack item, double dropRate) {
+ this.item = item;
+ this.dropRate = dropRate;
+ }
+
+ public LootItem(ItemStack item, int min, int max, double dropRate) {
+ this.item = item;
+ this.min = min;
+ this.max = max;
+ this.dropRate = dropRate;
+ }
+
+ public void tryDropItem(Location loc) {
+ if (Math.random() * 101 > dropRate) return;
+ int amount = randomiser.nextInt(max - min + 1) + min;
+ if (amount == 0) return;
+ ItemStack item = this.item.clone();
+ item.setAmount(amount);
+ loc.getWorld().dropItemNaturally(loc, item);
+ }
+
+}
diff --git a/src/main/java/com/night/nullvalkyrie/commands/AnvilCommand.java b/src/main/java/me/night/nullvalkyrie/commands/AnvilCommand.java
similarity index 94%
rename from src/main/java/com/night/nullvalkyrie/commands/AnvilCommand.java
rename to src/main/java/me/night/nullvalkyrie/commands/AnvilCommand.java
index ed1f040..6dc39d0 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/AnvilCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/AnvilCommand.java
@@ -1,44 +1,44 @@
-package com.night.nullvalkyrie.commands;
-
-
-//import net.minecraft.network.protocol.game.PacketPlayOutOpenWindow;
-//import net.minecraft.server.level.EntityPlayer;
-//import net.minecraft.server.network.PlayerConnection;
-//import net.minecraft.world.inventory.Containers;
-import org.bukkit.command.CommandSender;
-//import org.bukkit.craftbukkit.v1_18_R1.entity.CraftHumanEntity;
-//import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
-//import org.bukkit.craftbukkit.v1_18_R1.util.CraftChatMessage;
-import org.bukkit.entity.Player;
-
-import java.util.List;
-
-public class AnvilCommand extends Command {
-
- public AnvilCommand() {
- super(
- "anvil",
- new String[]{"av"},
- "Open anvil",
- ""
- );
- }
-
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- if(sender instanceof Player) {
-// Player player = (Player) sender;
-// CraftPlayer craftPlayer = (CraftPlayer) player;
-// EntityPlayer entityPlayer = craftPlayer.getHandle();
-// int id = 0;
-// PacketPlayOutOpenWindow OpenWindow = new PacketPlayOutOpenWindow(id, Containers.h, CraftChatMessage.fromStringOrNull("Test"));
-// PlayerConnection playerConnection = entityPlayer.b;
-// playerConnection.a(OpenWindow);
- }
- }
-
- @Override
- public List onTabComplete(CommandSender sender, String[] args) {
- return null;
- }
+package me.night.nullvalkyrie.commands;
+
+
+//import net.minecraft.network.protocol.game.PacketPlayOutOpenWindow;
+//import net.minecraft.server.level.EntityPlayer;
+//import net.minecraft.server.network.PlayerConnection;
+//import net.minecraft.world.inventory.Containers;
+import org.bukkit.command.CommandSender;
+//import org.bukkit.craftbukkit.v1_18_R1.entity.CraftHumanEntity;
+//import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
+//import org.bukkit.craftbukkit.v1_18_R1.util.CraftChatMessage;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+public class AnvilCommand extends Command {
+
+ public AnvilCommand() {
+ super(
+ "anvil",
+ new String[]{"av"},
+ "Open anvil",
+ ""
+ );
+ }
+
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ if(sender instanceof Player) {
+// Player player = (Player) sender;
+// CraftPlayer craftPlayer = (CraftPlayer) player;
+// EntityPlayer entityPlayer = craftPlayer.getHandle();
+// int id = 0;
+// PacketPlayOutOpenWindow OpenWindow = new PacketPlayOutOpenWindow(id, Containers.h, CraftChatMessage.fromStringOrNull("Test"));
+// PlayerConnection playerConnection = entityPlayer.b;
+// playerConnection.a(OpenWindow);
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ return null;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/night/nullvalkyrie/commands/ArmorCommand.java b/src/main/java/me/night/nullvalkyrie/commands/ArmorCommand.java
similarity index 96%
rename from src/main/java/com/night/nullvalkyrie/commands/ArmorCommand.java
rename to src/main/java/me/night/nullvalkyrie/commands/ArmorCommand.java
index de0d02e..2d5cb16 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/ArmorCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/ArmorCommand.java
@@ -1,77 +1,77 @@
-package com.night.nullvalkyrie.commands;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.LeatherArmorMeta;
-import org.bukkit.util.StringUtil;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class ArmorCommand extends Command {
-
- public ArmorCommand() {
- super(
- "armor",
- new String[]{},
- "Give you a set of armor",
- ""
- );
- }
-
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- if(sender instanceof Player) {
- Player player = (Player) sender;
- ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
- LeatherArmorMeta helmetdata = (LeatherArmorMeta) helmet.getItemMeta();
- helmetdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Helmet");
- helmetdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
- helmetdata.setUnbreakable(true);
- helmet.setItemMeta(helmetdata);
- player.getInventory().addItem(helmet);
-
- ItemStack cp = new ItemStack(Material.LEATHER_CHESTPLATE);
- LeatherArmorMeta cpdata = (LeatherArmorMeta) cp.getItemMeta();
- cpdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Chestplate");
- cpdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
- cpdata.setUnbreakable(true);
- cp.setItemMeta(cpdata);
- player.getInventory().addItem(cp);
-
- ItemStack leg = new ItemStack(Material.LEATHER_LEGGINGS);
- LeatherArmorMeta legdata = (LeatherArmorMeta) leg.getItemMeta();
- legdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Leggings");
- legdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
- legdata.setUnbreakable(true);
- leg.setItemMeta(legdata);
- player.getInventory().addItem(leg);
-
- ItemStack boot = new ItemStack(Material.LEATHER_BOOTS);
- LeatherArmorMeta bootdata = (LeatherArmorMeta) boot.getItemMeta();
- bootdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Boots");
- bootdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
- bootdata.setUnbreakable(true);
- boot.setItemMeta(legdata);
- player.getInventory().addItem(boot);
- }
- }
-
- @Override
- public List onTabComplete(CommandSender sender, String[] args) {
- if(args.length == 1) {
- return StringUtil.copyPartialMatches(args[0], Arrays.asList("angeles", "widow"), new ArrayList<>());
- } else if(args.length == 2) {
- List names = new ArrayList<>();
- for(Player player: Bukkit.getOnlinePlayers()) {
- names.add(player.getName());
- }
- return StringUtil.copyPartialMatches(args[1], names, new ArrayList<>());
- }
- return new ArrayList<>();
- }
-}
+package me.night.nullvalkyrie.commands;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.LeatherArmorMeta;
+import org.bukkit.util.StringUtil;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class ArmorCommand extends Command {
+
+ public ArmorCommand() {
+ super(
+ "armor",
+ new String[]{},
+ "Give you a set of armor",
+ ""
+ );
+ }
+
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ if(sender instanceof Player) {
+ Player player = (Player) sender;
+ ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
+ LeatherArmorMeta helmetdata = (LeatherArmorMeta) helmet.getItemMeta();
+ helmetdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Helmet");
+ helmetdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
+ helmetdata.setUnbreakable(true);
+ helmet.setItemMeta(helmetdata);
+ player.getInventory().addItem(helmet);
+
+ ItemStack cp = new ItemStack(Material.LEATHER_CHESTPLATE);
+ LeatherArmorMeta cpdata = (LeatherArmorMeta) cp.getItemMeta();
+ cpdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Chestplate");
+ cpdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
+ cpdata.setUnbreakable(true);
+ cp.setItemMeta(cpdata);
+ player.getInventory().addItem(cp);
+
+ ItemStack leg = new ItemStack(Material.LEATHER_LEGGINGS);
+ LeatherArmorMeta legdata = (LeatherArmorMeta) leg.getItemMeta();
+ legdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Leggings");
+ legdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
+ legdata.setUnbreakable(true);
+ leg.setItemMeta(legdata);
+ player.getInventory().addItem(leg);
+
+ ItemStack boot = new ItemStack(Material.LEATHER_BOOTS);
+ LeatherArmorMeta bootdata = (LeatherArmorMeta) boot.getItemMeta();
+ bootdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Boots");
+ bootdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
+ bootdata.setUnbreakable(true);
+ boot.setItemMeta(legdata);
+ player.getInventory().addItem(boot);
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ if(args.length == 1) {
+ return StringUtil.copyPartialMatches(args[0], Arrays.asList("angeles", "widow"), new ArrayList<>());
+ } else if(args.length == 2) {
+ List names = new ArrayList<>();
+ for(Player player: Bukkit.getOnlinePlayers()) {
+ names.add(player.getName());
+ }
+ return StringUtil.copyPartialMatches(args[1], names, new ArrayList<>());
+ }
+ return new ArrayList<>();
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/commands/Command.java b/src/main/java/me/night/nullvalkyrie/commands/Command.java
similarity index 94%
rename from src/main/java/com/night/nullvalkyrie/commands/Command.java
rename to src/main/java/me/night/nullvalkyrie/commands/Command.java
index 4ada902..2b3d414 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/Command.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/Command.java
@@ -1,45 +1,45 @@
-package com.night.nullvalkyrie.commands;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandMap;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.defaults.BukkitCommand;
-
-import java.lang.reflect.Field;
-import java.util.Arrays;
-import java.util.List;
-
-public abstract class Command extends BukkitCommand {
-
- public Command(String command, String[] aliases, String description, String permission) {
- super(command);
- this.setAliases(Arrays.asList(aliases));
- this.setDescription(description);
- this.setPermission(permission);
- this.setPermission(ChatColor.RED + "You must have" + permission + "in order to use this command");
-
- try {
- Field field = Bukkit.getServer().getClass().getDeclaredField("commandMap");
- field.setAccessible(true);
- CommandMap map = (CommandMap) field.get(Bukkit.getServer());
- map.register(command, this);
- } catch (NoSuchFieldException | IllegalAccessException e) {
- e.printStackTrace();
- }
-
- }
-
- @Override
- public boolean execute(CommandSender sender, String commandLabel, String[] args) {
- onCommand(sender, args);
- return false;
- }
-
- @Override
- public List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
- return onTabComplete(sender, args);
- }
- public abstract void onCommand(CommandSender sender, String[] args);
- public abstract List onTabComplete(CommandSender sender, String[] args);
-}
+package me.night.nullvalkyrie.commands;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.command.CommandMap;
+import org.bukkit.command.CommandSender;
+import org.bukkit.command.defaults.BukkitCommand;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.List;
+
+public abstract class Command extends BukkitCommand {
+
+ public Command(String command, String[] aliases, String description, String permission) {
+ super(command);
+ this.setAliases(Arrays.asList(aliases));
+ this.setDescription(description);
+ this.setPermission(permission);
+ this.setPermission(ChatColor.RED + "You must have" + permission + "in order to use this command");
+
+ try {
+ Field field = Bukkit.getServer().getClass().getDeclaredField("commandMap");
+ field.setAccessible(true);
+ CommandMap map = (CommandMap) field.get(Bukkit.getServer());
+ map.register(command, this);
+ } catch (NoSuchFieldException | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ @Override
+ public boolean execute(CommandSender sender, String commandLabel, String[] args) {
+ onCommand(sender, args);
+ return false;
+ }
+
+ @Override
+ public List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
+ return onTabComplete(sender, args);
+ }
+ public abstract void onCommand(CommandSender sender, String[] args);
+ public abstract List onTabComplete(CommandSender sender, String[] args);
+}
diff --git a/src/main/java/com/night/nullvalkyrie/commands/CraftCommand.java b/src/main/java/me/night/nullvalkyrie/commands/CraftCommand.java
similarity index 90%
rename from src/main/java/com/night/nullvalkyrie/commands/CraftCommand.java
rename to src/main/java/me/night/nullvalkyrie/commands/CraftCommand.java
index 29d2612..338c43d 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/CraftCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/CraftCommand.java
@@ -1,32 +1,32 @@
-package com.night.nullvalkyrie.commands;
-
-
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import java.util.List;
-
-public class CraftCommand extends Command {
-
- public CraftCommand() {
- super(
- "craft",
- new String[]{"ct", "crafting", "craftingtable"},
- "Open crafting table",
- ""
- );
- }
-
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- if(sender instanceof Player) {
- Player player = (Player) sender;
- player.openWorkbench(null, true);
- }
- }
-
- @Override
- public List onTabComplete(CommandSender sender, String[] args) {
- return null;
- }
-}
+package me.night.nullvalkyrie.commands;
+
+
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+public class CraftCommand extends Command {
+
+ public CraftCommand() {
+ super(
+ "craft",
+ new String[]{"ct", "crafting", "craftingtable"},
+ "Open crafting table",
+ ""
+ );
+ }
+
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ if(sender instanceof Player) {
+ Player player = (Player) sender;
+ player.openWorkbench(null, true);
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ return null;
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/commands/EnchantingCommand.java b/src/main/java/me/night/nullvalkyrie/commands/EnchantingCommand.java
similarity index 91%
rename from src/main/java/com/night/nullvalkyrie/commands/EnchantingCommand.java
rename to src/main/java/me/night/nullvalkyrie/commands/EnchantingCommand.java
index e291616..1bd3994 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/EnchantingCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/EnchantingCommand.java
@@ -1,30 +1,30 @@
-package com.night.nullvalkyrie.commands;
-
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import java.util.List;
-
-public class EnchantingCommand extends Command {
- public EnchantingCommand() {
- super(
- "enchant",
- new String[]{"et", "enchanting", "enchantingtable"},
- "Open enchanting table",
- ""
- );
- }
-
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- if(sender instanceof Player) {
- Player player = (Player) sender;
- player.openEnchanting(player.getLocation(), true);
- }
- }
-
- @Override
- public List onTabComplete(CommandSender sender, String[] args) {
- return null;
- }
+package me.night.nullvalkyrie.commands;
+
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+public class EnchantingCommand extends Command {
+ public EnchantingCommand() {
+ super(
+ "enchant",
+ new String[]{"et", "enchanting", "enchantingtable"},
+ "Open enchanting table",
+ ""
+ );
+ }
+
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ if(sender instanceof Player) {
+ Player player = (Player) sender;
+ player.openEnchanting(player.getLocation(), true);
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ return null;
+ }
}
\ No newline at end of file
diff --git a/src/main/java/com/night/nullvalkyrie/commands/HologramCommand.java b/src/main/java/me/night/nullvalkyrie/commands/HologramCommand.java
similarity index 94%
rename from src/main/java/com/night/nullvalkyrie/commands/HologramCommand.java
rename to src/main/java/me/night/nullvalkyrie/commands/HologramCommand.java
index 3d6344b..04f5b9e 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/HologramCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/HologramCommand.java
@@ -1,47 +1,47 @@
-package com.night.nullvalkyrie.commands;
-
-import org.bukkit.ChatColor;
-import org.bukkit.Location;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.ArmorStand;
-import org.bukkit.entity.Player;
-
-import java.util.List;
-
-public class HologramCommand extends Command {
- public HologramCommand() {
- super(
- "hologram",
- new String[]{},
- "Spawn a hologram",
- ""
- );
- }
-
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- if(sender instanceof Player) {
- Player player = (Player) sender;
- String[] ar = new String[]{
- ChatColor.AQUA + "Hi",
- ChatColor.DARK_PURPLE + "What",
- ChatColor.GOLD + "Hello World"
- };
- Location location = player.getLocation();
- for(String line: ar) {
- ArmorStand stand = location.getWorld().spawn(location.subtract(0,0.3,0), ArmorStand.class, armorStand -> {
- armorStand.setVisible(false);
- });
- stand.setGravity(false);
- stand.setInvulnerable(true);
- stand.setCustomNameVisible(true);
- stand.setCustomName(line);
- }
- }
- }
-
- @Override
- public List onTabComplete(CommandSender sender, String[] args) {
- return null;
- }
-}
+package me.night.nullvalkyrie.commands;
+
+import org.bukkit.ChatColor;
+import org.bukkit.Location;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.ArmorStand;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+public class HologramCommand extends Command {
+ public HologramCommand() {
+ super(
+ "hologram",
+ new String[]{},
+ "Spawn a hologram",
+ ""
+ );
+ }
+
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ if(sender instanceof Player) {
+ Player player = (Player) sender;
+ String[] ar = new String[]{
+ ChatColor.AQUA + "Hi",
+ ChatColor.DARK_PURPLE + "What",
+ ChatColor.GOLD + "Hello World"
+ };
+ Location location = player.getLocation();
+ for(String line: ar) {
+ ArmorStand stand = location.getWorld().spawn(location.subtract(0,0.3,0), ArmorStand.class, armorStand -> {
+ armorStand.setVisible(false);
+ });
+ stand.setGravity(false);
+ stand.setInvulnerable(true);
+ stand.setCustomNameVisible(true);
+ stand.setCustomName(line);
+ }
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ return null;
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/commands/MenuCommand.java b/src/main/java/me/night/nullvalkyrie/commands/MenuCommand.java
similarity index 96%
rename from src/main/java/com/night/nullvalkyrie/commands/MenuCommand.java
rename to src/main/java/me/night/nullvalkyrie/commands/MenuCommand.java
index 0dc7df3..7705654 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/MenuCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/MenuCommand.java
@@ -1,75 +1,75 @@
-package com.night.nullvalkyrie.commands;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.Inventory;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.meta.ItemMeta;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class MenuCommand extends Command {
- public static Inventory inv = Bukkit.createInventory(null, 45, ChatColor.DARK_BLUE.toString() + ChatColor.BOLD + "Valkyrie Menu");
-
- public MenuCommand() {
- super(
- "menu",
- new String[]{"m"},
- "Open the menu",
- ""
- );
- }
-
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- if(sender instanceof Player) {
- Player player = (Player) sender;
- inv = Bukkit.createInventory(player,45, ChatColor.DARK_BLUE.toString() + ChatColor.BOLD + "Valkyrie Menu");
-
- ItemStack KYS = new ItemStack(Material.WOODEN_SWORD);
- ItemMeta KYSmeta = KYS.getItemMeta();
- KYSmeta.setDisplayName(ChatColor.RED + "KILL YOURSELF WHEN???");
- KYSmeta.setLore(Arrays.asList(ChatColor.GRAY + "KYS", ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON"));
- KYS.setItemMeta(KYSmeta);
- inv.setItem(20, KYS);
-
- ItemStack home = new ItemStack(Material.MAP);
- ItemMeta homemeta = home.getItemMeta();
- homemeta.setDisplayName(ChatColor.BLUE + "Teleport to home");
- homemeta.setLore(Arrays.asList(ChatColor.GRAY + "Click to teleport back to home", ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON"));
- home.setItemMeta(homemeta);
- inv.setItem(22, home);
-
- ItemStack chest = new ItemStack(Material.ENDER_CHEST);
- ItemMeta chestmeta = chest.getItemMeta();
- chestmeta.setDisplayName(ChatColor.GREEN + "Open your chest");
- chestmeta.setLore(Arrays.asList(ChatColor.GRAY + "Click to open the chest", ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON"));
- chest.setItemMeta(chestmeta);
- inv.setItem(24, chest);
-
- ItemStack close = new ItemStack(Material.BARRIER);
- ItemMeta closemeta = close.getItemMeta();
- closemeta.setDisplayName(ChatColor.WHITE + "Close the menu");
- closemeta.setLore(Arrays.asList(ChatColor.GRAY + "Close the menu", ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON"));
- close.setItemMeta(closemeta);
- inv.setItem(0, close);
-
- ItemStack frame = new ItemStack(Material.BLUE_STAINED_GLASS_PANE);
- for(int i : new int[]{1,2,3,4,5,6,7,8,9,17,18,26,27,35,36,37,38,39,40,41,42,43,44}) {
- inv.setItem(i, frame);
- }
-
- player.openInventory(inv);
-
- }
- }
-
- @Override
- public List onTabComplete(CommandSender sender, String[] args) {
- return null;
- }
-}
+package me.night.nullvalkyrie.commands;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Material;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class MenuCommand extends Command {
+ public static Inventory inv = Bukkit.createInventory(null, 45, ChatColor.DARK_BLUE.toString() + ChatColor.BOLD + "Valkyrie Menu");
+
+ public MenuCommand() {
+ super(
+ "menu",
+ new String[]{"m"},
+ "Open the menu",
+ ""
+ );
+ }
+
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ if(sender instanceof Player) {
+ Player player = (Player) sender;
+ inv = Bukkit.createInventory(player,45, ChatColor.DARK_BLUE.toString() + ChatColor.BOLD + "Valkyrie Menu");
+
+ ItemStack KYS = new ItemStack(Material.WOODEN_SWORD);
+ ItemMeta KYSmeta = KYS.getItemMeta();
+ KYSmeta.setDisplayName(ChatColor.RED + "KILL YOURSELF WHEN???");
+ KYSmeta.setLore(Arrays.asList(ChatColor.GRAY + "KYS", ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON"));
+ KYS.setItemMeta(KYSmeta);
+ inv.setItem(20, KYS);
+
+ ItemStack home = new ItemStack(Material.MAP);
+ ItemMeta homemeta = home.getItemMeta();
+ homemeta.setDisplayName(ChatColor.BLUE + "Teleport to home");
+ homemeta.setLore(Arrays.asList(ChatColor.GRAY + "Click to teleport back to home", ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON"));
+ home.setItemMeta(homemeta);
+ inv.setItem(22, home);
+
+ ItemStack chest = new ItemStack(Material.ENDER_CHEST);
+ ItemMeta chestmeta = chest.getItemMeta();
+ chestmeta.setDisplayName(ChatColor.GREEN + "Open your chest");
+ chestmeta.setLore(Arrays.asList(ChatColor.GRAY + "Click to open the chest", ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON"));
+ chest.setItemMeta(chestmeta);
+ inv.setItem(24, chest);
+
+ ItemStack close = new ItemStack(Material.BARRIER);
+ ItemMeta closemeta = close.getItemMeta();
+ closemeta.setDisplayName(ChatColor.WHITE + "Close the menu");
+ closemeta.setLore(Arrays.asList(ChatColor.GRAY + "Close the menu", ChatColor.WHITE.toString() + ChatColor.BOLD + "COMMON"));
+ close.setItemMeta(closemeta);
+ inv.setItem(0, close);
+
+ ItemStack frame = new ItemStack(Material.BLUE_STAINED_GLASS_PANE);
+ for(int i : new int[]{1,2,3,4,5,6,7,8,9,17,18,26,27,35,36,37,38,39,40,41,42,43,44}) {
+ inv.setItem(i, frame);
+ }
+
+ player.openInventory(inv);
+
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ return null;
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/commands/MessageCommand.java b/src/main/java/me/night/nullvalkyrie/commands/MessageCommand.java
similarity index 95%
rename from src/main/java/com/night/nullvalkyrie/commands/MessageCommand.java
rename to src/main/java/me/night/nullvalkyrie/commands/MessageCommand.java
index 16265fc..b20fe3f 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/MessageCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/MessageCommand.java
@@ -1,59 +1,59 @@
-package com.night.nullvalkyrie.commands;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.util.StringUtil;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class MessageCommand extends Command {
- public MessageCommand() {
- super(
- "message",
- new String[]{"msg"},
- "Send message to someone",
- ""
- );
- }
-
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- if(sender instanceof Player) {
- Player player = (Player) sender;
- if (args.length >= 2) {
- if(Bukkit.getPlayerExact(args[0]) != null) {
- Player target = Bukkit.getPlayerExact(args[0]);
- if(!target.equals(player)) {
- StringBuilder builder = new StringBuilder();
- for(int i = 1; i < args.length; i++) {
- builder.append(args[i]).append(" ");
- }
- player.sendMessage(ChatColor.DARK_AQUA + "TO " + ChatColor.RED + target.getName() + ChatColor.WHITE + " : " + builder);
- target.sendMessage(ChatColor.DARK_AQUA + "FROM " + ChatColor.RED + player.getName() + ChatColor.WHITE + " : " + builder);
- } else {
- player.sendMessage(ChatColor.RED + "You cannot send message to yourself");
- }
- } else {
- player.sendMessage(ChatColor.RED + "You cannot send message to offline players");
- }
- } else {
- player.sendMessage(ChatColor.RED + "Invalid parameter, use /msg ");
- }
- }
- }
-
- @Override
- public List onTabComplete(CommandSender sender, String[] args) {
- if(args.length == 1) {
- List names = new ArrayList<>();
- for(Player player: Bukkit.getOnlinePlayers()) {
- names.add(player.getName());
- }
- return StringUtil.copyPartialMatches(args[0], names, new ArrayList<>());
- }
- return new ArrayList<>();
- }
-}
+package me.night.nullvalkyrie.commands;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.util.StringUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MessageCommand extends Command {
+ public MessageCommand() {
+ super(
+ "message",
+ new String[]{"msg"},
+ "Send message to someone",
+ ""
+ );
+ }
+
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ if(sender instanceof Player) {
+ Player player = (Player) sender;
+ if (args.length >= 2) {
+ if(Bukkit.getPlayerExact(args[0]) != null) {
+ Player target = Bukkit.getPlayerExact(args[0]);
+ if(!target.equals(player)) {
+ StringBuilder builder = new StringBuilder();
+ for(int i = 1; i < args.length; i++) {
+ builder.append(args[i]).append(" ");
+ }
+ player.sendMessage(ChatColor.DARK_AQUA + "TO " + ChatColor.RED + target.getName() + ChatColor.WHITE + " : " + builder);
+ target.sendMessage(ChatColor.DARK_AQUA + "FROM " + ChatColor.RED + player.getName() + ChatColor.WHITE + " : " + builder);
+ } else {
+ player.sendMessage(ChatColor.RED + "You cannot send message to yourself");
+ }
+ } else {
+ player.sendMessage(ChatColor.RED + "You cannot send message to offline players");
+ }
+ } else {
+ player.sendMessage(ChatColor.RED + "Invalid parameter, use /msg ");
+ }
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ if(args.length == 1) {
+ List names = new ArrayList<>();
+ for(Player player: Bukkit.getOnlinePlayers()) {
+ names.add(player.getName());
+ }
+ return StringUtil.copyPartialMatches(args[0], names, new ArrayList<>());
+ }
+ return new ArrayList<>();
+ }
+}
diff --git a/src/main/java/me/night/nullvalkyrie/commands/MinerCommand.java b/src/main/java/me/night/nullvalkyrie/commands/MinerCommand.java
new file mode 100644
index 0000000..01abbcc
--- /dev/null
+++ b/src/main/java/me/night/nullvalkyrie/commands/MinerCommand.java
@@ -0,0 +1,35 @@
+package me.night.nullvalkyrie.commands;
+
+import me.night.nullvalkyrie.Main;
+import me.night.nullvalkyrie.miners.MinerGUI;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import com.night.nullvalkyrie.miners.*;
+
+import java.util.List;
+
+public class MinerCommand extends Command {
+ private Main main;
+ public MinerCommand(Main main) {
+ super(
+ "miner",
+ new String[]{"m", "miners"},
+ "Miner list",
+ ""
+ );
+ this.main = main;
+ }
+
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ if(sender instanceof Player) {
+ Player player = (Player) sender;
+ new MinerGUI(main, player);
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ return null;
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/commands/RankCommand.java b/src/main/java/me/night/nullvalkyrie/commands/RankCommand.java
similarity index 92%
rename from src/main/java/com/night/nullvalkyrie/commands/RankCommand.java
rename to src/main/java/me/night/nullvalkyrie/commands/RankCommand.java
index 730ea0e..9a48e99 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/RankCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/RankCommand.java
@@ -1,91 +1,91 @@
-package com.night.nullvalkyrie.commands;
-
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import com.night.nullvalkyrie.Main;
-import com.night.nullvalkyrie.Rank.Rank;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.util.StringUtil;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.TimeUnit;
-
-import static com.night.nullvalkyrie.Rank.ScoreboardListener.rankManager;
-
-//92.0.69.141:25565
-public class RankCommand extends Command {
- private Main main;
- public RankCommand(Main main) {
- super(
- "rank",
- new String[]{},
- "Set rank of players",
- ""
- );
- this.main = main;
- }
- private Cache cooldown = CacheBuilder.newBuilder().expireAfterWrite(5, TimeUnit.SECONDS).build();
-
-
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- if(sender instanceof Player) {
- Player player = (Player) sender;
- if(!cooldown.asMap().containsKey(player.getUniqueId())) {
- if(player.isOp()) {
- if(args.length == 2) {
- if(Bukkit.getOfflinePlayer(args[0]).hasPlayedBefore()) {
- OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
- for(Rank rank : Rank.values()) {
- if(rank.name().equalsIgnoreCase(args[1])) {
- rankManager.setRank(target.getUniqueId(), rank);
- player.sendMessage(ChatColor.GREEN + "You changed " + target.getName() + "'s rank to " + rank.getDisplay());
- if(target.isOnline()) {
- target.getPlayer().sendMessage(ChatColor.GREEN + player.getName() + " set your rank to " + rank.getDisplay());
- }
- return;
- }
-
- }
- player.sendMessage(ChatColor.RED + "Invalid Rank, please specify a valid rank, ROOKIE, SPECIAL, ADMIN, OWNER");
- } else {
- player.sendMessage("This player has never played in this server before!");
- }
- } else {
- player.sendMessage(ChatColor.RED + "Invalid parameter, use /rank ");
- }
- } else {
- player.sendMessage(ChatColor.RED + "You must be server operator to use this command");
- }
- cooldown.put(player.getUniqueId(), System.currentTimeMillis() + 5000);
- } else {
- long distance = cooldown.asMap().get(player.getUniqueId()) - System.currentTimeMillis();
- player.sendMessage(ChatColor.RED + "You are on a " + TimeUnit.MILLISECONDS.toSeconds(distance) + " seconds cooldown to use the command again");
- }
- }
- }
-
- @Override
- public List onTabComplete(CommandSender sender, String[] args) {
- if(args.length == 1) {
- List names = new ArrayList<>();
- for(Player player: Bukkit.getOnlinePlayers()) {
- names.add(player.getName());
- }
- return StringUtil.copyPartialMatches(args[0], names, new ArrayList<>());
- } else if(args.length == 2) {
- List roles = new ArrayList<>();
- for(Rank rank : Rank.values()){
- roles.add(rank.name());
- }
- return StringUtil.copyPartialMatches(args[1], roles, new ArrayList<>());
- }
- return new ArrayList<>();
- }
-}
+package me.night.nullvalkyrie.commands;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import me.night.nullvalkyrie.Main;
+import me.night.nullvalkyrie.Rank.Rank;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+import org.bukkit.util.StringUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+import static me.night.nullvalkyrie.Rank.ScoreboardListener.rankManager;
+
+//92.0.69.141:25565
+public class RankCommand extends Command {
+ private Main main;
+ public RankCommand(Main main) {
+ super(
+ "rank",
+ new String[]{},
+ "Set rank of players",
+ ""
+ );
+ this.main = main;
+ }
+ private Cache cooldown = CacheBuilder.newBuilder().expireAfterWrite(5, TimeUnit.SECONDS).build();
+
+
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ if(sender instanceof Player) {
+ Player player = (Player) sender;
+ if(!cooldown.asMap().containsKey(player.getUniqueId())) {
+ if(player.isOp()) {
+ if(args.length == 2) {
+ if(Bukkit.getOfflinePlayer(args[0]).hasPlayedBefore()) {
+ OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
+ for(Rank rank : Rank.values()) {
+ if(rank.name().equalsIgnoreCase(args[1])) {
+ rankManager.setRank(target.getUniqueId(), rank);
+ player.sendMessage(ChatColor.GREEN + "You changed " + target.getName() + "'s rank to " + rank.getDisplay());
+ if(target.isOnline()) {
+ target.getPlayer().sendMessage(ChatColor.GREEN + player.getName() + " set your rank to " + rank.getDisplay());
+ }
+ return;
+ }
+
+ }
+ player.sendMessage(ChatColor.RED + "Invalid Rank, please specify a valid rank, ROOKIE, SPECIAL, ADMIN, OWNER");
+ } else {
+ player.sendMessage("This player has never played in this server before!");
+ }
+ } else {
+ player.sendMessage(ChatColor.RED + "Invalid parameter, use /rank ");
+ }
+ } else {
+ player.sendMessage(ChatColor.RED + "You must be server operator to use this command");
+ }
+ cooldown.put(player.getUniqueId(), System.currentTimeMillis() + 5000);
+ } else {
+ long distance = cooldown.asMap().get(player.getUniqueId()) - System.currentTimeMillis();
+ player.sendMessage(ChatColor.RED + "You are on a " + TimeUnit.MILLISECONDS.toSeconds(distance) + " seconds cooldown to use the command again");
+ }
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ if(args.length == 1) {
+ List names = new ArrayList<>();
+ for(Player player: Bukkit.getOnlinePlayers()) {
+ names.add(player.getName());
+ }
+ return StringUtil.copyPartialMatches(args[0], names, new ArrayList<>());
+ } else if(args.length == 2) {
+ List roles = new ArrayList<>();
+ for(Rank rank : Rank.values()){
+ roles.add(rank.name());
+ }
+ return StringUtil.copyPartialMatches(args[1], roles, new ArrayList<>());
+ }
+ return new ArrayList<>();
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/commands/SpawnCommand.java b/src/main/java/me/night/nullvalkyrie/commands/SpawnCommand.java
similarity index 91%
rename from src/main/java/com/night/nullvalkyrie/commands/SpawnCommand.java
rename to src/main/java/me/night/nullvalkyrie/commands/SpawnCommand.java
index ec95e48..b92cb02 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/SpawnCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/SpawnCommand.java
@@ -1,153 +1,152 @@
-package com.night.nullvalkyrie.commands;
-
-import com.night.nullvalkyrie.Main;
-import com.night.nullvalkyrie.Util.components.CustomMob;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.World;
-import org.bukkit.block.Block;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.*;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.EntityDeathEvent;
-import org.bukkit.scheduler.BukkitRunnable;
-
-import java.text.DecimalFormat;
-import java.util.*;
-
-import static com.night.nullvalkyrie.Util.Utils.color;
-
-public class SpawnCommand extends Command implements Listener {
- private final Main main;
- public World world;
- public final Map indicators = new HashMap<>();
- public final Map entities = new HashMap<>();
- private final DecimalFormat formatter = new DecimalFormat("#");
- public SpawnCommand(Main main) {
- super(
- "spawn",
- new String[]{},
- "Spawn a custom mob",
- ""
- );
- this.main = main;
- }
-
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- world = Bukkit.getWorld("world");
-
- spawnMobs(9, 10, 5 * 20);
- new BukkitRunnable() {
- final Set stands = indicators.keySet();
- final List removal = new ArrayList<>();
- @Override
- public void run() {
- for (Entity stand : stands) {
- int ticksLeft = indicators.get(stand);
- if (ticksLeft == 0) {
- stand.remove();
- removal.add(stand);
- continue;
- }
- ticksLeft--;
- indicators.put(stand, ticksLeft);
- }
- stands.removeAll(removal);
- }
- }.runTaskTimer(main, 0L, 1L);
-
- }
- public void spawnMobs(int size, int mobCap, int spawnTime) {
- CustomMob[] mobTypes = CustomMob.values();
- new BukkitRunnable() {
- final Set spawned = entities.keySet();
- final List removal = new ArrayList<>();
- @Override
- public void run() {
- for (Entity entity : spawned) {
- if (!entity.isValid() || entity.isDead()) removal.add(entity);
- }
- spawned.removeAll(removal);
-
- // Spawning Algorithm
- int diff = mobCap - entities.size();
- if (diff <= 0) return;
- int spawnAmount = (int) (Math.random() * (diff + 1)), count = 0;
- while (count <= spawnAmount) {
- count++;
- int ranX = getRandomWithNeg(size), ranZ = getRandomWithNeg(size);
- Block block = world.getHighestBlockAt(ranX, ranZ);
- double xOffset = getRandomOffset(), zOffset = getRandomOffset();
- Location loc = block.getLocation().clone().add(xOffset, 1, zOffset);
- if (!isSpawnable(loc)) continue;
- double random = Math.random() * 101, previous = 0;
- CustomMob typeToSpawn = mobTypes[0];
- for (CustomMob type : mobTypes) {
- previous += type.getSpawnChance();
- if (random <= previous) {
- typeToSpawn = type;
- break;
- }
- }
- entities.put(typeToSpawn.spawn(loc), typeToSpawn);
- }
- }
- }.runTaskTimer(main, 0L, spawnTime);
- }
-
- public static boolean isSpawnable(Location loc) {
- Block feetBlock = loc.getBlock(), headBlock = loc.clone().add(0, 1, 0).getBlock(), upperBlock = loc.clone().add(0, 2, 0).getBlock();
- return feetBlock.isPassable() && !feetBlock.isLiquid() && headBlock.isPassable() && !headBlock.isLiquid() && upperBlock.isPassable() && !upperBlock.isLiquid();
- }
-
- private static double getRandomOffset() {
- double random = Math.random();
- if (Math.random() > 0.5) random *= -1;
- return random;
- }
-
- public static int getRandomWithNeg(int size) {
- int random = (int) (Math.random() * (size + 1));
- if (Math.random() > 0.5) random *= -1;
- return random;
- }
-
- @EventHandler
- public void onEntityDamage(EntityDamageEvent event) {
- Entity rawEntity = event.getEntity();
- if (!entities.containsKey(rawEntity)) return;
- CustomMob mob = entities.get(rawEntity);
- LivingEntity entity = (LivingEntity) rawEntity;
- double damage = event.getFinalDamage(), health = entity.getHealth() + entity.getAbsorptionAmount();
- if (health > damage) {
- // If the entity survived the hit
- health -= damage;
- entity.setCustomName(color(mob.getName() + " &r&c" + (int) health + "/" + (int) mob.getMaxHealth() + "❤"));
- }
- Location loc = entity.getLocation().clone().add(getRandomOffset(), 1, getRandomOffset());
- world.spawn(loc, ArmorStand.class, armorStand -> {
- armorStand.setMarker(true);
- armorStand.setVisible(false);
- armorStand.setGravity(false);
- armorStand.setSmall(true);
- armorStand.setCustomNameVisible(true);
- armorStand.setCustomName(color("&c" + formatter.format(damage)));
- indicators.put(armorStand, 30);
- });
- }
-
- @EventHandler
- public void onEntityDeath(EntityDeathEvent event) {
- if (!entities.containsKey(event.getEntity())) return;
- event.setDroppedExp(0);
- event.getDrops().clear();
- entities.remove(event.getEntity()).tryDropLoot(event.getEntity().getLocation());
- }
- @Override
- public List onTabComplete(CommandSender sender, String[] args) {
- return null;
- }
-}
+package me.night.nullvalkyrie.commands;
+
+import me.night.nullvalkyrie.Main;
+import me.night.nullvalkyrie.Util.components.CustomMob;
+import me.night.nullvalkyrie.Util.Utils;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.block.Block;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.*;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.EntityDeathEvent;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import java.text.DecimalFormat;
+import java.util.*;
+
+public class SpawnCommand extends Command implements Listener {
+ private final Main main;
+ public World world;
+ public final Map indicators = new HashMap<>();
+ public final Map entities = new HashMap<>();
+ private final DecimalFormat formatter = new DecimalFormat("#");
+ public SpawnCommand(Main main) {
+ super(
+ "spawn",
+ new String[]{},
+ "Spawn a custom mob",
+ ""
+ );
+ this.main = main;
+ }
+
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ world = Bukkit.getWorld("world");
+
+ spawnMobs(9, 10, 5 * 20);
+ new BukkitRunnable() {
+ final Set stands = indicators.keySet();
+ final List removal = new ArrayList<>();
+ @Override
+ public void run() {
+ for (Entity stand : stands) {
+ int ticksLeft = indicators.get(stand);
+ if (ticksLeft == 0) {
+ stand.remove();
+ removal.add(stand);
+ continue;
+ }
+ ticksLeft--;
+ indicators.put(stand, ticksLeft);
+ }
+ stands.removeAll(removal);
+ }
+ }.runTaskTimer(main, 0L, 1L);
+
+ }
+ public void spawnMobs(int size, int mobCap, int spawnTime) {
+ CustomMob[] mobTypes = CustomMob.values();
+ new BukkitRunnable() {
+ final Set spawned = entities.keySet();
+ final List removal = new ArrayList<>();
+ @Override
+ public void run() {
+ for (Entity entity : spawned) {
+ if (!entity.isValid() || entity.isDead()) removal.add(entity);
+ }
+ spawned.removeAll(removal);
+
+ // Spawning Algorithm
+ int diff = mobCap - entities.size();
+ if (diff <= 0) return;
+ int spawnAmount = (int) (Math.random() * (diff + 1)), count = 0;
+ while (count <= spawnAmount) {
+ count++;
+ int ranX = getRandomWithNeg(size), ranZ = getRandomWithNeg(size);
+ Block block = world.getHighestBlockAt(ranX, ranZ);
+ double xOffset = getRandomOffset(), zOffset = getRandomOffset();
+ Location loc = block.getLocation().clone().add(xOffset, 1, zOffset);
+ if (!isSpawnable(loc)) continue;
+ double random = Math.random() * 101, previous = 0;
+ CustomMob typeToSpawn = mobTypes[0];
+ for (CustomMob type : mobTypes) {
+ previous += type.getSpawnChance();
+ if (random <= previous) {
+ typeToSpawn = type;
+ break;
+ }
+ }
+ entities.put(typeToSpawn.spawn(loc), typeToSpawn);
+ }
+ }
+ }.runTaskTimer(main, 0L, spawnTime);
+ }
+
+ public static boolean isSpawnable(Location loc) {
+ Block feetBlock = loc.getBlock(), headBlock = loc.clone().add(0, 1, 0).getBlock(), upperBlock = loc.clone().add(0, 2, 0).getBlock();
+ return feetBlock.isPassable() && !feetBlock.isLiquid() && headBlock.isPassable() && !headBlock.isLiquid() && upperBlock.isPassable() && !upperBlock.isLiquid();
+ }
+
+ private static double getRandomOffset() {
+ double random = Math.random();
+ if (Math.random() > 0.5) random *= -1;
+ return random;
+ }
+
+ public static int getRandomWithNeg(int size) {
+ int random = (int) (Math.random() * (size + 1));
+ if (Math.random() > 0.5) random *= -1;
+ return random;
+ }
+
+ @EventHandler
+ public void onEntityDamage(EntityDamageEvent event) {
+ Entity rawEntity = event.getEntity();
+ if (!entities.containsKey(rawEntity)) return;
+ CustomMob mob = entities.get(rawEntity);
+ LivingEntity entity = (LivingEntity) rawEntity;
+ double damage = event.getFinalDamage(), health = entity.getHealth() + entity.getAbsorptionAmount();
+ if (health > damage) {
+ // If the entity survived the hit
+ health -= damage;
+ entity.setCustomName(Utils.color(mob.getName() + " &r&c" + (int) health + "/" + (int) mob.getMaxHealth() + "❤"));
+ }
+ Location loc = entity.getLocation().clone().add(getRandomOffset(), 1, getRandomOffset());
+ world.spawn(loc, ArmorStand.class, armorStand -> {
+ armorStand.setMarker(true);
+ armorStand.setVisible(false);
+ armorStand.setGravity(false);
+ armorStand.setSmall(true);
+ armorStand.setCustomNameVisible(true);
+ armorStand.setCustomName(Utils.color("&c" + formatter.format(damage)));
+ indicators.put(armorStand, 30);
+ });
+ }
+
+ @EventHandler
+ public void onEntityDeath(EntityDeathEvent event) {
+ if (!entities.containsKey(event.getEntity())) return;
+ event.setDroppedExp(0);
+ event.getDrops().clear();
+ entities.remove(event.getEntity()).tryDropLoot(event.getEntity().getLocation());
+ }
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ return null;
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/commands/TestCommand.java b/src/main/java/me/night/nullvalkyrie/commands/TestCommand.java
similarity index 91%
rename from src/main/java/com/night/nullvalkyrie/commands/TestCommand.java
rename to src/main/java/me/night/nullvalkyrie/commands/TestCommand.java
index 2a43e38..a080fbe 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/TestCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/TestCommand.java
@@ -1,35 +1,35 @@
-package com.night.nullvalkyrie.commands;
-
-
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import java.util.List;
-
-public class TestCommand extends Command {
- public TestCommand() {
- super(
- "test",
- new String[]{},
- "Test",
- ""
- );
- }
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- if(sender instanceof Player) {
- if(args.length == 1) {
- if(args[0].equalsIgnoreCase("hello")) {
- Player player = (Player) sender;
- player.sendMessage(player.getAddress().getHostString());
- }
- }
-
- }
- }
-
- @Override
- public List onTabComplete(CommandSender sender, String[] args) {
- return null;
- }
-}
+package me.night.nullvalkyrie.commands;
+
+
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.util.List;
+
+public class TestCommand extends Command {
+ public TestCommand() {
+ super(
+ "test",
+ new String[]{},
+ "Test",
+ ""
+ );
+ }
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ if(sender instanceof Player) {
+ if(args.length == 1) {
+ if(args[0].equalsIgnoreCase("hello")) {
+ Player player = (Player) sender;
+ player.sendMessage(player.getAddress().getHostString());
+ }
+ }
+
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ return null;
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/commands/UtilCommand.java b/src/main/java/me/night/nullvalkyrie/commands/UtilCommand.java
similarity index 82%
rename from src/main/java/com/night/nullvalkyrie/commands/UtilCommand.java
rename to src/main/java/me/night/nullvalkyrie/commands/UtilCommand.java
index dd068e7..874320c 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/UtilCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/UtilCommand.java
@@ -1,68 +1,66 @@
-package com.night.nullvalkyrie.commands;
-
-import com.night.nullvalkyrie.Main;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.StringUtil;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
-
-import static com.night.nullvalkyrie.Items.CustomItemManager.getAllFilesFromDirectory;
-import static com.night.nullvalkyrie.Items.CustomItemManager.loadConfig;
-
-public class UtilCommand extends Command {
- private Main main;
- public UtilCommand(Main main) {
- super(
- "util",
- new String[]{},
- "Give you a tool",
- ""
-
- );
- this.main = main;
- }
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- Player player = (Player) sender;
- StringBuilder s = new StringBuilder();
- List b = Arrays.asList(args);
- for(String a: args) {
- if(a.equals(b.get(b.size() - 1))) {
- s.append(a);
- } else {
- s.append(a);
- s.append(" ");
- }
-
- }
- ItemStack item = main.getCustomItemManager().getItem(s.toString());
- if(item.hasItemMeta()) {
- player.getInventory().addItem(item);
- } else {
- player.sendMessage(ChatColor.RED + "This item doesn't exist");
- }
- }
-
- @Override
- public List onTabComplete(CommandSender sender, String[] args) {
- if(args.length == 1) {
- List hh = getAllFilesFromDirectory("ItemData");
- ArrayList cc = new ArrayList<>();
- for(int kk = 0; kk < hh.size(); kk++) {
- FileConfiguration c = loadConfig("ItemData\\" + hh.get(kk));
- if(Objects.equals(c.getString("type"), "Util")) {
- cc.add(c.getString("name"));
- }
- }
- return StringUtil.copyPartialMatches(args[0], cc, new ArrayList<>());
- }
- return new ArrayList<>();
- }
-}
+package me.night.nullvalkyrie.commands;
+
+import me.night.nullvalkyrie.Main;
+import me.night.nullvalkyrie.Items.CustomItemManager;
+import org.bukkit.ChatColor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.StringUtil;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+public class UtilCommand extends Command {
+ private Main main;
+ public UtilCommand(Main main) {
+ super(
+ "util",
+ new String[]{},
+ "Give you a tool",
+ ""
+
+ );
+ this.main = main;
+ }
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ Player player = (Player) sender;
+ StringBuilder s = new StringBuilder();
+ List b = Arrays.asList(args);
+ for(String a: args) {
+ if(a.equals(b.get(b.size() - 1))) {
+ s.append(a);
+ } else {
+ s.append(a);
+ s.append(" ");
+ }
+
+ }
+ ItemStack item = main.getCustomItemManager().getItem(s.toString());
+ if(item.hasItemMeta()) {
+ player.getInventory().addItem(item);
+ } else {
+ player.sendMessage(ChatColor.RED + "This item doesn't exist");
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ if(args.length == 1) {
+ List hh = CustomItemManager.getAllFilesFromDirectory("ItemData");
+ ArrayList cc = new ArrayList<>();
+ for(int kk = 0; kk < hh.size(); kk++) {
+ FileConfiguration c = CustomItemManager.loadConfig("ItemData\\" + hh.get(kk));
+ if(Objects.equals(c.getString("type"), "Util")) {
+ cc.add(c.getString("name"));
+ }
+ }
+ return StringUtil.copyPartialMatches(args[0], cc, new ArrayList<>());
+ }
+ return new ArrayList<>();
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/commands/VanishCommand.java b/src/main/java/me/night/nullvalkyrie/commands/VanishCommand.java
similarity index 94%
rename from src/main/java/com/night/nullvalkyrie/commands/VanishCommand.java
rename to src/main/java/me/night/nullvalkyrie/commands/VanishCommand.java
index 186c347..48e0a4a 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/VanishCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/VanishCommand.java
@@ -1,46 +1,46 @@
-package com.night.nullvalkyrie.commands;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-public class VanishCommand extends Command {
- private final List vanished = new ArrayList<>();
- public VanishCommand() {
- super(
- "vanish",
- new String[]{},
- "Turn yourself into invisible",
- ""
- );
- }
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- if(sender instanceof Player) {
- Player player = (Player) sender;
- if(vanished.contains(player.getUniqueId())) {
- vanished.remove(player.getUniqueId());
- for (Player target : Bukkit.getOnlinePlayers()) {
- target.showPlayer(player);
- }
- player.sendMessage(ChatColor.GREEN + "You are now seen by people");
- } else {
- vanished.add(player.getUniqueId());
- for (Player target: Bukkit.getOnlinePlayers()){
- target.hidePlayer(player);
- }
- player.sendMessage(ChatColor.GREEN + "You are now vanished");
- }
- }
- }
-
- @Override
- public List onTabComplete(CommandSender sender, String[] args) {
- return null;
- }
-}
+package me.night.nullvalkyrie.commands;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+public class VanishCommand extends Command {
+ private final List vanished = new ArrayList<>();
+ public VanishCommand() {
+ super(
+ "vanish",
+ new String[]{},
+ "Turn yourself into invisible",
+ ""
+ );
+ }
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ if(sender instanceof Player) {
+ Player player = (Player) sender;
+ if(vanished.contains(player.getUniqueId())) {
+ vanished.remove(player.getUniqueId());
+ for (Player target : Bukkit.getOnlinePlayers()) {
+ target.showPlayer(player);
+ }
+ player.sendMessage(ChatColor.GREEN + "You are now seen by people");
+ } else {
+ vanished.add(player.getUniqueId());
+ for (Player target: Bukkit.getOnlinePlayers()){
+ target.hidePlayer(player);
+ }
+ player.sendMessage(ChatColor.GREEN + "You are now vanished");
+ }
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ return null;
+ }
+}
diff --git a/src/main/java/com/night/nullvalkyrie/commands/WeaponCommand.java b/src/main/java/me/night/nullvalkyrie/commands/WeaponCommand.java
similarity index 82%
rename from src/main/java/com/night/nullvalkyrie/commands/WeaponCommand.java
rename to src/main/java/me/night/nullvalkyrie/commands/WeaponCommand.java
index 78a7466..2e210d4 100644
--- a/src/main/java/com/night/nullvalkyrie/commands/WeaponCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/WeaponCommand.java
@@ -1,70 +1,68 @@
-package com.night.nullvalkyrie.commands;
-
-import com.night.nullvalkyrie.Main;
-import org.bukkit.ChatColor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.StringUtil;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
-
-import static com.night.nullvalkyrie.Items.CustomItemManager.getAllFilesFromDirectory;
-import static com.night.nullvalkyrie.Items.CustomItemManager.loadConfig;
-
-public class WeaponCommand extends Command {
- private Main main;
- public WeaponCommand(Main main) {
- super(
- "weapon",
- new String[]{},
- "Give you a weapon",
- ""
-
- );
- this.main = main;
- }
-
-
- @Override
- public void onCommand(CommandSender sender, String[] args) {
- Player player = (Player) sender;
- StringBuilder s = new StringBuilder();
- List b = Arrays.asList(args);
- for(String a: args) {
- if(a.equals(b.get(b.size() - 1))) {
- s.append(a);
- } else {
- s.append(a);
- s.append(" ");
- }
-
- }
- ItemStack item = main.getCustomItemManager().getItem(s.toString());
- if(item.hasItemMeta()) {
- player.getInventory().addItem(item);
- } else {
- player.sendMessage(ChatColor.RED + "This item doesn't exist");
- }
- }
-
- @Override
- public List onTabComplete(CommandSender sender, String[] args) {
- if(args.length == 1) {
- List hh = getAllFilesFromDirectory("ItemData");
- ArrayList cc = new ArrayList<>();
- for(int kk = 0; kk < hh.size(); kk++) {
- FileConfiguration c = loadConfig("ItemData\\" + hh.get(kk));
- if(Objects.equals(c.getString("type"), "Weapon")) {
- cc.add(c.getString("name"));
- }
- }
- return StringUtil.copyPartialMatches(args[0], cc, new ArrayList<>());
- }
- return new ArrayList<>();
- }
-}
+package me.night.nullvalkyrie.commands;
+
+import me.night.nullvalkyrie.Main;
+import me.night.nullvalkyrie.Items.CustomItemManager;
+import org.bukkit.ChatColor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.StringUtil;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+public class WeaponCommand extends Command {
+ private Main main;
+ public WeaponCommand(Main main) {
+ super(
+ "weapon",
+ new String[]{},
+ "Give you a weapon",
+ ""
+
+ );
+ this.main = main;
+ }
+
+
+ @Override
+ public void onCommand(CommandSender sender, String[] args) {
+ Player player = (Player) sender;
+ StringBuilder s = new StringBuilder();
+ List b = Arrays.asList(args);
+ for(String a: args) {
+ if(a.equals(b.get(b.size() - 1))) {
+ s.append(a);
+ } else {
+ s.append(a);
+ s.append(" ");
+ }
+
+ }
+ ItemStack item = main.getCustomItemManager().getItem(s.toString());
+ if(item.hasItemMeta()) {
+ player.getInventory().addItem(item);
+ } else {
+ player.sendMessage(ChatColor.RED + "This item doesn't exist");
+ }
+ }
+
+ @Override
+ public List onTabComplete(CommandSender sender, String[] args) {
+ if(args.length == 1) {
+ List hh = CustomItemManager.getAllFilesFromDirectory("ItemData");
+ ArrayList cc = new ArrayList<>();
+ for(int kk = 0; kk < hh.size(); kk++) {
+ FileConfiguration c = CustomItemManager.loadConfig("ItemData/" + hh.get(kk));
+ if(Objects.equals(c.getString("type"), "Weapon")) {
+ cc.add(c.getString("name"));
+ }
+ }
+ return StringUtil.copyPartialMatches(args[0], cc, new ArrayList<>());
+ }
+ return new ArrayList<>();
+ }
+}
diff --git a/src/main/java/me/night/nullvalkyrie/miners/CryptoMiner.java b/src/main/java/me/night/nullvalkyrie/miners/CryptoMiner.java
new file mode 100644
index 0000000..a851e50
--- /dev/null
+++ b/src/main/java/me/night/nullvalkyrie/miners/CryptoMiner.java
@@ -0,0 +1,94 @@
+package me.night.nullvalkyrie.miners;
+
+import me.night.nullvalkyrie.Main;
+import org.bukkit.Material;
+import org.bukkit.configuration.Configuration;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.event.EventHandler;
+import org.bukkit.scheduler.BukkitRunnable;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+
+import static me.night.nullvalkyrie.Items.CustomItemManager.loadConfig;
+import static me.night.nullvalkyrie.Items.CustomItemManager.loadFile;
+
+public class CryptoMiner {
+ protected Main main;
+ protected String name;
+ protected Material type;
+ protected int level;
+ protected double rate;
+ protected int generated;
+ public CryptoMiner(Main main, String name, Material type, int level, double rate) {
+ this.main = main;
+ this.name = name; // Name of the miner
+ this.type = type; // Material to mine
+ this.level = level;
+ this.rate = rate; // Percentage generate chance in each tick 20tick per sec
+ //generate(70);
+
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public double getRate() {
+ return rate;
+ }
+ public void setRate(double rate) {
+ this.rate = rate;
+ }
+ public Material getType() {
+ return type;
+ }
+ public void setType(Material type) {
+ this.type = type;
+ }
+ public int getLevel() {
+ return level;
+ }
+ public void setLevel(int level) { this.level = level; }
+ public void generate(int pp) {
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ int count = ThreadLocalRandom.current().nextInt(100);
+ if(count > pp) generated++;
+ }
+ }.runTaskTimer(main, 0L, 1L);
+ }
+ public List getMiners() {
+ List arr = new ArrayList<>();
+ FileConfiguration file = loadConfig("miners.yml");
+ for(String c : file.getKeys(false)) {
+ arr.add(new CryptoMiner(main, file.getString(c + ".name"), Material.matchMaterial(file.getString(c + ".material")), file.getInt(c + ".level"), file.getDouble(c + ".rate")));
+ }
+ return arr;
+ }
+ public CryptoMiner getMiner(String index) {
+ FileConfiguration file = loadConfig("miners.yml");
+ return new CryptoMiner(main, file.getString(index + ".name"), Material.matchMaterial(file.getString(index + ".name")), file.getInt(index + ".level"), file.getDouble(index + ".rate"));
+ }
+ public void setMiner(String index, String name, String material, int level, double rate) {
+ CryptoMiner miner = new CryptoMiner(main, name, Material.matchMaterial(material), level, rate);
+ FileConfiguration file = loadConfig("miners.yml");
+ file.createSection(index);
+ file.set(index + ".name", name);
+ file.set(index + ".material", material);
+ file.set(index + ".level", level);
+ file.set(index + ".rate", rate);
+ file.set(index + ".enabled", true);
+ try {
+ file.save(loadFile("miners.yml"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/src/main/java/me/night/nullvalkyrie/miners/MinerGUI.java b/src/main/java/me/night/nullvalkyrie/miners/MinerGUI.java
new file mode 100644
index 0000000..57c9a42
--- /dev/null
+++ b/src/main/java/me/night/nullvalkyrie/miners/MinerGUI.java
@@ -0,0 +1,58 @@
+package me.night.nullvalkyrie.miners;
+
+import me.night.nullvalkyrie.Main;
+import me.night.nullvalkyrie.Items.CustomItemManager;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Material;
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.Inventory;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.meta.ItemMeta;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class MinerGUI {
+ private Main main;
+ private FileConfiguration file;
+ private Inventory inv;
+ public MinerGUI(Main main, Player player) {
+ this.main = main;
+ if(!main.getDataFolder().exists()) main.getDataFolder().mkdir();
+ file = CustomItemManager.loadConfig("miners.yml");
+ createUI();
+ player.openInventory(inv);
+ }
+ public void createUI() {
+ inv = Bukkit.createInventory(null,45, ChatColor.DARK_AQUA + "Crypto Miners");
+ ItemStack frame = new ItemStack(Material.BLUE_STAINED_GLASS_PANE);
+ for(int i : new int[]{1,2,3,4,5,6,7,8,9,17,18,26,27,35,36,37,38,39,40,41,42,43,44}) {
+ inv.setItem(i, frame);
+ }
+ ItemStack close = new ItemStack(Material.BARRIER);
+ ItemMeta closemeta = close.getItemMeta();
+ closemeta.setDisplayName(ChatColor.WHITE + "Close the menu");
+ closemeta.setLore(Arrays.asList(ChatColor.GRAY + "Close the menu"));
+ close.setItemMeta(closemeta);
+ inv.setItem(0, close);
+ int[] a = new int[]{10,11,12,13,14,15,16,19,20,21,22,23,24,25,28,29,30,31,32,33,34};
+ int ind = 0;
+ for(String c : file.getKeys(false)) {
+ ItemStack item = new ItemStack(Material.matchMaterial(file.getString(c + ".material")));
+ ItemMeta itemMeta = item.getItemMeta();
+ itemMeta.setDisplayName(file.getString(c + ".name"));
+ List lore = new ArrayList<>();
+ lore.add("Level: " + file.getString(c + ".level"));
+ lore.add("Rate: " + file.getString(c + ".rate"));
+ boolean b = file.getBoolean(c + ".rate") ? lore.add(ChatColor.GRAY + "Click to enable miner!") : lore.add(ChatColor.RED + "Click to disable miner!");
+ itemMeta.setLore(lore);
+ item.setItemMeta(itemMeta);
+ inv.setItem(a[ind], item);
+ ind++;
+ }
+ }
+
+}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 2a3b645..d8e66ad 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -1,6 +1,6 @@
name: NullValkyrie
version: '${project.version}'
-main: com.night.nullvalkyrie.Main
+main: me.night.nullvalkyrie.Main
api-version: 1.18
authors: [ NightKaly, Leocthl ]
description: Null Valkyrie