mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-02-19 13:51:20 +01:00
fixed NPE
This commit is contained in:
parent
f76cd8c771
commit
9da8f21a9b
@ -26,6 +26,7 @@ public class SIGNMob extends DSign{
|
|||||||
private int interval = 0;
|
private int interval = 0;
|
||||||
private int amount = 1;
|
private int amount = 1;
|
||||||
private boolean initialized;
|
private boolean initialized;
|
||||||
|
private int id = -1;
|
||||||
|
|
||||||
public SIGNMob(Sign sign, GameWorld gworld) {
|
public SIGNMob(Sign sign, GameWorld gworld) {
|
||||||
super(sign, gworld);
|
super(sign, gworld);
|
||||||
@ -74,12 +75,21 @@ public class SIGNMob extends DSign{
|
|||||||
if(initialized){
|
if(initialized){
|
||||||
MobSpawnScheduler scheduler = new MobSpawnScheduler(this);
|
MobSpawnScheduler scheduler = new MobSpawnScheduler(this);
|
||||||
|
|
||||||
int id = p.getServer().getScheduler().scheduleSyncRepeatingTask(p, scheduler, 0L, 20L);
|
id = p.getServer().getScheduler().scheduleSyncRepeatingTask(p, scheduler, 0L, 20L);
|
||||||
scheduler.id = id;
|
scheduler.id = id;
|
||||||
|
|
||||||
initialized = false;
|
initialized = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void killTask(){
|
||||||
|
//if(initialized){
|
||||||
|
if(id != -1){
|
||||||
|
p.getServer().getScheduler().cancelTask(id);
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
public class MobSpawnScheduler implements Runnable{
|
public class MobSpawnScheduler implements Runnable{
|
||||||
private SIGNMob sign;
|
private SIGNMob sign;
|
||||||
|
Loading…
Reference in New Issue
Block a user