Code Overhaul + Minor Fixes

This commit is contained in:
Driftay 2019-04-16 09:02:31 -04:00
parent 7f53b52d1c
commit 8c6107859e
21 changed files with 116 additions and 208 deletions

View File

@ -19,7 +19,6 @@ public class CmdAdmin extends FCommand {
this.aliases.add("setleader"); this.aliases.add("setleader");
this.requiredArgs.add("player name"); this.requiredArgs.add("player name");
//this.optionalArgs.put("", "");
this.permission = Permission.ADMIN.node; this.permission = Permission.ADMIN.node;
this.disableOnLock = true; this.disableOnLock = true;

View File

@ -51,12 +51,7 @@ public class CmdCheckpoint extends FCommand {
if (checkfaction.getId().equals(Factions.getInstance().getWilderness().getId()) || checkfaction.getId().equals(fme.getFaction().getId())) { if (checkfaction.getId().equals(Factions.getInstance().getWilderness().getId()) || checkfaction.getId().equals(fme.getFaction().getId())) {
fme.msg(TL.COMMAND_CHECKPOINT_GO); fme.msg(TL.COMMAND_CHECKPOINT_GO);
this.doWarmUp(WarmUpUtil.Warmup.CHECKPOINT, TL.WARMUPS_NOTIFY_TELEPORT, "Checkpoint", new Runnable() { this.doWarmUp(WarmUpUtil.Warmup.CHECKPOINT, TL.WARMUPS_NOTIFY_TELEPORT, "Checkpoint", () -> fme.getPlayer().teleport(fme.getFaction().getCheckpoint()), this.p.getConfig().getLong("warmups.f-checkpoint", 0));
@Override
public void run() {
fme.getPlayer().teleport(fme.getFaction().getCheckpoint());
}
}, this.p.getConfig().getLong("warmups.f-checkpoint", 0));
} else { } else {
fme.msg(TL.COMMAND_CHECKPOINT_CLAIMED); fme.msg(TL.COMMAND_CHECKPOINT_CLAIMED);
} }

View File

@ -81,12 +81,7 @@ public class CmdDisband extends FCommand {
if (!disbandMap.containsKey(me.getUniqueId().toString()) && faction.getTnt() > 0) { if (!disbandMap.containsKey(me.getUniqueId().toString()) && faction.getTnt() > 0) {
msg(TL.COMMAND_DISBAND_CONFIRM.toString().replace("{tnt}", faction.getTnt() + "")); msg(TL.COMMAND_DISBAND_CONFIRM.toString().replace("{tnt}", faction.getTnt() + ""));
disbandMap.put(me.getUniqueId().toString(), faction.getId()); disbandMap.put(me.getUniqueId().toString(), faction.getId());
Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, () -> disbandMap.remove(me.getUniqueId().toString()), 200L);
@Override
public void run() {
disbandMap.remove(me.getUniqueId().toString());
}
}, 200L);
} else if (faction.getId().equals(disbandMap.get(me.getUniqueId().toString())) || faction.getTnt() == 0) { } else if (faction.getId().equals(disbandMap.get(me.getUniqueId().toString())) || faction.getTnt() == 0) {
if (SavageFactions.plugin.getConfig().getBoolean("faction-disband-broadcast", true)) { if (SavageFactions.plugin.getConfig().getBoolean("faction-disband-broadcast", true)) {
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) { for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {

View File

@ -66,14 +66,11 @@ public class CmdFWarp extends FCommand {
} }
final FPlayer fPlayer = fme; final FPlayer fPlayer = fme;
final UUID uuid = fme.getPlayer().getUniqueId(); final UUID uuid = fme.getPlayer().getUniqueId();
this.doWarmUp(WarmUpUtil.Warmup.WARP, TL.WARMUPS_NOTIFY_TELEPORT, warpName, new Runnable() { this.doWarmUp(WarmUpUtil.Warmup.WARP, TL.WARMUPS_NOTIFY_TELEPORT, warpName, () -> {
@Override Player player = Bukkit.getPlayer(uuid);
public void run() { if (player != null) {
Player player = Bukkit.getPlayer(uuid); player.teleport(fPlayer.getFaction().getWarp(warpName).getLocation());
if (player != null) { fPlayer.msg(TL.COMMAND_FWARP_WARPED, warpName);
player.teleport(fPlayer.getFaction().getWarp(warpName).getLocation());
fPlayer.msg(TL.COMMAND_FWARP_WARPED, warpName);
}
} }
}, this.p.getConfig().getLong("warmups.f-warp", 0)); }, this.p.getConfig().getLong("warmups.f-warp", 0));
} else { } else {

View File

@ -123,21 +123,18 @@ public class CmdHome extends FCommand {
return; return;
} }
this.doWarmUp(WarmUpUtil.Warmup.HOME, TL.WARMUPS_NOTIFY_TELEPORT, "Home", new Runnable() { this.doWarmUp(WarmUpUtil.Warmup.HOME, TL.WARMUPS_NOTIFY_TELEPORT, "Home", () -> {
@Override // Create a smoke effect
public void run() { if (Conf.homesTeleportCommandSmokeEffectEnabled) {
// Create a smoke effect List<Location> smokeLocations = new ArrayList<>();
if (Conf.homesTeleportCommandSmokeEffectEnabled) { smokeLocations.add(loc);
List<Location> smokeLocations = new ArrayList<>(); smokeLocations.add(loc.add(0, 1, 0));
smokeLocations.add(loc); smokeLocations.add(CmdHome.this.myFaction.getHome());
smokeLocations.add(loc.add(0, 1, 0)); smokeLocations.add(CmdHome.this.myFaction.getHome().clone().add(0, 1, 0));
smokeLocations.add(CmdHome.this.myFaction.getHome()); SmokeUtil.spawnCloudRandom(smokeLocations, Conf.homesTeleportCommandSmokeEffectThickness);
smokeLocations.add(CmdHome.this.myFaction.getHome().clone().add(0, 1, 0));
SmokeUtil.spawnCloudRandom(smokeLocations, Conf.homesTeleportCommandSmokeEffectThickness);
}
CmdHome.this.me.teleport(CmdHome.this.myFaction.getHome());
} }
CmdHome.this.me.teleport(CmdHome.this.myFaction.getHome());
}, this.p.getConfig().getLong("warmups.f-home", 0)); }, this.p.getConfig().getLong("warmups.f-home", 0));
} }

View File

@ -52,43 +52,32 @@ public class CmdList extends FCommand {
// remove exempt factions // remove exempt factions
if (fme != null && fme.getPlayer() != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt")) { if (fme != null && fme.getPlayer() != null && !fme.getPlayer().hasPermission("factions.show.bypassexempt")) {
List<String> exemptFactions = SavageFactions.plugin.getConfig().getStringList("show-exempt"); List<String> exemptFactions = SavageFactions.plugin.getConfig().getStringList("show-exempt");
Iterator<Faction> factionIterator = factionList.iterator();
while (factionIterator.hasNext()) { factionList.removeIf(next -> exemptFactions.contains(next.getTag()));
Faction next = factionIterator.next();
if (exemptFactions.contains(next.getTag()))
factionIterator.remove();
}
} }
// Sort by total followers first // Sort by total followers first
Collections.sort(factionList, new Comparator<Faction>() { Collections.sort(factionList, (f1, f2) -> {
@Override int f1Size = f1.getFPlayers().size();
public int compare(Faction f1, Faction f2) { int f2Size = f2.getFPlayers().size();
int f1Size = f1.getFPlayers().size(); if (f1Size < f2Size) {
int f2Size = f2.getFPlayers().size(); return 1;
if (f1Size < f2Size) { } else if (f1Size > f2Size) {
return 1; return -1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
} }
return 0;
}); });
// Then sort by how many members are online now // Then sort by how many members are online now
Collections.sort(factionList, new Comparator<Faction>() { Collections.sort(factionList, (f1, f2) -> {
@Override int f1Size = f1.getFPlayersWhereOnline(true).size();
public int compare(Faction f1, Faction f2) { int f2Size = f2.getFPlayersWhereOnline(true).size();
int f1Size = f1.getFPlayersWhereOnline(true).size(); if (f1Size < f2Size) {
int f2Size = f2.getFPlayersWhereOnline(true).size(); return 1;
if (f1Size < f2Size) { } else if (f1Size > f2Size) {
return 1; return -1;
} else if (f1Size > f2Size) {
return -1;
}
return 0;
} }
return 0;
}); });
ArrayList<String> lines = new ArrayList<>(); ArrayList<String> lines = new ArrayList<>();

View File

@ -30,7 +30,6 @@ public class CmdReload extends FCommand {
SavageFactions.plugin.reloadConfig(); SavageFactions.plugin.reloadConfig();
SavageFactions.plugin.changeItemIDSInConfig(); SavageFactions.plugin.changeItemIDSInConfig();
SavageFactions.plugin.loadLang(); SavageFactions.plugin.loadLang();
int version = Integer.parseInt(ReflectionUtils.PackageType.getServerVersion().split("_")[1]);
if (SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight")) { if (SavageFactions.plugin.getConfig().getBoolean("enable-faction-flight")) {

View File

@ -17,9 +17,8 @@ public class CmdSeeChunk extends FCommand {
//Used a hashmap cuz imma make a particle selection gui later, will store it where the boolean is rn. //Used a hashmap cuz imma make a particle selection gui later, will store it where the boolean is rn.
public static HashMap<String, Boolean> seeChunkMap = new HashMap<>(); public static HashMap<String, Boolean> seeChunkMap = new HashMap<>();
Long interval = 10L; Long interval;
private boolean useParticles; private boolean useParticles;
private int length;
private ParticleEffect effect; private ParticleEffect effect;
private int taskID = -1; private int taskID = -1;
@ -72,18 +71,15 @@ public class CmdSeeChunk extends FCommand {
} }
private void startTask() { private void startTask() {
taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() { taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> {
@Override Iterator<String> itr = seeChunkMap.keySet().iterator();
public void run() { while (itr.hasNext()) {
Iterator<String> itr = seeChunkMap.keySet().iterator(); Object nameObject = itr.next();
while (itr.hasNext()) { String name = nameObject + "";
Object nameObject = itr.next(); Player player = Bukkit.getPlayer(name);
String name = nameObject + ""; showBorders(player);
Player player = Bukkit.getPlayer(name);
showBorders(player);
}
manageTask();
} }
manageTask();
}, 0, interval); }, 0, interval);
} }

View File

@ -39,7 +39,6 @@ public class CmdShowClaims extends FCommand {
chunks.setLength(0); chunks.setLength(0);
} }
} }
sendMessage(""); sendMessage("");
} }

