API: Claim expiration event.
Cancellable, with GPFlags in mind.
This commit is contained in:
parent
4406b83bc1
commit
32cc947fe4
|
|
@ -21,6 +21,10 @@
|
|||
import java.util.Calendar;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import me.ryanhamshire.GriefPrevention.events.ClaimExpirationEvent;
|
||||
|
||||
class CleanupUnusedClaimTask implements Runnable
|
||||
{
|
||||
Claim claim;
|
||||
|
|
@ -35,6 +39,11 @@ class CleanupUnusedClaimTask implements Runnable
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
//see if any other plugins don't want this claim deleted
|
||||
ClaimExpirationEvent event = new ClaimExpirationEvent(this.claim);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if(event.isCancelled()) return;
|
||||
|
||||
//determine area of the default chest claim
|
||||
int areaOfDefaultClaim = 0;
|
||||
if(GriefPrevention.instance.config_claims_automaticClaimsForNewPlayersRadius >= 0)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package me.ryanhamshire.GriefPrevention.events;
|
||||
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
//if cancelled, the claim will not be deleted
|
||||
public class ClaimExpirationEvent extends Event implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled = false;
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
Claim claim;
|
||||
|
||||
public ClaimExpirationEvent(Claim claim)
|
||||
{
|
||||
this.claim = claim;
|
||||
}
|
||||
|
||||
public Claim getClaim()
|
||||
{
|
||||
return this.claim;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled)
|
||||
{
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user