mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-09 20:31:28 +01:00
Move IDFile to EditWorld; fix instance purging
This commit is contained in:
parent
e06f4a946d
commit
a73a548b6e
@ -17,7 +17,6 @@
|
||||
package io.github.dre2n.dungeonsxl;
|
||||
|
||||
import io.github.dre2n.caliburn.CaliburnAPI;
|
||||
import io.github.dre2n.commons.command.BRCommands;
|
||||
import io.github.dre2n.commons.compatibility.Internals;
|
||||
import io.github.dre2n.commons.compatibility.Version;
|
||||
import io.github.dre2n.commons.config.MessageConfig;
|
||||
|
@ -36,13 +36,37 @@ public class DEditWorld extends DInstanceWorld {
|
||||
|
||||
static DWorlds worlds = plugin.getDWorlds();
|
||||
|
||||
public static String ID_FILE_PREFIX = ".id_";
|
||||
|
||||
private File idFile;
|
||||
private CopyOnWriteArrayList<Block> signs = new CopyOnWriteArrayList<>();
|
||||
|
||||
DEditWorld(DResourceWorld resourceWorld, File folder, World world, int id) {
|
||||
super(resourceWorld, folder, world, id);
|
||||
generateIdFile();
|
||||
}
|
||||
|
||||
/* Getters and setters */
|
||||
/**
|
||||
* @return the file that stores the ID
|
||||
*/
|
||||
public File getIdFile() {
|
||||
return idFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID file
|
||||
*/
|
||||
public void generateIdFile() {
|
||||
try {
|
||||
idFile = new File(getFolder(), ID_FILE_PREFIX + getName());
|
||||
idFile.createNewFile();
|
||||
|
||||
} catch (IOException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the signs
|
||||
*/
|
||||
@ -95,6 +119,7 @@ public class DEditWorld extends DInstanceWorld {
|
||||
try {
|
||||
getResource().getSignData().serializeSigns(signs);
|
||||
} catch (IOException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@ import io.github.dre2n.dungeonsxl.DungeonsXL;
|
||||
import io.github.dre2n.dungeonsxl.config.WorldConfig;
|
||||
import io.github.dre2n.dungeonsxl.player.DGamePlayer;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
||||
@ -33,12 +32,9 @@ public abstract class DInstanceWorld {
|
||||
protected static DungeonsXL plugin = DungeonsXL.getInstance();
|
||||
protected static DWorlds worlds = plugin.getDWorlds();
|
||||
|
||||
public static String ID_FILE_PREFIX = ".id_";
|
||||
|
||||
private DResourceWorld resourceWorld;
|
||||
private File folder;
|
||||
private World world;
|
||||
private File idFile;
|
||||
private int id;
|
||||
private Location lobby;
|
||||
|
||||
@ -87,13 +83,6 @@ public abstract class DInstanceWorld {
|
||||
return world;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the file that stores the ID
|
||||
*/
|
||||
public File getIdFile() {
|
||||
return idFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unique ID
|
||||
*/
|
||||
@ -129,18 +118,6 @@ public abstract class DInstanceWorld {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ID file
|
||||
*/
|
||||
public void generateIdFile() {
|
||||
try {
|
||||
idFile = new File(getFolder(), ID_FILE_PREFIX + getName());
|
||||
idFile.createNewFile();
|
||||
} catch (IOException exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/* Abstracts */
|
||||
/**
|
||||
* Deletes this instance.
|
||||
|
@ -237,7 +237,6 @@ public class DResourceWorld {
|
||||
World world = plugin.getServer().createWorld(creator);
|
||||
|
||||
DEditWorld editWorld = new DEditWorld(this, folder, world, id);
|
||||
editWorld.generateIdFile();
|
||||
|
||||
return editWorld;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user