Add API method for adding and removing logout listeners and converted existing usages.
This commit is contained in:
@@ -287,10 +287,12 @@ public final class RugMerchantDialogue extends DialoguePlugin {
|
||||
player.getInterfaceManager().hideTabs(0,1,2,3,4,5,6,7,8,9,10,11,12,13);
|
||||
player.getEquipment().replace(new Item(Items.MAGIC_CARPET_5614),EquipmentContainer.SLOT_WEAPON);
|
||||
player.getPacketDispatch().sendInterfaceConfig(548,69,true);
|
||||
player.logoutListeners.put("magic-carpet", (pl) -> {
|
||||
|
||||
ContentAPI.registerLogoutListener(player, "magic-carpet", (pl) -> {
|
||||
ContentAPI.removeItem(pl, Items.MAGIC_CARPET_5614, Container.EQUIPMENT);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
GameWorld.getPulser().submit(new Pulse(1, player) {
|
||||
int count;
|
||||
int index;
|
||||
@@ -330,7 +332,9 @@ public final class RugMerchantDialogue extends DialoguePlugin {
|
||||
player.unlock();
|
||||
player.animate(new Animation(-1));
|
||||
player.getConfigManager().set(499, 0);
|
||||
player.logoutListeners.remove("magic-carpet");
|
||||
|
||||
ContentAPI.clearLogoutListener(player, "magic-carpet");
|
||||
|
||||
break;
|
||||
case 902:
|
||||
player.moveStep();
|
||||
|
||||
@@ -1369,12 +1369,4 @@ public class Player extends Entity {
|
||||
state.getPulse().stop();
|
||||
states.remove(key);
|
||||
}
|
||||
|
||||
public void addLogoutListener(String key, Function1<Player,Unit> listener){
|
||||
logoutListeners.put(key,listener);
|
||||
}
|
||||
|
||||
public void removeLogoutListener(String key){
|
||||
logoutListeners.remove(key);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user