gui 리소스팩

GUI
poopki 2 years ago
parent ed6a80ef56
commit e495926665
  1. 108
      GUI/AccountGUI.java
  2. 50
      GUI/AccountGUIEvent.java
  3. 4
      GUI/Digit.java
  4. 1
      User_DB.java

@ -0,0 +1,108 @@
package org.poopki.duckdns.user_db.GUI;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
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;
import org.apache.commons.lang.StringEscapeUtils;
public class AccountGUI 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 AccountGUI(AccountArray AA, UserInfoArray UIA, FarmArray FA, NationArray NA, SquadArray SA, UUID uuid, InventoryClickEvent e) {
m_uuid=uuid;
this.inv = Bukkit.createInventory(null,54,ChatColor.WHITE+StringEscapeUtils.unescapeJava("\uE00A")+StringEscapeUtils.unescapeJava("\uE00B"));
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;
}
}
}

@ -0,0 +1,50 @@
package org.poopki.duckdns.user_db.GUI;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
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;
public class AccountGUIEvent implements Listener,CommandExecutor {
AccountArray m_AccountArray;
UserInfoArray m_UserInfoArray;
FarmArray m_FarmArray;
NationArray m_NationArray;
SquadArray m_SquadArray;
public AccountGUIEvent(UserInfoArray m_UIA, FarmArray FA, NationArray NA, SquadArray SA, AccountArray AA){
m_UserInfoArray = m_UIA;
m_AccountArray = AA;
m_FarmArray = FA;
m_NationArray = NA;
m_SquadArray = SA;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender instanceof Player){
Player player = (Player) sender;
player.sendMessage("이벤트 발생");
AccountGUI inv = new AccountGUI(m_AccountArray,m_UserInfoArray,m_FarmArray,m_NationArray, m_SquadArray,((Player) sender).getUniqueId(), null);
inv.open(player);
}
return false;
}
@EventHandler
public void inven2(InventoryClickEvent e){
Player player = (Player) e.getWhoClicked();;
player.sendMessage("이벤트 발생");
AccountGUI inv = new AccountGUI(m_AccountArray,m_UserInfoArray,m_FarmArray,m_NationArray, m_SquadArray, player.getUniqueId(), e);
inv.inven(e);
}
}

@ -0,0 +1,4 @@
package org.poopki.duckdns.user_db.GUI;
public class Digit {
}

@ -38,6 +38,7 @@ public final class User_DB extends JavaPlugin implements Listener {
getCommand("국가").setExecutor(new NationEventHandler(m_InfoArrayInstance, m_NationArrayInstance, m_AccountArrayInstance));
getCommand("분대").setExecutor(new SquadEventHandler(m_InfoArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance));
getCommand("opitem").setExecutor(new OpenInv(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance));
getCommand("은행").setExecutor(new AccountGUIEvent(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance));
getCommand("초대").setExecutor(new InviteMaster(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance));
getServer().getPluginManager().registerEvents(new UserJoin(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance, m_ScoreboardEventHandler),

Loading…
Cancel
Save