테크트리 시스템

GUI
poopki 2 years ago
parent e495926665
commit 2217f435c2
  1. 97
      Array/Group.java
  2. 14
      Array/GroupArray.java
  3. 88
      Array/Nation.java
  4. 8
      Array/NationEventHandler.java
  5. 182
      DB/DBUpdate.java
  6. 27
      GUI/AccountGUI.java
  7. 1
      GUI/OpenInv.java
  8. 138
      GUI/TechGUI.java
  9. 64
      GUI/TechGUIEvent.java
  10. 101
      GUI/TechStat.java
  11. 1
      User_DB.java

@ -1,13 +1,12 @@
package org.poopki.duckdns.user_db.Array;
import java.util.Collections;
import java.util.List;
import java.util.ArrayList;
import java.util.UUID;
import java.util.*;
public class Group {
private String m_Name;
private List<UUID> m_MemberList = new ArrayList<>();
public List<String> TechList = Arrays.asList("agriculture","pottery","animal_husbandry","archery","mining","sailing","calendar","writing","trapping","wheel","masonry","bronze","optics","horseback","mathematics","construction","philosophy","drama","currency","engineering","iron_working","theology","civil_service","guilds","metal_casting","compass","education","chivalry","machinery","physics","steel","astronomy","acoustics","banking","printing_press","gunpowder","navigation","architecture","economics","metallurgy","chemistry","archaeology","scientific_theory","industrialization","rifling","military_science","fertilizer","biology","electricity","steam_power","dynamite","refrigeration","radio","flight","railroad","plastics","electronics","ballistics","combustion","penicillin","atomic_theory","radar","combined_arms","ecology","nuclear_fission","rocketry","computers","telecommunications","mobile_tactics","advanced_ballistics","satellites","robotics","lasers","the_internet","globalization","particle_physics","nuclear_fusion","nanotechnology","stealth");
public Map<String, Integer> m_TechStat = new HashMap<String, Integer>();
UUID ZERO_UUID = UUID.fromString("00000000-0000-0000-0000-000000000000");
int MAX_FARM_NUM = 10;
@ -17,6 +16,7 @@ public class Group {
m_MemberList.add(index,key);
index++;
}
InitTechTree();
m_Name = Name;
}
@ -49,4 +49,93 @@ public class Group {
return false;
}
}
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 SetTechTree(String TechName, Integer set){
m_TechStat.replace(TechName,set);
}
public int GetTechTree(String TechName){
return m_TechStat.get(TechName);
}
}

@ -9,7 +9,7 @@ import java.util.*;
public class GroupArray {
protected Map<UUID, Group> m_GroupArray;
public Map<UUID, Group> m_GroupArray;
protected Map<String, UUID> m_GroupNameList;
public List<UUID> m_DeleteQueue = new ArrayList<>();
UserInfoArray m_UserInfoArray;
@ -36,6 +36,18 @@ public class GroupArray {
}
}
public void InitGroupTechTree(UUID GroupUUID){
m_GroupArray.get(GroupUUID).InitTechTree();
}
public void SetGroupTechTree(UUID GroupUUID, String TechName, Integer set){
m_GroupArray.get(GroupUUID).SetTechTree(TechName,set);
}
public int GetGroupTechTree(UUID GroupUUID, String TechName){
return m_GroupArray.get(GroupUUID).GetTechTree(TechName);
}
public boolean PutGroup(UUID GroupUUID, String Name,List<UUID> PlayerUUID){
List<UUID> m_MemberList = new ArrayList<>();

@ -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);
}
}