View File

@ -99,7 +99,7 @@ public class CmdTnt extends FCommand {
return; return;
} }
if (fme.getFaction().getTnt() < amount) { if (fme.getFaction().getTnt() < amount) {
fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH.toString()); fme.msg(TL.COMMAND_TNT_WIDTHDRAW_NOTENOUGH);
return; return;
} }
int fullStacks = amount / 64; int fullStacks = amount / 64;

View File

@ -30,16 +30,9 @@ public class CmdTpBanner extends FCommand {
return; return;
} }
final FactionsPlayerListener fpl = new FactionsPlayerListener();
if (FactionsBlockListener.bannerLocations.containsKey(fme.getTag())) { if (FactionsBlockListener.bannerLocations.containsKey(fme.getTag())) {
fme.msg(TL.COMMAND_TPBANNER_SUCCESS); fme.msg(TL.COMMAND_TPBANNER_SUCCESS);
this.doWarmUp(WarmUpUtil.Warmup.BANNER, TL.WARMUPS_NOTIFY_TELEPORT, "Banner", new Runnable() { this.doWarmUp(WarmUpUtil.Warmup.BANNER, TL.WARMUPS_NOTIFY_TELEPORT, "Banner", () -> me.teleport(FactionsBlockListener.bannerLocations.get(fme.getTag())), this.p.getConfig().getLong("warmups.f-banner", 0));
@Override
public void run() {
me.teleport(FactionsBlockListener.bannerLocations.get(fme.getTag()));
}
}, this.p.getConfig().getLong("warmups.f-banner", 0));
} else { } else {
fme.msg(TL.COMMAND_TPBANNER_NOTSET); fme.msg(TL.COMMAND_TPBANNER_NOTSET);
} }

