Refactor to maven standard layout (#270)
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
package me.ryanhamshire.GriefPrevention.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when GP is about to deliver claim blocks to a player (~every 10 minutes)
|
||||
*
|
||||
* @author RoboMWM
|
||||
* 11/15/2016.
|
||||
*/
|
||||
public class AccrueClaimBlocksEvent extends Event
|
||||
{
|
||||
// Custom Event Requirements
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
private Player player;
|
||||
private int blocksToAccrue;
|
||||
private boolean isIdle = false;
|
||||
private boolean cancelled = false;
|
||||
|
||||
/**
|
||||
* @param player Player receiving accruals
|
||||
* @param blocksToAccrue Blocks to accrue
|
||||
*
|
||||
* @deprecated Use {@link #AccrueClaimBlocksEvent(Player, int, boolean)} instead
|
||||
*/
|
||||
public AccrueClaimBlocksEvent(Player player, int blocksToAccrue)
|
||||
{
|
||||
this.player = player;
|
||||
this.blocksToAccrue = blocksToAccrue / 6;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player Player receiving accruals
|
||||
* @param blocksToAccrue Blocks to accrue
|
||||
* @param isIdle Whether player is detected as idle
|
||||
*/
|
||||
public AccrueClaimBlocksEvent(Player player, int blocksToAccrue, boolean isIdle)
|
||||
{
|
||||
this.player = player;
|
||||
this.blocksToAccrue = blocksToAccrue / 6;
|
||||
this.isIdle = isIdle;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return this.player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return amount of claim blocks GP will deliver to the player for this 10 minute interval
|
||||
*/
|
||||
public int getBlocksToAccrue()
|
||||
{
|
||||
return this.blocksToAccrue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether the player was detected as idle (used for idle accrual percentage)
|
||||
*/
|
||||
public boolean isIdle() {
|
||||
return this.isIdle;
|
||||
}
|
||||
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the amount of claim blocks to deliver to the player for this 10 minute interval
|
||||
* @param blocksToAccrue blocks to deliver
|
||||
*/
|
||||
public void setBlocksToAccrue(int blocksToAccrue)
|
||||
{
|
||||
this.blocksToAccrue = blocksToAccrue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to setBlocksToAccrue(int), but automatically converting from a per-hour rate value to a 10-minute rate value
|
||||
* @param blocksToAccruePerHour the per-hour rate of blocks to deliver
|
||||
*/
|
||||
|
||||
public void setBlocksToAccruePerHour(int blocksToAccruePerHour)
|
||||
{
|
||||
this.blocksToAccrue = blocksToAccruePerHour / 6;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel)
|
||||
{
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package me.ryanhamshire.GriefPrevention.events;
|
||||
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* This event gets called whenever a claim is going to be deleted. This event is
|
||||
* not called when a claim is resized.
|
||||
*
|
||||
* @author Tux2
|
||||
*
|
||||
*/
|
||||
public class ClaimDeletedEvent extends Event{
|
||||
|
||||
// Custom Event Requirements
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
private Claim claim;
|
||||
|
||||
public ClaimDeletedEvent(Claim claim) {
|
||||
this.claim = claim;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the claim to be deleted.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Claim getClaim() {
|
||||
return claim;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package me.ryanhamshire.GriefPrevention.events;
|
||||
|
||||
import me.ryanhamshire.GriefPrevention.Messages;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Called when GP is retrieving the denial message to send to the player when canceling an action
|
||||
*
|
||||
* @author RoboMWM
|
||||
* Created 1/4/2017.
|
||||
*/
|
||||
public class DeniedMessageEvent extends Event
|
||||
{
|
||||
// Custom Event Requirements
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
private String message;
|
||||
private Messages messageID;
|
||||
|
||||
public DeniedMessageEvent(Messages messageID, String message)
|
||||
{
|
||||
this.message = message;
|
||||
this.messageID = messageID;
|
||||
}
|
||||
|
||||
public Messages getMessageID()
|
||||
{
|
||||
return this.messageID;
|
||||
}
|
||||
|
||||
public String getMessage()
|
||||
{
|
||||
return this.message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message to print to the player.
|
||||
* @param message Cannot be null. Set to an empty string if you wish for no message to be printed.
|
||||
*/
|
||||
public void setMessage(@Nonnull String message)
|
||||
{
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package me.ryanhamshire.GriefPrevention.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Called when GP is about to kick or ban a player
|
||||
*
|
||||
* @author BillyGalbreath
|
||||
* 03/10/2017.
|
||||
*/
|
||||
public class PlayerKickBanEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
private Player player;
|
||||
private String reason;
|
||||
private String source;
|
||||
private boolean ban;
|
||||
private boolean cancelled = false;
|
||||
|
||||
/**
|
||||
* @param player Player getting kicked and/or banned
|
||||
* @param reason Reason message for kick/ban
|
||||
* @param source What caused the kick/ban
|
||||
* @param ban True if player is getting banned
|
||||
*/
|
||||
public PlayerKickBanEvent(Player player, String reason, String source, boolean ban)
|
||||
{
|
||||
this.player = player;
|
||||
this.reason = reason;
|
||||
this.source = source;
|
||||
this.ban = ban;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return player getting kicked/banned
|
||||
*/
|
||||
public Player getPlayer()
|
||||
{
|
||||
return this.player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return reason player is getting kicked/banned
|
||||
*/
|
||||
public String getReason()
|
||||
{
|
||||
return this.reason;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return source that is kicking/banning the player
|
||||
*/
|
||||
public String getSource()
|
||||
{
|
||||
return this.source;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return is player getting banned
|
||||
*/
|
||||
public boolean getBan()
|
||||
{
|
||||
return this.ban;
|
||||
}
|
||||
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancel)
|
||||
{
|
||||
this.cancelled = cancel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package me.ryanhamshire.GriefPrevention.events;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
|
||||
//if cancelled, GriefPrevention will allow a block to be broken which it would not have otherwise
|
||||
public class PreventBlockBreakEvent extends Event implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled = false;
|
||||
private BlockBreakEvent innerEvent;
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public PreventBlockBreakEvent(BlockBreakEvent innerEvent)
|
||||
{
|
||||
this.innerEvent = innerEvent;
|
||||
}
|
||||
|
||||
public BlockBreakEvent getInnerEvent()
|
||||
{
|
||||
return this.innerEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled)
|
||||
{
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
}
|
||||
@@ -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, GriefPrevention will not cancel the PvP event it's processing.
|
||||
public class PreventPvPEvent extends Event implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled = false;
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
Claim claim;
|
||||
|
||||
public PreventPvPEvent(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;
|
||||
}
|
||||
}
|
||||
@@ -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, GriefPrevention will not protect items dropped by a player on death
|
||||
public class ProtectDeathDropsEvent extends Event implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled = false;
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
Claim claim;
|
||||
|
||||
public ProtectDeathDropsEvent(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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package me.ryanhamshire.GriefPrevention.events;
|
||||
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
//if destination field is set, then GriefPrevention will send the player to that location instead of searching for one
|
||||
public class SaveTrappedPlayerEvent extends Event implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled = false;
|
||||
private Location destination = null;
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
Claim claim;
|
||||
|
||||
public SaveTrappedPlayerEvent(Claim claim)
|
||||
{
|
||||
this.claim = claim;
|
||||
}
|
||||
|
||||
public Location getDestination()
|
||||
{
|
||||
return destination;
|
||||
}
|
||||
|
||||
public void setDestination(Location destination)
|
||||
{
|
||||
this.destination = destination;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package me.ryanhamshire.GriefPrevention.events;
|
||||
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
/**
|
||||
* Called when GriefPrevention is sending claim visuals to a player
|
||||
*/
|
||||
public class VisualizationEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Collection<Claim> claims;
|
||||
private final boolean showSubdivides;
|
||||
|
||||
/**
|
||||
* New visualization being sent to player
|
||||
*
|
||||
* @param player Player receiving visuals
|
||||
* @param claim The claim being visualized (with subdivides), or null if visuals being removed
|
||||
*/
|
||||
public VisualizationEvent(Player player, Claim claim) {
|
||||
super(player);
|
||||
this.claims = Collections.singleton(claim);
|
||||
this.showSubdivides = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* New visualization being sent to player
|
||||
*
|
||||
* @param player Player receiving visuals
|
||||
* @param claims Claims being visualized (without subdivides)
|
||||
*/
|
||||
public VisualizationEvent(Player player, Collection<Claim> claims) {
|
||||
super(player);
|
||||
this.claims = claims;
|
||||
this.showSubdivides = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the claims being visualized, or null if visualization being removed
|
||||
*
|
||||
* @return Claims being visualized
|
||||
*/
|
||||
public Collection<Claim> getClaims() {
|
||||
return claims;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if subdivide claims are being shown
|
||||
*
|
||||
* @return True if subdivide claims are being shown
|
||||
*/
|
||||
public boolean showSubdivides() {
|
||||
return showSubdivides;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @author Ryan
|
||||
*
|
||||
*/
|
||||
package me.ryanhamshire.GriefPrevention.events;
|
||||
Reference in New Issue
Block a user