From: Hendrik B. <nh...@us...> - 2012-01-20 23:04:25
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/actions In directory vz-cvs-4.sog:/tmp/cvs-serv20116/src/games/stendhal/server/actions Modified Files: CStatusAction.java Log Message: moved ingame version check from client to server Index: CStatusAction.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/actions/CStatusAction.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CStatusAction.java 19 Jan 2012 23:38:53 -0000 1.1 --- CStatusAction.java 20 Jan 2012 23:04:23 -0000 1.2 *************** *** 15,18 **** --- 15,20 ---- import static games.stendhal.common.constants.Actions.CSTATUS; import static games.stendhal.common.constants.Actions.ID; + import games.stendhal.common.NotificationType; + import games.stendhal.common.Version; import games.stendhal.server.entity.player.Player; *************** *** 40,43 **** --- 42,46 ---- public void onAction(final Player player, final RPAction action) { + final String pName = player.getName(); if (action.has(CID) || action.has(ID)) { *************** *** 46,54 **** cid = action.get(ID); } - final String pName = player.getName(); - if (action.has("version")) { - player.setClientVersion(action.get("version")); - // dataProvider.provideData(player, action.get("version")); - } //add to idList --- 49,52 ---- *************** *** 65,69 **** nameList.put(pName, cid); } ! } } --- 63,81 ---- nameList.put(pName, cid); } ! ! if (action.has("version")) { ! String clientVersion = action.get("version"); ! player.setClientVersion(clientVersion); ! String serverVersion = Version.VERSION; ! if (!Version.checkCompatibility(serverVersion, clientVersion)) { ! player.sendPrivateText(NotificationType.ERROR, ! "Your client may not function properly.\nThe version of this server is " ! + serverVersion ! + " but your client is version " ! + clientVersion ! + ".\nYou can download the most recent version from http://arianne.sourceforge.net "); ! } ! } ! } } |