2018-12-18 02:36:54 +00:00
|
|
|
|
package pw.kaboom.weapons;
|
|
|
|
|
|
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
class CommandWeapons implements CommandExecutor {
|
|
|
|
|
private void addWeapon(Inventory inventory, Material material, String name) {
|
2019-07-23 23:03:55 +00:00
|
|
|
|
final ItemStack item = new ItemStack(material, 1);
|
|
|
|
|
final ItemMeta itemMeta = item.getItemMeta();
|
|
|
|
|
|
2018-12-18 02:36:54 +00:00
|
|
|
|
itemMeta.setDisplayName(name);
|
|
|
|
|
item.setItemMeta(itemMeta);
|
|
|
|
|
inventory.addItem(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
2019-07-23 23:03:55 +00:00
|
|
|
|
final Player player = (Player) sender;
|
|
|
|
|
final Inventory inventory = Bukkit.createInventory(null, 18, "Weapons");
|
|
|
|
|
|
2018-12-18 02:36:54 +00:00
|
|
|
|
addWeapon(inventory, Material.ANVIL, "§rAnvil Dropper");
|
|
|
|
|
addWeapon(inventory, Material.SPECTRAL_ARROW, "§rArcher");
|
2019-07-23 23:03:55 +00:00
|
|
|
|
addWeapon(inventory, Material.FIRE_CHARGE, "§rArmageddon");
|
2018-12-18 02:36:54 +00:00
|
|
|
|
addWeapon(inventory, Material.MAGMA_CREAM, "§rBlobinator");
|
2019-07-22 14:20:58 +00:00
|
|
|
|
addWeapon(inventory, Material.EGG, "§rGrenade");
|
2018-12-18 02:36:54 +00:00
|
|
|
|
addWeapon(inventory, Material.BLAZE_POWDER, "§rLaser");
|
|
|
|
|
addWeapon(inventory, Material.STICK, "§rLightning Stick");
|
2019-07-23 23:03:55 +00:00
|
|
|
|
addWeapon(inventory, Material.GOLDEN_HORSE_ARMOR, "§rMachine Gun");
|
2018-12-18 02:36:54 +00:00
|
|
|
|
addWeapon(inventory, Material.BLAZE_ROD, "§rNuker");
|
2019-07-23 23:03:55 +00:00
|
|
|
|
addWeapon(inventory, Material.IRON_HORSE_ARMOR, "§rSniper");
|
2018-12-18 02:36:54 +00:00
|
|
|
|
player.openInventory(inventory);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|