Armor command update with custom color and name
Gun command update with custom color and name Menu command and fix Msg command
This commit is contained in:
parent
928984d44b
commit
3e0cf3ce33
6 changed files with 154 additions and 11 deletions
|
@ -5,7 +5,6 @@ import net.md_5.bungee.api.ChatMessageType;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Color;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.boss.BarColor;
|
import org.bukkit.boss.BarColor;
|
||||||
import org.bukkit.boss.BarStyle;
|
import org.bukkit.boss.BarStyle;
|
||||||
|
@ -17,11 +16,11 @@ import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.server.ServerListPingEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public final class Main extends JavaPlugin implements Listener {
|
public final class Main extends JavaPlugin implements Listener {
|
||||||
private BossBar bossbar;
|
private BossBar bossbar;
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,6 +32,8 @@ public final class Main extends JavaPlugin implements Listener {
|
||||||
getCommand("vanish").setExecutor(new VanishCommand());
|
getCommand("vanish").setExecutor(new VanishCommand());
|
||||||
getCommand("armor").setExecutor(new ArmorCommand());
|
getCommand("armor").setExecutor(new ArmorCommand());
|
||||||
getCommand("gun").setExecutor(new GunCommand());
|
getCommand("gun").setExecutor(new GunCommand());
|
||||||
|
getCommand("msg").setExecutor(new MessageCommand());
|
||||||
|
getCommand("menu").setExecutor(new MenuCommand());
|
||||||
bossbar = Bukkit.createBossBar(
|
bossbar = Bukkit.createBossBar(
|
||||||
ChatColor.GOLD + "Kuudra",
|
ChatColor.GOLD + "Kuudra",
|
||||||
BarColor.RED,
|
BarColor.RED,
|
||||||
|
@ -65,9 +66,30 @@ public final class Main extends JavaPlugin implements Listener {
|
||||||
bossbar.addPlayer(e.getPlayer());
|
bossbar.addPlayer(e.getPlayer());
|
||||||
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");
|
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");
|
||||||
}
|
}
|
||||||
|
public 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();
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void onPing(ServerListPingEvent e) {
|
||||||
|
e.setMaxPlayers(8964);
|
||||||
|
String s = centerText("Operation Valkyrie [1.18.1 & 1.8.9]\n", 45);
|
||||||
|
String s2 = centerText("Support 1.18 & 1.8.9",45);
|
||||||
|
e.setMotd(ChatColor.AQUA.toString() + ChatColor.BOLD + s + ChatColor.GOLD + ChatColor.BOLD + s2);
|
||||||
|
try {
|
||||||
|
e.setServerIcon(Bukkit.loadServerIcon(new File("nuke.png")));
|
||||||
|
} catch (Exception ee) {
|
||||||
|
ee.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDisable() {
|
|
||||||
// Plugin shutdown logic
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.night.nullvalkyrie.commands;
|
package com.night.nullvalkyrie.commands;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
@ -13,26 +14,34 @@ public class ArmorCommand implements CommandExecutor {
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
|
ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
|
||||||
LeatherArmorMeta helmetMeta = (LeatherArmorMeta) helmet.getItemMeta();
|
LeatherArmorMeta helmetdata = (LeatherArmorMeta) helmet.getItemMeta();
|
||||||
helmetMeta.setColor(org.bukkit.Color.fromRGB(2,2,58));
|
helmetdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Helmet");
|
||||||
helmet.setItemMeta(helmetMeta);
|
helmetdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
|
||||||
|
helmetdata.setUnbreakable(true);
|
||||||
|
helmet.setItemMeta(helmetdata);
|
||||||
player.getInventory().addItem(helmet);
|
player.getInventory().addItem(helmet);
|
||||||
|
|
||||||
ItemStack cp = new ItemStack(Material.LEATHER_CHESTPLATE);
|
ItemStack cp = new ItemStack(Material.LEATHER_CHESTPLATE);
|
||||||
LeatherArmorMeta cpdata = (LeatherArmorMeta) cp.getItemMeta();
|
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.setColor(org.bukkit.Color.fromRGB(2,2,58));
|
||||||
|
cpdata.setUnbreakable(true);
|
||||||
cp.setItemMeta(cpdata);
|
cp.setItemMeta(cpdata);
|
||||||
player.getInventory().addItem(cp);
|
player.getInventory().addItem(cp);
|
||||||
|
|
||||||
ItemStack leg = new ItemStack(Material.LEATHER_LEGGINGS);
|
ItemStack leg = new ItemStack(Material.LEATHER_LEGGINGS);
|
||||||
LeatherArmorMeta legdata = (LeatherArmorMeta) leg.getItemMeta();
|
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.setColor(org.bukkit.Color.fromRGB(2,2,58));
|
||||||
|
legdata.setUnbreakable(true);
|
||||||
leg.setItemMeta(legdata);
|
leg.setItemMeta(legdata);
|
||||||
player.getInventory().addItem(leg);
|
player.getInventory().addItem(leg);
|
||||||
|
|
||||||
ItemStack boot = new ItemStack(Material.LEATHER_BOOTS);
|
ItemStack boot = new ItemStack(Material.LEATHER_BOOTS);
|
||||||
LeatherArmorMeta bootdata = (LeatherArmorMeta) boot.getItemMeta();
|
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.setColor(org.bukkit.Color.fromRGB(2,2,58));
|
||||||
|
bootdata.setUnbreakable(true);
|
||||||
boot.setItemMeta(legdata);
|
boot.setItemMeta(legdata);
|
||||||
player.getInventory().addItem(boot);
|
player.getInventory().addItem(boot);
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,27 @@
|
||||||
package com.night.nullvalkyrie.commands;
|
package com.night.nullvalkyrie.commands;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
public class GunCommand implements CommandExecutor {
|
public class GunCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
ItemStack hoe = new ItemStack(Material.DIAMOND_HOE);
|
ItemStack hoe = new ItemStack(Material.DIAMOND_HOE);
|
||||||
|
ItemMeta hoedata = hoe.getItemMeta();
|
||||||
|
hoedata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "SnowGun");
|
||||||
|
hoedata.setUnbreakable(true);
|
||||||
|
hoedata.setLore(Arrays.asList(ChatColor.GOLD + "Shoot Snowball!"));
|
||||||
|
hoe.setItemMeta(hoedata);
|
||||||
player.getInventory().addItem(hoe);
|
player.getInventory().addItem(hoe);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.night.nullvalkyrie.commands;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
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.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class MenuCommand implements CommandExecutor {
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
if(sender instanceof Player) {
|
||||||
|
Player player = (Player) sender;
|
||||||
|
Inventory 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);
|
||||||
|
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class MessageCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, 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]);
|
||||||
|
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 offline players");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
player.sendMessage(ChatColor.RED + "Invalid parameter, use /msg <Player> <Message>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,5 +9,12 @@ commands:
|
||||||
test:
|
test:
|
||||||
description: "Test"
|
description: "Test"
|
||||||
vanish:
|
vanish:
|
||||||
|
description: "Turn yourself into invisible"
|
||||||
armor:
|
armor:
|
||||||
gun:
|
description: "Give you a set of armor"
|
||||||
|
gun:
|
||||||
|
description: "Give you a gun"
|
||||||
|
msg:
|
||||||
|
description: "Send message to someone"
|
||||||
|
menu:
|
||||||
|
description: "Open the menu"
|
Loading…
Reference in a new issue