mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 21:19:00 +01:00
Fixed NPE when running a custom build of CraftBukkit. This fixes issue #BUKKIT-765
This commit is contained in:
parent
d057ee1e07
commit
3b634b14f6
@ -1024,7 +1024,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
public void onPlayerJoin(Player player) {
|
||||
if ((updater.isEnabled()) && (player.hasPermission(Server.BROADCAST_CHANNEL_ADMINISTRATIVE))) {
|
||||
if ((updater.isEnabled()) && (updater.getCurrent() != null) && (player.hasPermission(Server.BROADCAST_CHANNEL_ADMINISTRATIVE))) {
|
||||
if ((updater.getCurrent().isBroken()) && (updater.getOnBroken().contains(updater.WARN_OPERATORS))) {
|
||||
player.sendMessage(ChatColor.DARK_RED + "The version of CraftBukkit that this server is running is known to be broken. Please consider updating to the latest version at dl.bukkit.org.");
|
||||
} else if ((updater.isUpdateAvailable()) && (updater.getOnUpdate().contains(updater.WARN_OPERATORS))) {
|
||||
|
@ -65,8 +65,8 @@ public class AutoUpdater {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
current = service.getArtifact(currentSlug);
|
||||
latest = service.getArtifact("latest-" + channel);
|
||||
current = service.getArtifact(currentSlug, "current artifact information; perhaps you are running a custom version?");
|
||||
latest = service.getArtifact("latest-" + channel, "latest artifact information");
|
||||
|
||||
if (isUpdateAvailable()) {
|
||||
if ((current.isBroken()) && (onBroken.contains(WARN_CONSOLE))) {
|
||||
|
@ -1,15 +1,11 @@
|
||||
package org.bukkit.craftbukkit.updater;
|
||||
|
||||
import com.google.gson.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
@ -25,13 +21,13 @@ public class BukkitDLUpdaterService {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public ArtifactDetails getArtifact(String slug) {
|
||||
public ArtifactDetails getArtifact(String slug, String name) {
|
||||
try {
|
||||
return fetchArtifact(slug);
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
Logger.getLogger(BukkitDLUpdaterService.class.getName()).log(Level.WARNING, "Could not get Artifact details for the auto-updater: " + ex.getClass().getSimpleName());
|
||||
Logger.getLogger(BukkitDLUpdaterService.class.getName()).log(Level.WARNING, "Could not get " + name + ": " + ex.getClass().getSimpleName());
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(BukkitDLUpdaterService.class.getName()).log(Level.WARNING, "Could not get Artifact details for the auto-updater: " + ex.getClass().getSimpleName());
|
||||
Logger.getLogger(BukkitDLUpdaterService.class.getName()).log(Level.WARNING, "Could not get " + name + ": " + ex.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Loading…
Reference in New Issue
Block a user