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();
}
}else { return; }
}
}

View file

@ -50,11 +50,15 @@ public final class Main extends JavaPlugin implements Listener {
getCommand("test").setExecutor(new TestCommand());
getCommand("vanish").setExecutor(new VanishCommand());
getCommand("armor").setExecutor(new ArmorCommand());
getCommand("armor").setTabCompleter(new ArmorTab());
getCommand("gun").setExecutor(new GunCommand());
getCommand("msg").setExecutor(new MessageCommand());
getCommand("menu").setExecutor(new MenuCommand());
getCommand("rank").setExecutor(new RankCommand(this));
getCommand("hologram").setExecutor(new HologramCommand());
getCommand("craft").setExecutor(new CraftCommand());
getCommand("anvil").setExecutor(new AnvilCommand());
getCommand("enchant").setExecutor(new EnchantingCommand());
bossbar = Bukkit.createBossBar(
ChatColor.GOLD + "Kuudra",
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;
import org.bukkit.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
@ -10,40 +10,43 @@ 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 helmetdata = (LeatherArmorMeta) helmet.getItemMeta();
helmetdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Helmet");
helmetdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
helmetdata.setUnbreakable(true);
helmet.setItemMeta(helmetdata);
player.getInventory().addItem(helmet);
if(sender instanceof Player) {
Player player = (Player) sender;
ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
LeatherArmorMeta helmetdata = (LeatherArmorMeta) helmet.getItemMeta();
helmetdata.setDisplayName(net.md_5.bungee.api.ChatColor.of("#ff23ff") + "Angeles Helmet");
helmetdata.setColor(org.bukkit.Color.fromRGB(2,2,58));
helmetdata.setUnbreakable(true);
helmet.setItemMeta(helmetdata);
player.getInventory().addItem(helmet);
ItemStack cp = new ItemStack(Material.LEATHER_CHESTPLATE);
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.setUnbreakable(true);
cp.setItemMeta(cpdata);
player.getInventory().addItem(cp);
ItemStack cp = new ItemStack(Material.LEATHER_CHESTPLATE);
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.setUnbreakable(true);
cp.setItemMeta(cpdata);
player.getInventory().addItem(cp);
ItemStack leg = new ItemStack(Material.LEATHER_LEGGINGS);
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.setUnbreakable(true);
leg.setItemMeta(legdata);
player.getInventory().addItem(leg);
ItemStack leg = new ItemStack(Material.LEATHER_LEGGINGS);
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.setUnbreakable(true);
leg.setItemMeta(legdata);
player.getInventory().addItem(leg);
ItemStack boot = new ItemStack(Material.LEATHER_BOOTS);
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.setUnbreakable(true);
boot.setItemMeta(legdata);
player.getInventory().addItem(boot);
ItemStack boot = new ItemStack(Material.LEATHER_BOOTS);
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.setUnbreakable(true);
boot.setItemMeta(legdata);
player.getInventory().addItem(boot);
}
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"
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"