Skip to content

Commit

Permalink
Removed warp sign for players who leave a team or are kicked.
Browse files Browse the repository at this point in the history
Fixes #67
  • Loading branch information
tastybento committed Jan 15, 2020
1 parent a51930f commit ef523d4
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
import org.bukkit.event.block.SignChangeEvent;

import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.events.team.TeamEvent.TeamKickEvent;
import world.bentobox.bentobox.api.events.team.TeamEvent.TeamLeaveEvent;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.util.Util;
import world.bentobox.warps.Warp;
Expand All @@ -42,6 +44,20 @@ public WarpSignsListener(Warp addon) {
this.plugin = addon.getPlugin();
}

@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerLeave(TeamLeaveEvent e) {
// Remove any warp signs from this game mode
addon.getWarpSignsManager().removeWarp(e.getIsland().getWorld(), e.getPlayerUUID());
User.getInstance(e.getPlayerUUID()).sendMessage("warps.deactivate");
}

@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerLeave(TeamKickEvent e) {
// Remove any warp signs from this game mode
addon.getWarpSignsManager().removeWarp(e.getIsland().getWorld(), e.getPlayerUUID());
User.getInstance(e.getPlayerUUID()).sendMessage("warps.deactivate");
}

/**
* Checks to see if a sign has been broken
* @param e - event
Expand Down

0 comments on commit ef523d4

Please sign in to comment.