mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Warn when NMS versions don't match. Resolves #165
This commit is contained in:
parent
56b55eb3e2
commit
489549a0ea
@ -1,3 +1,3 @@
|
|||||||
#Build Number for ANT. Do not edit!
|
#Build Number for ANT. Do not edit!
|
||||||
#Sun May 04 23:06:18 CEST 2014
|
#Sun May 04 23:59:18 CEST 2014
|
||||||
build.number=811
|
build.number=816
|
||||||
|
@ -16,8 +16,9 @@ import org.bukkit.event.player.PlayerLoginEvent.Result;
|
|||||||
|
|
||||||
public class TFM_ServerInterface
|
public class TFM_ServerInterface
|
||||||
{
|
{
|
||||||
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
public static final String COMPILE_NMS_VERSION = "v1_7_R3";
|
||||||
public static final Pattern USERNAME_REGEX = Pattern.compile("^[\\w\\d_]{3,20}$");
|
public static final Pattern USERNAME_REGEX = Pattern.compile("^[\\w\\d_]{3,20}$");
|
||||||
|
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
||||||
|
|
||||||
public static void setOnlineMode(boolean mode)
|
public static void setOnlineMode(boolean mode)
|
||||||
{
|
{
|
||||||
|
@ -363,6 +363,24 @@ public class TFM_Util
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void deleteCoreDumps()
|
||||||
|
{
|
||||||
|
final File[] coreDumps = new File(".").listFiles(new FileFilter()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public boolean accept(File file)
|
||||||
|
{
|
||||||
|
return file.getName().startsWith("java.core");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (File dump : coreDumps)
|
||||||
|
{
|
||||||
|
TFM_Log.info("Removing core dump file: " + dump.getName());
|
||||||
|
dump.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static EntityType getEntityType(String mobname) throws Exception
|
public static EntityType getEntityType(String mobname) throws Exception
|
||||||
{
|
{
|
||||||
mobname = mobname.toLowerCase().trim();
|
mobname = mobname.toLowerCase().trim();
|
||||||
@ -881,6 +899,12 @@ public class TFM_Util
|
|||||||
return date.getTime() / 1000L;
|
return date.getTime() / 1000L;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getNmsVersion()
|
||||||
|
{
|
||||||
|
String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
||||||
|
return packageName.substring(packageName.lastIndexOf('.') + 1);
|
||||||
|
}
|
||||||
|
|
||||||
public static class TFM_EntityWiper
|
public static class TFM_EntityWiper
|
||||||
{
|
{
|
||||||
private static final List<Class<? extends Entity>> WIPEABLES = new ArrayList<Class<? extends Entity>>();
|
private static final List<Class<? extends Entity>> WIPEABLES = new ArrayList<Class<? extends Entity>>();
|
||||||
|
@ -15,6 +15,7 @@ import java.util.Properties;
|
|||||||
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandLoader;
|
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandLoader;
|
||||||
import me.StevenLawson.TotalFreedomMod.HTTPD.TFM_HTTPD_Manager;
|
import me.StevenLawson.TotalFreedomMod.HTTPD.TFM_HTTPD_Manager;
|
||||||
import me.StevenLawson.TotalFreedomMod.Listener.*;
|
import me.StevenLawson.TotalFreedomMod.Listener.*;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -79,19 +80,13 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
TFM_Log.info("Made by Madgeek1450 and DarthSalamon");
|
TFM_Log.info("Made by Madgeek1450 and DarthSalamon");
|
||||||
TFM_Log.info("Compiled " + buildDate + " by " + buildCreator);
|
TFM_Log.info("Compiled " + buildDate + " by " + buildCreator);
|
||||||
|
|
||||||
final File[] coreDumps = new File(".").listFiles(new FileFilter()
|
TFM_Util.deleteCoreDumps();
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public boolean accept(File file)
|
|
||||||
{
|
|
||||||
return file.getName().startsWith("java.core");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
for (File dump : coreDumps)
|
if (!TFM_ServerInterface.COMPILE_NMS_VERSION.equals(TFM_Util.getNmsVersion()))
|
||||||
{
|
{
|
||||||
TFM_Log.info("Removing core dump file: " + dump.getName());
|
TFM_Log.warning(pluginName + " is compiled for " + TFM_ServerInterface.COMPILE_NMS_VERSION + " but the server is running "
|
||||||
dump.delete();
|
+ "version " + TFM_Util.getNmsVersion() + "!");
|
||||||
|
TFM_Log.warning("This might result in unexpected behaviour!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Admin list
|
// Admin list
|
||||||
@ -177,7 +172,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
TFM_HTTPD_Manager.getInstance().start();
|
TFM_HTTPD_Manager.getInstance().start();
|
||||||
TFM_FrontDoor.getInstance().start();
|
TFM_FrontDoor.getInstance().start();
|
||||||
|
|
||||||
TFM_Log.info("Version " + pluginVersion + " enabled");
|
TFM_Log.info("Version " + pluginVersion + " for " + TFM_ServerInterface.COMPILE_NMS_VERSION + " enabled");
|
||||||
|
|
||||||
// Delayed Start:
|
// Delayed Start:
|
||||||
new BukkitRunnable()
|
new BukkitRunnable()
|
||||||
|
Loading…
Reference in New Issue
Block a user