You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
5.3 KiB
133 lines
5.3 KiB
1 year ago
|
package org.poopki.duckdns.user_db.Bank;
|
||
2 years ago
|
|
||
1 year ago
|
import dev.lone.itemsadder.api.CustomStack;;
|
||
2 years ago
|
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;
|
||
1 year ago
|
import org.poopki.duckdns.user_db.GUI.ItemManager;
|
||
2 years ago
|
import org.poopki.duckdns.user_db.UserInfoArray;
|
||
2 years ago
|
import org.bukkit.inventory.ItemStack;
|
||
2 years ago
|
import java.util.UUID;
|
||
2 years ago
|
import java.util.ArrayList;
|
||
|
import java.util.Arrays;
|
||
|
import java.util.List;
|
||
2 years ago
|
import org.apache.commons.lang.StringEscapeUtils;
|
||
2 years ago
|
import java.util.stream.Stream;
|
||
2 years ago
|
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;
|
||
2 years ago
|
this.inv = Bukkit.createInventory(null,54,":offset_-8::bank_main:");
|
||
2 years ago
|
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);
|
||
2 years ago
|
|
||
|
CustomStack stack = CustomStack.getInstance("digits:digit-zero");
|
||
|
ItemStack itemStack = stack.getItemStack();
|
||
2 years ago
|
*/
|
||
2 years ago
|
List<String> strList = new ArrayList<String>();
|
||
|
|
||
|
String before = String.valueOf(m_AA.getAccountInfo(m_uuid));
|
||
|
strList.addAll(Arrays.asList(before.split("")));
|
||
|
|
||
|
int tmp = strList.size();
|
||
|
for(int i=0; i<8-tmp; i++) {
|
||
|
strList.add(0, "0");
|
||
|
}
|
||
|
|
||
|
for(int i = 0; i<strList.size(); i++){
|
||
|
inv.setItem(10+i, CustomStack.getInstance("digits:digit-"+strList.get(i)).getItemStack());
|
||
|
}
|
||
|
|
||
2 years ago
|
}
|
||
|
|
||
|
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;
|
||
1 year ago
|
/*
|
||
2 years ago
|
switch(e.getCurrentItem().getType()){
|
||
1 year ago
|
case TORCH:
|
||
2 years ago
|
e.setCancelled(true);
|
||
|
p.sendMessage("10000원 증가");
|
||
|
m_AA.setAccountInfo(p.getUniqueId(), (long)m_AA.getAccountInfo(p.getUniqueId())+10000);
|
||
|
initItemSetting();
|
||
|
p.openInventory(inv);
|
||
|
break;
|
||
1 year ago
|
case TORCH:
|
||
2 years ago
|
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;
|
||
|
}
|
||
1 year ago
|
|
||
|
*/
|
||
2 years ago
|
}
|
||
|
}
|