parent
e495926665
commit
2217f435c2
11 changed files with 694 additions and 27 deletions
@ -1,11 +1,93 @@ |
||||
package org.poopki.duckdns.user_db.Array; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.UUID; |
||||
import java.util.*; |
||||
|
||||
public class Nation extends Group{ |
||||
public Nation(String Name, List<UUID> uuid_list){ |
||||
super(Name, uuid_list); |
||||
} |
||||
private Map<String, Integer> m_TechStat = new HashMap<String, Integer>(); |
||||
public void InitTechTree(){ |
||||
m_TechStat.put("agriculture",0); |
||||
m_TechStat.put("pottery",0); |
||||
m_TechStat.put("animal_husbandry",0); |
||||
m_TechStat.put("archery",0); |
||||
m_TechStat.put("mining",0); |
||||
m_TechStat.put("sailing",0); |
||||
m_TechStat.put("calendar",0); |
||||
m_TechStat.put("writing",0); |
||||
m_TechStat.put("trapping",0); |
||||
m_TechStat.put("wheel",0); |
||||
m_TechStat.put("masonry",0); |
||||
m_TechStat.put("bronze",0); |
||||
m_TechStat.put("optics",0); |
||||
m_TechStat.put("horseback",0); |
||||
m_TechStat.put("mathematics",0); |
||||
m_TechStat.put("construction",0); |
||||
m_TechStat.put("philosophy",0); |
||||
m_TechStat.put("drama",0); |
||||
m_TechStat.put("currency",0); |
||||
m_TechStat.put("engineering",0); |
||||
m_TechStat.put("iron_working",0); |
||||
m_TechStat.put("theology",0); |
||||
m_TechStat.put("civil_service",0); |
||||
m_TechStat.put("guilds",0); |
||||
m_TechStat.put("metal_casting",0); |
||||
m_TechStat.put("compass",0); |
||||
m_TechStat.put("education",0); |
||||
m_TechStat.put("chivalry",0); |
||||
m_TechStat.put("machinery",0); |
||||
m_TechStat.put("physics",0); |
||||
m_TechStat.put("steel",0); |
||||
m_TechStat.put("astronomy",0); |
||||
m_TechStat.put("acoustics",0); |
||||
m_TechStat.put("banking",0); |
||||
m_TechStat.put("printing_press",0); |
||||
m_TechStat.put("gunpowder",0); |
||||
m_TechStat.put("navigation",0); |
||||
m_TechStat.put("architecture",0); |
||||
m_TechStat.put("economics",0); |
||||
m_TechStat.put("metallurgy",0); |
||||
m_TechStat.put("chemistry",0); |
||||
m_TechStat.put("archaeology",0); |
||||
m_TechStat.put("scientific_theory",0); |
||||
m_TechStat.put("industrialization",0); |
||||
m_TechStat.put("rifling",0); |
||||
m_TechStat.put("military_science",0); |
||||
m_TechStat.put("fertilizer",0); |
||||
m_TechStat.put("biology",0); |
||||
m_TechStat.put("electricity",0); |
||||
m_TechStat.put("steam_power",0); |
||||
m_TechStat.put("dynamite",0); |
||||
m_TechStat.put("refrigeration",0); |
||||
m_TechStat.put("radio",0); |
||||
m_TechStat.put("flight",0); |
||||
m_TechStat.put("railroad",0); |
||||
m_TechStat.put("plastics",0); |
||||
m_TechStat.put("electronics",0); |
||||
m_TechStat.put("ballistics",0); |
||||
m_TechStat.put("combustion",0); |
||||
m_TechStat.put("penicillin",0); |
||||
m_TechStat.put("atomic_theory",0); |
||||
m_TechStat.put("radar",0); |
||||
m_TechStat.put("combined_arms",0); |
||||
m_TechStat.put("ecology",0); |
||||
m_TechStat.put("nuclear_fission",0); |
||||
m_TechStat.put("rocketry",0); |
||||
m_TechStat.put("computers",0); |
||||
m_TechStat.put("telecommunications",0); |
||||
m_TechStat.put("mobile_tactics",0); |
||||
m_TechStat.put("advanced_ballistics",0); |
||||
m_TechStat.put("satellites",0); |
||||
m_TechStat.put("robotics",0); |
||||
m_TechStat.put("lasers",0); |
||||
m_TechStat.put("the_internet",0); |
||||
m_TechStat.put("globalization",0); |
||||
m_TechStat.put("particle_physics",0); |
||||
m_TechStat.put("nuclear_fusion",0); |
||||
m_TechStat.put("nanotechnology",0); |
||||
m_TechStat.put("stealth",0); |
||||
} |
||||
|
||||
|
||||
} |
||||
|
@ -0,0 +1,138 @@ |
||||
package org.poopki.duckdns.user_db.GUI; |
||||
|
||||
import dev.lone.itemsadder.api.CustomStack; |
||||
import org.bukkit.Bukkit; |
||||
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.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
import java.util.UUID; |
||||
|
||||
public class TechGUI 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 TechGUI(AccountArray AA, UserInfoArray UIA, FarmArray FA, NationArray NA, SquadArray SA, UUID uuid, InventoryClickEvent e) { |
||||
m_uuid=uuid; |
||||
this.inv = Bukkit.createInventory(null,54,":offset_-8::ancient_era:"); |
||||
|
||||
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); |
||||
|
||||
CustomStack stack = CustomStack.getInstance("digits:digit-zero"); |
||||
ItemStack itemStack = stack.getItemStack(); |
||||
*/ |
||||
|
||||
inv.setItem(27, CustomStack.getInstance("techtree:agriculture_"+ Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"agriculture"))).getItemStack()); |
||||
|
||||
inv.setItem(20, CustomStack.getInstance("techtree:pottery_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"pottery"))).getItemStack()); |
||||
inv.setItem(29, CustomStack.getInstance("techtree:archery_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"archery"))).getItemStack()); |
||||
inv.setItem(38, CustomStack.getInstance("techtree:mining_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"mining"))).getItemStack()); |
||||
|
||||
inv.setItem(13, CustomStack.getInstance("techtree:animal_husbandry_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"animal_husbandry"))).getItemStack()); |
||||
inv.setItem(22, CustomStack.getInstance("techtree:writing_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"writing"))).getItemStack()); |
||||
inv.setItem(31, CustomStack.getInstance("techtree:masonry_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"masonry"))).getItemStack()); |
||||
inv.setItem(40, CustomStack.getInstance("techtree:bronze_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"bronze"))).getItemStack()); |
||||
|
||||
inv.setItem(15, CustomStack.getInstance("techtree:calendar_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"calendar"))).getItemStack()); |
||||
inv.setItem(24, CustomStack.getInstance("techtree:trapping_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"trapping"))).getItemStack()); |
||||
inv.setItem(33, CustomStack.getInstance("techtree:writing_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"writing"))).getItemStack()); |
||||
inv.setItem(42, CustomStack.getInstance("techtree:wheel_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"wheel"))).getItemStack()); |
||||
inv.setItem(51, CustomStack.getInstance("techtree:optics_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"optics"))).getItemStack()); |
||||
|
||||
inv.setItem(17, CustomStack.getInstance("techtree:sailing_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"sailing"))).getItemStack()); |
||||
inv.setItem(26, CustomStack.getInstance("techtree:mathematics_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"mathematics"))).getItemStack()); |
||||
inv.setItem(35, CustomStack.getInstance("techtree:construction_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"construction"))).getItemStack()); |
||||
inv.setItem(44, CustomStack.getInstance("techtree:horseback_"+Integer.toString(m_NA.GetGroupTechTree(m_UIA.getUserGroupUUID(m_uuid,"Nation"),"horseback"))).getItemStack()); |
||||
|
||||
|
||||
} |
||||
|
||||
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,64 @@ |
||||
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; |
||||
|
||||
import java.util.UUID; |
||||
|
||||
|
||||
public class TechGUIEvent implements Listener,CommandExecutor { |
||||
AccountArray m_AccountArray; |
||||
UserInfoArray m_UserInfoArray; |
||||
FarmArray m_FarmArray; |
||||
NationArray m_NationArray; |
||||
SquadArray m_SquadArray; |
||||
UUID ZERO_UUID = new UUID(0,0); |
||||
public TechGUIEvent(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){ |
||||
if(ZERO_UUID.equals(m_UserInfoArray.getUserGroupUUID(((Player) sender).getUniqueId(), "Nation"))){ |
||||
Player player = (Player) sender; |
||||
player.sendMessage("국가에 소속된 유저만 사용이 가능"); |
||||
} |
||||
else{ |
||||
Player player = (Player) sender; |
||||
player.sendMessage("TECH: "+player.getUniqueId()); |
||||
player.sendMessage("TECH: "+m_UserInfoArray.getUserGroupUUID(player.getUniqueId(),"Nation")); |
||||
player.sendMessage("TECH: "+m_NationArray.GetGroupTechTree(m_UserInfoArray.getUserGroupUUID(player.getUniqueId(),"Nation"),"agriculture")); |
||||
|
||||
TechGUI inv = new TechGUI(m_AccountArray,m_UserInfoArray,m_FarmArray,m_NationArray, m_SquadArray,player.getUniqueId(), null); |
||||
|
||||
inv.open(player); |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
@EventHandler |
||||
public void inven2(InventoryClickEvent e){ |
||||
Player player = (Player) e.getWhoClicked();; |
||||
player.sendMessage("이벤트 발생"); |
||||
TechGUI inv = new TechGUI(m_AccountArray,m_UserInfoArray,m_FarmArray,m_NationArray, m_SquadArray, player.getUniqueId(), e); |
||||
inv.inven(e); |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,101 @@ |
||||
package org.poopki.duckdns.user_db.GUI; |
||||
|
||||
import org.poopki.duckdns.user_db.UserInfo; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
import java.util.UUID; |
||||
|
||||
public class TechStat { |
||||
private Map<String, Integer> m_TechStat = new HashMap<String, Integer>(); |
||||
|
||||
public void InitTechTree(){ |
||||
m_TechStat.put("agriculture",0); |
||||
m_TechStat.put("pottery",0); |
||||
m_TechStat.put("animal_husbandry",0); |
||||
m_TechStat.put("archery",0); |
||||
m_TechStat.put("mining",0); |
||||
m_TechStat.put("sailing",0); |
||||
m_TechStat.put("calendar",0); |
||||
m_TechStat.put("writing",0); |
||||
m_TechStat.put("trapping",0); |
||||
m_TechStat.put("wheel",0); |
||||
m_TechStat.put("masonry",0); |
||||
m_TechStat.put("bronze",0); |
||||
m_TechStat.put("optics",0); |
||||
m_TechStat.put("horseback",0); |
||||
m_TechStat.put("mathematics",0); |
||||
m_TechStat.put("construction",0); |
||||
m_TechStat.put("philosophy",0); |
||||
m_TechStat.put("drama",0); |
||||
m_TechStat.put("currency",0); |
||||
m_TechStat.put("engineering",0); |
||||
m_TechStat.put("iron_working",0); |
||||
m_TechStat.put("theology",0); |
||||
m_TechStat.put("civil_service",0); |
||||
m_TechStat.put("guilds",0); |
||||
m_TechStat.put("metal_casting",0); |
||||
m_TechStat.put("compass",0); |
||||
m_TechStat.put("education",0); |
||||
m_TechStat.put("chivalry",0); |
||||
m_TechStat.put("machinery",0); |
||||
m_TechStat.put("physics",0); |
||||
m_TechStat.put("steel",0); |
||||
m_TechStat.put("astronomy",0); |
||||
m_TechStat.put("acoustics",0); |
||||
m_TechStat.put("banking",0); |
||||
m_TechStat.put("printing_press",0); |
||||
m_TechStat.put("gunpowder",0); |
||||
m_TechStat.put("navigation",0); |
||||
m_TechStat.put("architecture",0); |
||||
m_TechStat.put("economics",0); |
||||
m_TechStat.put("metallurgy",0); |
||||
m_TechStat.put("chemistry",0); |
||||
m_TechStat.put("archaeology",0); |
||||
m_TechStat.put("scientific_theory",0); |
||||
m_TechStat.put("industrialization",0); |
||||
m_TechStat.put("rifling",0); |
||||
m_TechStat.put("military_science",0); |
||||
m_TechStat.put("fertilizer",0); |
||||
m_TechStat.put("biology",0); |
||||
m_TechStat.put("electricity",0); |
||||
m_TechStat.put("steam_power",0); |
||||
m_TechStat.put("dynamite",0); |
||||
m_TechStat.put("refrigeration",0); |
||||
m_TechStat.put("radio",0); |
||||
m_TechStat.put("flight",0); |
||||
m_TechStat.put("railroad",0); |
||||
m_TechStat.put("plastics",0); |
||||
m_TechStat.put("electronics",0); |
||||
m_TechStat.put("ballistics",0); |
||||
m_TechStat.put("combustion",0); |
||||
m_TechStat.put("penicillin",0); |
||||
m_TechStat.put("atomic_theory",0); |
||||
m_TechStat.put("radar",0); |
||||
m_TechStat.put("combined_arms",0); |
||||
m_TechStat.put("ecology",0); |
||||
m_TechStat.put("nuclear_fission",0); |
||||
m_TechStat.put("rocketry",0); |
||||
m_TechStat.put("computers",0); |
||||
m_TechStat.put("telecommunications",0); |
||||
m_TechStat.put("mobile_tactics",0); |
||||
m_TechStat.put("advanced_ballistics",0); |
||||
m_TechStat.put("satellites",0); |
||||
m_TechStat.put("robotics",0); |
||||
m_TechStat.put("lasers",0); |
||||
m_TechStat.put("the_internet",0); |
||||
m_TechStat.put("globalization",0); |
||||
m_TechStat.put("particle_physics",0); |
||||
m_TechStat.put("nuclear_fusion",0); |
||||
m_TechStat.put("nanotechnology",0); |
||||
m_TechStat.put("stealth",0); |
||||
} |
||||
|
||||
public void EnableTechTree(String TechName){ |
||||
m_TechStat.replace(TechName,1); |
||||
} |
||||
|
||||
public int GetTachTree(String TechName){ |
||||
return m_TechStat.get(TechName); |
||||
} |
||||
} |
Loading…
Reference in new issue