Chronicle 4 branch.

This commit is contained in:
MobiusDev
2017-07-19 21:24:06 +00:00
parent 9a69bec286
commit 3a0bf3539a
13496 changed files with 641683 additions and 0 deletions

View File

@@ -0,0 +1,56 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.events;
import javolution.util.FastList;
/**
* @author Layane
*/
public class Event
{
private final FastList<EventHandler> _handlers = new FastList<>();
public void add(EventHandler handler)
{
if (!_handlers.contains(handler))
{
_handlers.add(handler);
}
}
public void remove(EventHandler handler)
{
if (handler != null)
{
_handlers.remove(handler);
}
}
public void fire(Object trigger, IEventParams params)
{
for (final EventHandler handler : _handlers)
{
handler.handler(trigger, params);
}
}
public void clear()
{
_handlers.clear();
}
}

View File

@@ -0,0 +1,47 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.events;
/**
* @author Layane
*/
public abstract class EventHandler
{
private final Object _owner;
public EventHandler(Object owner)
{
_owner = owner;
}
public final Object getOwner()
{
return _owner;
}
@Override
public final boolean equals(Object object)
{
if ((object instanceof EventHandler) && (_owner == ((EventHandler) object)._owner))
{
return true;
}
return false;
}
public abstract void handler(Object trigger, IEventParams params);
}

View File

@@ -0,0 +1,24 @@
/*
* This file is part of the L2J Mobius project.
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.events;
/**
* @author Layane
*/
public interface IEventParams
{
}