Unifying, simplifying and messing around with land claiming and the related costs.
This commit is contained in:
@ -13,7 +13,7 @@ public abstract class FactionsEventAbstractSender extends MCoreEvent
|
||||
|
||||
private final CommandSender sender;
|
||||
public CommandSender getSender() { return this.sender; }
|
||||
public UPlayer getFSender() { return UPlayer.get(this.sender); }
|
||||
public UPlayer getUSender() { return this.sender == null ? null : UPlayer.get(this.sender); }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
|
@ -0,0 +1,59 @@
|
||||
package com.massivecraft.factions.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.massivecraft.factions.entity.BoardColls;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.mcore.ps.PS;
|
||||
|
||||
public class FactionsEventChunkChange extends FactionsEventAbstractSender
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// REQUIRED EVENT CODE
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@Override public HandlerList getHandlers() { return handlers; }
|
||||
public static HandlerList getHandlerList() { return handlers; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final PS chunk;
|
||||
public PS getChunk() { return this.chunk; }
|
||||
|
||||
private final Faction newFaction;
|
||||
public Faction getNewFaction() { return this.newFaction; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public FactionsEventChunkChange(CommandSender sender, PS chunk, Faction newFaction)
|
||||
{
|
||||
super(sender);
|
||||
this.chunk = chunk.getChunk(true);
|
||||
this.newFaction = newFaction;
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// UTIL
|
||||
// -------------------------------------------- //
|
||||
|
||||
public FactionsEventChunkChangeType getType()
|
||||
{
|
||||
Faction currentFaction = BoardColls.get().getFactionAt(chunk);
|
||||
|
||||
if (currentFaction.isNone()) return FactionsEventChunkChangeType.BUY;
|
||||
if (newFaction.isNormal()) return FactionsEventChunkChangeType.CONQUER;
|
||||
|
||||
UPlayer usender = this.getUSender();
|
||||
if (usender != null && usender.getFaction() == currentFaction) return FactionsEventChunkChangeType.SELL;
|
||||
|
||||
return FactionsEventChunkChangeType.PILLAGE;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.massivecraft.factions.event;
|
||||
|
||||
public enum FactionsEventChunkChangeType
|
||||
{
|
||||
BUY,
|
||||
SELL,
|
||||
CONQUER,
|
||||
PILLAGE,
|
||||
;
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package com.massivecraft.factions.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.mcore.ps.PS;
|
||||
|
||||
public class FactionsEventLandClaim extends FactionsEventAbstractSender
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// REQUIRED EVENT CODE
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@Override public HandlerList getHandlers() { return handlers; }
|
||||
public static HandlerList getHandlerList() { return handlers; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final Faction faction;
|
||||
public Faction getFaction() { return this.faction; }
|
||||
|
||||
private final PS chunk;
|
||||
public PS getChunk() { return this.chunk; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public FactionsEventLandClaim(CommandSender sender, Faction faction, PS chunk)
|
||||
{
|
||||
super(sender);
|
||||
this.faction = faction;
|
||||
this.chunk = chunk.getChunk(true);
|
||||
}
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package com.massivecraft.factions.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.mcore.ps.PS;
|
||||
|
||||
public class FactionsEventLandUnclaim extends FactionsEventAbstractSender
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// REQUIRED EVENT CODE
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@Override public HandlerList getHandlers() { return handlers; }
|
||||
public static HandlerList getHandlerList() { return handlers; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final Faction faction;
|
||||
public Faction getFaction() { return this.faction; }
|
||||
|
||||
private final PS chunk;
|
||||
public PS getChunk() { return this.chunk; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public FactionsEventLandUnclaim(CommandSender sender, Faction faction, PS chunk)
|
||||
{
|
||||
super(sender);
|
||||
this.chunk = chunk.getChunk(true);
|
||||
this.faction = faction;
|
||||
}
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
package com.massivecraft.factions.event;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
|
||||
public class FactionsEventLandUnclaimAll extends FactionsEventAbstractSender
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// REQUIRED EVENT CODE
|
||||
// -------------------------------------------- //
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
@Override public HandlerList getHandlers() { return handlers; }
|
||||
public static HandlerList getHandlerList() { return handlers; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// FIELDS
|
||||
// -------------------------------------------- //
|
||||
|
||||
private final Faction faction;
|
||||
public Faction getFaction() { return this.faction; }
|
||||
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public FactionsEventLandUnclaimAll(CommandSender sender, Faction faction)
|
||||
{
|
||||
super(sender);
|
||||
this.faction = faction;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user