Skip to content

Instantly share code, notes, and snippets.

@avighnash
Created March 7, 2016 01:44
Show Gist options
  • Save avighnash/f913e566ab9c5abcb257 to your computer and use it in GitHub Desktop.
Save avighnash/f913e566ab9c5abcb257 to your computer and use it in GitHub Desktop.
package us.universalpvp.play;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
public class Inventory extends JavaPlugin
{
Logger myPluginLogger = Bukkit.getLogger();
@Override
public void onEnable()
{
}
@Override
public void onDisable()
{
}
public boolean onCommand(CommandSender theSender, Command cmd, String commandLabel, String[] args)
{
if(theSender instanceof Player) {
Player player = (Player)theSender;
if(commandLabel.equalsIgnoreCase("openinventory"))
{
Inventory inv = Bukkit.createInventory(null, 9, "The Inventory!"); [RED LINE]
inv.setItem(0, new ItemStack(Material.DIRT)); [RED LINE]
inv = inv;
player.openInventory(inv); [RED LINE]
}
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment