Skip to content

Commit

Permalink
Add whitelist and spectate OP overrides
Browse files Browse the repository at this point in the history
Signed-off-by: Pugzy <[email protected]>
  • Loading branch information
Pugzy authored and Pablete1234 committed Jan 31, 2023
1 parent 328e7a4 commit cc3e489
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/java/dev/pgm/events/listeners/PlayerJoinListen.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ public void beforeLogin(PlayerLoginEvent event) {
// check if the player is on one of the teams
if (playerTeam.isPresent()) {
Team team = playerTeam.get();
if (!isFull(team)) return;

// team is full -- lets kick this mad lad
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Your team is full!");
if (isFull(team)) {
// team is full -- lets kick this mad lad
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Your team is full!");
} else {
event.allow();
}
return;
}

Expand All @@ -71,7 +74,8 @@ public void beforeLogin(PlayerLoginEvent event) {

@EventHandler(priority = EventPriority.HIGH)
public void vanish(PlayerJoinEvent event) {
if (event.getPlayer().hasPermission("events.spectate.vanish")
if (!event.getPlayer().isOp()
&& event.getPlayer().hasPermission("events.spectate.vanish")
&& !manager.playerTeam(event.getPlayer().getUniqueId()).isPresent())
PGM.get()
.getVanishManager()
Expand Down

0 comments on commit cc3e489

Please sign in to comment.