Java Code Examples for javolution.util.FastList#head()
The following examples show how to use
javolution.util.FastList#head() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorldBuffService.java From aion-germany with GNU General Public License v3.0 | 6 votes |
public void onReturnHome(Npc npc) { FastList<WorldBuffTemplate> buff = worldBuff.get(npc.getWorldId()); if (buff == null) { return; } for (FastList.Node<WorldBuffTemplate> n = buff.head(), end = buff.tail(); (n = n.getNext()) != end;) { WorldBuffTemplate bf = n.getValue(); if (bf.getType().equals(WorldBuffType.PC)) { continue; } for (FastList.Node<TribeClass> t = bf.getTribe().head(), endt = bf.getTribe().tail(); (t = t.getNext()) != endt;) { if (npc.getTribe().equals(t.getValue())) { buff(bf, npc); break; } } if (!bf.getNpcIds().isEmpty() && bf.getNpcIds().contains(npc.getNpcId())) { buff(bf, npc); } } }
Example 2
Source File: ManagementImpl.java From sctp with GNU Affero General Public License v3.0 | 6 votes |
public void startServer(String serverName) throws Exception { if (!this.started) { throw new Exception(String.format("Management=%s not started", this.name)); } if (name == null) { throw new Exception("Server name cannot be null"); } FastList<Server> tempServers = servers; for (FastList.Node<Server> n = tempServers.head(), end = tempServers.tail(); (n = n.getNext()) != end;) { Server serverTemp = n.getValue(); if (serverName.equals(serverTemp.getName())) { if (serverTemp.isStarted()) { throw new Exception(String.format("Server=%s is already started", serverName)); } ((ServerImpl) serverTemp).start(); this.store(); return; } } throw new Exception(String.format("No Server foubd with name=%s", serverName)); }
Example 3
Source File: ManagementImpl.java From sctp with GNU Affero General Public License v3.0 | 6 votes |
public void stopServer(String serverName) throws Exception { if (!this.started) { throw new Exception(String.format("Management=%s not started", this.name)); } if (serverName == null) { throw new Exception("Server name cannot be null"); } FastList<Server> tempServers = servers; for (FastList.Node<Server> n = tempServers.head(), end = tempServers.tail(); (n = n.getNext()) != end;) { Server serverTemp = n.getValue(); if (serverName.equals(serverTemp.getName())) { ((ServerImpl) serverTemp).stop(); this.store(); return; } } throw new Exception(String.format("No Server found with name=%s", serverName)); }
Example 4
Source File: NettySctpManagementImpl.java From sctp with GNU Affero General Public License v3.0 | 6 votes |
@Override public void stopServer(String serverName) throws Exception { if (!this.started) { throw new Exception(String.format("Management=%s not started", this.name)); } if (serverName == null) { throw new Exception("Server name cannot be null"); } FastList<Server> tempServers = servers; for (FastList.Node<Server> n = tempServers.head(), end = tempServers.tail(); (n = n.getNext()) != end;) { Server serverTemp = n.getValue(); if (serverName.equals(serverTemp.getName())) { ((NettyServerImpl) serverTemp).stop(); this.store(); return; } } throw new Exception(String.format("No Server found with name=%s", serverName)); }
Example 5
Source File: WorldBuffService.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public void onEnterWorld(Player player) { if (player.getWorldBuffList() == null) { onAfterSpawn(player); return; } FastList<WorldBuff> buff = player.getWorldBuffList(); for (FastList.Node<WorldBuff> n = buff.head(), end = buff.tail(); (n = n.getNext()) != end;) { if (player.getWorldId() != n.getValue().getWorldId()) { for (FastList.Node<Integer> s = n.getValue().getSkillIds().head(), ends = n.getValue().getSkillIds().tail(); (s = s.getNext()) != ends;) { player.getEffectController().removeEffect(s.getValue()); } player.getWorldBuffList().remove(n.getValue()); } } }
Example 6
Source File: WorldBuffService.java From aion-germany with GNU General Public License v3.0 | 5 votes |
public void onLogOut(Player player) { if (player.getWorldBuffList() == null) { return; } FastList<WorldBuff> buff = player.getWorldBuffList(); for (FastList.Node<WorldBuff> n = buff.head(), end = buff.tail(); (n = n.getNext()) != end;) { if (player.getWorldId() != n.getValue().getWorldId()) { for (FastList.Node<Integer> s = n.getValue().getSkillIds().head(), ends = n.getValue().getSkillIds().tail(); (s = s.getNext()) != ends;) { player.getEffectController().removeEffect(s.getValue()); } player.getWorldBuffList().remove(n.getValue()); } } }
Example 7
Source File: ServerImpl.java From sctp with GNU Affero General Public License v3.0 | 5 votes |
protected void stop() throws Exception { FastList<String> tempAssociations = associations; for (FastList.Node<String> n = tempAssociations.head(), end = tempAssociations.tail(); (n = n.getNext()) != end;) { String assocName = n.getValue(); Association associationTemp = this.management.getAssociation(assocName); if (associationTemp.isStarted()) { throw new Exception(String.format("Stop all the associations first. Association=%s is still started", associationTemp.getName())); } } synchronized (this.anonymAssociations) { // stopping all anonymous associations for (Association ass : this.anonymAssociations) { ass.stopAnonymousAssociation(); } this.anonymAssociations.clear(); } if (this.getIpChannel() != null) { try { this.getIpChannel().close(); } catch (Exception e) { logger.warn(String.format("Error while stopping the Server=%s", this.name), e); } } this.started = false; if (logger.isInfoEnabled()) { logger.info(String.format("Stoped Server=%s", this.name)); } }
Example 8
Source File: NettyServerImpl.java From sctp with GNU Affero General Public License v3.0 | 5 votes |
protected void stop() throws Exception { FastList<String> tempAssociations = associations; for (FastList.Node<String> n = tempAssociations.head(), end = tempAssociations.tail(); (n = n.getNext()) != end;) { String assocName = n.getValue(); Association associationTemp = this.management.getAssociation(assocName); if (associationTemp.isStarted()) { throw new Exception(String.format("Stop all the associations first. Association=%s is still started", associationTemp.getName())); } } synchronized (this.anonymAssociations) { // stopping all anonymous associations for (Association ass : this.anonymAssociations) { ass.stopAnonymousAssociation(); } this.anonymAssociations.clear(); } this.started = false; if (logger.isInfoEnabled()) { logger.info(String.format("Stoped Server=%s", this.name)); } // Stop underlying channel and wait till its done if (this.getIpChannel() != null) { try { this.getIpChannel().close().sync(); } catch (Exception e) { logger.warn(String.format("Error while stopping the Server=%s", this.name), e); } } }
Example 9
Source File: NettySctpManagementImpl.java From sctp with GNU Affero General Public License v3.0 | 5 votes |
@Override public void startServer(String serverName) throws Exception { if (!this.started) { throw new Exception(String.format("Management=%s not started", this.name)); } if (name == null) { throw new Exception("Server name cannot be null"); } FastList<Server> tempServers = servers; for (FastList.Node<Server> n = tempServers.head(), end = tempServers.tail(); (n = n.getNext()) != end;) { Server serverTemp = n.getValue(); if (serverName.equals(serverTemp.getName())) { if (serverTemp.isStarted()) { throw new Exception(String.format("Server=%s is already started", serverName)); } ((NettyServerImpl) serverTemp).start(); this.store(); return; } } throw new Exception(String.format("No Server foubd with name=%s", serverName)); }
Example 10
Source File: WorldBuffService.java From aion-germany with GNU General Public License v3.0 | 4 votes |
public void onAfterSpawn(Creature creature) { FastList<WorldBuffTemplate> buff = worldBuff.get(creature.getWorldId()); if (buff == null) { return; } for (FastList.Node<WorldBuffTemplate> n = buff.head(), end = buff.tail(); (n = n.getNext()) != end;) { WorldBuffTemplate bf = n.getValue(); if (creature instanceof Player) { Player player = (Player) creature; if (bf.getType().equals(WorldBuffType.NPC)) { continue; } if (player.getWorldBuffList() != null) { FastList<WorldBuff> buffList = player.getWorldBuffList(); for (FastList.Node<WorldBuff> b = buffList.head(), endb = buffList.tail(); (b = b.getNext()) != endb;) { if (player.getWorldId() == b.getValue().getWorldId()) { buff(bf, creature); break; } } } else { player.addWorldBuff(new WorldBuff(bf.getSkillIds(), player.getWorldId())); buff(bf, creature); } } if (creature instanceof Npc) { Npc npc = (Npc) creature; if (bf.getType().equals(WorldBuffType.PC)) { continue; } for (FastList.Node<TribeClass> t = bf.getTribe().head(), endt = bf.getTribe().tail(); (t = t.getNext()) != endt;) { if (npc.getTribe().equals(t.getValue())) { buff(bf, npc); break; } } if (!bf.getNpcIds().isEmpty() && bf.getNpcIds().contains(npc.getNpcId())) { buff(bf, npc); } } } }