测试版
This commit is contained in:
parent
e0ccdfc871
commit
916d4fd0c6
|
@ -14,13 +14,13 @@ public class BossManage {
|
|||
private boolean bossSurvive;
|
||||
private final List<String> bossKeyList = new ArrayList<>(); // 获取boss名列表
|
||||
private final List<String> customNameList = new ArrayList<>(); // 获取boss名列表
|
||||
private final HashMap<String,BossData> bossDataMap = new HashMap<>();
|
||||
private final HashMap<String, BossData> bossDataMap = new HashMap<>();
|
||||
|
||||
public BossManage(FileConfiguration yml) {
|
||||
this.bossSurvive = false;
|
||||
for (String bossKey : yml.getConfigurationSection("BossData").getKeys(false)){
|
||||
bossDataMap.put(bossKey,new BossData(bossKey,yml));
|
||||
String customName = yml.getString("BossData."+bossKey+".name");
|
||||
for (String bossKey : yml.getConfigurationSection("BossData").getKeys(false)) {
|
||||
bossDataMap.put(bossKey, new BossData(bossKey, yml));
|
||||
String customName = yml.getString("BossData." + bossKey + ".name");
|
||||
customNameList.add(customName);
|
||||
bossKeyList.add(bossKey);
|
||||
}
|
||||
|
@ -28,17 +28,17 @@ public class BossManage {
|
|||
}
|
||||
|
||||
public BossData getBossData(String bossKey) {
|
||||
if(bossDataMap.get(bossKey) == null){
|
||||
if (bossDataMap.get(bossKey) == null) {
|
||||
return null;
|
||||
}
|
||||
return bossDataMap.get(bossKey);
|
||||
}
|
||||
|
||||
public BossData getNameToData(String customName) {
|
||||
for (String bossKey : bossDataMap.keySet()){
|
||||
for (String bossKey : bossDataMap.keySet()) {
|
||||
BossData data = bossDataMap.get(bossKey);
|
||||
String bossName = data.getBossName();
|
||||
if(customName.contains(bossName)){
|
||||
if (customName.contains(bossName)) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,8 @@ public class BossManage {
|
|||
public boolean isBossSurvive() {
|
||||
return bossSurvive;
|
||||
}
|
||||
public void setBossSurvive(boolean butt){
|
||||
|
||||
public void setBossSurvive(boolean butt) {
|
||||
bossSurvive = butt;
|
||||
}
|
||||
|
||||
|
@ -56,14 +57,18 @@ public class BossManage {
|
|||
return bossKeyList;
|
||||
}
|
||||
|
||||
public boolean isCustomNameContains(String customName){
|
||||
for (String name : this.customNameList){
|
||||
if(customName.contains(name)){
|
||||
public boolean isCustomNameContains(String customName) {
|
||||
// 检查 customName 是否为 null
|
||||
if (customName == null) {
|
||||
return false;
|
||||
}
|
||||
// 遍历 customNameList 检查是否有任何名称包含 customName
|
||||
for (String name : this.customNameList) {
|
||||
// 检查 name 是否为 null
|
||||
if (name != null && customName.contains(name)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
package com.io.yaohun.worldbosshurt.mangage;
|
||||
|
||||
import com.io.yaohun.worldbosshurt.data.BossData;
|
||||
import com.io.yaohun.worldbosshurt.data.RewardData;
|
||||
import com.sun.xml.internal.txw2.output.StreamSerializer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class RewardManage {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user