Skip to content

Commit

Permalink
Delay tasks after first
Browse files Browse the repository at this point in the history
  • Loading branch information
Sataniel98 committed Jul 6, 2016
1 parent 2389d54 commit 3b671a6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
18 changes: 12 additions & 6 deletions src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class DungeonsXL extends BRPlugin {
private static DungeonsXL instance;

public static final String[] EXCLUDED_FILES = {"config.yml", "uid.dat", "DXLData.data"};
public static File BACKUPS;
public static File DUNGEONS;
public static File LANGUAGES;
public static File MAPS;
Expand Down Expand Up @@ -208,7 +209,7 @@ public void onDisable() {

// Stop shedulers
getServer().getScheduler().cancelTasks(this);

// DebukkIt
debug.save();
}
Expand All @@ -219,6 +220,11 @@ public void initFolders() {
getDataFolder().mkdir();
}

BACKUPS = new File(getDataFolder(), "backups");
if (!BACKUPS.exists()) {
BACKUPS.mkdir();
}

DUNGEONS = new File(getDataFolder(), "dungeons");
if (!DUNGEONS.exists()) {
DUNGEONS.mkdir();
Expand Down Expand Up @@ -572,7 +578,7 @@ public BukkitTask getAnnouncerTask() {
*/
public void startAnnouncerTask(long period) {
if (!announcers.getAnnouncers().isEmpty()) {
announcerTask = new AnnouncerTask(announcers).runTaskTimer(this, 0L, period);
announcerTask = new AnnouncerTask(announcers).runTaskTimer(this, period, period);
}
}

Expand All @@ -587,7 +593,7 @@ public BukkitTask getWorldUnloadTask() {
* start a new WorldUnloadTask
*/
public void startWorldUnloadTask(long period) {
worldUnloadTask = new WorldUnloadTask().runTaskTimer(this, 0L, period);
worldUnloadTask = new WorldUnloadTask().runTaskTimer(this, period, period);
}

/**
Expand All @@ -601,7 +607,7 @@ public BukkitTask getLazyUpdateTask() {
* start a new LazyUpdateTask
*/
public void startLazyUpdateTask(long period) {
lazyUpdateTask = new LazyUpdateTask().runTaskTimer(this, 0L, period);
lazyUpdateTask = new LazyUpdateTask().runTaskTimer(this, period, period);
}

/**
Expand All @@ -615,7 +621,7 @@ public BukkitTask getUpdateTask() {
* start a new LazyUpdateTask
*/
public void startUpdateTask(long period) {
updateTask = new UpdateTask().runTaskTimer(this, 0L, period);
updateTask = new UpdateTask().runTaskTimer(this, period, period);
}

/**
Expand All @@ -629,7 +635,7 @@ public BukkitTask getSecureModeTask() {
* start a new SecureModeTask
*/
public void startSecureModeTask(long period) {
updateTask = new SecureModeTask().runTaskTimer(this, 0L, period);
updateTask = new SecureModeTask().runTaskTimer(this, period, period);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/io/github/dre2n/dungeonsxl/sign/DropSign.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ public void onTrigger() {
getSign().getWorld().dropItem(spawnLocation, item);

} else {
new DropItemTask(item, spawnLocation).runTaskTimer(plugin, 0, (long) interval * 20);
long period = (long) interval * 20;
new DropItemTask(item, spawnLocation).runTaskTimer(plugin, period, period);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import io.github.dre2n.dungeonsxl.world.DGameWorld;

/**
* @author Frank Baumann, Daniel Saukel
* @author Daniel Saukel
*/
public class FortuneTrigger extends Trigger {

Expand All @@ -35,6 +35,9 @@ public FortuneTrigger(double chance) {
}

/* Getters and setters */
/**
* @return the chance
*/
public double getChance() {
return chance;
}
Expand Down

0 comments on commit 3b671a6

Please sign in to comment.