Skip to content

Commit

Permalink
Merge pull request #1 from AzisabaNetwork/master
Browse files Browse the repository at this point in the history
最新化
  • Loading branch information
aburaagetarou authored Dec 10, 2024
2 parents c1b2ab5 + 70902c1 commit 826241a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 10 deletions.
31 changes: 29 additions & 2 deletions src/main/java/dev/felnull/Data/GroupData.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,45 @@
package dev.felnull.Data;

import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class GroupData {
public final String groupName; //グループ名 プレイヤー個人の場合はプレイヤーUUID
public Set<Player> playerList; //グループ所属のプレイヤーリスト 最低1つは格納されるはず
public Map<Player,String[]> playerPermission; //プレイヤーが保持している役職 //StringじゃなくてENUMでやるべきかもです
public GroupData (String groupName, Set<Player> playerList, Map<Player,String[]> playerPermission) {
public Map<Player,String[]> playerPermission; //プレイヤーが保持している役職
public boolean isPrivate; //個人用グループか否か
public StorageData storageData; //グループ保有のストレージデータ null許容

public GroupData (@NotNull String groupName,@NotNull Set<Player> playerList,@NotNull Map<Player,String[]> playerPermission, boolean isPrivate, StorageData storageData) {
this.groupName = groupName;
this.playerList = playerList;
this.playerPermission = playerPermission;
this.isPrivate = isPrivate;
storageData.groupName = groupName;
storageData.groupData = this;
this.storageData = storageData;
}

public GroupData (@NotNull Player player, StorageData storageData) {
this.groupName = player.getUniqueId().toString();

//引数で得たプレイヤーをメンバに追加してowner権限を付与する
playerList = new HashSet<>();
playerPermission = new HashMap<>();
playerList.add(player);
String[] permission = {GroupPermENUM.OWNER.getPermName()};
playerPermission.put(player, permission );
//個人用を想定したコンストラクタなのでtrue
this.isPrivate = true;

storageData.groupName = groupName;
storageData.groupData = this;
this.storageData = storageData;
}

}
19 changes: 11 additions & 8 deletions src/main/java/dev/felnull/Data/StorageData.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
package dev.felnull.Data;

import org.bukkit.inventory.Inventory;
import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class StorageData {
public final String groupName;//グループ名(個人プレイヤーもグループ扱い)
public final boolean personal;//個人用かグループ用かのフラグ
public String groupName;//グループ名(個人プレイヤーもグループ扱い)
public GroupData groupData;//ストレージの所属グループ
public final Set<String> requireBankPermission;//ストレージ直下の金庫の要求パーミッション(BukkitPermではない)
public int bankMoney;//ストレージ付属金庫の値
public Map<String,InventoryData> storageInventry;//ストレージに含まれているインベントリデータ キーのStringはページ名
@NotNull
public Map<String,InventoryData> storageInventory;//ストレージに含まれているインベントリデータ キーのStringはページ名

public StorageData(String groupName, boolean personal, Set<String> requireBankPermission, Map<String,InventoryData> storageInventry, int bankMoney) {
this.groupName = groupName;
this.personal = personal;
public StorageData(@NotNull Set<String> requireBankPermission, Map<String,InventoryData> storageInventory, int bankMoney) {
this.requireBankPermission = requireBankPermission;
this.storageInventry = storageInventry;
if(storageInventory == null){
storageInventory = new HashMap<>();
}
this.storageInventory = storageInventory;
this.bankMoney = bankMoney;
}
}

0 comments on commit 826241a

Please sign in to comment.