Crossfire JXClient, Trunk
PlayerLoginSkinEvent.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff
19  * Copyright (C) 2006-2017,2019-2023 Andreas Kirschbaum
20  * Copyright (C) 2010-2012,2014-2018,2020-2023 Nicolas Weeger
21  */
22 
23 package com.realtime.crossfire.jxclient.skin.events;
24 
29 import org.jetbrains.annotations.NotNull;
30 import org.jetbrains.annotations.Nullable;
31 
36 public class PlayerLoginSkinEvent implements SkinEvent {
37 
42  private final boolean login;
43 
47  @NotNull
48  private final CommandList commandList;
49 
53  @NotNull
54  private final ItemSet itemSet;
55 
59  @NotNull
61 
62  @Override
63  public void playerChanged(@Nullable final CfItem player) {
64  //noinspection VariableNotUsedInsideIf
65  if (player == null) {
66  if (!login) {
68  }
69  } else {
70  if (login) {
72  }
73  }
74  }
75 
76  @Override
77  public void openContainerChanged(final int tag) {
78  // ignore
79  }
80 
81  };
82 
90  public PlayerLoginSkinEvent(final boolean login, @NotNull final CommandList commandList, @NotNull final ItemSet itemSet) {
91  this.login = login;
92  this.commandList = commandList;
93  this.itemSet = itemSet;
94  this.itemSet.addItemSetListener(itemSetListener);
95  }
96 
97  @Override
98  public void dispose() {
100  }
101 
102 }
com.realtime.crossfire.jxclient
com.realtime.crossfire.jxclient.skin.events.SkinEvent
Interface for events attached to skins.
Definition: SkinEvent.java:29
com.realtime.crossfire.jxclient.skin.events.PlayerLoginSkinEvent.dispose
void dispose()
Will be called when the skin is disposed.
Definition: PlayerLoginSkinEvent.java:98
com.realtime.crossfire.jxclient.items.ItemSet
Model class maintaining the CfItems known to the player.
Definition: ItemSet.java:44
com.realtime.crossfire.jxclient.skin.events.PlayerLoginSkinEvent.itemSet
final ItemSet itemSet
The ItemSet to watch.
Definition: PlayerLoginSkinEvent.java:54
com.realtime.crossfire.jxclient.gui.commandlist
Definition: CommandList.java:23
com.realtime.crossfire.jxclient.skin.events.PlayerLoginSkinEvent.itemSetListener
final ItemSetListener itemSetListener
The ItemSetListener attached to itemSet.
Definition: PlayerLoginSkinEvent.java:60
com.realtime.crossfire.jxclient.items.CfItem
The representation of a Crossfire Item, client-side.
Definition: CfItem.java:37
com.realtime.crossfire.jxclient.gui
com.realtime.crossfire.jxclient.skin.events.PlayerLoginSkinEvent.commandList
final CommandList commandList
The CommandList to execute.
Definition: PlayerLoginSkinEvent.java:48
com.realtime.crossfire.jxclient.items.ItemSet.addItemSetListener
void addItemSetListener(@NotNull final ItemSetListener listener)
Adds an ItemSetListener to be notified about changes.
Definition: ItemSet.java:95
com.realtime.crossfire.jxclient.skin.events.PlayerLoginSkinEvent.PlayerLoginSkinEvent
PlayerLoginSkinEvent(final boolean login, @NotNull final CommandList commandList, @NotNull final ItemSet itemSet)
Creates a new instance.
Definition: PlayerLoginSkinEvent.java:90
com.realtime.crossfire.jxclient.gui.commandlist.CommandList.execute
void execute()
Execute the command list by calling GUICommand#execute() for each command in order.
Definition: CommandList.java:99
com.realtime.crossfire.jxclient.gui.commandlist.CommandList
A list of GUICommand instances.
Definition: CommandList.java:34
com.realtime.crossfire
com.realtime
com
com.realtime.crossfire.jxclient.items
Definition: AbstractItemView.java:23
com.realtime.crossfire.jxclient.skin.events.PlayerLoginSkinEvent.login
final boolean login
Whether to generate login events (.
Definition: PlayerLoginSkinEvent.java:42
com.realtime.crossfire.jxclient.skin.events.PlayerLoginSkinEvent
A SkinEvent that executes a CommandList at connection setup.
Definition: PlayerLoginSkinEvent.java:36
com.realtime.crossfire.jxclient.items.ItemSetListener
Interface for listeners in ItemSet related events.
Definition: ItemSetListener.java:32
com.realtime.crossfire.jxclient.items.ItemSet.removeItemSetListener
void removeItemSetListener(@NotNull final ItemSetListener listener)
Removes an ItemSetListener to be notified about changes.
Definition: ItemSet.java:103