Anvil and ET command doesnt work idk why, crafting working fine so idc

This commit is contained in:
night0721 2022-07-07 21:41:36 +01:00
parent 8fefa1c0db
commit 8b17d36069
8 changed files with 141 additions and 32 deletions

View file

@ -32,6 +32,6 @@ public class MenuListener implements Listener {
player.closeInventory(); player.closeInventory();
} }else { return; }
} }
} }

View file

@ -50,11 +50,15 @@ public final class Main extends JavaPlugin implements Listener {
getCommand("test").setExecutor(new TestCommand()); getCommand("test").setExecutor(new TestCommand());
getCommand("vanish").setExecutor(new VanishCommand()); getCommand("vanish").setExecutor(new VanishCommand());
getCommand("armor").setExecutor(new ArmorCommand()); getCommand("armor").setExecutor(new ArmorCommand());
getCommand("armor").setTabCompleter(new ArmorTab());
getCommand("gun").setExecutor(new GunCommand()); getCommand("gun").setExecutor(new GunCommand());
getCommand("msg").setExecutor(new MessageCommand()); getCommand("msg").setExecutor(new MessageCommand());
getCommand("menu").setExecutor(new MenuCommand()); getCommand("menu").setExecutor(new MenuCommand());
getCommand("rank").setExecutor(new RankCommand(this)); getCommand("rank").setExecutor(new RankCommand(this));
getCommand("hologram").setExecutor(new HologramCommand()); getCommand("hologram").setExecutor(new HologramCommand());
getCommand("craft").setExecutor(new CraftCommand());
getCommand("anvil").setExecutor(new AnvilCommand());
getCommand("enchant").setExecutor(new EnchantingCommand());
bossbar = Bukkit.createBossBar( bossbar = Bukkit.createBossBar(
ChatColor.GOLD + "Kuudra", ChatColor.GOLD + "Kuudra",
BarColor.RED, BarColor.RED,

View file

@ -0,0 +1,21 @@
package com.night.nullvalkyrie.commands;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
public class AnvilCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender instanceof Player) {
Player player = (Player) sender;
player.openInventory(Bukkit.createInventory(player, InventoryType.ANVIL));
}
return false;
}
}

View file

@ -1,6 +1,6 @@
package com.night.nullvalkyrie.commands; package com.night.nullvalkyrie.commands;
import org.bukkit.ChatColor; import org.bukkit.Bukkit;
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;
@ -10,40 +10,43 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta; import org.bukkit.inventory.meta.LeatherArmorMeta;
public class ArmorCommand implements CommandExecutor { public class ArmorCommand 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; if(sender instanceof Player) {
ItemStack helmet = new ItemStack(Material.LEATHER_HELMET); Player player = (Player) sender;
LeatherArmorMeta helmetdata = (LeatherArmorMeta) helmet.getItemMeta(); ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
helmetdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Helmet"); LeatherArmorMeta helmetdata = (LeatherArmorMeta) helmet.getItemMeta();
helmetdata.setColor(org.bukkit.Color.fromRGB(2,2,58)); helmetdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Helmet");
helmetdata.setUnbreakable(true); helmetdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
helmet.setItemMeta(helmetdata); helmetdata.setUnbreakable(true);
player.getInventory().addItem(helmet); helmet.setItemMeta(helmetdata);
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.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); 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.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); 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.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); bootdata.setUnbreakable(true);
boot.setItemMeta(legdata); boot.setItemMeta(legdata);
player.getInventory().addItem(boot); player.getInventory().addItem(boot);
}
return false; return false;

View file

@ -0,0 +1,32 @@
package com.night.nullvalkyrie.commands;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ArmorTab implements TabCompleter {
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
if(args.length == 1) {
return StringUtil.copyPartialMatches(args[0], Arrays.asList("angeles", "widow"), new ArrayList<>());
} else if(args.length == 2) {
List<String> names = new ArrayList<>();
for(Player player: Bukkit.getOnlinePlayers()) {
names.add(player.getName());
}
return StringUtil.copyPartialMatches(args[1], names, new ArrayList<>());
}
return new ArrayList<>();
}
}

View file

@ -0,0 +1,19 @@
package com.night.nullvalkyrie.commands;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class CraftCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender instanceof Player) {
Player player = (Player) sender;
player.openWorkbench(null, true);
}
return false;
}
}

View file

@ -0,0 +1,21 @@
package com.night.nullvalkyrie.commands;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
public class EnchantingCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender instanceof Player) {
Player player = (Player) sender;
player.openEnchanting(null, true);
}
return false;
}
}

View file

@ -22,3 +22,12 @@ commands:
description: "Set rank of players" description: "Set rank of players"
hologram: hologram:
description: "Spawn a hologram" description: "Spawn a hologram"
craft:
aliases: ["ct", "crafting", "craftingtable"]
description: "Open crafting table"
anvil:
aliases: [ "av", "anvil" ]
description: "Open anvil"
enchant:
aliases: [ "et", "enchanting", "enchantingtable"]
description: "Open enchanting table"