@ -49,12 +49,12 @@ public class NationEventHandler implements CommandExecutor {
m_UserInfoArray.setUserGroupUUID("Nation",p.getUniqueId(), tempUUID);
m_AccountArray.putAccountInfo(tempUUID,0);
for (UUID key: m_UserInfoArray.getKeySet()){
p.sendMessage("------------"+p.getUniqueId());
p.sendMessage(""+m_UserInfoArray.getUserGroupUUID(key,"Nation"));
}
p.sendMessage(args[1]+"국가이 생성되었습니다.");
p.sendMessage(args[1]+"국가이 생성되었습니다."+m_NationArray.GetGroupTechTree(tempUUID,"agriculture"));
p.sendMessage("국가 멤버 목록: ");
for (String Name: m_NationArray.GetGroupMembersName(tempUUID)){
@ -280,6 +280,10 @@ public class NationEventHandler implements CommandExecutor {
p.sendMessage("==잔액: " + m_AccountArray.getAccountInfo(m_NationArray.GetUUID(args[1]))+ "원==");
break;
}
case "테크": {
m_NationArray.SetGroupTechTree(m_NationArray.GetUUID(args[1]),args[2],1);
break;
}
default: {
p.sendMessage("잘못된 명령어");
}

@ -42,17 +42,8 @@ public class DBUpdate {
System.out.println("Connection success");
stmt = conn.createStatement();
StringBuilder sb = new StringBuilder();
String sql = sb.append("create table if not exists UserInfo(")
.append("UUID varchar(36) PRIMARY KEY,")
.append("Name varchar(15), ")
.append("Nation varchar(36),") //public
.append("Squad varchar(36),") //public
.append("Farm varchar(36),") //public
.append("Account int(10)") //public
/*
.append("Occupation int(8),") //private
.append("Account int(8),") //private
.append("Status int(8)") //private*/
String sql = sb.append("create table if not exists TechTree(")
.append("UUID varchar(36) PRIMARY KEY")
.append(")").toString();
stmt.execute(sql);
}
@ -178,8 +169,41 @@ public class DBUpdate {
conn.close();
}
}
//
try {
Class.forName("org.mariadb.jdbc.Driver");
conn = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);
System.out.println("Connection success");
stmt = conn.createStatement();
String sql = "SELECT * FROM TechTree";
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){
Integer index=2;
if(rs.getString(index) != null){
for(String TechName: m_NationArray.m_GroupArray.get(UUID.fromString(rs.getString(1))).TechList){
m_NationArray.SetGroupTechTree(UUID.fromString(rs.getString(1)),TechName, Integer.parseInt(rs.getString(index)));
index++;
}
}
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
catch (SQLException e) {
// TODO Auto-generated catch block
System.err.println("에러 내용 :" + e.getMessage());
System.out.println("DB Connection fail");
}finally{
if(conn != null && !conn.isClosed()){
conn.close();
}
}
//
try {
Class.forName("org.mariadb.jdbc.Driver");
@ -384,7 +408,74 @@ public class DBUpdate {
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, String.valueOf(key.toString()));
int cnt = pstmt.executeUpdate();
m_NationArray.m_DeleteQueue.remove(key);
}
}
catch(ClassNotFoundException e){
e.printStackTrace();
}
catch(SQLException e){
System.err.println("에러 내용 :" + e.getMessage());
System.out.println("DB Connection fail");
}
finally {
if( conn != null && !conn.isClosed()){
conn.close();
}
}
try{
Class.forName("org.mariadb.jdbc.Driver");
conn = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);
for (UUID key : m_SquadArray.getKeySet()) {
String sql = "REPLACE INTO Squad VALUES (?,?,?,?,?,?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, String.valueOf(key.toString()));
pstmt.setString(2, String.valueOf(m_SquadArray.GetGroupName(key)));
pstmt.setString(3, String.valueOf(m_AccountArray.getAccountInfo(key)));
int index = 4;
for (UUID MemUUID : m_SquadArray.GetGroupMembersUUID(key)){
pstmt.setString(index, String.valueOf(MemUUID.toString()));
index++;
}
for(; index<=11;index++){
pstmt.setString(index, null);
}
int cnt = pstmt.executeUpdate();
if( cnt == 0 ){
System.out.println("데이터 입력 실패");
}
else{
System.out.println("데이터 입력 성공");
}
}
}
catch(ClassNotFoundException e){
e.printStackTrace();
}
catch(SQLException e){
System.err.println("에러 내용 :" + e.getMessage());
System.out.println("DB Connection fail");
}
finally {
if( conn != null && !conn.isClosed()){
conn.close();
}
}
try{
Class.forName("org.mariadb.jdbc.Driver");
conn = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);
for (UUID key: m_SquadArray.m_DeleteQueue){
String sql = "DELETE FROM Squad WHERE Squad_UUID=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, String.valueOf(key.toString()));
int cnt = pstmt.executeUpdate();
m_SquadArray.m_DeleteQueue.remove(key);
}
}
catch(ClassNotFoundException e){
@ -447,7 +538,7 @@ public class DBUpdate {
Class.forName("org.mariadb.jdbc.Driver");
conn = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);
for (UUID key: m_SquadArray.m_DeleteQueue){
String sql = "DELETE FROM Squad WHERE FARM_UUID=?";
String sql = "DELETE FROM Squad WHERE Squad_UUID=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, String.valueOf(key.toString()));
int cnt = pstmt.executeUpdate();
@ -466,5 +557,70 @@ public class DBUpdate {
conn.close();
}
}
//Update Tech
try{
Class.forName("org.mariadb.jdbc.Driver");
conn = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);
for (UUID key : m_NationArray.getKeySet()) {
String sql = "REPLACE INTO TechTree VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sql);
int index = 2;
pstmt.setString(1, String.valueOf(key.toString()));
for (String Name : m_NationArray.m_GroupArray.get(key).TechList){
System.out.println(Name+String.valueOf(m_NationArray.m_GroupArray.get(key).GetTechTree(Name)));
pstmt.setString(index, String.valueOf(m_NationArray.m_GroupArray.get(key).GetTechTree(Name)));
index++;
}
int cnt = pstmt.executeUpdate();
if( cnt == 0 ){
System.out.println("데이터 입력 실패");
}
else{
System.out.println("데이터 입력 성공");
}
}
}
catch(ClassNotFoundException e){
e.printStackTrace();
}
catch(SQLException e){
System.err.println("에러 내용 :" + e.getMessage());
System.out.println("DB Connection fail");
}
finally {
if( conn != null && !conn.isClosed()){
conn.close();
}
}
try{
Class.forName("org.mariadb.jdbc.Driver");
conn = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);
for (UUID key: m_NationArray.m_DeleteQueue){
String sql = "DELETE FROM TechTree WHERE UUID=?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, String.valueOf(key.toString()));
int cnt = pstmt.executeUpdate();
m_NationArray.m_DeleteQueue.remove(key);
}
}
catch(ClassNotFoundException e){
e.printStackTrace();
}
catch(SQLException e){
System.err.println("에러 내용 :" + e.getMessage());
System.out.println("DB Connection fail");
}
finally {
if( conn != null && !conn.isClosed()){
conn.close();
}
}
}
}

@ -1,5 +1,6 @@
package org.poopki.duckdns.user_db.GUI;
import dev.lone.itemsadder.api.CustomStack;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@ -11,10 +12,13 @@ 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 org.bukkit.inventory.ItemStack;
import java.util.UUID;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang.StringEscapeUtils;
import java.util.stream.Stream;
public class AccountGUI implements Listener{
private final Inventory inv;
UUID m_uuid;
@ -26,7 +30,7 @@ public class AccountGUI implements Listener{
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"));
this.inv = Bukkit.createInventory(null,54,":offset_-8::bank_main:");
m_AA = AA;
m_UIA = UIA;
m_FA = FA;
@ -47,7 +51,24 @@ public class AccountGUI implements Listener{
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();
*/
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());
}
}
public void open(Player player){

@ -42,7 +42,6 @@ public class OpenInv implements Listener,CommandExecutor {
player.sendMessage("이벤트 발생");
BaseGUI inv = new BaseGUI(m_AccountArray,m_UserInfoArray,m_FarmArray,m_NationArray, m_SquadArray, player.getUniqueId(), e);
inv.inven(e);
}

@ -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);
}
}

@ -39,6 +39,7 @@ public final class User_DB extends JavaPlugin implements Listener {
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 TechGUIEvent(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