mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 13:36:33 +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).
|
||||
*/
|
||||
protected int n;
|
||||
/**
|
||||
* How many times the task has been executed.
|
||||
*/
|
||||
protected int k;
|
||||
|
||||
private Runnable runnable;
|
||||
private BukkitTask task;
|
||||
@ -135,26 +131,12 @@ public abstract class Windup extends Deactivatable {
|
||||
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
|
||||
public void activate() {
|
||||
if (interval <= 0) {
|
||||
runnable.run();
|
||||
for (int k = 0; k < n; k++) {
|
||||
runnable.run();
|
||||
}
|
||||
} else {
|
||||
active = true;
|
||||
startTask();
|
||||
|
@ -138,7 +138,6 @@ public class MobSign extends Windup {
|
||||
return null;
|
||||
}
|
||||
spawned = (LivingEntity) type.toEntity(spawnLoc);
|
||||
spawned.setRemoveWhenFarAway(false);
|
||||
|
||||
} else {
|
||||
provider.summon(mob, spawnLoc);
|
||||
@ -152,6 +151,7 @@ public class MobSign extends Windup {
|
||||
}
|
||||
}
|
||||
|
||||
spawned.setRemoveWhenFarAway(false);
|
||||
spawnedMobs.add(spawned);
|
||||
return spawned;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
public class MobSpawnTask extends BukkitRunnable {
|
||||
|
||||
private MobSign sign;
|
||||
private int k, n;
|
||||
private int k = 1, n;
|
||||
|
||||
public MobSpawnTask(MobSign sign, int n) {
|
||||
this.sign = sign;
|
||||
|
Loading…
Reference in New Issue
Block a user