diff --git a/pom.xml b/pom.xml
index c3ec580..6672dd5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -54,39 +54,6 @@
E:\Files\SB\plugins
-
- net.md-5
- specialsource-maven-plugin
- 1.2.2
-
-
- package
-
- remap
-
- remap-obf
-
- org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:txt:maps-mojang
- true
- org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-mojang
- true
- remapped-obf
-
-
-
- package
-
- remap
-
- remap-spigot
-
- ${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar
- org.spigotmc:minecraft-server:1.19.2-R0.1-SNAPSHOT:csrg:maps-spigot
- org.spigotmc:spigot:1.19.2-R0.1-SNAPSHOT:jar:remapped-obf
-
-
-
-
@@ -111,7 +78,6 @@
org.spigotmc
spigot
1.19.2-R0.1-SNAPSHOT
- remapped-mojang
provided
diff --git a/src/main/java/me/night/nullvalkyrie/Main.java b/src/main/java/me/night/nullvalkyrie/Main.java
index acf69e4..7f7c628 100644
--- a/src/main/java/me/night/nullvalkyrie/Main.java
+++ b/src/main/java/me/night/nullvalkyrie/Main.java
@@ -35,20 +35,7 @@ public final class Main extends JavaPlugin implements Listener {
public void onEnable() {
getConfig().options().copyDefaults();
saveDefaultConfig();
- new VanishCommand();
- new TestCommand();
- new AnvilCommand();
- new ArmorCommand();
- new MenuCommand();
- new MessageCommand();
- new HologramCommand();
- new CraftCommand();
- new EnchantingCommand();
- new BetaCommand();
- new RankCommand(this);
- new UtilCommand(this);
- new WeaponCommand(this);
- new MinerCommand(this);
+ new CommandManager(this).register();
bossbar = Bukkit.createBossBar(ChatColor.GOLD + "Kuudra", BarColor.RED, BarStyle.SEGMENTED_12);
Bukkit.getPluginManager().registerEvents(this, this);
Bukkit.getPluginManager().registerEvents(new MenuListener(), this);
@@ -67,7 +54,6 @@ public final class Main extends JavaPlugin implements Listener {
public void onJoin(PlayerJoinEvent e) {
e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§1NOT ENOUGH MANNER"));
bossbar.addPlayer(e.getPlayer());
-
}
@EventHandler
diff --git a/src/main/java/me/night/nullvalkyrie/commands/BetaCommand.java b/src/main/java/me/night/nullvalkyrie/commands/BetaCommand.java
index 524c46f..b2222ee 100644
--- a/src/main/java/me/night/nullvalkyrie/commands/BetaCommand.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/BetaCommand.java
@@ -1,31 +1,48 @@
package me.night.nullvalkyrie.commands;
-import net.minecraft.network.protocol.game.ClientboundSetHealthPacket;
+import me.night.nullvalkyrie.Main;
+import net.md_5.bungee.api.ChatMessageType;
+import net.md_5.bungee.api.chat.TextComponent;
+import net.minecraft.network.protocol.game.*;
+import net.minecraft.server.level.EntityPlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer;
+import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
+import org.bukkit.scheduler.BukkitRunnable;
+import java.util.ArrayList;
import java.util.List;
import static me.night.nullvalkyrie.database.Client.getUser;
public class BetaCommand extends Command {
- public BetaCommand() {
- super(
- "beta",
- new String[]{"b"},
- "Beta",
- ""
- );
+ private Main main;
+
+ public BetaCommand(Main main) {
+ super("beta", new String[]{"b"}, "Beta", "");
+ this.main = main;
}
@Override
public void onCommand(CommandSender sender, String[] args) {
getUser("Kaly15");
- if(sender instanceof Player) {
- CraftPlayer p = (CraftPlayer) sender;
- ClientboundSetHealthPacket packet = new ClientboundSetHealthPacket(19.5f, 20, 0.0f);
- p.getHandle().connection.send(packet);
+ if (sender instanceof Player) {
+ Player pa = (Player) sender;
+ CraftPlayer cp = (CraftPlayer) sender;
+ EntityPlayer ep = cp.getHandle();
+ Entity e = (Entity) ep;
+ PacketPlayOutUpdateHealth packet = new PacketPlayOutUpdateHealth(20f, 20, 5.0f); // health, food, food
+ // saturation
+ ep.b.a(packet); // Sends the Packet
+
+ new BukkitRunnable() {
+ @Override
+ public void run() {
+ pa.spigot().sendMessage(ChatMessageType.ACTION_BAR,
+ TextComponent.fromLegacyText("§1NOT ENOUGH MANNER"));
+ }
+ }.runTaskTimer(main, 0L, 10);
}
}
diff --git a/src/main/java/me/night/nullvalkyrie/commands/Command.java b/src/main/java/me/night/nullvalkyrie/commands/Command.java
index 2b3d414..00c225c 100644
--- a/src/main/java/me/night/nullvalkyrie/commands/Command.java
+++ b/src/main/java/me/night/nullvalkyrie/commands/Command.java
@@ -17,7 +17,6 @@ public abstract class Command extends BukkitCommand {
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");
diff --git a/src/main/java/me/night/nullvalkyrie/commands/CommandManager.java b/src/main/java/me/night/nullvalkyrie/commands/CommandManager.java
new file mode 100644
index 0000000..04e6415
--- /dev/null
+++ b/src/main/java/me/night/nullvalkyrie/commands/CommandManager.java
@@ -0,0 +1,26 @@
+package me.night.nullvalkyrie.commands;
+
+import me.night.nullvalkyrie.Main;
+
+public class CommandManager {
+ private Main main;
+ public CommandManager(Main main) {
+ this.main = main;
+ }
+ public void register() {
+ new VanishCommand();
+ new TestCommand();
+ new AnvilCommand();
+ new ArmorCommand();
+ new MenuCommand();
+ new MessageCommand();
+ new HologramCommand();
+ new CraftCommand();
+ new EnchantingCommand();
+ new BetaCommand(main);
+ new RankCommand(main);
+ new UtilCommand(main);
+ new WeaponCommand(main);
+ new MinerCommand(main);
+ }
+}
diff --git a/src/main/java/me/night/nullvalkyrie/events/CustomItemEvents.java b/src/main/java/me/night/nullvalkyrie/events/CustomItemEvents.java
index 0f4118f..b559c3e 100644
--- a/src/main/java/me/night/nullvalkyrie/events/CustomItemEvents.java
+++ b/src/main/java/me/night/nullvalkyrie/events/CustomItemEvents.java
@@ -24,9 +24,11 @@ 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)) {
@@ -47,7 +49,7 @@ public class CustomItemEvents implements Listener {
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 (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));
@@ -69,13 +71,14 @@ public class CustomItemEvents implements Listener {
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)) {
+ 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();
@@ -112,7 +115,7 @@ public class CustomItemEvents implements Listener {
a2.setShooter(player);
a2.setDamage(50);
e.setCancelled(true);
- } else if(name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Explosive Bow")) {
+ } 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);
@@ -137,7 +140,7 @@ public class CustomItemEvents implements Listener {
a2.setShooter(player);
a2.setDamage(50);
e.setCancelled(true);
- } else if(name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Explosive Bow")) {
+ } 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);
@@ -147,6 +150,7 @@ public class CustomItemEvents implements Listener {
}
}
}
+
@EventHandler
public void onEntityShoot(EntityShootBowEvent e) {
if (e.getProjectile() instanceof Arrow) {
@@ -156,29 +160,30 @@ public class CustomItemEvents implements Listener {
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")) {
+ } else if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Explosive Bow")) {
e.setCancelled(true);
}
}
}
}
}
+
@EventHandler
public void onProjectileHit(ProjectileHitEvent e) {
- if(e.getEntity().getShooter() instanceof Player) {
+ 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(Rarity.LEGENDARY.getColor() + "Frag Grenade")) {
- if(e.getHitBlock() == null) {
+ 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) {
+ 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);
+ e.getHitBlock().getWorld().createExplosion(l.getX(), l.getY(), l.getZ(), 100, false, false);
}
- } else if(name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Explosive Bow")) {
+ } else if (name.equalsIgnoreCase(Rarity.LEGENDARY.getColor() + "Explosive Bow")) {
Arrow arrow = (Arrow) e.getEntity();
Location al = arrow.getLocation();
arrow.setShooter(shooter);
@@ -188,17 +193,19 @@ public class CustomItemEvents implements Listener {
}
}
+
@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) {
+ if (e.getEntity().getShooter() instanceof Player) {
Player player = (Player) e.getEntity().getShooter();
- if(player.getInventory().getItemInMainHand().getItemMeta() != null) {
+ 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();
@@ -207,44 +214,49 @@ public class CustomItemEvents implements Listener {
}
}
}
+
@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) {
+ 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.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.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) {
+ 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);
+ 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)) {
@@ -252,27 +264,34 @@ public class CustomItemEvents implements Listener {
// player.teleport(l);
// }
// }
- player.teleport(generateRandomCoord(9, Bukkit.getWorld("world")));
- }
- }.runTaskLater(main, 100L);
- run(player, new int[]{5});
- }
+ 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();
+ 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);
+ 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);
@@ -281,12 +300,14 @@ public class CustomItemEvents implements Listener {
}
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;
+ if (p.getInventory().getItemInMainHand().getType() != Material.STICK)
+ return;
clickedEntity.remove();
Location loc = clickedEntity.getLocation();
Villager villager = (Villager) p.getWorld().spawnEntity(loc, EntityType.VILLAGER);
@@ -309,7 +330,8 @@ public class CustomItemEvents implements Listener {
}
if (e.getRightClicked() instanceof Villager) {
Merchant merchant = villagerlist.get(clickedEntity.getUniqueId());
- if (merchant == null) return;
+ if (merchant == null)
+ return;
e.setCancelled(true);
p.openMerchant(merchant, true);
}
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index d8e66ad..fc68a0b 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -4,4 +4,7 @@ main: me.night.nullvalkyrie.Main
api-version: 1.18
authors: [ NightKaly, Leocthl ]
description: Null Valkyrie
-website: https://github.com/night0721/nullvalkyrie
\ No newline at end of file
+website: https://github.com/night0721/nullvalkyrie
+permissions:
+ nv.command.use:
+ default: true