2015-10-19 17:43:46 +00:00
|
|
|
package me.totalfreedom.totalfreedommod;
|
2012-12-09 03:42:29 +00:00
|
|
|
|
2016-03-06 15:56:15 +00:00
|
|
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
|
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
2012-12-09 03:42:29 +00:00
|
|
|
|
2016-03-01 16:47:01 +00:00
|
|
|
public class ServerInterface extends FreedomService
|
2012-12-09 03:42:29 +00:00
|
|
|
{
|
2015-11-22 18:26:47 +00:00
|
|
|
|
2017-05-22 18:05:41 +00:00
|
|
|
public static final String COMPILE_NMS_VERSION = "v1_12_R1";
|
2012-12-09 03:42:29 +00:00
|
|
|
|
2015-10-19 17:43:46 +00:00
|
|
|
public ServerInterface(TotalFreedomMod plugin)
|
|
|
|
{
|
|
|
|
super(plugin);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onStart()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onStop()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-03-06 15:56:15 +00:00
|
|
|
public static void warnVersion()
|
|
|
|
{
|
|
|
|
final String nms = FUtil.getNmsVersion();
|
|
|
|
|
|
|
|
if (!COMPILE_NMS_VERSION.equals(nms))
|
|
|
|
{
|
|
|
|
FLog.warning(TotalFreedomMod.pluginName + " is compiled for " + COMPILE_NMS_VERSION + " but the server is running version " + nms + "!");
|
|
|
|
FLog.warning("This might result in unexpected behaviour!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-26 01:07:22 +00:00
|
|
|
// public void setOnlineMode(boolean mode)
|
|
|
|
// {
|
|
|
|
// final PropertyManager manager = getServer().getPropertyManager();
|
|
|
|
// manager.setProperty("online-mode", mode);
|
|
|
|
// manager.savePropertiesFile();
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// public int purgeWhitelist()
|
|
|
|
// {
|
|
|
|
// String[] whitelisted = getServer().getPlayerList().getWhitelisted();
|
|
|
|
// int size = whitelisted.length;
|
|
|
|
// for (EntityPlayer player : getServer().getPlayerList().players)
|
|
|
|
// {
|
|
|
|
// getServer().getPlayerList().getWhitelist().remove(player.getProfile());
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// try
|
|
|
|
// {
|
|
|
|
// getServer().getPlayerList().getWhitelist().save();
|
|
|
|
// }
|
|
|
|
// catch (Exception ex)
|
|
|
|
// {
|
|
|
|
// FLog.warning("Could not purge the whitelist!");
|
|
|
|
// FLog.warning(ex);
|
|
|
|
// }
|
|
|
|
// return size;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// public boolean isWhitelisted()
|
|
|
|
// {
|
|
|
|
// return getServer().getPlayerList().getHasWhitelist();
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// public List<?> getWhitelisted()
|
|
|
|
// {
|
|
|
|
// return Arrays.asList(getServer().getPlayerList().getWhitelisted());
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// public String getVersion()
|
|
|
|
// {
|
|
|
|
// return getServer().getVersion();
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// private MinecraftServer getServer()
|
|
|
|
// {
|
|
|
|
// return ((CraftServer) Bukkit.getServer()).getServer();
|
|
|
|
// }
|
2012-12-09 03:42:29 +00:00
|
|
|
|
|
|
|
}
|