|
|
|
package org.poopki.duckdns.user_db.GUI;
|
|
|
|
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.entity.Item;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.event.EventHandler;
|
|
|
|
import org.bukkit.event.Listener;
|
|
|
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
|
|
import org.bukkit.inventory.Inventory;
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
import org.poopki.duckdns.user_db.Array.AccountArray;
|
|
|
|
import org.poopki.duckdns.user_db.Array.FarmArray;
|
|
|
|
import org.poopki.duckdns.user_db.Array.NationArray;
|
|
|
|
import org.poopki.duckdns.user_db.Array.SquadArray;
|
|
|
|
import org.poopki.duckdns.user_db.UserInfoArray;
|
|
|
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
public class BaseGUI implements Listener{
|
|
|
|
private final Inventory inv;
|
|
|
|
UUID m_uuid;
|
|
|
|
ItemManager m_ItemManager= new ItemManager();
|
|
|
|
AccountArray m_AA;
|
|
|
|
UserInfoArray m_UIA;
|
|
|
|
FarmArray m_FA;
|
|
|
|
NationArray m_NA;
|
|
|
|
SquadArray m_SA;
|
|
|
|
public BaseGUI(AccountArray AA, UserInfoArray UIA, FarmArray FA, NationArray NA, SquadArray SA, UUID uuid, InventoryClickEvent e) {
|
|
|
|
m_uuid=uuid;
|
|
|
|
this.inv = Bukkit.createInventory(null,27,"TESTGUI");
|
|
|
|
m_AA = AA;
|
|
|
|
m_UIA = UIA;
|
|
|
|
m_FA = FA;
|
|
|
|
m_NA = NA;
|
|
|
|
m_SA = SA;
|
|
|
|
initItemSetting();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void initItemSetting() {
|
|
|
|
|
|
|
|
inv.setItem(0,m_ItemManager.GetBalance(m_AA, m_UIA, m_FA, m_NA,m_SA,m_uuid, "User"));
|
|
|
|
inv.setItem(1,m_ItemManager.GetBalance(m_AA, m_UIA, m_FA, m_NA,m_SA,m_uuid, "Nation"));
|
|
|
|
inv.setItem(2,m_ItemManager.GetBalance(m_AA, m_UIA, m_FA, m_NA,m_SA,m_uuid, "Farm"));
|
|
|
|
|
|
|
|
inv.setItem(9, m_ItemManager.btn1);
|
|
|
|
inv.setItem(18, m_ItemManager.btn2);
|
|
|
|
inv.setItem(10, m_ItemManager.btn3);
|
|
|
|
inv.setItem(19, m_ItemManager.btn4);
|
|
|
|
inv.setItem(11, m_ItemManager.btn5);
|
|
|
|
inv.setItem(20, m_ItemManager.btn6);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void open(Player player){
|
|
|
|
player.openInventory(inv);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void inven(InventoryClickEvent e){
|
|
|
|
Player p = (Player) e.getWhoClicked();
|
|
|
|
Inventory m_inv = e.getClickedInventory();
|
|
|
|
|
|
|
|
if (e.getInventory() != m_inv) return;
|
|
|
|
|
|
|
|
switch(e.getCurrentItem().getType()){
|
|
|
|
case CANDLE:
|
|
|
|
e.setCancelled(true);
|
|
|
|
p.sendMessage("10000원 증가");
|
|
|
|
m_AA.setAccountInfo(p.getUniqueId(), (long)m_AA.getAccountInfo(p.getUniqueId())+10000);
|
|
|
|
initItemSetting();
|
|
|
|
p.openInventory(inv);
|
|
|
|
break;
|
|
|
|
case BEEF:
|
|
|
|
e.setCancelled(true);
|
|
|
|
p.sendMessage("10000원 감소");
|
|
|
|
m_AA.setAccountInfo(p.getUniqueId(), (long)m_AA.getAccountInfo(p.getUniqueId())-10000);
|
|
|
|
initItemSetting();
|
|
|
|
p.openInventory(inv);
|
|
|
|
break;
|
|
|
|
case TORCH:
|
|
|
|
e.setCancelled(true);
|
|
|
|
p.sendMessage("국가 10000원 증가"+ m_AA.getAccountInfo(m_UIA.getUserGroupUUID(m_uuid, "Nation")));
|
|
|
|
m_AA.setAccountInfo(m_UIA.getUserGroupUUID(p.getUniqueId(),"Nation"), (long)m_AA.getAccountInfo(m_UIA.getUserGroupUUID(p.getUniqueId(),"Nation"))+10000);
|
|
|
|
initItemSetting();
|
|
|
|
p.openInventory(inv);
|
|
|
|
break;
|
|
|
|
case GRASS:
|
|
|
|
e.setCancelled(true);
|
|
|
|
p.sendMessage("국가 10000원 감소"+ m_AA.getAccountInfo(m_UIA.getUserGroupUUID(m_uuid, "Nation")));
|
|
|
|
m_AA.setAccountInfo(m_UIA.getUserGroupUUID(p.getUniqueId(),"Nation"), (long)m_AA.getAccountInfo(m_UIA.getUserGroupUUID(p.getUniqueId(),"Nation"))-10000);
|
|
|
|
initItemSetting();
|
|
|
|
p.openInventory(inv);
|
|
|
|
break;
|
|
|
|
case DIAMOND:
|
|
|
|
e.setCancelled(true);
|
|
|
|
p.sendMessage("농장 10000원 증가"+ m_AA.getAccountInfo(m_UIA.getUserGroupUUID(m_uuid, "Farm")));
|
|
|
|
m_AA.setAccountInfo(m_UIA.getUserGroupUUID(p.getUniqueId(),"Farm"), (long)m_AA.getAccountInfo(m_UIA.getUserGroupUUID(p.getUniqueId(),"Farm"))+10000);
|
|
|
|
initItemSetting();
|
|
|
|
p.openInventory(inv);
|
|
|
|
break;
|
|
|
|
case IRON_INGOT:
|
|
|
|
e.setCancelled(true);
|
|
|
|
p.sendMessage("농장 10000원 감소"+ m_AA.getAccountInfo(m_UIA.getUserGroupUUID(m_uuid, "Farm")));
|
|
|
|
m_AA.setAccountInfo(m_UIA.getUserGroupUUID(p.getUniqueId(),"Farm"), (long)m_AA.getAccountInfo(m_UIA.getUserGroupUUID(p.getUniqueId(),"Farm"))-10000);
|
|
|
|
initItemSetting();
|
|
|
|
p.openInventory(inv);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|