1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-09 08:52:51 +00:00

Refactored Filters

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-05-16 15:08:30 -03:00
parent 242616d384
commit df36f9bb32
38 changed files with 322 additions and 80 deletions

View File

@@ -18,6 +18,7 @@ package com.l2jserver.model.world;
import com.l2jserver.model.id.object.CharacterID;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.template.ItemTemplate;
import com.l2jserver.model.world.capability.Dropable;
import com.l2jserver.model.world.capability.Listenable;
import com.l2jserver.model.world.capability.Playable;
@@ -50,7 +51,13 @@ import com.l2jserver.util.dimensional.Coordinate;
*/
public class Item extends AbstractObject implements Playable, Spawnable,
Listenable<ItemListener, ItemEvent>, Dropable {
/**
* The {@link ItemTemplate} ID
*/
private final ItemTemplateID templateID;
/**
* The {@link L2Character} ID owner of this object
*/
private CharacterID ownerID;
/**
@@ -65,7 +72,10 @@ public class Item extends AbstractObject implements Playable, Spawnable,
* Drop coordinate of this item
*/
private Coordinate coordinate;
/**
* Count of items
*/
private int count = 1;
public Item(ItemTemplateID templateID) {
@@ -75,6 +85,8 @@ public class Item extends AbstractObject implements Playable, Spawnable,
@Override
public void drop(Coordinate position) {
this.coordinate = position;
this.location = null;
this.paperdoll = null;
}
@Override
@@ -84,8 +96,7 @@ public class Item extends AbstractObject implements Playable, Spawnable,
@Override
public boolean isSpawned() {
// TODO Auto-generated method stub
return false;
return (location != null);
}
@Override
@@ -98,6 +109,21 @@ public class Item extends AbstractObject implements Playable, Spawnable,
this.coordinate = coord;
}
/**
* @return the count
*/
public int getCount() {
return count;
}
/**
* @param count
* the count to set
*/
public void setCount(int count) {
this.count = count;
}
/**
* @return the location
*/

View File

@@ -17,7 +17,7 @@
package com.l2jserver.model.world.actor;
import com.l2jserver.model.world.capability.Actor;
import com.l2jserver.model.world.event.WorldEvent;
import com.l2jserver.service.game.world.event.WorldEvent;
/**
* Base event for {@link Actor} instances

View File

@@ -17,7 +17,7 @@
package com.l2jserver.model.world.actor;
import com.l2jserver.model.world.capability.Actor;
import com.l2jserver.model.world.event.WorldListener;
import com.l2jserver.service.game.world.event.WorldListener;
/**
* Base listener for {@link Actor} instances

View File

@@ -17,8 +17,8 @@
package com.l2jserver.model.world.capability;
import com.l2jserver.model.world.AbstractObject;
import com.l2jserver.model.world.event.WorldEvent;
import com.l2jserver.model.world.event.WorldListener;
import com.l2jserver.service.game.world.event.WorldEvent;
import com.l2jserver.service.game.world.event.WorldListener;
/**
* Defines an {@link AbstractObject} that can attach {@link WorldListener} that

View File

@@ -50,6 +50,21 @@ public class CharacterInventory implements Iterable<Item> {
this.character = character;
}
/**
* Get the item in the given <tt>paperdoll</tt> slot
*
* @param paperdoll
* the paperdoll slot
* @return the item in slot, null if emptys
*/
public Item getItem(InventoryPaperdoll paperdoll) {
for (final Item item : items) {
if (item.getPaperdoll() == paperdoll)
return item;
}
return null;
}
/**
* This method will add new items to the inventory. This is normally called
* from the DAO object.
@@ -74,7 +89,7 @@ public class CharacterInventory implements Iterable<Item> {
}
/**
* Location of an item
* Location of an item in the player's inventory
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
@@ -99,7 +114,11 @@ public class CharacterInventory implements Iterable<Item> {
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum InventoryPaperdoll {
UNDERWEAR, HEAD, HAIR1, HAIR2, NECK, RIGHT_HAND, LEFT_HAND, RIGHT_EAR, LEFT_EAR, GLOVES, LEGS, LEFT_FEET, RIGHT_FEET, RIGHT_FINGER, LEFT_FINGER, LEFT_BRACELET, RIGHT_BRACELET, DECORATION_1, DECOREATION_2, DECORATION_3, DECORATION_4, DECORATION_5, DECORATION_6, CLOAK, BELT;
UNDERWEAR, HEAD, HAIR1, HAIR2, NECK, RIGHT_HAND, FEET, LEFT_HAND, RIGHT_EAR, LEFT_EAR, GLOVES,
LEGS, LEFT_FEET, RIGHT_FEET, RIGHT_FINGER, LEFT_FINGER, CHEST, LEFT_BRACELET, RIGHT_BRACELET,
DECORATION_1, DECORATION_2, DECORATION_3, DECORATION_4, DECORATION_5, DECORATION_6, CLOAK, BELT;
}
/**

View File

@@ -14,22 +14,21 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.filter;
package com.l2jserver.model.world.character.event;
import com.l2jserver.model.world.WorldObject;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.player.event.PlayerEvent;
/**
* Filter an object in a world
* Base event for character
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface WorldObjectFilter<O extends WorldObject> {
public interface CharacterEvent extends PlayerEvent {
/**
* Test if <tt>object</tt> matches the filter requirements
* The character issue in this event
*
* @param object
* the object
* @return true if object match requirements
* @return the character
*/
boolean accept(O object);
L2Character getCharacter();
}

