@NetworkCheckHandler public static boolean networkCheck(Map<String, String> mods, Side side) { if (mods.containsKey(MODID)) { if (COMPATIBLE_RANGE.containsVersion(new DefaultArtifactVersion(mods.get(MODID)))) { LOG.info("{} version {} compatible with version {} {}, allowing connection", MODID, VERSION, mods.get(MODID), side); return true; } LOG.info("{} version {} not compatible with version {} {}, denying connection", MODID, VERSION, mods.get(MODID), side); return false; } LOG.info("{} not found on {}, denying connection", MODID, side); return false; }
@SuppressWarnings("SameReturnValue") @NetworkCheckHandler public boolean checkIfServer(Map<String, String> serverMods, Side remoteSide) { if (remoteSide == Side.CLIENT) return true; isOnServer = false; for (String modName : serverMods.keySet()) { if (modName.equals("sprinkles_for_vanilla")) { isOnServer = true; } } if (!isOnServer && ConfigurationHandler.configLoaded) { Settings.copyClientToServer(); } return true; }
/** * Basic version checker, support having different build number on each side * @param mods the data sent from FML handshake packet * @param remoteParty the side that sent this data * @return true if we allow this to run */ @NetworkCheckHandler public boolean checkRemote(Map<String,String> mods, Side remoteParty){ if(mods.containsKey(MODID)){ String remoteVersion = mods.get(MODID); if(remoteVersion!=null) { String internalVersion = FMLCommonHandler.instance().findContainerFor(this).getVersion(); if(remoteVersion.equals(internalVersion)) return true; else{ internalVersion = internalVersion.substring(0, internalVersion.lastIndexOf(".")); remoteVersion = remoteVersion.substring(0, remoteVersion.lastIndexOf(".")); return remoteVersion.equals(internalVersion); } } } return false; }
@NetworkCheckHandler public boolean checkModLists(@Nonnull final Map<String, String> modList, @Nonnull final Side side) { if (side == Side.SERVER) { installedOnServer = modList.containsKey(DSurround.MOD_ID); } return true; }
@SuppressWarnings("unused") @NetworkCheckHandler public boolean networkCheck(Map<String, String> mods, Side side) { // Ignore if the request is on the server if (side.isClient()) return true; boolean hasCore = false; for (String mod : mods.keySet()) if (mod.equals("multihotbarcore")) hasCore = true; HotbarLogic.setHasCoreMod(hasCore); HotbarLogic.setSentPlayerMessage(false); return true; }
@NetworkCheckHandler public boolean checkModList(final @Nonnull Map<String, String> versions, final @Nonnull Side side) { return true; }
@NetworkCheckHandler public boolean checkModLists(Map<String,String> modList, Side side) { return Loader.instance().checkRemoteModList(modList,side); }
@NetworkCheckHandler public boolean acceptModList(Map<String, String> modList, Side side) { return ModRestriction.acceptModList(modList, side); }
/** make sure to accept clients without this mod! */ @NetworkCheckHandler public boolean networkCheck(Map<String, String> map, Side side) { return true; }
@NetworkCheckHandler public boolean checkModList(final Map<String, String> versions, final Side side) { return true; }
@NetworkCheckHandler public boolean checkModList(Map<String, String> versions, Side side) { return true; }
@NetworkCheckHandler public boolean networkCheckHandler(Map<String, String> map, Side side) { return true; }
/** * Do not reject vanilla clients or vanilla servers. */ @NetworkCheckHandler public boolean checkNetwork(Map<String, String> modsList, Side remote){ return true; }
@NetworkCheckHandler() public boolean matchModVersions(Map<String, String> remoteVersions, Side side) { return remoteVersions.containsKey("FloodLights") && Reference.VERSION.equals(remoteVersions.get("FloodLights")); }
@NetworkCheckHandler public boolean checkModList(final Map<String, String> versions, final Side side) { final String version = versions.get(Reference.MODID); return version == null || Reference.VERSION.equals(version); }
/** * This method is used to reject connection when the server has server info available for IGW-mod. Unless the properties.txt explicitly says * it's okay to connect without IGW-Mod, by setting "optional=true". * @param installedMods * @param side * @return */ @NetworkCheckHandler public boolean onConnectRequest(Map<String, String> installedMods, Side side){ if(side == Side.SERVER || proxy == null) return true; File serverFolder = new File(proxy.getSaveLocation() + File.separator + "igwmod" + File.separator); if(serverFolder.exists() || new File(proxy.getSaveLocation() + File.separator + "igwmodServer" + File.separator).exists()) {//TODO remove legacy String str = proxy.getSaveLocation() + File.separator + "igwmod" + File.separator + "properties.txt"; File file = new File(str); if(!file.exists()) { file = new File(proxy.getSaveLocation() + File.separator + "igwmodServer" + File.separator + "properties.txt");//TODO remove legacy } if(file.exists()) { try { FileInputStream stream = new FileInputStream(file); BufferedReader br = new BufferedReader(new InputStreamReader(stream, "UTF-8")); List<String> textList = new ArrayList<String>(); String line = br.readLine(); while(line != null) { textList.add(line); line = br.readLine(); } br.close(); if(textList != null) { for(String s : textList) { String[] entry = s.split("="); if(entry[0].equals("optional")) { if(Boolean.parseBoolean(entry[1])) return true; } } } } catch(Exception e) { e.printStackTrace(); } } String version = installedMods.get(Constants.MOD_ID); if(version.equals("${version}")) return true; return version != null && version.equals(Constants.fullVersionString()); } else { return true; } }
/** * A client-side mod must always accept remote clients and servers * * @param mods * @param remoteSide * @return */ @NetworkCheckHandler public boolean acceptsRemote(Map<String, String> mods, Side remoteSide) { return true; }