diff --git a/pom.xml b/pom.xml index adc9d3f..64f51fd 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ org.spigotmc - spigot-api + spigot 1.18.1-R0.1-SNAPSHOT provided diff --git a/src/main/java/com/night/nullvalkyrie/Main.java b/src/main/java/com/night/nullvalkyrie/Main.java index 6daf98b..f67147b 100644 --- a/src/main/java/com/night/nullvalkyrie/Main.java +++ b/src/main/java/com/night/nullvalkyrie/Main.java @@ -1,26 +1,31 @@ package com.night.nullvalkyrie; import com.night.nullvalkyrie.Chests.MenuListener; -import com.night.nullvalkyrie.NameTag.NameTagManager; +import com.night.nullvalkyrie.RankSys.NameTagManager; import com.night.nullvalkyrie.RankSys.ScoreboardListener; import com.night.nullvalkyrie.RankSys.RankManager; -import com.night.nullvalkyrie.SideBar.SideBarManager; +import com.night.nullvalkyrie.RankSys.SideBarManager; import com.night.nullvalkyrie.commands.*; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.*; +import org.bukkit.block.Block; +import org.bukkit.block.data.BlockData; import org.bukkit.boss.BarColor; import org.bukkit.boss.BarStyle; import org.bukkit.boss.BossBar; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.*; +import org.bukkit.event.Event; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.player.PlayerEggThrowEvent; +import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.server.ServerListPingEvent; @@ -28,8 +33,11 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ShapedRecipe; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.plugin.java.JavaPlugin; +import org.bukkit.util.Vector; import java.io.File; +import java.util.HashMap; +import java.util.UUID; public final class Main extends JavaPlugin implements Listener { private BossBar bossbar; @@ -45,7 +53,7 @@ public final class Main extends JavaPlugin implements Listener { @Override public void onEnable() { new VanishCommand();new TestCommand();new WeaponCommand();new AnvilCommand();new ArmorCommand();new MenuCommand();new RankCommand(this); - new MessageCommand();new HologramCommand();new CraftCommand();new EnchantingCommand(); + new MessageCommand();new HologramCommand();new CraftCommand();new EnchantingCommand();new SpawnCommand(); bossbar = Bukkit.createBossBar( ChatColor.GOLD + "Kuudra", BarColor.RED, @@ -73,19 +81,32 @@ public final class Main extends JavaPlugin implements Listener { wither_sword_recipe.setIngredient('B', Material.STICK); Bukkit.addRecipe(wither_sword_recipe); } + @EventHandler + public void Projectile(ProjectileLaunchEvent e) { + Player player = (Player) e.getEntity().getShooter(); + if(player.getInventory().getItemInMainHand().getItemMeta() != null) { + String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName(); + if (name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Frag Grenade")) { + Egg s = (Egg) e.getEntity(); + s.setVelocity(player.getLocation().getDirection().multiply(10)); + } + } + + + } @EventHandler public void onPlayerInteract(PlayerInteractEvent e) { Player player = e.getPlayer(); if(e.hasItem()) { - if(e.getAction().equals(Action.RIGHT_CLICK_AIR) || e.getAction().equals(Action.RIGHT_CLICK_BLOCK)) { - if (player.getInventory().getItemInMainHand()!= null && player.getInventory().getItemInMainHand().getType().equals(Material.DIAMOND_HOE)) { - player.launchProjectile(Snowball.class, player.getLocation().getDirection()); - + if(player.getInventory().getItemInMainHand().getItemMeta() != null) { + String name = player.getInventory().getItemInMainHand().getItemMeta().getDisplayName(); + if (name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "SnowGun")) { + Snowball s = player.launchProjectile(Snowball.class, player.getLocation().getDirection()); + s.setVelocity(player.getLocation().getDirection().multiply(10)); } } } - } @EventHandler @@ -115,7 +136,7 @@ public final class Main extends JavaPlugin implements Listener { public void onPing(ServerListPingEvent e) { e.setMaxPlayers(8964); String s = centerText("Apache\n", 45); - String s2 = centerText("Support 1.18 & 1.8.9",15); + String s2 = centerText("Support 1.18 & 1.8.9",25); e.setMotd(ChatColor.AQUA.toString() + ChatColor.BOLD + s + ChatColor.GOLD + ChatColor.BOLD + s2); try { e.setServerIcon(Bukkit.loadServerIcon(new File("nuke.png"))); @@ -131,7 +152,7 @@ public final class Main extends JavaPlugin implements Listener { if (!(ent instanceof Player)) { Snowball sb = (Snowball) e.getDamager(); Player pl = (Player) sb.getShooter(); - if(pl.getInventory().getItemInMainHand().getItemMeta() == null) { + if(pl.getInventory().getItemInMainHand().getItemMeta() != null) { String name = pl.getInventory().getItemInMainHand().getItemMeta().getDisplayName(); if (name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "SnowGun")) { e.setDamage(10000); @@ -149,7 +170,7 @@ public final class Main extends JavaPlugin implements Listener { public void onProjectileHit(ProjectileHitEvent e) { if(e.getEntity().getShooter() instanceof Player) { Player shooter = (Player) e.getEntity().getShooter(); - if(shooter.getInventory().getItemInMainHand().getItemMeta() == null) { + if(shooter.getInventory().getItemInMainHand().getItemMeta() != null) { String name = shooter.getInventory().getItemInMainHand().getItemMeta().getDisplayName(); if(name.equalsIgnoreCase(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Frag Grenade")) { if(e.getHitBlock() == null) { diff --git a/src/main/java/com/night/nullvalkyrie/NameTag/NameTagManager.java b/src/main/java/com/night/nullvalkyrie/RankSys/NameTagManager.java similarity index 97% rename from src/main/java/com/night/nullvalkyrie/NameTag/NameTagManager.java rename to src/main/java/com/night/nullvalkyrie/RankSys/NameTagManager.java index 86a9c7d..760a4c6 100644 --- a/src/main/java/com/night/nullvalkyrie/NameTag/NameTagManager.java +++ b/src/main/java/com/night/nullvalkyrie/RankSys/NameTagManager.java @@ -1,4 +1,4 @@ -package com.night.nullvalkyrie.NameTag; +package com.night.nullvalkyrie.RankSys; import com.night.nullvalkyrie.Main; import com.night.nullvalkyrie.RankSys.Rank; diff --git a/src/main/java/com/night/nullvalkyrie/SideBar/SideBarManager.java b/src/main/java/com/night/nullvalkyrie/RankSys/SideBarManager.java similarity index 98% rename from src/main/java/com/night/nullvalkyrie/SideBar/SideBarManager.java rename to src/main/java/com/night/nullvalkyrie/RankSys/SideBarManager.java index bf69c15..bfcf778 100644 --- a/src/main/java/com/night/nullvalkyrie/SideBar/SideBarManager.java +++ b/src/main/java/com/night/nullvalkyrie/RankSys/SideBarManager.java @@ -1,4 +1,4 @@ -package com.night.nullvalkyrie.SideBar; +package com.night.nullvalkyrie.RankSys; import com.night.nullvalkyrie.Main; import org.bukkit.Bukkit; diff --git a/src/main/java/com/night/nullvalkyrie/commands/SpawnCommand.java b/src/main/java/com/night/nullvalkyrie/commands/SpawnCommand.java new file mode 100644 index 0000000..f69715c --- /dev/null +++ b/src/main/java/com/night/nullvalkyrie/commands/SpawnCommand.java @@ -0,0 +1,35 @@ +package com.night.nullvalkyrie.commands; + +import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; + +import java.util.List; + +public class SpawnCommand extends Command { + public SpawnCommand() { + super( + "spawn", + new String[]{}, + "Spawn a custom mob", + "" + ); + } + + @Override + public void onCommand(CommandSender sender, String[] args) { + Player player = (Player) sender; + Entity ent = (Entity) Bukkit.getWorld("world").spawnEntity((player.getLocation().add(0, 2, 0)), EntityType.ZOMBIE); + ent.setCustomName("Gay"); + ent.setCustomNameVisible(true); + + } + + @Override + public List onTabComplete(CommandSender sender, String[] args) { + return null; + } +}