View File

@@ -14,37 +14,27 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.filter;
package com.l2jserver.model.world.character.event;
import com.l2jserver.model.world.WorldObject;
import com.l2jserver.model.world.player.event.PlayerEvent;
import com.l2jserver.model.world.player.event.PlayerListener;
import com.l2jserver.service.game.world.event.WorldEvent;
import com.l2jserver.service.game.world.event.WorldListener;
/**
* And filter that accepts all values in which the other <tt>filter</tt> return
* false.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
* @param <O>
* the item type
*/
public class NotFilter<O extends WorldObject> implements WorldObjectFilter<O> {
/**
* The filter
*/
private WorldObjectFilter<O> filter;
/**
* Creates a new instance
*
* @param filter
* the filter
*/
public NotFilter(WorldObjectFilter<O> filter) {
this.filter = filter;
}
public abstract class CharacterListener extends PlayerListener {
@Override
public boolean accept(O object) {
return !filter.accept(object);
protected boolean dispatch(PlayerEvent e) {
if (!(e instanceof CharacterEvent))
return false;
return dispatch((CharacterEvent) e);
}
/**
* @see WorldListener#dispatch(WorldEvent)
*/
protected abstract boolean dispatch(CharacterEvent e);
}

View File

@@ -0,0 +1,96 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.character.event;
import java.util.Date;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.Player;
import com.l2jserver.model.world.WorldObject;
import com.l2jserver.model.world.capability.Actor;
import com.l2jserver.model.world.capability.Listenable;
/**
* Event triggered once a character logs-in.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterLoggedInEvent implements CharacterEvent {
/**
* The character that is logging in
*/
private final L2Character character;
/**
* The time that this character has logged in
*/
private final Date date;
/**
* Creates a new instance
*
* @param character
* the character
* @param date
* the login date
*/
public CharacterLoggedInEvent(L2Character character, Date date) {
this.character = character;
this.date = date;
}
/**
* Creates a new instance. Login date is set to now.
*
* @param character
* the character
*/
public CharacterLoggedInEvent(L2Character character) {
this(character, new Date());
}
/**
* @return the date
*/
public Date getDate() {
return date;
}
@Override
public Player getPlayer() {
return character;
}
@Override
public Actor getActor() {
return character;
}
@Override
public WorldObject getObject() {
return character;
}
@Override
public L2Character getCharacter() {
return character;
}
@Override
public Listenable<?, ?>[] getDispatchableObjects() {
return new Listenable<?, ?>[] { character };
}
}

View File

@@ -17,7 +17,7 @@
package com.l2jserver.model.world.clan;
import com.l2jserver.model.world.Clan;
import com.l2jserver.model.world.event.WorldEvent;
import com.l2jserver.service.game.world.event.WorldEvent;
/**
* Base event for {@link Clan} objects

View File

@@ -16,7 +16,7 @@
*/
package com.l2jserver.model.world.clan;
import com.l2jserver.model.world.event.WorldListener;
import com.l2jserver.service.game.world.event.WorldListener;
/**
* Base listener for {@link ClanEvent}

View File

@@ -17,6 +17,7 @@
package com.l2jserver.model.world.event;
import com.l2jserver.model.world.capability.Spawnable;
import com.l2jserver.service.game.world.event.WorldEvent;
import com.l2jserver.util.dimensional.Coordinate;
/**

View File

@@ -1,32 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.event;
import com.l2jserver.model.world.WorldObject;
import com.l2jserver.model.world.capability.Listenable;
public interface WorldEvent {
/**
* @return the object that issued this event
*/
WorldObject getObject();
/**
* @return the list of objects that will be notified of this event
*/
Listenable<?, ?>[] getDispatchableObjects();
}

View File

