actually fix update checker not scheduled yet error on fast shutdowns
This commit is contained in:
		
							parent
							
								
									3bfea0a004
								
							
						
					
					
						commit
						c560fe597e
					
				
					 2 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
					@ -148,8 +148,10 @@ public class ZNpcsPlus {
 | 
				
			||||||
        log(ChatColor.WHITE + " * Starting tasks...");
 | 
					        log(ChatColor.WHITE + " * Starting tasks...");
 | 
				
			||||||
        if (configManager.getConfig().checkForUpdates()) {
 | 
					        if (configManager.getConfig().checkForUpdates()) {
 | 
				
			||||||
            UpdateChecker updateChecker = new UpdateChecker(getDescription());
 | 
					            UpdateChecker updateChecker = new UpdateChecker(getDescription());
 | 
				
			||||||
            scheduler.runDelayedTimerAsync(updateChecker, 5L, 6000L);
 | 
					            scheduler.runLaterAsync(() -> {
 | 
				
			||||||
            shutdownTasks.add(updateChecker::shutdown);
 | 
					                scheduler.runDelayedTimerAsync(updateChecker, 0L, 6000L);
 | 
				
			||||||
 | 
					                shutdownTasks.add(updateChecker::shutdown);
 | 
				
			||||||
 | 
					            }, 5L);
 | 
				
			||||||
            pluginManager.registerEvents(new UpdateNotificationListener(this, adventure, updateChecker, scheduler), bootstrap);
 | 
					            pluginManager.registerEvents(new UpdateNotificationListener(this, adventure, updateChecker, scheduler), bootstrap);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,7 @@ public class UpdateChecker extends BukkitRunnable {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void shutdown() {
 | 
					    public void shutdown() {
 | 
				
			||||||
        if (getTaskId() != -1) cancel();
 | 
					        cancel();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private int versionToNumber(String version) {
 | 
					    private int versionToNumber(String version) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue