GUI 스코어보드

GUI
poopki 2 years ago
parent b3e5851b05
commit 8591169fc2
  1. 2
      Array/NationArray.java
  2. 2
      DB/DBConnect.java
  3. 2
      DB/DBUpdate.java
  4. 77
      GUI/ScoreboardEvent.java
  5. 23
      UserJoin.java
  6. 22
      User_DB.java

@ -1,9 +1,9 @@
package org.poopki.duckdns.user_db.Array;
import org.poopki.duckdns.user_db.UserInfoArray;
public class NationArray extends GroupArray{
public NationArray(UserInfoArray m_UIA){
super(m_UIA, 50);
}
}

@ -5,7 +5,7 @@ import java.sql.*;
public class DBConnect {
private static final String DB_DRIVER_CLASS = "org.mariadb.jdbc.Driver";
private static final String DB_URL = "jdbc:mariadb://poopki.duckdns.org:3307/";
private static final String DB_URL = "jdbc:mariadb://211.135.195.201:3307/";
private static final String DB_USERNAME = "mc_dev";
private static final String DB_PASSWORD = "!Rkdalsrn1027";

@ -13,7 +13,7 @@ import java.util.UUID;
public class DBUpdate {
private final String DB_DRIVER_CLASS = "org.mariadb.jdbc.Driver";
private final String DB_URL = "jdbc:mariadb://poopki.duckdns.org:3307/mc_dev";
private final String DB_URL = "jdbc:mariadb://211.135.195.201:3307/mc_dev";
private final String DB_USERNAME = "mc_dev";
private final String DB_PASSWORD = "!Rkdalsrn1027";
private UserInfoArray m_InfoArrayInstance;

@ -0,0 +1,77 @@
package org.poopki.duckdns.user_db.GUI;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.*;
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 ScoreboardEvent {
ScoreboardManager manager;
Scoreboard scoreboard;
UUID ZERO_UUID = new UUID(0,0);
private UserInfoArray m_InfoArrayInstance;
private AccountArray m_AccountArray;
private FarmArray m_FarmArray;
private NationArray m_NationArray;
private SquadArray m_SquadArray;
public ScoreboardEvent(UserInfoArray m_UIA, FarmArray FA, NationArray NA, SquadArray SA, AccountArray AA){
m_InfoArrayInstance = m_UIA;
m_AccountArray = AA;
m_FarmArray = FA;
m_NationArray = NA;
m_SquadArray = SA;
}
public void ScoreboardUpdate(Player player){
manager = Bukkit.getScoreboardManager();
scoreboard = manager.getNewScoreboard();
Objective score_obj = scoreboard.registerNewObjective("Scoreboard","dummy","계좌");
score_obj.setDisplaySlot(DisplaySlot.SIDEBAR);
Score score = score_obj.getScore(ChatColor.BLUE + "==-=-=-=-=-=-==");
score.setScore(15);
Score score1 = score_obj.getScore("계좌 잔액: "+m_AccountArray.getAccountInfo(player.getUniqueId())+"원");
score1.setScore(14);
Score score3 = score_obj.getScore(ChatColor.BLUE + "==-=-=-=-=-=-==");
score3.setScore(15);
if(ZERO_UUID.equals(m_InfoArrayInstance.getUserGroupUUID(player.getUniqueId(), "Farm"))) {
Score score4 = score_obj.getScore("농장 이름: ----");
score4.setScore(14);
}
else{
Score score4 = score_obj.getScore("농장 이름: " + m_FarmArray.GetGroupName(m_InfoArrayInstance.getUserGroupUUID(player.getUniqueId(), "Farm")));
score4.setScore(14);
}
if(ZERO_UUID.equals(m_InfoArrayInstance.getUserGroupUUID(player.getUniqueId(), "Nation"))) {
Score score5 = score_obj.getScore("국가 이름: ----");
score5.setScore(13);
}
else{
Score score5 = score_obj.getScore("국가 이름: "+m_NationArray.GetGroupName(m_InfoArrayInstance.getUserGroupUUID(player.getUniqueId(), "Nation")));
score5.setScore(13);
}
if(ZERO_UUID.equals(m_InfoArrayInstance.getUserGroupUUID(player.getUniqueId(), "Squad"))) {
Score score6 = score_obj.getScore("분대 이름: ----");
score6.setScore(12);
}
else{
Score score6 = score_obj.getScore("분대 이름: "+m_SquadArray.GetGroupName(m_InfoArrayInstance.getUserGroupUUID(player.getUniqueId(), "Squad")));
score6.setScore(12);
}
player.setScoreboard(scoreboard);
}
}

@ -1,18 +1,31 @@
package org.poopki.duckdns.user_db;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.poopki.duckdns.user_db.Array.AccountArray;
import org.bukkit.scoreboard.*;
import org.poopki.duckdns.user_db.Array.*;
import org.poopki.duckdns.user_db.GUI.ScoreboardEvent;
import java.util.UUID;
public class UserJoin implements Listener {
private UserInfoArray m_InfoArrayInstance;
private AccountArray m_AccountArray;
UserJoin(UserInfoArray UIA, AccountArray AA){
private FarmArray m_FarmArray;
private NationArray m_NationArray;
private SquadArray m_SquadArray;
private ScoreboardEvent m_ScoreboardEventHandler;
UserJoin(UserInfoArray m_UIA, FarmArray FA, NationArray NA, SquadArray SA, AccountArray AA, ScoreboardEvent SE){
m_AccountArray = AA;
m_InfoArrayInstance = UIA;
m_InfoArrayInstance = m_UIA;
m_FarmArray = FA;
m_NationArray = NA;
m_SquadArray = SA;
m_ScoreboardEventHandler = SE;
}
@EventHandler
public void PlayerLogin(PlayerJoinEvent e) {
@ -21,5 +34,9 @@ public class UserJoin implements Listener {
m_InfoArrayInstance.putUserInfo(p.getUniqueId(), p.getName(), new UUID(0,0), new UUID(0,0), new UUID(0,0), new UUID(0,0));
m_AccountArray.putAccountInfo(p.getUniqueId(), 0);
}
m_ScoreboardEventHandler.ScoreboardUpdate(p);
}
}

@ -1,12 +1,17 @@
package org.poopki.duckdns.user_db;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scoreboard.*;
import org.poopki.duckdns.user_db.Array.*;
import org.poopki.duckdns.user_db.DB.*;
import org.poopki.duckdns.user_db.GUI.*;
import org.poopki.duckdns.user_db.Invite.*;
import java.sql.SQLException;
import java.util.UUID;
public final class User_DB extends JavaPlugin implements Listener {
@ -16,6 +21,7 @@ public final class User_DB extends JavaPlugin implements Listener {
FarmArray m_FarmArrayInstance = new FarmArray(m_InfoArrayInstance);
NationArray m_NationArrayInstance = new NationArray(m_InfoArrayInstance);
SquadArray m_SquadArrayInstance = new SquadArray(m_InfoArrayInstance);
ScoreboardEvent m_ScoreboardEventHandler = new ScoreboardEvent(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance);
DBUpdate Database_backup = new DBUpdate(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance);
@Override
@ -33,11 +39,19 @@ 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 InviteMaster(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance));
getServer().getPluginManager().registerEvents(new UserJoin(m_InfoArrayInstance, m_AccountArrayInstance),this);
getServer().getPluginManager().registerEvents(new OpenInv( m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance), this);
getServer().getPluginManager().registerEvents(new UserJoin(m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance, m_ScoreboardEventHandler),
this);
getServer().getPluginManager().registerEvents(new OpenInv( m_InfoArrayInstance, m_FarmArrayInstance, m_NationArrayInstance, m_SquadArrayInstance, m_AccountArrayInstance), this);
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run(){
for(Player p : Bukkit.getOnlinePlayers()) {
m_ScoreboardEventHandler.ScoreboardUpdate(p);
}
}
},0,20L);
}
@Override
@ -49,4 +63,6 @@ public final class User_DB extends JavaPlugin implements Listener {
throw new RuntimeException(e);
}
}
}

Loading…
Cancel
Save