@@ -1,38 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.event;
/**
* This is the most abstract listener for the listening engine.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
* @param <E>
* the received event type
*/
public interface WorldListener<E extends WorldEvent> {
/**
* Once the event call is dispatched the listener <b>WILL</b> be removed if
* false is returned. If you wish to keep this listener, you must return
* true.
*
* @param e
* the event
* @return true to keep listener alive
*/
boolean dispatch(E e);
}

View File

@@ -1,54 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.filter;
import com.l2jserver.model.world.WorldObject;
/**
* <tt>AND</tt> filter that accepts all values in which all other
* <tt>filters</tt> return true.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
* @param <O>
* the item type
*/
public class AndFilter<O extends WorldObject> implements WorldObjectFilter<O> {
/**
* The filters
*/
private WorldObjectFilter<O>[] filters;
/**
* Creates a new instance
*
* @param filters
* filters to be used with <tt>AND</tt> operator
*/
public AndFilter(WorldObjectFilter<O>... filters) {
this.filters = filters;
}
@Override
public boolean accept(O object) {
for (final WorldObjectFilter<O> filter : filters) {
if (!filter.accept(object))
return false;
}
return true;
}
}

View File

@@ -1,54 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.filter;
import com.l2jserver.model.world.WorldObject;
/**
* <tt>OR</tt> filter that accepts all values in which at least one of the
* <tt>filters</tt> return true.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
* @param <O>
* the item type
*/
public class OrFilter<O extends WorldObject> implements WorldObjectFilter<O> {
/**
* The filters
*/
private WorldObjectFilter<O>[] filters;
/**
* Creates a new instance
*
* @param filters
* filters to be used with <tt>OR</tt> operator
*/
public OrFilter(WorldObjectFilter<O>... filters) {
this.filters = filters;
}
@Override
public boolean accept(O object) {
for (final WorldObjectFilter<O> filter : filters) {
if (filter.accept(object))
return true;
}
return false;
}
}

View File

@@ -1,68 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.filter;
import com.l2jserver.model.world.WorldObject;
/**
* Utility class for common filter types
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public final class WorldFilters {
/**
* Performs an <tt>AND</tt> operation
*
* @param <O>
* the object type
* @param filters
* the filters
* @return the {@link AndFilter}
*/
public static final <O extends WorldObject> WorldObjectFilter<O> and(
WorldObjectFilter<O>... filters) {
return new AndFilter<O>(filters);
}
/**
* Performs an <tt>OR</tt> operation
*
* @param <O>
* the object type
* @param filters
* the filters
* @return the {@link OrFilter}
*/
public static final <O extends WorldObject> WorldObjectFilter<O> or(
WorldObjectFilter<O>... filters) {
return new OrFilter<O>(filters);
}
/**
* Performs an <tt>NOTA</tt> operation
*
* @param <O>
* the object type
* @param filters
* the filters
* @return the {@link NotFilter}
*/
public static final <O extends WorldObject> WorldObjectFilter<O> not(
WorldObjectFilter<O> filter) {
return new NotFilter<O>(filter);
}
}

View File

@@ -1,50 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.filter.impl;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.world.capability.Positionable;
import com.l2jserver.model.world.filter.WorldObjectFilter;
/**
* Filter objects based on its ID.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class IDFilter implements WorldObjectFilter<Positionable> {
/**
* The object id
*/
private final ObjectID<?> id;
/**
* Creates a new instance
*
* @param id
* the desired object ID
*/
public IDFilter(final ObjectID<?> id) {
this.id = id;
}
@Override
public boolean accept(Positionable other) {
if (other == null)
return false;
return other.getID().equals(id);
}
}

View File

@@ -1,52 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.filter.impl;
import com.l2jserver.model.world.WorldObject;
import com.l2jserver.model.world.filter.WorldObjectFilter;
/**
* Filter object based on their types
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
* @param <T>
* the instance type
*/
public class InstanceFilter<T extends WorldObject> implements
WorldObjectFilter<T> {
/**
* The object's type
*/
private final Class<?> type;
/**
* Creates a new instance
*
* @param instance
* the instance type
*/
public InstanceFilter(Class<?> instance) {
this.type = instance;
}
@Override
public boolean accept(T other) {
if (other == null)
return false;
return type.isInstance(other);
}
}

View File

