Added InterfaceListener.kt and converted a few interfaces over to it
This commit is contained in:
@@ -10,9 +10,10 @@ import core.game.node.entity.player.info.login.LoginConfiguration;
|
||||
import core.game.node.entity.player.link.request.assist.AssistSession;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.system.task.Pulse;
|
||||
import rs09.game.world.GameWorld;
|
||||
import core.net.packet.IncomingPacket;
|
||||
import core.net.packet.IoBuffer;
|
||||
import rs09.game.interaction.InterfaceListeners;
|
||||
import rs09.game.world.GameWorld;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -58,10 +59,15 @@ public class ActionButtonPacket implements IncomingPacket {
|
||||
player.debug("Component " + c + " wasn't opened in interface manager.");
|
||||
return;
|
||||
}
|
||||
int cOpcode = buffer.opcode();
|
||||
ComponentPlugin plugin = c.getPlugin();
|
||||
if (plugin != null) {
|
||||
player.debug("Component plugin = " + plugin.getClass().getSimpleName());
|
||||
plugin.handle(player, c, buffer.opcode(), buttonId, slot, itemId);
|
||||
plugin.handle(player, c, cOpcode, buttonId, slot, itemId);
|
||||
} else {
|
||||
if(InterfaceListeners.run(player,c,cOpcode,buttonId,slot,itemId)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import core.net.packet.context.PlayerContext;
|
||||
import core.net.packet.out.ClearMinimapFlag;
|
||||
import rs09.ServerConstants;
|
||||
import rs09.game.ai.AIPlayer;
|
||||
import rs09.game.interaction.Listeners;
|
||||
import rs09.game.interaction.InteractionListeners;
|
||||
import rs09.game.world.repository.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@@ -186,7 +186,7 @@ public final class InteractionPacket implements IncomingPacket {
|
||||
player.debug("spawn=" + npc.getProperties().getSpawnLocation() + ".");
|
||||
player.debug("Varp ID= " + npc.getDefinition().getConfigId() + " Offset=" + npc.getDefinition().getVarbitOffset() + " Size=" + npc.getDefinition().getVarbitSize());
|
||||
handleAIPLegion(player, 0, optionIndex, index);
|
||||
if(Listeners.run(npc.getId(),2, option.getName(),player,npc)){
|
||||
if(InteractionListeners.run(npc.getId(),2, option.getName(),player,npc)){
|
||||
return;
|
||||
}
|
||||
if(PluginInteractionManager.handle(player,shown,option)){
|
||||
@@ -270,7 +270,7 @@ public final class InteractionPacket implements IncomingPacket {
|
||||
}
|
||||
handleAIPLegion(player, 1, optionIndex, x, y, objectId);
|
||||
|
||||
if(Listeners.run(object.getId(),1, option.getName(),player,object)){
|
||||
if(InteractionListeners.run(object.getId(),1, option.getName(),player,object)){
|
||||
return;
|
||||
}
|
||||
if(PluginInteractionManager.handle(player,object)){
|
||||
|
||||
@@ -17,7 +17,7 @@ import core.net.packet.context.PlayerContext;
|
||||
import core.net.packet.out.ClearMinimapFlag;
|
||||
import org.rs09.consts.Items;
|
||||
import rs09.game.interaction.ItemOnBankBooth;
|
||||
import rs09.game.interaction.Listeners;
|
||||
import rs09.game.interaction.InteractionListeners;
|
||||
import rs09.game.node.entity.skill.farming.CompostBins;
|
||||
import rs09.game.node.entity.skill.farming.FarmingPatch;
|
||||
import rs09.game.node.entity.skill.farming.UseWithBinHandler;
|
||||
@@ -69,7 +69,7 @@ public class ItemActionPacket implements IncomingPacket {
|
||||
if(PluginInteractionManager.handle(player,event)){
|
||||
return;
|
||||
}
|
||||
if(Listeners.run(item,npc,2,player)){
|
||||
if(InteractionListeners.run(item,npc,2,player)){
|
||||
return;
|
||||
}
|
||||
event = new NodeUsageEvent(player, interfaceId, item, npc);
|
||||
@@ -128,7 +128,7 @@ public class ItemActionPacket implements IncomingPacket {
|
||||
RottenPotatoUseWithHandler.handle(used,player);
|
||||
return;
|
||||
}
|
||||
if(Listeners.run(used,with,0,player)){
|
||||
if(InteractionListeners.run(used,with,0,player)){
|
||||
return;
|
||||
}
|
||||
if (usedItemId < usedWithItemId) {
|
||||
@@ -179,7 +179,7 @@ public class ItemActionPacket implements IncomingPacket {
|
||||
RottenPotatoUseWithHandler.handle(object,player);
|
||||
return;
|
||||
}
|
||||
if(Listeners.run(used,object,1,player)){
|
||||
if(InteractionListeners.run(used,object,1,player)){
|
||||
return;
|
||||
}
|
||||
event = new NodeUsageEvent(player, 0, used, object);
|
||||
|
||||
Reference in New Issue
Block a user