Runnable to Lambda

This commit is contained in:
Driftay 2019-03-27 10:54:32 -04:00
parent 173676fa31
commit ec36827378
1 changed files with 78 additions and 87 deletions

View File

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