mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 21:48:43 +01:00
Fixed Chunk corruption bug
Signed-off-by: Grafe <flingelfrank@hotmail.com>
This commit is contained in:
parent
03da154fc1
commit
f02ba1b93f
@ -180,6 +180,14 @@ public class EditWorld {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Id File
|
||||||
|
File idFile = new File("DXL_Edit_"+eworld.id+"/.id_"+name);
|
||||||
|
try {
|
||||||
|
idFile.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
return eworld;
|
return eworld;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import net.milkbowl.vault.permission.Permission;
|
|||||||
import net.minecraft.server.v1_4_R1.EntityPlayer;
|
import net.minecraft.server.v1_4_R1.EntityPlayer;
|
||||||
import net.minecraft.server.v1_4_R1.MinecraftServer;
|
import net.minecraft.server.v1_4_R1.MinecraftServer;
|
||||||
import net.minecraft.server.v1_4_R1.PlayerInteractManager;
|
import net.minecraft.server.v1_4_R1.PlayerInteractManager;
|
||||||
|
|
||||||
import org.apache.commons.lang.math.NumberUtils;
|
import org.apache.commons.lang.math.NumberUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -109,11 +110,9 @@ public class P extends JavaPlugin{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Scheduler
|
//Scheduler
|
||||||
this.initSchedulers();
|
this.initSchedulers();
|
||||||
|
|
||||||
|
|
||||||
//MSG
|
//MSG
|
||||||
this.log(this.getDescription().getName()+" enabled!");
|
this.log(this.getDescription().getName()+" enabled!");
|
||||||
}
|
}
|
||||||
@ -252,6 +251,29 @@ public class P extends JavaPlugin{
|
|||||||
|
|
||||||
//Load saved players
|
//Load saved players
|
||||||
DSavePlayer.load();
|
DSavePlayer.load();
|
||||||
|
|
||||||
|
//Check Worlds
|
||||||
|
this.checkWorlds();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void checkWorlds(){
|
||||||
|
File serverDir = new File(".");
|
||||||
|
|
||||||
|
for(File file : serverDir.listFiles()){
|
||||||
|
if(file.getName().contains("DXL_Edit_") && file.isDirectory()){
|
||||||
|
for(File dungeonFile : file.listFiles()){
|
||||||
|
if(dungeonFile.getName().contains(".id_")){
|
||||||
|
String dungeonName = dungeonFile.getName().substring(4);
|
||||||
|
this.copyDirectory(file,new File(p.getDataFolder(),"/dungeons/"+dungeonName));
|
||||||
|
this.deletenotusingfiles(new File(p.getDataFolder(),"/dungeons/"+dungeonName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.removeDirectory(file);
|
||||||
|
} else if (file.getName().contains("DXL_Game_") && file.isDirectory()){
|
||||||
|
this.removeDirectory(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//File Control
|
//File Control
|
||||||
@ -284,9 +306,7 @@ public class P extends JavaPlugin{
|
|||||||
public String[] excludedFiles={"config.yml"};
|
public String[] excludedFiles={"config.yml"};
|
||||||
|
|
||||||
public void copyDirectory(File sourceLocation, File targetLocation) {
|
public void copyDirectory(File sourceLocation, File targetLocation) {
|
||||||
|
|
||||||
if (sourceLocation.isDirectory()) {
|
if (sourceLocation.isDirectory()) {
|
||||||
|
|
||||||
if (!targetLocation.exists()) {
|
if (!targetLocation.exists()) {
|
||||||
targetLocation.mkdir();
|
targetLocation.mkdir();
|
||||||
}
|
}
|
||||||
@ -301,15 +321,11 @@ public class P extends JavaPlugin{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isOk){
|
if(isOk){
|
||||||
copyDirectory(new File(sourceLocation, children[i]), new File(
|
copyDirectory(new File(sourceLocation, children[i]), new File(targetLocation, children[i]));
|
||||||
targetLocation, children[i]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (!targetLocation.getParentFile().exists()) {
|
if (!targetLocation.getParentFile().exists()) {
|
||||||
|
|
||||||
createDirectory(targetLocation.getParentFile().getAbsolutePath());
|
createDirectory(targetLocation.getParentFile().getAbsolutePath());
|
||||||
@ -328,11 +344,10 @@ public class P extends JavaPlugin{
|
|||||||
while ((len = in.read(buf)) > 0) {
|
while ((len = in.read(buf)) > 0) {
|
||||||
out.write(buf, 0, len);
|
out.write(buf, 0, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
in.close();
|
in.close();
|
||||||
out.close();
|
out.close();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
if (e.getMessage().contains("Zugriff")
|
if (e.getMessage().contains("Zugriff")
|
||||||
|| e.getMessage().contains("Access"))
|
|| e.getMessage().contains("Access"))
|
||||||
P.p.log("Error: " + e.getMessage() + " // Access denied");
|
P.p.log("Error: " + e.getMessage() + " // Access denied");
|
||||||
@ -355,7 +370,7 @@ public class P extends JavaPlugin{
|
|||||||
public void deletenotusingfiles(File directory){
|
public void deletenotusingfiles(File directory){
|
||||||
File[] files=directory.listFiles();
|
File[] files=directory.listFiles();
|
||||||
for(File file:files){
|
for(File file:files){
|
||||||
if(file.getName().equalsIgnoreCase("uid.dat")){
|
if(file.getName().equalsIgnoreCase("uid.dat") || file.getName().contains(".id_") ){
|
||||||
file.delete();
|
file.delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user