@@ -1,69 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.filter.impl;
import com.l2jserver.model.world.capability.Positionable;
import com.l2jserver.model.world.filter.WorldObjectFilter;
import com.l2jserver.util.dimensional.Coordinate;
/**
* Filter objects that are in the <tt>range</tt> of <tt>coordinate</tt>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class RangeFilter implements WorldObjectFilter<Positionable> {
/**
* The coordinate point
*/
private final Coordinate coordinate;
/**
* The desired maximum distance of the object
*/
private final int range;
/**
* Creates a new instance
*
* @param coordinate
* the coordinate as base for range search
* @param range
* the desired maximum distance of the object
*/
public RangeFilter(final Coordinate coordinate, final int range) {
this.coordinate = coordinate;
this.range = range;
}
/**
* Creates a new instance
*
* @param positionable
* the base object
* @param range
* the desired maximum distance of the object
*/
public RangeFilter(final Positionable positionable, final int range) {
this(positionable.getPosition(), range);
}
@Override
public boolean accept(Positionable other) {
if (other == null)
return false;
return other.getPosition().getDistance(coordinate) <= range;
}
}

View File

@@ -21,7 +21,7 @@ import com.l2jserver.model.world.Player;
import com.l2jserver.model.world.WorldObject;
import com.l2jserver.model.world.capability.Actor;
import com.l2jserver.model.world.capability.Listenable;
import com.l2jserver.model.world.player.PlayerEvent;
import com.l2jserver.model.world.player.event.PlayerEvent;
/**
* Event dispatched once an {@link Item} has been dropped on the ground.

View File

@@ -17,7 +17,7 @@
package com.l2jserver.model.world.item;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.event.WorldEvent;
import com.l2jserver.service.game.world.event.WorldEvent;
/**
* Base event for items

View File

@@ -16,7 +16,7 @@
*/
package com.l2jserver.model.world.item;
import com.l2jserver.model.world.event.WorldListener;
import com.l2jserver.service.game.world.event.WorldListener;
/**
* Listener for {@link ItemEvent}

View File

@@ -1,102 +0,0 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.iterator;
import java.util.Iterator;
import com.l2jserver.model.world.WorldObject;
import com.l2jserver.model.world.filter.WorldObjectFilter;
/**
* The {@link FilterIterator} takes an {@link WorldObject} and a
* {@link WorldObjectFilter} and dynamically iterates over the items and find
* the next matching object.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
* @param <O>
* the object type
*/
public class FilterIterator<O extends WorldObject> implements Iterator<O> {
/**
* The unfiltered object iterator
*/
private final Iterator<WorldObject> objects;
/**
* The filter
*/
private final WorldObjectFilter<O> filter;
/**
* The next object found
*/
private O selected;
/**
* Creates a new instance
*
* @param filter
* the filter
* @param objects
* the unfiltered object iterator
*/
public FilterIterator(final WorldObjectFilter<O> filter,
Iterator<WorldObject> objects) {
this.filter = filter;
this.objects = objects;
}
@Override
public boolean hasNext() {
O next = findNext();
return (next != null);
}
@Override
public O next() {
try {
return findNext();
} finally {
selected = null;
}
}
@Override
public void remove() {
}
/**
* Locates the next matching object
*
* @return the next matching object
*/
private O findNext() {
if (selected != null)
return selected;
while (objects.hasNext()) {
try {
@SuppressWarnings("unchecked")
final O object = (O) objects.next();
if (filter.accept(object)) {
selected = object;
return selected;
}
} catch (ClassCastException e) {
}
}
return null;
}
}

View File

@@ -18,7 +18,7 @@ package com.l2jserver.model.world.party;
import com.l2jserver.model.world.Clan;
import com.l2jserver.model.world.Party;
import com.l2jserver.model.world.event.WorldEvent;
import com.l2jserver.service.game.world.event.WorldEvent;
/**
* Base event for {@link Party} objects

View File

@@ -16,7 +16,7 @@
*/
package com.l2jserver.model.world.party;
import com.l2jserver.model.world.event.WorldListener;
import com.l2jserver.service.game.world.event.WorldListener;
/**
* Listener for {@link PartyEvent}

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.player;
package com.l2jserver.model.world.player.event;
import com.l2jserver.model.world.Player;
import com.l2jserver.model.world.actor.ActorEvent;

View File

@@ -14,12 +14,12 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.player;
package com.l2jserver.model.world.player.event;
import com.l2jserver.model.world.actor.ActorEvent;
import com.l2jserver.model.world.actor.ActorListener;
import com.l2jserver.model.world.event.WorldEvent;
import com.l2jserver.model.world.event.WorldListener;
import com.l2jserver.service.game.world.event.WorldEvent;
import com.l2jserver.service.game.world.event.WorldListener;
/**
* Listener for {@link PlayerEvent}

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.player;
package com.l2jserver.model.world.player.event;
import com.l2jserver.model.world.Player;
import com.l2jserver.model.world.capability.Actor;

View File

@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.world.player;
package com.l2jserver.model.world.player.event;
import com.l2jserver.model.world.Player;
import com.l2jserver.util.dimensional.Coordinate;