mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-24 19:45:43 +01:00
Fix windup / mob sign behavior
This commit is contained in:
parent
a89ccbb830
commit
ff1c46a848
@ -35,10 +35,6 @@ public abstract class Windup extends Deactivatable {
|
|||||||
* How many times the task is supposed to be executed (unless it is cancelled).
|
* How many times the task is supposed to be executed (unless it is cancelled).
|
||||||
*/
|
*/
|
||||||
protected int n;
|
protected int n;
|
||||||
/**
|
|
||||||
* How many times the task has been executed.
|
|
||||||
*/
|
|
||||||
protected int k;
|
|
||||||
|
|
||||||
private Runnable runnable;
|
private Runnable runnable;
|
||||||
private BukkitTask task;
|
private BukkitTask task;
|
||||||
@ -135,26 +131,12 @@ public abstract class Windup extends Deactivatable {
|
|||||||
this.n = n;
|
this.n = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns how many times the task has already been executed (like in SIGMA notation).
|
|
||||||
*
|
|
||||||
* @return how many times the task has already been executed (like in SIGMA notation)
|
|
||||||
*/
|
|
||||||
public int getK() {
|
|
||||||
return k;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets k (like in SIGMA notation) to 0.
|
|
||||||
*/
|
|
||||||
public void resetK() {
|
|
||||||
k = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void activate() {
|
public void activate() {
|
||||||
if (interval <= 0) {
|
if (interval <= 0) {
|
||||||
|
for (int k = 0; k < n; k++) {
|
||||||
runnable.run();
|
runnable.run();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
active = true;
|
active = true;
|
||||||
startTask();
|
startTask();
|
||||||
|
@ -138,7 +138,6 @@ public class MobSign extends Windup {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
spawned = (LivingEntity) type.toEntity(spawnLoc);
|
spawned = (LivingEntity) type.toEntity(spawnLoc);
|
||||||
spawned.setRemoveWhenFarAway(false);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
provider.summon(mob, spawnLoc);
|
provider.summon(mob, spawnLoc);
|
||||||
@ -152,6 +151,7 @@ public class MobSign extends Windup {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spawned.setRemoveWhenFarAway(false);
|
||||||
spawnedMobs.add(spawned);
|
spawnedMobs.add(spawned);
|
||||||
return spawned;
|
return spawned;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
public class MobSpawnTask extends BukkitRunnable {
|
public class MobSpawnTask extends BukkitRunnable {
|
||||||
|
|
||||||
private MobSign sign;
|
private MobSign sign;
|
||||||
private int k, n;
|
private int k = 1, n;
|
||||||
|
|
||||||
public MobSpawnTask(MobSign sign, int n) {
|
public MobSpawnTask(MobSign sign, int n) {
|
||||||
this.sign = sign;
|
this.sign = sign;
|
||||||
|
Loading…
Reference in New Issue
Block a user