Update to Spigot 1.9-R1

This commit is contained in:
JeromSar 2016-03-01 17:59:44 +01:00
parent e93ac11172
commit 19ced05110
2 changed files with 20 additions and 13 deletions

View File

@ -67,7 +67,7 @@
<artifactId>spigot</artifactId> <artifactId>spigot</artifactId>
<version>1.8.7-R0.1-SNAPSHOT</version> <version>1.8.7-R0.1-SNAPSHOT</version>
<scope>system</scope> <scope>system</scope>
<systemPath>${project.basedir}/lib/Spigot-1.8.7.jar</systemPath> <systemPath>${project.basedir}/lib/Spigot-1.9.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -3,14 +3,16 @@ package me.totalfreedom.totalfreedommod;
import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FLog;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_8_R3.EntityPlayer; import net.minecraft.server.v1_9_R1.EntityPlayer;
import net.minecraft.server.v1_8_R3.MinecraftServer; import net.minecraft.server.v1_9_R1.MinecraftServer;
import net.minecraft.server.v1_8_R3.PropertyManager; import net.minecraft.server.v1_9_R1.PropertyManager;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
public class ServerInterface extends FreedomService public class ServerInterface extends FreedomService
{ {
public static final String COMPILE_NMS_VERSION = "v1_8_R3"; public static final String COMPILE_NMS_VERSION = "v1_9_R1";
public ServerInterface(TotalFreedomMod plugin) public ServerInterface(TotalFreedomMod plugin)
{ {
@ -29,23 +31,23 @@ public class ServerInterface extends FreedomService
public void setOnlineMode(boolean mode) public void setOnlineMode(boolean mode)
{ {
final PropertyManager manager = MinecraftServer.getServer().getPropertyManager(); final PropertyManager manager = getServer().getPropertyManager();
manager.setProperty("online-mode", mode); manager.setProperty("online-mode", mode);
manager.savePropertiesFile(); manager.savePropertiesFile();
} }
public int purgeWhitelist() public int purgeWhitelist()
{ {
String[] whitelisted = MinecraftServer.getServer().getPlayerList().getWhitelisted(); String[] whitelisted = getServer().getPlayerList().getWhitelisted();
int size = whitelisted.length; int size = whitelisted.length;
for (EntityPlayer player : MinecraftServer.getServer().getPlayerList().players) for (EntityPlayer player : getServer().getPlayerList().players)
{ {
MinecraftServer.getServer().getPlayerList().getWhitelist().remove(player.getProfile()); getServer().getPlayerList().getWhitelist().remove(player.getProfile());
} }
try try
{ {
MinecraftServer.getServer().getPlayerList().getWhitelist().save(); getServer().getPlayerList().getWhitelist().save();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -57,17 +59,22 @@ public class ServerInterface extends FreedomService
public boolean isWhitelisted() public boolean isWhitelisted()
{ {
return MinecraftServer.getServer().getPlayerList().getHasWhitelist(); return getServer().getPlayerList().getHasWhitelist();
} }
public List<?> getWhitelisted() public List<?> getWhitelisted()
{ {
return Arrays.asList(MinecraftServer.getServer().getPlayerList().getWhitelisted()); return Arrays.asList(getServer().getPlayerList().getWhitelisted());
} }
public String getVersion() public String getVersion()
{ {
return MinecraftServer.getServer().getVersion(); return getServer().getVersion();
}
private MinecraftServer getServer()
{
return ((CraftServer) Bukkit.getServer()).getServer();
} }
} }