增加了区分危险度刷新
This commit is contained in:
parent
f41a8511dd
commit
29da41875e
@ -55,7 +55,10 @@ public class BiomeEntityRefreshSettings {
|
|||||||
int nums = config.getInt(biomeName+"."+entityName+".nums");
|
int nums = config.getInt(biomeName+"."+entityName+".nums");
|
||||||
int yMax = config.getInt(biomeName+"."+entityName+".yMax");
|
int yMax = config.getInt(biomeName+"."+entityName+".yMax");
|
||||||
int yMin = config.getInt(biomeName+"."+entityName+".yMin");
|
int yMin = config.getInt(biomeName+"."+entityName+".yMin");
|
||||||
EntityCondition entityCondition = new EntityCondition(entityName, biomeName, spawnEntityType,entitySite, light, stime,etime, nums, yMax, yMin);
|
int riskMax = config.getInt(biomeName+"."+entityName+".riskMax");
|
||||||
|
int riskMin = config.getInt(biomeName+"."+entityName+".riskMin");
|
||||||
|
EntityCondition entityCondition = new EntityCondition(entityName, biomeName,
|
||||||
|
spawnEntityType,entitySite, light, stime,etime, nums, yMax, yMin,riskMax,riskMin);
|
||||||
|
|
||||||
plugin.getLogger().info(ChatColor.AQUA+entityCondition.toString());
|
plugin.getLogger().info(ChatColor.AQUA+entityCondition.toString());
|
||||||
|
|
||||||
|
@ -20,8 +20,10 @@ public class EntityCondition {
|
|||||||
private final int nums;//刷新的数量
|
private final int nums;//刷新的数量
|
||||||
private final int yMax;
|
private final int yMax;
|
||||||
private final int yMin;
|
private final int yMin;
|
||||||
|
private final int riskMax;
|
||||||
|
private final int riskMin;
|
||||||
|
|
||||||
public EntityCondition(String entityName, String biome, SpawnEntityType spawnEntityType, EntitySite entitySite, int light, long startTiming, long endTiming, int nums, int yMax, int yMin) {
|
public EntityCondition(String entityName, String biome, SpawnEntityType spawnEntityType, EntitySite entitySite, int light, long startTiming, long endTiming, int nums, int yMax, int yMin,int riskMax,int riskMin) {
|
||||||
this.entityName = entityName;
|
this.entityName = entityName;
|
||||||
this.biome = biome;
|
this.biome = biome;
|
||||||
this.spawnEntityType = spawnEntityType;
|
this.spawnEntityType = spawnEntityType;
|
||||||
@ -32,6 +34,20 @@ public class EntityCondition {
|
|||||||
this.nums = nums;
|
this.nums = nums;
|
||||||
this.yMax = yMax;
|
this.yMax = yMax;
|
||||||
this.yMin = yMin;
|
this.yMin = yMin;
|
||||||
|
this.riskMax = riskMax;
|
||||||
|
this.riskMin = riskMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SpawnEntityType getSpawnEntityType() {
|
||||||
|
return spawnEntityType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRiskMax() {
|
||||||
|
return riskMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRiskMin() {
|
||||||
|
return riskMin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpawnEntityType getEntityType() {
|
public SpawnEntityType getEntityType() {
|
||||||
@ -87,6 +103,8 @@ public class EntityCondition {
|
|||||||
", nums=" + nums +
|
", nums=" + nums +
|
||||||
", yMax=" + yMax +
|
", yMax=" + yMax +
|
||||||
", yMin=" + yMin +
|
", yMin=" + yMin +
|
||||||
|
", riskMax=" + riskMax +
|
||||||
|
", riskMin=" + riskMin +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,6 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
@ -322,7 +321,6 @@ public class EntityRefreshListener implements Listener, CommandExecutor {
|
|||||||
//TODO(危险度提示,后续需要使用这个变量去控制怪物的参数等级`)
|
//TODO(危险度提示,后续需要使用这个变量去控制怪物的参数等级`)
|
||||||
logger.info(ChatColor.GREEN + "危险度为:" + level);
|
logger.info(ChatColor.GREEN + "危险度为:" + level);
|
||||||
|
|
||||||
|
|
||||||
Location playerlocation = player.getLocation();
|
Location playerlocation = player.getLocation();
|
||||||
|
|
||||||
//获取玩家位置信息
|
//获取玩家位置信息
|
||||||
@ -348,6 +346,15 @@ public class EntityRefreshListener implements Listener, CommandExecutor {
|
|||||||
//获取entity配置
|
//获取entity配置
|
||||||
EntityCondition entityCondition = entityConditionHashMap.get(entityName);
|
EntityCondition entityCondition = entityConditionHashMap.get(entityName);
|
||||||
|
|
||||||
|
//危险度验证,通过才能刷新
|
||||||
|
int riskMax = entityCondition.getRiskMax();
|
||||||
|
int riskMin = entityCondition.getRiskMin();
|
||||||
|
|
||||||
|
if (level >= riskMax || level < riskMin){
|
||||||
|
//不在范围内则跳过
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int yMin = entityCondition.getyMin();
|
int yMin = entityCondition.getyMin();
|
||||||
int yMax = entityCondition.getyMax();
|
int yMax = entityCondition.getyMax();
|
||||||
|
|
||||||
@ -383,7 +390,7 @@ public class EntityRefreshListener implements Listener, CommandExecutor {
|
|||||||
}else {
|
}else {
|
||||||
//刷新MM怪物
|
//刷新MM怪物
|
||||||
try {
|
try {
|
||||||
entity = mythicMobs.getAPIHelper().spawnMythicMob(entityName, location);
|
entity = mythicMobs.getAPIHelper().spawnMythicMob(entityName, location,level);
|
||||||
} catch (InvalidMobTypeException e) {
|
} catch (InvalidMobTypeException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
RefreshTime: 10 #刷新时间,单位为s
|
RefreshTime: 10 #刷新时间,单位为s
|
||||||
total: 12 #每个玩家每次刷新的实体数量
|
total: 12 #每个玩家每次刷新的实体数量
|
||||||
num: 4 #单次刷新的数量,每RefreshTime秒刷新的数量
|
num: 4 #单次刷新的最大数量,每RefreshTime秒刷新的数量
|
@ -8,6 +8,8 @@ DESERT:
|
|||||||
nums: 2 #entity的刷新数量,注意,这里的数量会和通群系中其他entity相关,总数不会超过config.yml中的定义
|
nums: 2 #entity的刷新数量,注意,这里的数量会和通群系中其他entity相关,总数不会超过config.yml中的定义
|
||||||
yMax: 150 #极限刷新高度
|
yMax: 150 #极限刷新高度
|
||||||
yMin: 60 #最小刷新高度
|
yMin: 60 #最小刷新高度
|
||||||
|
riskMax: 10 #刷新危险度的范围
|
||||||
|
riskMin: 0 #条件是小于等于riskMin大于riskMax,即riskMin<= risklevel < riskMax 才会刷新
|
||||||
ROOFED_FOREST:
|
ROOFED_FOREST:
|
||||||
ZOMBIE: #指出entity在该群系的刷新条件
|
ZOMBIE: #指出entity在该群系的刷新条件
|
||||||
type: 0 #0表示生成mc原生实体,1表示生成MM怪物,2表示生成萌芽怪物
|
type: 0 #0表示生成mc原生实体,1表示生成MM怪物,2表示生成萌芽怪物
|
||||||
@ -18,6 +20,8 @@ ROOFED_FOREST:
|
|||||||
nums: 2 #entity的刷新数量,注意,这里的数量会和通群系中其他entity相关,总数不会超过config.yml中的定义
|
nums: 2 #entity的刷新数量,注意,这里的数量会和通群系中其他entity相关,总数不会超过config.yml中的定义
|
||||||
yMax: 150 #极限刷新高度
|
yMax: 150 #极限刷新高度
|
||||||
yMin: 60 #最小刷新高度
|
yMin: 60 #最小刷新高度
|
||||||
|
riskMax: 10 #刷新危险度的范围
|
||||||
|
riskMin: 0
|
||||||
|
|
||||||
PIG_ZOMBIE: #指出entity在该群系的刷新条件
|
PIG_ZOMBIE: #指出entity在该群系的刷新条件
|
||||||
type: 0 #0表示生成mc原生实体,1表示生成MM怪物,2表示生成萌芽怪物
|
type: 0 #0表示生成mc原生实体,1表示生成MM怪物,2表示生成萌芽怪物
|
||||||
@ -28,3 +32,5 @@ ROOFED_FOREST:
|
|||||||
nums: 2 #entity的刷新数量,注意,这里的数量会和通群系中其他entity相关,总数不会超过config.yml中的定义
|
nums: 2 #entity的刷新数量,注意,这里的数量会和通群系中其他entity相关,总数不会超过config.yml中的定义
|
||||||
yMax: 150 #极限刷新高度
|
yMax: 150 #极限刷新高度
|
||||||
yMin: 60 #最小刷新高度
|
yMin: 60 #最小刷新高度
|
||||||
|
riskMax: 10 #刷新危险度的范围
|
||||||
|
riskMin: 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user