From: Astrid S. <ast...@us...> - 2009-05-05 20:55:09
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/mapstuff/chest In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv32751/src/games/stendhal/server/entity/mapstuff/chest Modified Files: PersonalChest.java Log Message: let vault be its own subclass of stendhalrpzone so we are able to overwrite onfinish let Personalchest remove its turnlisterner in onremoved(rpzone) fixing the NPE when leaving vaults Index: PersonalChest.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/server/entity/mapstuff/chest/PersonalChest.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PersonalChest.java 26 Feb 2009 21:33:23 -0000 1.16 --- PersonalChest.java 5 May 2009 20:54:52 -0000 1.17 *************** *** 3,6 **** --- 3,7 ---- import games.stendhal.common.Grammar; import games.stendhal.server.core.engine.SingletonRepository; + import games.stendhal.server.core.engine.StendhalRPZone; import games.stendhal.server.core.events.TurnListener; import games.stendhal.server.entity.RPEntity; *************** *** 40,43 **** --- 41,46 ---- private final String bankName; + private SyncContent chestSynchronizer; + /** * Create a personal chest using the default bank slot. *************** *** 159,163 **** attending = user; ! SingletonRepository.getTurnNotifier().notifyInTurns(0, new SyncContent()); final RPSlot content = getSlot("content"); --- 162,167 ---- attending = user; ! chestSynchronizer = new SyncContent(); ! SingletonRepository.getTurnNotifier().notifyInTurns(0, chestSynchronizer); final RPSlot content = getSlot("content"); *************** *** 184,187 **** --- 188,192 ---- getSlot("content").clear(); attending = null; + } *************** *** 230,234 **** --- 235,246 ---- } } + + } + @Override + public void onRemoved(final StendhalRPZone zone) { + SingletonRepository.getTurnNotifier().dontNotify(chestSynchronizer); + super.onRemoved(zone); + } } |