1

Help me!

Rileys 2/4/15 5:23 am
231
Hey i need to finish off my plugin, but i'm not sure how.
Here's a run down of what it's meant to do

You do /potions , it opens up a gui, and you select what potion you would like to activate.

Please help me

my code -

package me.MinecraftGold.Potions;

import java.util.Arrays;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.plugin.java.JavaPlugin;

public class potions extends JavaPlugin {

public void onEnable() {}

public void openGui(Player player) {
Inventory inv = Bukkit.createInventory(null, 9, ChatColor.LIGHT_PURPLE + "Potion Picker");

ItemStack speed = new ItemStack(Material.POTION, (short) 0);
ItemMeta speedMeta = speed.getItemMeta();

ItemStack strength = new ItemStack(Material.POTION, (short) 0);
ItemMeta strengthMeta = strength.getItemMeta();

ItemStack fireRes = new ItemStack(Material.POTION, (short) 0);
ItemMeta fireResMeta = fireRes.getItemMeta();

ItemStack nightvision = new ItemStack(Material.POTION, (short) 0);
ItemMeta nightvisionMeta = nightvision.getItemMeta();

ItemStack jumpboost = new ItemStack(Material.POTION, (short) 0);
ItemMeta jumpboostMeta = jumpboost.getItemMeta();

ItemStack clear = new ItemStack(Material.GLASS_BOTTLE);
ItemMeta clearMeta = clear.getItemMeta();

speedMeta.setDisplayName(ChatColor.BLUE + "Swiftness");
strengthMeta.setDisplayName(ChatColor.RED + "Strength");
fireResMeta.setDisplayName(ChatColor.YELLOW + "Fire Resistance");
jumpboostMeta.setDisplayName(ChatColor.GREEN + "Jump Boost");
nightvisionMeta.setDisplayName(ChatColor.GOLD + "Night Vision");
clearMeta.setDisplayName(ChatColor.GRAY + ChatColor.BOLD.toString() + "Clear Potion Effects!");

speedMeta.setLore(Arrays.asList(ChatColor.DARK_AQUA + "Click here for a Speed potion for 2 mintues!"));
fireResMeta.setLore(Arrays.asList(ChatColor.DARK_AQUA + "Click here for a Fire potion for 8 minutes!"));
jumpboostMeta.setLore(Arrays.asList(ChatColor.DARK_AQUA + "Click here for a Jump boost potion for 4 minutes!"));
nightvisionMeta.setLore(Arrays.asList(ChatColor.DARK_AQUA + "Click here for a Night Vision potion for 10 Minutes!"));
strengthMeta.setLore(Arrays.asList(ChatColor.DARK_AQUA + "Click here for a Strength potion for 2 minutes!"));
clearMeta.setLore(Arrays.asList(ChatColor.RED + "Click here to Clear All current Potion Effects!"));

strength.setItemMeta(strengthMeta);
speed.setItemMeta(speedMeta);
fireRes.setItemMeta(fireResMeta);
jumpboost.setItemMeta(jumpboostMeta);
nightvision.setItemMeta(nightvisionMeta);
clear.setItemMeta(clearMeta);

inv.setItem(0, strength);
inv.setItem(1, speed);
inv.setItem(2, jumpboost);
inv.setItem(3, nightvision);
inv.setItem(4, fireRes);
inv.setItem(5, clear);

player.openInventory(inv);



}
}
}
Posted by
Rileys
Level 3 : Apprentice Network
1

  Have something to say?

JoinSign in

Welcome