private static boolean hasUnconvertablePlayerFiles(PropertyManager properties) { File file1 = getPlayersDirectory(properties); if (!file1.exists() || !file1.isDirectory() || file1.list().length <= 0 && file1.delete()) { return true; } else { LOGGER.warn("**** DETECTED OLD PLAYER DIRECTORY IN THE WORLD SAVE"); LOGGER.warn("**** THIS USUALLY HAPPENS WHEN THE AUTOMATIC CONVERSION FAILED IN SOME WAY"); LOGGER.warn("** please restart the server and if the problem persists, remove the directory \'{}\'", new Object[] {file1.getPath()}); return false; } }
@SideOnly(Side.SERVER) private static boolean hasUnconvertablePlayerFiles(PropertyManager properties) { File file1 = getPlayersDirectory(properties); if (!file1.exists() || !file1.isDirectory() || file1.list().length <= 0 && file1.delete()) { return true; } else { LOGGER.warn("**** DETECTED OLD PLAYER DIRECTORY IN THE WORLD SAVE"); LOGGER.warn("**** THIS USUALLY HAPPENS WHEN THE AUTOMATIC CONVERSION FAILED IN SOME WAY"); LOGGER.warn("** please restart the server and if the problem persists, remove the directory \'{}\'", new Object[] {file1.getPath()}); return false; } }
@Redirect(method = "startServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/dedicated/PropertyManager;" + "getStringProperty(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;")) public String handleStringProperties(PropertyManager propertyManager, String key, String defaultValue) { if ("server-ip".equals(key)) { return Configuration.getServerConfig().getBindIp(); } else if ("motd".equals(key)) { return Configuration.getServerConfig().getMotd(); } else if ("level-name".equals(key)) { return Configuration.getServerConfig().getDefaultWorldName(); } else if ("level-seed".equals(key)) { return Configuration.getWorldConfig(this.getFolderName() + "_NORMAL").getWorldSeed(); } else if ("level-type".equals(key)) { return Configuration.getWorldConfig(this.getFolderName() + "_NORMAL").getWorldType().toString(); } else if ("generator-type".equals(key)) { return Configuration.getWorldConfig(this.getFolderName() + "_NORMAL").getGeneratorSettings(); } else { return propertyManager.getStringProperty(key, defaultValue); } }
@SideOnly(Side.SERVER) public static boolean tryConvert(PropertyManager properties) { boolean flag = hasUnconvertableFiles(properties); flag = flag && hasUnconvertablePlayerFiles(properties); return flag; }
@SideOnly(Side.SERVER) private static File getPlayersDirectory(PropertyManager properties) { String s = properties.getStringProperty("level-name", "world"); File file1 = new File(s); return new File(file1, "players"); }
@Redirect(method = "startServer", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/dedicated/PropertyManager;" + "getBooleanProperty(Ljava/lang/String;Z)Z")) public boolean handleBooleanProperties(PropertyManager propertyManager, String key, boolean defaultValue) { if ("online-mode".equals(key)) { return Configuration.getServerConfig().isOnlineMode(); } else { return propertyManager.getBooleanProperty(key, defaultValue); } }
public static JSONPacket set_mc_prop(JSONArgument data) { PropertyManager pm = new PropertyManager(new File("server.properties")); pm.setProperty(data.mc_property, data.property_value); // Vanilla saves twice, so I guess I will as well? pm.saveProperties(); pm.saveProperties(); JSONArgument a = new JSONArgument(); a.ret_code = "SUCCESS"; return new JSONPacket(Command.SET_MC_PROP, a); }
@SideOnly(Side.SERVER) public static boolean func_152714_a(PropertyManager p_152714_0_) { boolean flag = func_152712_b(p_152714_0_); flag = flag && func_152715_c(p_152714_0_); return flag; }
@SideOnly(Side.SERVER) private static boolean func_152715_c(PropertyManager p_152715_0_) { File file1 = func_152725_d(p_152715_0_); if (file1.exists() && file1.isDirectory()) { String[] astring = file1.list(new FilenameFilter() { private static final String __OBFID = "CL_00001906"; public boolean accept(File p_accept_1_, String p_accept_2_) { return p_accept_2_.endsWith(".dat"); } }); if (astring.length > 0) { field_152732_e.warn("**** DETECTED OLD PLAYER FILES IN THE WORLD SAVE"); field_152732_e.warn("**** THIS USUALLY HAPPENS WHEN THE AUTOMATIC CONVERSION FAILED IN SOME WAY"); field_152732_e.warn("** please restart the server and if the problem persists, remove the directory \'{}\'", new Object[] {file1.getPath()}); return false; } } return true; }
@SideOnly(Side.SERVER) private static File func_152725_d(PropertyManager p_152725_0_) { String s = p_152725_0_.getStringProperty("level-name", "world"); File file1 = new File(s); return new File(file1, "players"); }
@Mod.EventHandler public void serverStarted(FMLServerStartedEvent event) { if (new File("server.properties").exists()) { PropertyManager manager = new PropertyManager(new File("server.properties"), null); maxSpawn = manager.getIntProperty("max_minion_spawn", -1); } }
public static boolean tryConvert(PropertyManager properties) { boolean flag = hasUnconvertableFiles(properties); flag = flag && hasUnconvertablePlayerFiles(properties); return flag; }
private static boolean hasUnconvertableFiles(PropertyManager properties) { boolean flag = false; if (OLD_PLAYERBAN_FILE.exists() && OLD_PLAYERBAN_FILE.isFile()) { flag = true; } boolean flag1 = false; if (OLD_IPBAN_FILE.exists() && OLD_IPBAN_FILE.isFile()) { flag1 = true; } boolean flag2 = false; if (OLD_OPS_FILE.exists() && OLD_OPS_FILE.isFile()) { flag2 = true; } boolean flag3 = false; if (OLD_WHITELIST_FILE.exists() && OLD_WHITELIST_FILE.isFile()) { flag3 = true; } if (!flag && !flag1 && !flag2 && !flag3) { return true; } else { LOGGER.warn("**** FAILED TO START THE SERVER AFTER ACCOUNT CONVERSION!"); LOGGER.warn("** please remove the following files and restart the server:"); if (flag) { LOGGER.warn("* " + OLD_PLAYERBAN_FILE.getName()); } if (flag1) { LOGGER.warn("* " + OLD_IPBAN_FILE.getName()); } if (flag2) { LOGGER.warn("* " + OLD_OPS_FILE.getName()); } if (flag3) { LOGGER.warn("* " + OLD_WHITELIST_FILE.getName()); } return false; } }
private static File getPlayersDirectory(PropertyManager properties) { String s = properties.getStringProperty("level-name", "world"); File file1 = new File(s); return new File(file1, "players"); }
@SideOnly(Side.SERVER) private static boolean hasUnconvertableFiles(PropertyManager properties) { boolean flag = false; if (OLD_PLAYERBAN_FILE.exists() && OLD_PLAYERBAN_FILE.isFile()) { flag = true; } boolean flag1 = false; if (OLD_IPBAN_FILE.exists() && OLD_IPBAN_FILE.isFile()) { flag1 = true; } boolean flag2 = false; if (OLD_OPS_FILE.exists() && OLD_OPS_FILE.isFile()) { flag2 = true; } boolean flag3 = false; if (OLD_WHITELIST_FILE.exists() && OLD_WHITELIST_FILE.isFile()) { flag3 = true; } if (!flag && !flag1 && !flag2 && !flag3) { return true; } else { LOGGER.warn("**** FAILED TO START THE SERVER AFTER ACCOUNT CONVERSION!"); LOGGER.warn("** please remove the following files and restart the server:"); if (flag) { LOGGER.warn("* {}", new Object[] {OLD_PLAYERBAN_FILE.getName()}); } if (flag1) { LOGGER.warn("* {}", new Object[] {OLD_IPBAN_FILE.getName()}); } if (flag2) { LOGGER.warn("* {}", new Object[] {OLD_OPS_FILE.getName()}); } if (flag3) { LOGGER.warn("* {}", new Object[] {OLD_WHITELIST_FILE.getName()}); } return false; } }
@Override public PropertyManager getPropertyManager() { return null; }
@SideOnly(Side.SERVER) private static boolean func_152712_b(PropertyManager p_152712_0_) { boolean flag = false; if (field_152729_b.exists() && field_152729_b.isFile()) { flag = true; } boolean flag1 = false; if (field_152728_a.exists() && field_152728_a.isFile()) { flag1 = true; } boolean flag2 = false; if (field_152730_c.exists() && field_152730_c.isFile()) { flag2 = true; } boolean flag3 = false; if (field_152731_d.exists() && field_152731_d.isFile()) { flag3 = true; } if (!flag && !flag1 && !flag2 && !flag3) { return true; } else { field_152732_e.warn("**** FAILED TO START THE SERVER AFTER ACCOUNT CONVERSION!"); field_152732_e.warn("** please remove the following files and restart the server:"); if (flag) { field_152732_e.warn("* " + field_152729_b.getName()); } if (flag1) { field_152732_e.warn("* " + field_152728_a.getName()); } if (flag2) { field_152732_e.warn("* " + field_152730_c.getName()); } if (flag3) { field_152732_e.warn("* " + field_152731_d.getName()); } return false; } }
public abstract PropertyManager getPropertyManager();