mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-06 08:40:03 +00:00
Only send CloseInterfaceMessage if an interface is open.
This commit is contained in:
@@ -24,7 +24,8 @@ import org.apollo.game.model.inv.InventoryListener;
|
|||||||
* This class manages all six distinct types of interface (the last two are not present on 317 servers).
|
* This class manages all six distinct types of interface (the last two are not present on 317 servers).
|
||||||
* <p>
|
* <p>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li><strong>Windows:</strong> Interfaces such as the bank, the wilderness warning screen, the trade screen, etc.</li>
|
* <li><strong>Windows:</strong> Interfaces such as the bank, the wilderness warning screen, the trade screen,
|
||||||
|
* etc.</li>
|
||||||
* <li><strong>Overlays:</strong> Displayed in the same place as windows, but don't prevent a player from moving e.g.
|
* <li><strong>Overlays:</strong> Displayed in the same place as windows, but don't prevent a player from moving e.g.
|
||||||
* the wilderness level indicator.</li>
|
* the wilderness level indicator.</li>
|
||||||
* <li><strong>Dialogues:</strong> Interfaces displayed over the chat box.</li>
|
* <li><strong>Dialogues:</strong> Interfaces displayed over the chat box.</li>
|
||||||
@@ -38,6 +39,16 @@ import org.apollo.game.model.inv.InventoryListener;
|
|||||||
*/
|
*/
|
||||||
public final class InterfaceSet {
|
public final class InterfaceSet {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A map of open interfaces.
|
||||||
|
*/
|
||||||
|
private final Map<InterfaceType, Integer> interfaces = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The player whose interfaces are being managed.
|
||||||
|
*/
|
||||||
|
private final Player player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current enter amount listener.
|
* The current enter amount listener.
|
||||||
*/
|
*/
|
||||||
@@ -48,21 +59,11 @@ public final class InterfaceSet {
|
|||||||
*/
|
*/
|
||||||
private Optional<DialogueListener> dialogueListener = Optional.empty();
|
private Optional<DialogueListener> dialogueListener = Optional.empty();
|
||||||
|
|
||||||
/**
|
|
||||||
* A map of open interfaces.
|
|
||||||
*/
|
|
||||||
private final Map<InterfaceType, Integer> interfaces = new HashMap<>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current listener.
|
* The current listener.
|
||||||
*/
|
*/
|
||||||
private Optional<InterfaceListener> listener = Optional.empty();
|
private Optional<InterfaceListener> listener = Optional.empty();
|
||||||
|
|
||||||
/**
|
|
||||||
* The player whose interfaces are being managed.
|
|
||||||
*/
|
|
||||||
private final Player player;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an interface set.
|
* Creates an interface set.
|
||||||
*
|
*
|
||||||
@@ -86,10 +87,13 @@ public final class InterfaceSet {
|
|||||||
* Closes the current open interface(s).
|
* Closes the current open interface(s).
|
||||||
*/
|
*/
|
||||||
public void close() {
|
public void close() {
|
||||||
CloseInterfacesEvent event = new CloseInterfacesEvent(player);
|
if (interfaces.size() != 0) {
|
||||||
if (player.getWorld().submit(event)) {
|
CloseInterfacesEvent event = new CloseInterfacesEvent(player);
|
||||||
closeAndNotify();
|
|
||||||
player.send(new CloseInterfaceMessage());
|
if (player.getWorld().submit(event)) {
|
||||||
|
closeAndNotify();
|
||||||
|
player.send(new CloseInterfaceMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user