Skip to content

Commit

Permalink
Fix SignData NullPointerException
Browse files Browse the repository at this point in the history
Also remove some debug
  • Loading branch information
Sataniel98 committed Jul 12, 2016
1 parent 821f0fc commit 81be1be
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ public class SignData {
private File file;

public SignData(File file) {
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException exception) {
exception.printStackTrace();
}
}

this.file = file;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package io.github.dre2n.dungeonsxl.task;

import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.mob.DMob;
import io.github.dre2n.dungeonsxl.mob.ExternalMobProvider;
import io.github.dre2n.dungeonsxl.sign.ExternalMobSign;
Expand All @@ -28,8 +27,6 @@
* @author Frank Baumann, Daniel Saukel
*/
public class ExternalMobSpawnTask extends BukkitRunnable {

DungeonsXL plugin = DungeonsXL.getInstance();

private ExternalMobSign sign;
private ExternalMobProvider provider;
Expand All @@ -41,7 +38,6 @@ public ExternalMobSpawnTask(ExternalMobSign sign, ExternalMobProvider provider)

@Override
public void run() {
plugin.debug.start("ExternalMobSpawnTask#run");
if (sign.getInterval() <= 0) {
World world = sign.getSign().getWorld();
DGameWorld gameWorld = DGameWorld.getByWorld(world);
Expand Down Expand Up @@ -74,7 +70,6 @@ public void run() {
}

sign.setInterval(sign.getInterval() - 1);
plugin.debug.end("ExternalMobSpawnTask#run", true);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
*/
public class MobSpawnTask extends BukkitRunnable {

DungeonsXL plugin = DungeonsXL.getInstance();

private DMobSign sign;

public MobSpawnTask(DMobSign sign) {
Expand All @@ -46,7 +44,6 @@ public MobSpawnTask(DMobSign sign) {

@Override
public void run() {
plugin.debug.start("MobSpawnTask#run");
if (sign.getInterval() <= 0) {
World world = sign.getSign().getWorld();
DGameWorld gameWorld = DGameWorld.getByWorld(world);
Expand Down Expand Up @@ -99,7 +96,6 @@ public void run() {
}

sign.setInterval(sign.getInterval() - 1);
plugin.debug.end("MobSpawnTask#run", true);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import io.github.dre2n.dungeonsxl.task.BackupResourceTask;
import io.github.dre2n.dungeonsxl.util.worldloader.WorldLoader;
import java.io.File;
import java.io.IOException;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.WorldCreator;
Expand Down Expand Up @@ -55,15 +54,6 @@ public DResourceWorld(DWorlds worlds, String name) {
}

File signDataFile = new File(folder, "DXLData.data");
if (!signDataFile.exists()) {
try {
signDataFile.createNewFile();

} catch (IOException exception) {
exception.printStackTrace();
}
}

signData = new SignData(signDataFile);
}

Expand All @@ -77,10 +67,8 @@ public DResourceWorld(DWorlds worlds, File folder) {
config = new WorldConfig(configFile);
}

File signData = new File(folder, "DXLData.data");
if (signData.exists()) {
this.signData = new SignData(signData);
}
File signDataFile = new File(folder, "DXLData.data");
signData = new SignData(signDataFile);
}

/* Getters and setters */
Expand Down

0 comments on commit 81be1be

Please sign in to comment.