mirror of
https://github.com/plexusorg/Plex.git
synced 2025-06-29 14:56:43 +00:00
Begin work on 1.18.2
- Add update checking - World generation is broken - Won't compile unless 1.18.2 is in your local Maven repository - No longer need MiniMessage bundled in Plex - Customizable namehistory - Set comments in config.yml if they're missing
This commit is contained in:
@ -131,7 +131,7 @@ public class PlexUtils extends PlexBase
|
||||
|
||||
public static Component messageComponent(String entry, Object... objects)
|
||||
{
|
||||
return MiniMessage.miniMessage().parse(LegacyComponentSerializer.legacySection().serialize(LegacyComponentSerializer.legacyAmpersand().deserialize(messageString(entry, objects))));
|
||||
return MiniMessage.miniMessage().deserialize(LegacyComponentSerializer.legacySection().serialize(LegacyComponentSerializer.legacyAmpersand().deserialize(messageString(entry, objects))));
|
||||
}
|
||||
|
||||
public static String messageString(String entry, Object... objects)
|
||||
|
47
src/main/java/dev/plex/util/UpdateChecker.java
Normal file
47
src/main/java/dev/plex/util/UpdateChecker.java
Normal file
@ -0,0 +1,47 @@
|
||||
package dev.plex.util;
|
||||
|
||||
import dev.plex.PlexBase;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class UpdateChecker extends PlexBase
|
||||
{
|
||||
private final String currentVersion = plugin.getDescription().getVersion();
|
||||
|
||||
public boolean check()
|
||||
{
|
||||
try
|
||||
{
|
||||
String versionLink = "https://plex.us.org/updater/check/";
|
||||
URL url = new URL(versionLink);
|
||||
URLConnection con = url.openConnection();
|
||||
InputStreamReader isr = new InputStreamReader(con.getInputStream());
|
||||
BufferedReader reader = new BufferedReader(isr);
|
||||
if (!reader.ready())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
String newVersion = reader.readLine();
|
||||
reader.close();
|
||||
|
||||
if (!newVersion.equals(currentVersion))
|
||||
{
|
||||
PlexLog.log(ChatColor.RED + "There is a new version of Plex available: " + newVersion);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
PlexLog.error("There was an error checking for updates!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user