Added possibility to change the herobrine world name from configuration!
This commit is contained in:
parent
15822b46d8
commit
95f2d2e2d5
@ -9,7 +9,7 @@ import org.jakub1221.herobrineai.misc.StructureLoader;
|
|||||||
public class GraveyardWorld {
|
public class GraveyardWorld {
|
||||||
|
|
||||||
public static void create() {
|
public static void create() {
|
||||||
final Location loc = new Location(Bukkit.getServer().getWorld("world_herobrine_graveyard"), 0.0, 3.0, 0.0);
|
final Location loc = new Location(Bukkit.getServer().getWorld(HerobrineAI.getPluginCore().getConfigDB().HerobrineWorldName), 0.0, 3.0, 0.0);
|
||||||
for (int x = -50; x <= 50; ++x) {
|
for (int x = -50; x <= 50; ++x) {
|
||||||
for (int z = -50; z <= 50; ++z) {
|
for (int z = -50; z <= 50; ++z) {
|
||||||
loc.getWorld().getBlockAt(x, 3, z).setType(Material.MYCEL);
|
loc.getWorld().getBlockAt(x, 3, z).setType(Material.MYCEL);
|
||||||
|
@ -81,6 +81,7 @@ public class ConfigDB
|
|||||||
public int maxHeads = 1;
|
public int maxHeads = 1;
|
||||||
public boolean UseIgnorePermission = true;
|
public boolean UseIgnorePermission = true;
|
||||||
public String HerobrineName = "Herobrine";
|
public String HerobrineName = "Herobrine";
|
||||||
|
public String HerobrineWorldName = "world_herobrine_graveyard";
|
||||||
public boolean UseSound = true;
|
public boolean UseSound = true;
|
||||||
private boolean isStartupDone = false;
|
private boolean isStartupDone = false;
|
||||||
|
|
||||||
@ -247,8 +248,8 @@ public class ConfigDB
|
|||||||
this.config.set("config.Limit.Heads", Integer.valueOf(1));
|
this.config.set("config.Limit.Heads", Integer.valueOf(1));
|
||||||
this.config.set("config.UseIgnorePermission", Boolean.valueOf(false));
|
this.config.set("config.UseIgnorePermission", Boolean.valueOf(false));
|
||||||
this.config.set("config.Name", "Herobrine");
|
this.config.set("config.Name", "Herobrine");
|
||||||
|
this.config.set("config.HerobrineWorldName", "world_herobrine_graveyard");
|
||||||
this.config.set("config.UseHauntSound", Boolean.valueOf(true));
|
this.config.set("config.UseHauntSound", Boolean.valueOf(true));
|
||||||
this.config.set("config.HerobrineUUID", "f84c6a79-0a4e-45e0-879b-cd49ebd4c4e2");
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.config.save(this.configF);
|
this.config.save(this.configF);
|
||||||
@ -261,6 +262,12 @@ public class ConfigDB
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
boolean hasUpdated = false;
|
boolean hasUpdated = false;
|
||||||
|
if (!this.config.contains("config.HerobrineWorldName"))
|
||||||
|
{
|
||||||
|
hasUpdated = true;
|
||||||
|
this.log.info("[HerobrineAI] Updating old config...");
|
||||||
|
this.config.set("config.HerobrineWorldName", this.HerobrineWorldName);
|
||||||
|
}
|
||||||
if (!this.config.contains("config.Worlds"))
|
if (!this.config.contains("config.Worlds"))
|
||||||
{
|
{
|
||||||
hasUpdated = true;
|
hasUpdated = true;
|
||||||
@ -494,15 +501,6 @@ public class ConfigDB
|
|||||||
|
|
||||||
this.config.set("config.UseHauntSound", Boolean.valueOf(true));
|
this.config.set("config.UseHauntSound", Boolean.valueOf(true));
|
||||||
}
|
}
|
||||||
if (!this.config.contains("config.HerobrineUUID"))
|
|
||||||
{
|
|
||||||
if (!hasUpdated) {
|
|
||||||
this.log.info("[HerobrineAI] Updating old config...");
|
|
||||||
}
|
|
||||||
hasUpdated = true;
|
|
||||||
|
|
||||||
this.config.set("config.HerobrineUUID", "f84c6a79-0a4e-45e0-879b-cd49ebd4c4e2");
|
|
||||||
}
|
|
||||||
if (hasUpdated)
|
if (hasUpdated)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -601,6 +599,7 @@ public class ConfigDB
|
|||||||
this.maxHeads = this.config.getInt("config.Limit.Heads");
|
this.maxHeads = this.config.getInt("config.Limit.Heads");
|
||||||
this.UseIgnorePermission = this.config.getBoolean("config.UseIgnorePermission");
|
this.UseIgnorePermission = this.config.getBoolean("config.UseIgnorePermission");
|
||||||
this.HerobrineName = this.config.getString("config.Name");
|
this.HerobrineName = this.config.getString("config.Name");
|
||||||
|
this.HerobrineWorldName = this.config.getString("config.HerobrineWorldName");
|
||||||
this.UseSound = this.config.getBoolean("config.UseHauntSound");
|
this.UseSound = this.config.getBoolean("config.UseHauntSound");
|
||||||
HerobrineAI.HerobrineMaxHP = this.HerobrineHP;
|
HerobrineAI.HerobrineMaxHP = this.HerobrineHP;
|
||||||
HerobrineAI.getPluginCore().getAICore().stopMAIN();
|
HerobrineAI.getPluginCore().getAICore().stopMAIN();
|
||||||
@ -649,7 +648,7 @@ public class ConfigDB
|
|||||||
ArrayList<String> allWorlds = new ArrayList<String>();
|
ArrayList<String> allWorlds = new ArrayList<String>();
|
||||||
List<World> worlds_ = Bukkit.getWorlds();
|
List<World> worlds_ = Bukkit.getWorlds();
|
||||||
for (int i = 0; i <= worlds_.size() - 1; i++) {
|
for (int i = 0; i <= worlds_.size() - 1; i++) {
|
||||||
if (!((World)worlds_.get(i)).getName().equalsIgnoreCase("world_herobrineai_graveyard")) {
|
if (!((World)worlds_.get(i)).getName().equalsIgnoreCase(this.HerobrineWorldName)) {
|
||||||
allWorlds.add(((World)worlds_.get(i)).getName());
|
allWorlds.add(((World)worlds_.get(i)).getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,9 +74,9 @@ public class HerobrineAI extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initHerobrine() {
|
private void initHerobrine() {
|
||||||
if (configdb.UseGraveyardWorld && (Bukkit.getServer().getWorld("world_herobrine_graveyard") == null)) {
|
if (configdb.UseGraveyardWorld && (Bukkit.getServer().getWorld(configdb.HerobrineWorldName) == null)) {
|
||||||
HerobrineAI.log.info("[Herobrine] Creating Herobrine Graveyard world");
|
HerobrineAI.log.info("[Herobrine] Creating Herobrine Graveyard world");
|
||||||
final WorldCreator wc = new WorldCreator("world_herobrine_graveyard");
|
final WorldCreator wc = new WorldCreator(configdb.HerobrineWorldName);
|
||||||
wc.generateStructures(false);
|
wc.generateStructures(false);
|
||||||
final WorldType type = WorldType.FLAT;
|
final WorldType type = WorldType.FLAT;
|
||||||
wc.type(type);
|
wc.type(type);
|
||||||
|
Reference in New Issue
Block a user