Skip to content

Commit

Permalink
fix orb of origins not clearing powers
Browse files Browse the repository at this point in the history
  • Loading branch information
Dueris committed Jun 2, 2024
1 parent 4d6a304 commit 0893709
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public void forPlayer(Player player) {
}

public void removePlayer(Player player) {
this.hasPlayers = false;
this.players.remove((CraftPlayer) player);
this.hasPlayers = !this.players.isEmpty();
}

public boolean isActive(Player player) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import javassist.NotFoundException;
import me.dueris.genesismc.GenesisMC;
import me.dueris.genesismc.content.OrbOfOrigins;
import me.dueris.genesismc.event.OrbInteractEvent;
Expand Down Expand Up @@ -170,9 +171,14 @@ public void onOrbClick(PlayerInteractEvent e) {
if (!((CraftPlayer) p).getHandle().getAbilities().instabuild) {
Util.consumeItem(e.getItem());
}
for (Layer layer : CraftApoli.getLayersFromRegistry()) {
CraftApoli.getLayersFromRegistry().forEach(layer -> {
try {
PowerHolderComponent.unassignPowers(p, layer);
} catch (NotFoundException ee) {
throw new RuntimeException(ee);
}
PowerHolderComponent.setOrigin(p, layer, CraftApoli.emptyOrigin());
}
});
OrbInteractEvent event = new OrbInteractEvent(p);
getServer().getPluginManager().callEvent(event);
}
Expand Down

0 comments on commit 0893709

Please sign in to comment.