Add warmups for /f home and /f warp

This commit is contained in:
Joshua Popoff
2015-01-19 15:59:15 -08:00
parent b923e1efd7
commit 355e1f58b0
6 changed files with 74 additions and 16 deletions

View File

@@ -0,0 +1,27 @@
package com.massivecraft.factions.util;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.P;
import com.massivecraft.factions.zcore.util.TL;
public class WarmUpUtil {
/**
*
* @param player The player to notify.
* @param translationKey The translation key used for notifying.
* @param action The action, inserted into the notification message.
* @param runnable The task to run after the delay. If the delay is 0, the task is instantly ran.
* @param delay The time used, in seconds, for the delay.
*
* note: for translations: %s = action, %d = delay
*/
public static void process(FPlayer player, TL translationKey, String action, Runnable runnable, long delay) {
if (delay > 0) {
player.msg(translationKey.format(action, delay));
P.p.getServer().getScheduler().runTaskLater(P.p, runnable, delay * 20);
} else {
runnable.run();
}
}
}