I am trying to make it so when I put an item into this gui it will be saved. Can someone tell me what I need to make it save when closed.
Code:
package com.etterman.crdonate;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
public class CRdonate extends JavaPlugin implements Listener {
public void onEnable() {
System.out.println("Turning on...");
PluginManager pm = Bukkit.getServer().getPluginManager();
pm.registerEvents(this, this);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
return true;
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e){
Player p = e.getPlayer();
ItemStack item = p.getItemInHand();
if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK){
if(item.getType() == Material.DIRT){
Inventory inv = Bukkit.createInventory(null, 9 * 2, ChatColor.ITALIC + "Donations");
p.openInventory(inv);
}
}
}
}
