Skip to content

Commit 0c98704

Browse files
committed
fix: register who has a hotbar enabled inside directly from the HotbarItem
Signed-off-by: Cristóbal Veas <[email protected]>
1 parent 23141fd commit 0c98704

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/main/java/team/devblook/akropolis/module/modules/hotbar/HotbarItem.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public void giveItem(Player player) {
121121
}
122122

123123
player.getInventory().setItem(slot, newItem);
124+
hotbarManager.getPlayers().add(player.getUniqueId());
124125
}
125126

126127
public void removeItem(Player player) {
@@ -135,6 +136,8 @@ public void removeItem(Player player) {
135136
if (keyValueInItem != null && keyValueInItem.equals(keyValue)) {
136137
inventory.remove(itemInSlot);
137138
}
139+
140+
hotbarManager.getPlayers().remove(player.getUniqueId());
138141
}
139142

140143
@EventHandler

src/main/java/team/devblook/akropolis/module/modules/hotbar/HotbarManager.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,12 @@ public void giveItemsToPlayer(Player player) {
129129
if (inDisabledWorld(player.getLocation())) return;
130130

131131
hotbarItems.forEach(hotbarItem -> hotbarItem.giveItem(player));
132-
players.add(player.getUniqueId());
133132
}
134133

135134
public void removeItemsFromPlayer(Player player) {
136135
if (inDisabledWorld(player.getLocation())) return;
137136

138137
hotbarItems.forEach(hotbarItem -> hotbarItem.removeItem(player));
139-
players.remove(player.getUniqueId());
140138
}
141139

142140
public boolean hasHotbar(UUID playerUuid) {
@@ -146,4 +144,8 @@ public boolean hasHotbar(UUID playerUuid) {
146144
public List<HotbarItem> getHotbarItems() {
147145
return hotbarItems;
148146
}
147+
148+
public Set<UUID> getPlayers() {
149+
return players;
150+
}
149151
}

0 commit comments

Comments
 (0)