Armor command to give custom colored armor
Gun command to give diamond hoe for shooting snowball Vanish command to be invisble
This commit is contained in:
parent
ce19390d3a
commit
928984d44b
5 changed files with 123 additions and 17 deletions
|
@ -11,8 +11,11 @@ import org.bukkit.boss.BarColor;
|
|||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -27,7 +30,9 @@ public final class Main extends JavaPlugin implements Listener {
|
|||
System.out.println("PREPARING TO DESTROY HYPIXEL");
|
||||
|
||||
getCommand("test").setExecutor(new TestCommand());
|
||||
|
||||
getCommand("vanish").setExecutor(new VanishCommand());
|
||||
getCommand("armor").setExecutor(new ArmorCommand());
|
||||
getCommand("gun").setExecutor(new GunCommand());
|
||||
bossbar = Bukkit.createBossBar(
|
||||
ChatColor.GOLD + "Kuudra",
|
||||
BarColor.RED,
|
||||
|
@ -35,26 +40,25 @@ public final class Main extends JavaPlugin implements Listener {
|
|||
);
|
||||
Bukkit.getPluginManager().registerEvents(this, this);
|
||||
}
|
||||
@EventHandler
|
||||
public void onPlayerMove(PlayerMoveEvent e) {
|
||||
// e.setCancelled(true);
|
||||
// e.getPlayer().sendMessage(ChatColor.RED + "STOP UR MOM");
|
||||
}
|
||||
|
||||
@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());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(PlayerJoinEvent e) {
|
||||
e.setJoinMessage(ChatColor.RED+"[ADMIN] " + e.getPlayer().getName() + ChatColor.WHITE + " joined the server!");
|
||||
ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
|
||||
LeatherArmorMeta helmetMeta = (LeatherArmorMeta) helmet.getItemMeta();
|
||||
helmetMeta.setColor(Color.ORANGE);
|
||||
helmet.setItemMeta(helmetMeta);
|
||||
e.getPlayer().getInventory().addItem(helmet);
|
||||
ItemStack cp = new ItemStack(Material.LEATHER_CHESTPLATE);
|
||||
LeatherArmorMeta cpdata = (LeatherArmorMeta) cp.getItemMeta();
|
||||
cpdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
|
||||
cp.setItemMeta(cpdata);
|
||||
e.getPlayer().getInventory().addItem(cp);
|
||||
|
||||
e.getPlayer().sendTitle(ChatColor.RED +"Welcome to Operation Valkyrie!", ChatColor.GREEN + "LOL", 20, 100, 20);
|
||||
e.getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText("§1NOT ENOUGH MANNER"));
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
|
||||
public class ArmorCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
|
||||
LeatherArmorMeta helmetMeta = (LeatherArmorMeta) helmet.getItemMeta();
|
||||
helmetMeta.setColor(org.bukkit.Color.fromRGB(2,2,58));
|
||||
helmet.setItemMeta(helmetMeta);
|
||||
player.getInventory().addItem(helmet);
|
||||
|
||||
ItemStack cp = new ItemStack(Material.LEATHER_CHESTPLATE);
|
||||
LeatherArmorMeta cpdata = (LeatherArmorMeta) cp.getItemMeta();
|
||||
cpdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
|
||||
cp.setItemMeta(cpdata);
|
||||
player.getInventory().addItem(cp);
|
||||
|
||||
ItemStack leg = new ItemStack(Material.LEATHER_LEGGINGS);
|
||||
LeatherArmorMeta legdata = (LeatherArmorMeta) leg.getItemMeta();
|
||||
legdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
|
||||
leg.setItemMeta(legdata);
|
||||
player.getInventory().addItem(leg);
|
||||
|
||||
ItemStack boot = new ItemStack(Material.LEATHER_BOOTS);
|
||||
LeatherArmorMeta bootdata = (LeatherArmorMeta) boot.getItemMeta();
|
||||
bootdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
|
||||
boot.setItemMeta(legdata);
|
||||
player.getInventory().addItem(boot);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
|
||||
public class GunCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
ItemStack hoe = new ItemStack(Material.DIAMOND_HOE);
|
||||
player.getInventory().addItem(hoe);
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.night.nullvalkyrie.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
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 implements CommandExecutor {
|
||||
private List<UUID> vanished = new ArrayList<>();
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
Player player = (Player) sender;
|
||||
if(sender instanceof Player) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -8,3 +8,6 @@ website: https://github.com/night0721/nullvalkyrie
|
|||
commands:
|
||||
test:
|
||||
description: "Test"
|
||||
vanish:
|
||||
armor:
|
||||
gun:
|
Loading…
Reference in a new issue