Added new configuration file option: "SpawnDemonsOnPlayerBedEnter" which lets server administrators decide if players getting in to bed should cause a demon to occasionally spawn
This commit is contained in:
parent
bce711aa9e
commit
b124383f33
@ -156,12 +156,11 @@ public class AICore {
|
|||||||
GraveyardTeleport(player);
|
GraveyardTeleport(player);
|
||||||
} else if (chance < 50) {
|
} else if (chance < 50) {
|
||||||
setHauntTarget(player);
|
setHauntTarget(player);
|
||||||
} else {
|
} else if (Herobrine.getPluginCore().getConfigDB().SpawnDemonsOnPlayerBedEnter && Herobrine.getPluginCore().getConfigDB().UseNPC_Demon
|
||||||
if (Herobrine.getPluginCore().getConfigDB().UseNPC_Demon && !Herobrine.isNPCDisabled) {
|
&& !Herobrine.isNPCDisabled) {
|
||||||
Herobrine.getPluginCore().getEntityManager().spawnCustomSkeleton(player.getLocation(), MobType.DEMON);
|
Herobrine.getPluginCore().getEntityManager().spawnCustomSkeleton(player.getLocation(), MobType.DEMON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void FindPlayer() {
|
public void FindPlayer() {
|
||||||
if (Herobrine.getPluginCore().getConfigDB().OnlyWalkingMode == false) {
|
if (Herobrine.getPluginCore().getConfigDB().OnlyWalkingMode == false) {
|
||||||
|
@ -72,6 +72,7 @@ public class ConfigDB {
|
|||||||
public boolean UseNPC_Guardian = true;
|
public boolean UseNPC_Guardian = true;
|
||||||
public boolean UseNPC_Warrior = true;
|
public boolean UseNPC_Warrior = true;
|
||||||
public boolean UseNPC_Demon = true;
|
public boolean UseNPC_Demon = true;
|
||||||
|
public boolean SpawnDemonsOnPlayerBedEnter = true;
|
||||||
public CustomID ItemInHand = null;
|
public CustomID ItemInHand = null;
|
||||||
public boolean Explosions = true;
|
public boolean Explosions = true;
|
||||||
public boolean Burn = true;
|
public boolean Burn = true;
|
||||||
@ -101,6 +102,7 @@ public class ConfigDB {
|
|||||||
public File npcF = new File("plugins/Herobrine/npc.yml");
|
public File npcF = new File("plugins/Herobrine/npc.yml");
|
||||||
|
|
||||||
public void Startup() {
|
public void Startup() {
|
||||||
|
boolean configUpdated = false;
|
||||||
new File("plugins/Herobrine/pregraveyard_caches").mkdirs();
|
new File("plugins/Herobrine/pregraveyard_caches").mkdirs();
|
||||||
|
|
||||||
if (!configF.exists())
|
if (!configF.exists())
|
||||||
@ -238,6 +240,7 @@ public class ConfigDB {
|
|||||||
config.set("config.UseNPC.Guardian", true);
|
config.set("config.UseNPC.Guardian", true);
|
||||||
config.set("config.UseNPC.Warrior", true);
|
config.set("config.UseNPC.Warrior", true);
|
||||||
config.set("config.UseNPC.Demon", true);
|
config.set("config.UseNPC.Demon", true);
|
||||||
|
config.set("config.SpawnDemonsOnPlayerBedEnter", true);
|
||||||
config.set("config.ItemInHand", "AIR");
|
config.set("config.ItemInHand", "AIR");
|
||||||
config.set("config.Explosions", true);
|
config.set("config.Explosions", true);
|
||||||
config.set("config.Burn", true);
|
config.set("config.Burn", true);
|
||||||
@ -259,6 +262,19 @@ public class ConfigDB {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(!config.contains("config.SpawnDemonsOnPlayerBedEnter")) {
|
||||||
|
config.set("config.SpawnDemonsOnPlayerBedEnter", true);
|
||||||
|
configUpdated = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(configUpdated) {
|
||||||
|
try {
|
||||||
|
config.save(configF);
|
||||||
|
log.info("[Herobrine] The Herobrine configuration file was updated with new parameters for Herobrine v" + pluginVersionString + ".");
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Reload();
|
Reload();
|
||||||
}
|
}
|
||||||
@ -332,6 +348,7 @@ public class ConfigDB {
|
|||||||
UseNPC_Guardian = config.getBoolean("config.UseNPC.Guardian");
|
UseNPC_Guardian = config.getBoolean("config.UseNPC.Guardian");
|
||||||
UseNPC_Warrior = config.getBoolean("config.UseNPC.Warrior");
|
UseNPC_Warrior = config.getBoolean("config.UseNPC.Warrior");
|
||||||
UseNPC_Demon = config.getBoolean("config.UseNPC.Demon");
|
UseNPC_Demon = config.getBoolean("config.UseNPC.Demon");
|
||||||
|
SpawnDemonsOnPlayerBedEnter = config.getBoolean("config.SpawnDemonsOnPlayerBedEnter");
|
||||||
ItemInHand = new CustomID(config.getString("config.ItemInHand"));
|
ItemInHand = new CustomID(config.getString("config.ItemInHand"));
|
||||||
Explosions = config.getBoolean("config.Explosions");
|
Explosions = config.getBoolean("config.Explosions");
|
||||||
Burn = config.getBoolean("config.Burn");
|
Burn = config.getBoolean("config.Burn");
|
||||||
|
Loading…
Reference in New Issue
Block a user