Runnable to Lambda

This commit is contained in:
Driftay 2019-03-27 10:54:32 -04:00
parent 173676fa31
commit ec36827378

View File

@ -44,9 +44,7 @@ public class CmdFly extends FCommand {
return;
}
id = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() {
@Override
public void run() {
id = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> {
for (String name : flyMap.keySet()) {
Player player = Bukkit.getPlayer(name);
if (player == null) {
@ -83,14 +81,11 @@ public class CmdFly extends FCommand {
Bukkit.getScheduler().cancelTask(id);
id = -1;
}
}
}, 10L, 3L);
}
public static void startFlyCheck() {
flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() {
@Override
public void run() throws ConcurrentModificationException { //threw the exception for now, until I recode fly :( Cringe.
flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> { //threw the exception for now, until I recode fly :( Cringe.
checkTaskState();
if (flyMap.keySet().size() != 0) {
for (String name : flyMap.keySet()) {
@ -136,7 +131,6 @@ public class CmdFly extends FCommand {
}
}
}
}, 20L, 20L);
}
@ -226,9 +220,7 @@ public class CmdFly extends FCommand {
if (fme.canFlyAtLocation())
this.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", new Runnable() {
@Override
public void run() {
this.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", () -> {
fme.setFlying(true);
flyMap.put(player.getName(), true);
if (id == -1) {
@ -239,7 +231,6 @@ public class CmdFly extends FCommand {
if (flyid == -1) {
startFlyCheck();
}
}
}, this.p.getConfig().getLong("warmups.f-fly", 0));
}