View File

@ -113,27 +113,24 @@ public class EngineDynmap {
} }
// Shedule non thread safe sync at the end! // Shedule non thread safe sync at the end!
Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> {
@Override
public void run() {
final Map<String, TempMarker> homes = createHomes(); final Map<String, TempMarker> homes = createHomes();
final Map<String, TempAreaMarker> areas = createAreas(); final Map<String, TempAreaMarker> areas = createAreas();
final Map<String, Set<String>> playerSets = createPlayersets(); final Map<String, Set<String>> playerSets = createPlayersets();
if (!updateCore()) { if (!updateCore()) {
return; return;
}
// createLayer() is thread safe but it makes use of fields set in updateCore() so we must have it after.
if (!updateLayer(createLayer())) {
return;
}
updateHomes(homes);
updateAreas(areas);
updatePlayersets(playerSets);
} }
// createLayer() is thread safe but it makes use of fields set in updateCore() so we must have it after.
if (!updateLayer(createLayer())) {
return;
}
updateHomes(homes);
updateAreas(areas);
updatePlayersets(playerSets);
}, 100L, 100L); }, 100L, 100L);
} }

View File

@ -332,12 +332,7 @@ public class FactionsBlockListener implements Listener {
as.setCustomNameVisible(true); //This makes the text appear no matter if your looking at the entity or not as.setCustomNameVisible(true); //This makes the text appear no matter if your looking at the entity or not
final ArmorStand armorStand = as; final ArmorStand armorStand = as;
final String tag = fme.getTag(); final String tag = fme.getTag();
Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, () -> bannerCooldownMap.remove(tag), Long.parseLong(bannerCooldown + ""));
@Override
public void run() {
bannerCooldownMap.remove(tag);
}
}, Long.parseLong(bannerCooldown + ""));
final Block banner = e.getBlockPlaced(); final Block banner = e.getBlockPlaced();
final Material bannerType = banner.getType(); final Material bannerType = banner.getType();
final Faction bannerFaction = fme.getFaction(); final Faction bannerFaction = fme.getFaction();
@ -345,39 +340,33 @@ public class FactionsBlockListener implements Listener {
// e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ENTITY_LIGHTNING_IMPACT,2.0F,0.5F); // e.getPlayer().getWorld().playSound(e.getPlayer().getLocation(), Sound.ENTITY_LIGHTNING_IMPACT,2.0F,0.5F);
final int radius = SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Effect-Radius"); final int radius = SavageFactions.plugin.getConfig().getInt("fbanners.Banner-Effect-Radius");
final List<String> effects = SavageFactions.plugin.getConfig().getStringList("fbanners.Effects"); final List<String> effects = SavageFactions.plugin.getConfig().getStringList("fbanners.Effects");
final int affectorTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, new Runnable() { final int affectorTask = Bukkit.getScheduler().scheduleSyncRepeatingTask(SavageFactions.plugin, () -> {
@Override
public void run() {
for (Entity e : banner.getLocation().getWorld().getNearbyEntities(banner.getLocation(), radius, 255, radius)) { for (Entity e1 : banner.getLocation().getWorld().getNearbyEntities(banner.getLocation(), radius, 255, radius)) {
if (e instanceof Player) { if (e1 instanceof Player) {
Player player = (Player) e; Player player = (Player) e1;
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player); FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
if (fplayer.getFaction() == bannerFaction) { if (fplayer.getFaction() == bannerFaction) {
for (String effect : effects) { for (String effect : effects) {
String[] components = effect.split(":"); String[] components = effect.split(":");
player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(components[0]), 100, Integer.parseInt(components[1]))); player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(components[0]), 100, Integer.parseInt(components[1])));
} }
ParticleEffect.LAVA.display(1, 1, 1, 1, 10, banner.getLocation(), 16); ParticleEffect.LAVA.display(1, 1, 1, 1, 10, banner.getLocation(), 16);
ParticleEffect.FLAME.display(1, 1, 1, 1, 10, banner.getLocation(), 16); ParticleEffect.FLAME.display(1, 1, 1, 1, 10, banner.getLocation(), 16);
if (banner.getType() != bannerType) { if (banner.getType() != bannerType) {
banner.setType(bannerType); banner.setType(bannerType);
}
} }
} }
} }
} }
}, 0L, 20L); }, 0L, 20L);
Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, () -> {
@Override banner.setType(Material.AIR);
public void run() { as.remove();
banner.setType(Material.AIR); banner.getWorld().strikeLightningEffect(banner.getLocation());
as.remove(); Bukkit.getScheduler().cancelTask(affectorTask);
banner.getWorld().strikeLightningEffect(banner.getLocation()); bannerLocations.remove(bannerFaction.getTag());
Bukkit.getScheduler().cancelTask(affectorTask);
bannerLocations.remove(bannerFaction.getTag());
}
}, Long.parseLong(bannerTime + "")); }, Long.parseLong(bannerTime + ""));
} else { } else {
fme.msg(TL.WARBANNER_INVALIDLOC); fme.msg(TL.WARBANNER_INVALIDLOC);

View File

@ -196,14 +196,11 @@ public class FactionsChatListener implements Listener {
} }
private void doWarmup(final String warp, final FPlayer fme) { private void doWarmup(final String warp, final FPlayer fme) {
WarmUpUtil.process(fme, WarmUpUtil.Warmup.WARP, TL.WARMUPS_NOTIFY_TELEPORT, warp, new Runnable() { WarmUpUtil.process(fme, WarmUpUtil.Warmup.WARP, TL.WARMUPS_NOTIFY_TELEPORT, warp, () -> {
@Override Player player = Bukkit.getPlayer(fme.getPlayer().getUniqueId());
public void run() { if (player != null) {
Player player = Bukkit.getPlayer(fme.getPlayer().getUniqueId()); player.teleport(fme.getFaction().getWarp(warp).getLocation());
if (player != null) { fme.msg(TL.COMMAND_FWARP_WARPED, warp);
player.teleport(fme.getFaction().getWarp(warp).getLocation());
fme.msg(TL.COMMAND_FWARP_WARPED, warp);
}
} }
}, SavageFactions.plugin.getConfig().getLong("warmups.f-warp", 0)); }, SavageFactions.plugin.getConfig().getLong("warmups.f-warp", 0));
} }

