Anvil and ET command doesnt work idk why, crafting working fine so idc
This commit is contained in:
parent
8fefa1c0db
commit
8b17d36069
8 changed files with 141 additions and 32 deletions
|
@ -32,6 +32,6 @@ public class MenuListener implements Listener {
|
||||||
|
|
||||||
|
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
}
|
}else { return; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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,8 +10,10 @@ 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) {
|
||||||
|
if(sender instanceof Player) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
|
ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
|
||||||
LeatherArmorMeta helmetdata = (LeatherArmorMeta) helmet.getItemMeta();
|
LeatherArmorMeta helmetdata = (LeatherArmorMeta) helmet.getItemMeta();
|
||||||
|
@ -44,6 +46,7 @@ public class ArmorCommand implements CommandExecutor {
|
||||||
bootdata.setUnbreakable(true);
|
bootdata.setUnbreakable(true);
|
||||||
boot.setItemMeta(legdata);
|
boot.setItemMeta(legdata);
|
||||||
player.getInventory().addItem(boot);
|
player.getInventory().addItem(boot);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
32
src/main/java/com/night/nullvalkyrie/commands/ArmorTab.java
Normal file
32
src/main/java/com/night/nullvalkyrie/commands/ArmorTab.java
Normal 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<>();
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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"
|
Loading…
Reference in a new issue