|
|
|
package org.poopki.duckdns.user_db;
|
|
|
|
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
public class FarmEventHandler implements CommandExecutor {
|
|
|
|
|
|
|
|
GroupArray m_GroupArray;
|
|
|
|
UserInfoArray m_UserInfoArray;
|
|
|
|
UUID ZERO_UUID = new UUID(0,0);
|
|
|
|
public FarmEventHandler(GroupArray GA, UserInfoArray UIA){
|
|
|
|
m_GroupArray = GA;
|
|
|
|
m_UserInfoArray = UIA;
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
|
|
Player p = (Player) sender;
|
|
|
|
|
|
|
|
if (args.length != 0) {
|
|
|
|
switch (args[0]) {
|
|
|
|
case "생성":{
|
|
|
|
UUID tempUUID = UUID.randomUUID();
|
|
|
|
if(m_UserInfoArray.getUserGroupUUID(p.getUniqueId(), "Farm").equals(ZERO_UUID)){
|
|
|
|
if(m_GroupArray.CreateGroup(tempUUID, args[1], p.getUniqueId())){
|
|
|
|
m_UserInfoArray.setUserGroupUUID("Farm",p.getUniqueId(), tempUUID);
|
|
|
|
p.sendMessage(args[1]+"농장이 생성되었습니다.");
|
|
|
|
p.sendMessage("농장 멤버 목록: ");
|
|
|
|
for (String Name: m_GroupArray.GetGroupMembersName(tempUUID)){
|
|
|
|
p.sendMessage(Name);
|
|
|
|
}
|
|
|
|
p.sendMessage("농장 목록:");
|
|
|
|
for (String Name: m_GroupArray.GetGroupNameList()){
|
|
|
|
p.sendMessage(Name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
p.sendMessage("이미 존재하는 농장 이름");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
p.sendMessage("이미 농장을 소유중"+m_UserInfoArray.getUserGroupUUID(p.getUniqueId(), "Farm"));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case "가입":{
|
|
|
|
p.sendMessage("플레이어 UUID:"+p.getUniqueId()+" 농장 UUID:"+m_UserInfoArray.getUserGroupUUID(p.getUniqueId(), "Farm"));
|
|
|
|
p.sendMessage("ZERO UUID:"+ZERO_UUID);
|
|
|
|
if(!m_UserInfoArray.getUserGroupUUID(p.getUniqueId(), "Farm").equals(ZERO_UUID)){
|
|
|
|
p.sendMessage("이미 가입한 농장이 존재");
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
p.sendMessage("가입 완료");
|
|
|
|
m_GroupArray.SignUpGroup("Farm",m_GroupArray.m_GroupNameList.get(args[1]),p.getUniqueId());
|
|
|
|
p.sendMessage("농장 멤버 목록: ");
|
|
|
|
for (String Name: m_GroupArray.GetGroupMembersName(m_GroupArray.m_GroupNameList.get(args[1]))){
|
|
|
|
p.sendMessage(Name);
|
|
|
|
}
|
|
|
|
p.sendMessage("농장 목록:");
|
|
|
|
for (String Name: m_GroupArray.GetGroupNameList()){
|
|
|
|
p.sendMessage(Name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case "초대":{
|
|
|
|
p.sendMessage("초대 테스트");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case "강퇴":{
|
|
|
|
p.sendMessage("강퇴 테스트");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case "탈퇴": {
|
|
|
|
if(!m_UserInfoArray.getUserGroupUUID(p.getUniqueId(), "Farm").equals(ZERO_UUID)){
|
|
|
|
m_GroupArray.ExpulsionGroupPlayer("Farm",m_UserInfoArray.getUserGroupUUID(p.getUniqueId(),"Farm"),p.getUniqueId());
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
p.sendMessage("가입한 농장이 없습니다."+m_UserInfoArray.getUserGroupUUID(p.getUniqueId(), "Farm"));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case "이름":{
|
|
|
|
p.sendMessage("현재 파티 이름"+m_GroupArray.GetGroupName(m_UserInfoArray.getUserGroupUUID(p.getUniqueId(),"Party")));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case "정보": {
|
|
|
|
for (String Name: m_GroupArray.GetGroupNameList()){
|
|
|
|
p.sendMessage("농장 이름:");
|
|
|
|
p.sendMessage(Name);
|
|
|
|
p.sendMessage("인원 목록");
|
|
|
|
for (String Name2: m_GroupArray.GetGroupMembersName(m_GroupArray.m_GroupNameList.get(Name))) {
|
|
|
|
p.sendMessage(Name2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|