1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-02 14:29:07 +01:00

More work

This commit is contained in:
montlikadani 2021-03-29 15:28:15 +02:00
parent 5337e2c36d
commit add9bbf34f
4 changed files with 14 additions and 20 deletions

View File

@ -162,15 +162,15 @@ public class SignUtil {
public void updateAllSign(Job job) {
for (SignTopType types : SignTopType.values()) {
if (types != SignTopType.questtoplist)
SignUpdate(job, types);
signUpdate(job, types);
}
}
public boolean SignUpdate(Job job) {
return SignUpdate(job, SignTopType.toplist);
public boolean signUpdate(Job job) {
return signUpdate(job, SignTopType.toplist);
}
public boolean SignUpdate(Job job, SignTopType type) {
public boolean signUpdate(Job job, SignTopType type) {
if (!Jobs.getGCManager().SignsEnabled)
return true;

View File

@ -20,7 +20,7 @@ public class signupdate implements Cmd {
}
if (args[0].equalsIgnoreCase("all")) {
Jobs.getJobs().forEach(Jobs.getSignUtil()::SignUpdate);
Jobs.getJobs().forEach(Jobs.getSignUtil()::signUpdate);
return true;
}
@ -33,14 +33,13 @@ public class signupdate implements Cmd {
if (args.length == 2) {
SignTopType type = SignTopType.getType(args[1]);
if (type != null) {
Jobs.getSignUtil().SignUpdate(oldjob, type);
Jobs.getSignUtil().signUpdate(oldjob, type);
}
return true;
}
Jobs.getSignUtil().SignUpdate(oldjob);
Jobs.getSignUtil().signUpdate(oldjob);
return true;
}
}

View File

@ -1257,12 +1257,9 @@ public class JobsPlayer {
this.setSaved(false);
if (questSignUpdateShed == null) {
questSignUpdateShed = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
@Override
public void run() {
Jobs.getSignUtil().SignUpdate(job, SignTopType.questtoplist);
questSignUpdateShed = null;
}
questSignUpdateShed = Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
Jobs.getSignUtil().signUpdate(job, SignTopType.questtoplist);
questSignUpdateShed = null;
}, Jobs.getGCManager().getSavePeriod() * 60 * 20L);
}
}

View File

@ -303,7 +303,7 @@ public class JobsListener implements Listener {
event.setCancelled(true);
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> signUtil.SignUpdate(job, type), 1L);
plugin.getServer().getScheduler().runTaskLater(plugin, () -> signUtil.signUpdate(job, type), 1L);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
@ -358,7 +358,7 @@ public class JobsListener implements Listener {
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onCropGrown(final BlockGrowEvent event) {
if (Jobs.getGCManager().canPerformActionInWorld(event.getBlock().getWorld())) {
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> Jobs.getBpManager().remove(event.getBlock()), 1L);
plugin.getServer().getScheduler().runTaskLater(plugin, () -> Jobs.getBpManager().remove(event.getBlock()), 1L);
}
}
@ -448,10 +448,8 @@ public class JobsListener implements Listener {
Chunk from = event.getFrom().getChunk();
Chunk to = event.getTo().getChunk();
if (from == to)
return;
plugin.getServer().getPluginManager().callEvent(new JobsChunkChangeEvent(event.getPlayer(), from, to));
if (from != to)
plugin.getServer().getPluginManager().callEvent(new JobsChunkChangeEvent(event.getPlayer(), from, to));
}
@EventHandler