View File

@ -296,12 +296,9 @@ public class FactionsPlayerListener implements Listener {
me.login(); // set kills / deaths me.login(); // set kills / deaths
// Check for Faction announcements. Let's delay this so they actually see it. // Check for Faction announcements. Let's delay this so they actually see it.
Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() { Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, () -> {
@Override if (me.isOnline()) {
public void run() { me.getFaction().sendUnreadAnnouncements(me);
if (me.isOnline()) {
me.getFaction().sendUnreadAnnouncements(me);
}
} }
}, 33L); // Don't ask me why. }, 33L); // Don't ask me why.
@ -322,13 +319,7 @@ public class FactionsPlayerListener implements Listener {
fallMap.put(me.getPlayer(), false); fallMap.put(me.getPlayer(), false);
Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, new Runnable() { Bukkit.getScheduler().scheduleSyncDelayedTask(SavageFactions.plugin, () -> fallMap.remove(me.getPlayer()), 180L);
@Override
public void run() {
fallMap.remove(me.getPlayer());
}
}, 180L);
if (me.isSpyingChat() && !player.hasPermission(Permission.CHATSPY.node)) { if (me.isSpyingChat() && !player.hasPermission(Permission.CHATSPY.node)) {

View File

@ -45,12 +45,9 @@ public class FTeamWrapper {
if (updating.add(faction)) { if (updating.add(faction)) {
Bukkit.getScheduler().runTask(SavageFactions.plugin, new Runnable() { Bukkit.getScheduler().runTask(SavageFactions.plugin, () -> {
@Override updating.remove(faction);
public void run() { applyUpdates(faction);
updating.remove(faction);
applyUpdates(faction);
}
}); });
} }
} }

View File

@ -21,12 +21,9 @@ public class WarmUpUtil {
player.msg(TL.WARMUPS_ALREADY); player.msg(TL.WARMUPS_ALREADY);
} else { } else {
player.msg(translationKey.format(action, delay)); player.msg(translationKey.format(action, delay));
int id = SavageFactions.plugin.getServer().getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() { int id = SavageFactions.plugin.getServer().getScheduler().runTaskLater(SavageFactions.plugin, () -> {
@Override player.stopWarmup();
public void run() { runnable.run();
player.stopWarmup();
runnable.run();
}
}, delay * 20).getTaskId(); }, delay * 20).getTaskId();
player.addWarmup(warmup, id); player.addWarmup(warmup, id);
} }

