mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
#94: Testing done - fixes under way!
This commit is contained in:
parent
2efa8e0527
commit
39281a2bd8
@ -146,7 +146,6 @@ public class DungeonsXL extends BRPlugin {
|
||||
loadMainConfig(new File(getDataFolder(), "config.yml"));
|
||||
// Load Language 2
|
||||
loadMessageConfig(new File(LANGUAGES, mainConfig.getLanguage() + ".yml"));
|
||||
loadDCommands();
|
||||
DPermissions.register();
|
||||
loadGameTypes();
|
||||
loadRequirementTypes();
|
||||
@ -161,6 +160,8 @@ public class DungeonsXL extends BRPlugin {
|
||||
loadDClasses(CLASSES);
|
||||
loadDMobTypes(MOBS);
|
||||
loadSignScripts(SIGNS);
|
||||
loadDWorlds(MAPS);
|
||||
loadDCommands();
|
||||
|
||||
manager.registerEvents(new EntityListener(), this);
|
||||
manager.registerEvents(new GUIListener(), this);
|
||||
@ -582,7 +583,7 @@ public class DungeonsXL extends BRPlugin {
|
||||
/**
|
||||
* load / reload a new instance of DWorlds
|
||||
*/
|
||||
public void loadWorlds(File folder) {
|
||||
public void loadDWorlds(File folder) {
|
||||
dWorlds = new DWorlds(MAPS);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class CreateCommand extends BRCommand {
|
||||
public void onExecute(String[] args, CommandSender sender) {
|
||||
String name = args[1];
|
||||
|
||||
if (new File(plugin.getDataFolder(), "/maps/" + name).exists()) {
|
||||
if (new File(DungeonsXL.MAPS, name).exists()) {
|
||||
MessageUtil.sendMessage(sender, DMessages.ERROR_NAME_IN_USE.getMessage(name));
|
||||
return;
|
||||
}
|
||||
@ -67,7 +67,8 @@ public class CreateCommand extends BRCommand {
|
||||
MessageUtil.log(plugin, DMessages.LOG_GENERATE_NEW_WORLD.getMessage());
|
||||
|
||||
// Create World
|
||||
DResourceWorld resource = new DResourceWorld(name);
|
||||
DResourceWorld resource = new DResourceWorld(plugin.getDWorlds(), name);
|
||||
plugin.getDWorlds().addResource(resource);
|
||||
DEditWorld editWorld = resource.generate();
|
||||
editWorld.save();
|
||||
editWorld.delete();
|
||||
@ -88,7 +89,8 @@ public class CreateCommand extends BRCommand {
|
||||
MessageUtil.log(plugin, DMessages.LOG_GENERATE_NEW_WORLD.getMessage());
|
||||
|
||||
// Create World
|
||||
DResourceWorld resource = new DResourceWorld(name);
|
||||
DResourceWorld resource = new DResourceWorld(plugin.getDWorlds(), name);
|
||||
plugin.getDWorlds().addResource(resource);
|
||||
DEditWorld editWorld = resource.generate();
|
||||
|
||||
// MSG Done
|
||||
|
@ -78,10 +78,9 @@ public class Game {
|
||||
|
||||
dGroups.add(dGroup);
|
||||
started = false;
|
||||
// TO DO world = new DGameWorld();
|
||||
DResourceWorld resource = plugin.getDWorlds().getResourceByName(worldName);
|
||||
world = resource.instantiateAsGameWorld();
|
||||
dGroup.setGameWorld(world);
|
||||
resource.instantiateAsGameWorld();
|
||||
fetchRules();
|
||||
}
|
||||
|
||||
|
@ -37,13 +37,15 @@ import org.bukkit.WorldType;
|
||||
public class DResourceWorld {
|
||||
|
||||
DungeonsXL plugin = DungeonsXL.getInstance();
|
||||
DWorlds worlds = plugin.getDWorlds();
|
||||
DWorlds worlds;
|
||||
|
||||
private File folder;
|
||||
private WorldConfig config;
|
||||
private SignData signData;
|
||||
|
||||
public DResourceWorld(String name) {
|
||||
public DResourceWorld(DWorlds worlds, String name) {
|
||||
this.worlds = worlds;
|
||||
|
||||
folder = new File(DungeonsXL.MAPS, name);
|
||||
if (!folder.exists()) {
|
||||
folder.mkdir();
|
||||
@ -60,11 +62,11 @@ public class DResourceWorld {
|
||||
}
|
||||
|
||||
signData = new SignData(signDataFile);
|
||||
|
||||
worlds.addResource(this);
|
||||
}
|
||||
|
||||
public DResourceWorld(File folder) {
|
||||
public DResourceWorld(DWorlds worlds, File folder) {
|
||||
this.worlds = worlds;
|
||||
|
||||
this.folder = folder;
|
||||
|
||||
File configFile = new File(folder, "config.yml");
|
||||
@ -76,8 +78,6 @@ public class DResourceWorld {
|
||||
if (signData.exists()) {
|
||||
this.signData = new SignData(signData);
|
||||
}
|
||||
|
||||
worlds.addResource(this);
|
||||
}
|
||||
|
||||
/* Getters and setters */
|
||||
@ -185,11 +185,11 @@ public class DResourceWorld {
|
||||
DInstanceWorld instance = null;
|
||||
try {
|
||||
if (game) {
|
||||
new DGameWorld(this, instanceFolder, world, id);
|
||||
instance = new DGameWorld(this, instanceFolder, world, id);
|
||||
signData.deserializeSigns((DGameWorld) instance);
|
||||
|
||||
} else {
|
||||
new DEditWorld(this, instanceFolder, world, id);
|
||||
instance = new DEditWorld(this, instanceFolder, world, id);
|
||||
signData.deserializeSigns((DEditWorld) instance);
|
||||
}
|
||||
|
||||
|
@ -29,13 +29,13 @@ import org.bukkit.Bukkit;
|
||||
*/
|
||||
public class DWorlds {
|
||||
|
||||
private Set<DResourceWorld> resources;
|
||||
private Set<DInstanceWorld> instances;
|
||||
private Set<DResourceWorld> resources = new HashSet<>();
|
||||
private Set<DInstanceWorld> instances = new HashSet<>();
|
||||
|
||||
public DWorlds(File folder) {
|
||||
for (File file : folder.listFiles()) {
|
||||
if (file.isDirectory()) {
|
||||
new DResourceWorld(file);
|
||||
resources.add(new DResourceWorld(this, file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user