AbstractScript uses NPC templates to register events.
This commit is contained in:
parent
6b6e2585c8
commit
3918bbc997
@ -1511,6 +1511,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1511,6 +1511,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1511,6 +1511,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1511,6 +1511,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1511,6 +1511,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1511,6 +1511,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1511,6 +1511,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1511,6 +1511,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1512,6 +1512,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1512,6 +1512,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1751,8 +1751,14 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPC's within given radius
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
* @param radius - radius to send event
|
||||
* @param reference - WorldObject to pass, if needed
|
||||
@ -1761,7 +1767,7 @@ public class Npc extends Creature
|
||||
{
|
||||
World.getInstance().forEachVisibleObjectInRange(this, Npc.class, radius, obj ->
|
||||
{
|
||||
if (obj.isNpc() && obj.hasListener(EventType.ON_NPC_EVENT_RECEIVED))
|
||||
if (obj.hasListener(EventType.ON_NPC_EVENT_RECEIVED))
|
||||
{
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcEventReceived(eventName, this, obj, reference), obj);
|
||||
}
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1751,8 +1751,14 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPC's within given radius
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
* @param radius - radius to send event
|
||||
* @param reference - WorldObject to pass, if needed
|
||||
@ -1761,7 +1767,7 @@ public class Npc extends Creature
|
||||
{
|
||||
World.getInstance().forEachVisibleObjectInRange(this, Npc.class, radius, obj ->
|
||||
{
|
||||
if (obj.isNpc() && obj.hasListener(EventType.ON_NPC_EVENT_RECEIVED))
|
||||
if (obj.hasListener(EventType.ON_NPC_EVENT_RECEIVED))
|
||||
{
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcEventReceived(eventName, this, obj, reference), obj);
|
||||
}
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1511,6 +1511,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1511,6 +1511,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1511,6 +1511,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1523,6 +1523,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1523,6 +1523,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1523,6 +1523,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1495,6 +1495,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1524,6 +1524,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1524,6 +1524,12 @@ public class Npc extends Creature
|
||||
return vars != null ? vars : addScript(new NpcVariables());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
return getTemplate().hasListener(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an "event" to all NPCs within given radius
|
||||
* @param eventName - name of event
|
||||
|
@ -108,8 +108,7 @@ public class ListenersContainer
|
||||
|
||||
public boolean hasListener(EventType type)
|
||||
{
|
||||
// FIXME: return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
return !getListeners(type).isEmpty();
|
||||
return (_listeners != null) && !getListeners(type).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user