View File

@ -102,13 +102,10 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
} else { } else {
fme.setEnteringPassword(true, warp); fme.setEnteringPassword(true, warp);
fme.msg(TL.COMMAND_FWARP_PASSWORD_REQUIRED); fme.msg(TL.COMMAND_FWARP_PASSWORD_REQUIRED);
Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() { Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, () -> {
@Override if (fme.isEnteringPassword()) {
public void run() { fme.msg(TL.COMMAND_FWARP_PASSWORD_TIMEOUT);
if (fme.isEnteringPassword()) { fme.setEnteringPassword(false, "");
fme.msg(TL.COMMAND_FWARP_PASSWORD_TIMEOUT);
fme.setEnteringPassword(false, "");
}
} }
}, SavageFactions.plugin.getConfig().getInt("fwarp-gui.password-timeout", 5) * 20); }, SavageFactions.plugin.getConfig().getInt("fwarp-gui.password-timeout", 5) * 20);
} }
@ -116,14 +113,11 @@ public class WarpGUI implements InventoryHolder, FactionGUI {
} }
private void doWarmup(final String warp) { private void doWarmup(final String warp) {
WarmUpUtil.process(fme, WarmUpUtil.Warmup.WARP, TL.WARMUPS_NOTIFY_TELEPORT, warp, new Runnable() { WarmUpUtil.process(fme, WarmUpUtil.Warmup.WARP, TL.WARMUPS_NOTIFY_TELEPORT, warp, () -> {
@Override Player player = Bukkit.getPlayer(fme.getPlayer().getUniqueId());
public void run() { if (player != null) {
Player player = Bukkit.getPlayer(fme.getPlayer().getUniqueId()); player.teleport(fme.getFaction().getWarp(warp).getLocation());
if (player != null) { fme.msg(TL.COMMAND_FWARP_WARPED, warp);
player.teleport(fme.getFaction().getWarp(warp).getLocation());
fme.msg(TL.COMMAND_FWARP_WARPED, warp);
}
} }
}, SavageFactions.plugin.getConfig().getLong("warmups.f-warp", 0)); }, SavageFactions.plugin.getConfig().getLong("warmups.f-warp", 0));
} }

