Make LandUnclaimAllEvent Cancellable
This commit is contained in:
parent
3733539077
commit
3c2e51e8ed
@ -44,7 +44,9 @@ public class CmdUnclaimall extends FCommand {
|
|||||||
|
|
||||||
LandUnclaimAllEvent unclaimAllEvent = new LandUnclaimAllEvent(myFaction, fme);
|
LandUnclaimAllEvent unclaimAllEvent = new LandUnclaimAllEvent(myFaction, fme);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(unclaimAllEvent);
|
Bukkit.getServer().getPluginManager().callEvent(unclaimAllEvent);
|
||||||
// this event cannot be cancelled
|
if (unclaimAllEvent.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Board.getInstance().unclaimAll(myFaction.getId());
|
Board.getInstance().unclaimAll(myFaction.getId());
|
||||||
myFaction.msg(TL.COMMAND_UNCLAIMALL_UNCLAIMED, fme.describeTo(myFaction, true));
|
myFaction.msg(TL.COMMAND_UNCLAIMALL_UNCLAIMED, fme.describeTo(myFaction, true));
|
||||||
|
@ -3,8 +3,10 @@ package com.massivecraft.factions.event;
|
|||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
|
||||||
public class LandUnclaimAllEvent extends FactionPlayerEvent {
|
public class LandUnclaimAllEvent extends FactionPlayerEvent implements Cancellable {
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
public LandUnclaimAllEvent(Faction f, FPlayer p) {
|
public LandUnclaimAllEvent(Faction f, FPlayer p) {
|
||||||
super(f, p);
|
super(f, p);
|
||||||
@ -45,4 +47,14 @@ public class LandUnclaimAllEvent extends FactionPlayerEvent {
|
|||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return getfPlayer().getPlayer();
|
return getfPlayer().getPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled() {
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean cancelled) {
|
||||||
|
this.cancelled = cancelled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user