View File

@ -278,12 +278,7 @@ public abstract class MPlugin extends JavaPlugin {
} }
if (async) { if (async) {
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() { Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(this, () -> command.execute(sender, args));
@Override
public void run() {
command.execute(sender, args);
}
});
} else { } else {
command.execute(sender, args); command.execute(sender, args);
} }

View File

@ -873,12 +873,7 @@ public abstract class MemoryFPlayer implements FPlayer {
// Short task so we're just doing it in method. Not clean but eh. // Short task so we're just doing it in method. Not clean but eh.
if (cooldown > 0) { if (cooldown > 0) {
setTakeFallDamage(false); setTakeFallDamage(false);
Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, new Runnable() { Bukkit.getScheduler().runTaskLater(SavageFactions.plugin, () -> setTakeFallDamage(true), 20L * cooldown);
@Override
public void run() {
setTakeFallDamage(true);
}
}, 20L * cooldown);
} }
} }

View File

@ -80,17 +80,14 @@ public class DiscUtil {
lock.unlock(); lock.unlock();
} }
} else { } else {
Bukkit.getScheduler().runTaskAsynchronously(SavageFactions.plugin, new Runnable() { Bukkit.getScheduler().runTaskAsynchronously(SavageFactions.plugin, () -> {
@Override lock.lock();
public void run() { try {
lock.lock(); write(file, content);
try { } catch (IOException e) {
write(file, content); e.printStackTrace();
} catch (IOException e) { } finally {
e.printStackTrace(); lock.unlock();
} finally {
lock.unlock();
}
} }
}); });
} }