Merge pull request #103 from donington/CustomFactionEvents
Custom faction events
This commit is contained in:
commit
a53a556594
@ -82,10 +82,10 @@ public class Board
|
|||||||
Entry<FLocation, String> entry = iter.next();
|
Entry<FLocation, String> entry = iter.next();
|
||||||
if (entry.getValue().equals(factionId))
|
if (entry.getValue().equals(factionId))
|
||||||
{
|
{
|
||||||
if(Conf.onUnclaimResetLwcLocks && LWCFeatures.getEnabled())
|
if(Conf.onUnclaimResetLwcLocks && LWCFeatures.getEnabled())
|
||||||
LWCFeatures.clearAllChests(entry.getKey());
|
LWCFeatures.clearAllChests(entry.getKey());
|
||||||
|
|
||||||
iter.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,13 @@ package com.massivecraft.factions;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
||||||
|
import com.massivecraft.factions.event.LandClaimEvent;
|
||||||
import com.massivecraft.factions.iface.EconomyParticipator;
|
import com.massivecraft.factions.iface.EconomyParticipator;
|
||||||
import com.massivecraft.factions.iface.RelationParticipator;
|
import com.massivecraft.factions.iface.RelationParticipator;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
@ -507,7 +510,11 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
|||||||
double cost = Conf.econCostLeave;
|
double cost = Conf.econCostLeave;
|
||||||
if ( ! Econ.modifyMoney(this, -cost, "to leave your faction.", "for leaving your faction.")) return;
|
if ( ! Econ.modifyMoney(this, -cost, "to leave your faction.", "for leaving your faction.")) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FPlayerLeaveEvent leaveEvent = new FPlayerLeaveEvent(this,myFaction,FPlayerLeaveEvent.PlayerLeaveReason.LEAVE);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(leaveEvent);
|
||||||
|
if (leaveEvent.isCancelled()) return;
|
||||||
|
|
||||||
// Am I the last one in the faction?
|
// Am I the last one in the faction?
|
||||||
if (myFaction.getFPlayers().size() == 1)
|
if (myFaction.getFPlayers().size() == 1)
|
||||||
{
|
{
|
||||||
@ -654,7 +661,11 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
|||||||
if ( ! Econ.modifyMoney(this, -cost, "to claim this land", "for claiming this land")) return false;
|
if ( ! Econ.modifyMoney(this, -cost, "to claim this land", "for claiming this land")) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LandClaimEvent claimEvent = new LandClaimEvent(flocation, forFaction, this);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(claimEvent);
|
||||||
|
if(claimEvent.isCancelled()) return false;
|
||||||
|
|
||||||
if (LWCFeatures.getEnabled() && forFaction.isNormal() && Conf.onCaptureResetLwcLocks)
|
if (LWCFeatures.getEnabled() && forFaction.isNormal() && Conf.onCaptureResetLwcLocks)
|
||||||
LWCFeatures.clearOtherChests(flocation, this.getFaction());
|
LWCFeatures.clearOtherChests(flocation, this.getFaction());
|
||||||
|
|
||||||
|
@ -2,12 +2,16 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
import com.massivecraft.factions.P;
|
import com.massivecraft.factions.P;
|
||||||
|
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
||||||
|
import com.massivecraft.factions.event.FactionCreateEvent;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Rel;
|
import com.massivecraft.factions.struct.Rel;
|
||||||
|
|
||||||
@ -53,6 +57,11 @@ public class CmdCreate extends FCommand
|
|||||||
sendMessage(tagValidationErrors);
|
sendMessage(tagValidationErrors);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// trigger the faction creation event (cancellable)
|
||||||
|
FactionCreateEvent createEvent = new FactionCreateEvent(me, tag);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(createEvent);
|
||||||
|
if(createEvent.isCancelled()) return;
|
||||||
|
|
||||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||||
if ( ! payForCommand(Conf.econCostCreate, "to create a new faction", "for creating a new faction")) return;
|
if ( ! payForCommand(Conf.econCostCreate, "to create a new faction", "for creating a new faction")) return;
|
||||||
@ -66,7 +75,15 @@ public class CmdCreate extends FCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
faction.setTag(tag);
|
// finish setting up the Faction
|
||||||
|
faction.setTag(tag);
|
||||||
|
|
||||||
|
// trigger the faction join event for the creator
|
||||||
|
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.i.get(me),faction,FPlayerJoinEvent.PlayerJoinReason.CREATE);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
|
||||||
|
// join event cannot be cancelled or you'll have an empty faction
|
||||||
|
|
||||||
|
// finish setting up the FPlayer
|
||||||
fme.setRole(Rel.LEADER);
|
fme.setRole(Rel.LEADER);
|
||||||
fme.setFaction(faction);
|
fme.setFaction(faction);
|
||||||
|
|
||||||
|
@ -1,82 +1,96 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import org.bukkit.Bukkit;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
||||||
import com.massivecraft.factions.P;
|
import com.massivecraft.factions.event.FactionDisbandEvent;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.struct.FFlag;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.struct.FPerm;
|
import com.massivecraft.factions.P;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||||
public class CmdDisband extends FCommand
|
import com.massivecraft.factions.struct.FFlag;
|
||||||
{
|
import com.massivecraft.factions.struct.FPerm;
|
||||||
public CmdDisband()
|
import com.massivecraft.factions.struct.Permission;
|
||||||
{
|
|
||||||
super();
|
public class CmdDisband extends FCommand
|
||||||
this.aliases.add("disband");
|
{
|
||||||
|
public CmdDisband()
|
||||||
//this.requiredArgs.add("");
|
{
|
||||||
this.optionalArgs.put("faction", "your");
|
super();
|
||||||
|
this.aliases.add("disband");
|
||||||
this.permission = Permission.DISBAND.node;
|
|
||||||
this.disableOnLock = true;
|
//this.requiredArgs.add("");
|
||||||
|
this.optionalArgs.put("faction", "your");
|
||||||
senderMustBePlayer = false;
|
|
||||||
senderMustBeMember = false;
|
this.permission = Permission.DISBAND.node;
|
||||||
senderMustBeOfficer = false;
|
this.disableOnLock = true;
|
||||||
senderMustBeLeader = false;
|
|
||||||
}
|
senderMustBePlayer = false;
|
||||||
|
senderMustBeMember = false;
|
||||||
@Override
|
senderMustBeOfficer = false;
|
||||||
public void perform()
|
senderMustBeLeader = false;
|
||||||
{
|
}
|
||||||
// The faction, default to your own.. but null if console sender.
|
|
||||||
Faction faction = this.argAsFaction(0, fme == null ? null : myFaction);
|
@Override
|
||||||
if (faction == null) return;
|
public void perform()
|
||||||
|
{
|
||||||
if ( ! FPerm.DISBAND.has(sender, faction, true)) return;
|
// The faction, default to your own.. but null if console sender.
|
||||||
|
Faction faction = this.argAsFaction(0, fme == null ? null : myFaction);
|
||||||
if (faction.getFlag(FFlag.PERMANENT))
|
if (faction == null) return;
|
||||||
{
|
|
||||||
msg("<i>This faction is designated as permanent, so you cannot disband it.");
|
if ( ! FPerm.DISBAND.has(sender, faction, true)) return;
|
||||||
return;
|
|
||||||
}
|
if (faction.getFlag(FFlag.PERMANENT))
|
||||||
|
{
|
||||||
// Inform all players
|
msg("<i>This faction is designated as permanent, so you cannot disband it.");
|
||||||
for (FPlayer fplayer : FPlayers.i.getOnline())
|
return;
|
||||||
{
|
}
|
||||||
String who = senderIsConsole ? "A server admin" : fme.describeTo(fplayer);
|
|
||||||
if (fplayer.getFaction() == faction)
|
FactionDisbandEvent disbandEvent = new FactionDisbandEvent(me, faction.getId());
|
||||||
{
|
Bukkit.getServer().getPluginManager().callEvent(disbandEvent);
|
||||||
fplayer.msg("<h>%s<i> disbanded your faction.", who);
|
if(disbandEvent.isCancelled()) return;
|
||||||
}
|
|
||||||
else
|
// Send FPlayerLeaveEvent for each player in the faction
|
||||||
{
|
for ( FPlayer fplayer : faction.getFPlayers() )
|
||||||
fplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getTag(fplayer));
|
{
|
||||||
}
|
Bukkit.getServer().getPluginManager().callEvent(new FPlayerLeaveEvent(fplayer, faction, FPlayerLeaveEvent.PlayerLeaveReason.DISBAND));
|
||||||
}
|
}
|
||||||
if (Conf.logFactionDisband)
|
|
||||||
P.p.log("The faction "+faction.getTag()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+".");
|
// Inform all players
|
||||||
|
for (FPlayer fplayer : FPlayers.i.getOnline())
|
||||||
if (Econ.shouldBeUsed() && ! senderIsConsole)
|
{
|
||||||
{
|
String who = senderIsConsole ? "A server admin" : fme.describeTo(fplayer);
|
||||||
//Give all the faction's money to the disbander
|
if (fplayer.getFaction() == faction)
|
||||||
double amount = Econ.getBalance(faction.getAccountId());
|
{
|
||||||
Econ.transferMoney(fme, faction, fme, amount, false);
|
fplayer.msg("<h>%s<i> disbanded your faction.", who);
|
||||||
|
}
|
||||||
if (amount > 0.0)
|
else
|
||||||
{
|
{
|
||||||
String amountString = Econ.moneyString(amount);
|
fplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getTag(fplayer));
|
||||||
msg("<i>You have been given the disbanded faction's bank, totaling %s.", amountString);
|
}
|
||||||
P.p.log(fme.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getTag()+".");
|
}
|
||||||
}
|
if (Conf.logFactionDisband)
|
||||||
}
|
P.p.log("The faction "+faction.getTag()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+".");
|
||||||
|
|
||||||
faction.detach();
|
if (Econ.shouldBeUsed() && ! senderIsConsole)
|
||||||
|
{
|
||||||
SpoutFeatures.updateAppearances();
|
//Give all the faction's money to the disbander
|
||||||
}
|
double amount = Econ.getBalance(faction.getAccountId());
|
||||||
}
|
Econ.transferMoney(fme, faction, fme, amount, false);
|
||||||
|
|
||||||
|
if (amount > 0.0)
|
||||||
|
{
|
||||||
|
String amountString = Econ.moneyString(amount);
|
||||||
|
msg("<i>You have been given the disbanded faction's bank, totaling %s.", amountString);
|
||||||
|
P.p.log(fme.getName() + " has been given bank holdings of "+amountString+" from disbanding "+faction.getTag()+".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
faction.detach();
|
||||||
|
|
||||||
|
SpoutFeatures.updateAppearances();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.P;
|
import com.massivecraft.factions.P;
|
||||||
|
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
|
|
||||||
public class CmdJoin extends FCommand
|
public class CmdJoin extends FCommand
|
||||||
@ -76,6 +80,12 @@ public class CmdJoin extends FCommand
|
|||||||
if (samePlayer && ! payForCommand(Conf.econCostJoin, "to join a faction", "for joining a faction")) return;
|
if (samePlayer && ! payForCommand(Conf.econCostJoin, "to join a faction", "for joining a faction")) return;
|
||||||
|
|
||||||
fme.msg("<i>%s successfully joined %s.", fplayer.describeTo(fme, true), faction.getTag(fme));
|
fme.msg("<i>%s successfully joined %s.", fplayer.describeTo(fme, true), faction.getTag(fme));
|
||||||
|
|
||||||
|
// trigger the join event (cancellable)
|
||||||
|
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.i.get(me),faction,FPlayerJoinEvent.PlayerJoinReason.COMMAND);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
|
||||||
|
if (joinEvent.isCancelled()) return;
|
||||||
|
|
||||||
if (!samePlayer)
|
if (!samePlayer)
|
||||||
fplayer.msg("<i>%s moved you into the faction %s.", fme.describeTo(fplayer, true), faction.getTag(fplayer));
|
fplayer.msg("<i>%s moved you into the faction %s.", fme.describeTo(fplayer, true), faction.getTag(fplayer));
|
||||||
faction.msg("<i>%s joined your faction.", fplayer.describeTo(faction, true));
|
faction.msg("<i>%s joined your faction.", fplayer.describeTo(faction, true));
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.P;
|
import com.massivecraft.factions.P;
|
||||||
|
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
||||||
import com.massivecraft.factions.struct.FPerm;
|
import com.massivecraft.factions.struct.FPerm;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Rel;
|
import com.massivecraft.factions.struct.Rel;
|
||||||
@ -60,6 +63,11 @@ public class CmdKick extends FCommand
|
|||||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||||
if ( ! payForCommand(Conf.econCostKick, "to kick someone from the faction", "for kicking someone from the faction")) return;
|
if ( ! payForCommand(Conf.econCostKick, "to kick someone from the faction", "for kicking someone from the faction")) return;
|
||||||
|
|
||||||
|
// trigger the leave event (cancellable) [reason:kicked]
|
||||||
|
FPlayerLeaveEvent event = new FPlayerLeaveEvent(you, you.getFaction(), FPlayerLeaveEvent.PlayerLeaveReason.KICKED);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
if (event.isCancelled()) return;
|
||||||
|
|
||||||
yourFaction.msg("%s<i> kicked %s<i> from the faction! :O", fme.describeTo(yourFaction, true), you.describeTo(yourFaction, true));
|
yourFaction.msg("%s<i> kicked %s<i> from the faction! :O", fme.describeTo(yourFaction, true), you.describeTo(yourFaction, true));
|
||||||
you.msg("%s<i> kicked you from %s<i>! :O", fme.describeTo(you, true), yourFaction.describeTo(you));
|
you.msg("%s<i> kicked you from %s<i>! :O", fme.describeTo(you, true), yourFaction.describeTo(you));
|
||||||
if (yourFaction != myFaction)
|
if (yourFaction != myFaction)
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.struct.Rel;
|
import com.massivecraft.factions.struct.Rel;
|
||||||
import com.massivecraft.factions.util.RelationUtil;
|
import com.massivecraft.factions.util.RelationUtil;
|
||||||
@ -63,7 +66,16 @@ public class CmdLeader extends FCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
|
||||||
|
// (only possibly triggered by console)
|
||||||
|
if (newLeader.getFaction() != targetFaction)
|
||||||
|
{
|
||||||
|
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.i.get(me),targetFaction,FPlayerJoinEvent.PlayerJoinReason.LEADER);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
if (event.isCancelled()) return;
|
||||||
|
}
|
||||||
|
|
||||||
// if target player is currently leader, demote and replace him
|
// if target player is currently leader, demote and replace him
|
||||||
if (targetFactionCurrentLeader == newLeader)
|
if (targetFactionCurrentLeader == newLeader)
|
||||||
{
|
{
|
||||||
|
@ -2,9 +2,12 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.Factions;
|
import com.massivecraft.factions.Factions;
|
||||||
|
import com.massivecraft.factions.event.FactionRenameEvent;
|
||||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.util.MiscUtil;
|
import com.massivecraft.factions.util.MiscUtil;
|
||||||
@ -39,7 +42,7 @@ public class CmdTag extends FCommand
|
|||||||
msg("<b>That tag is already taken");
|
msg("<b>That tag is already taken");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<String> errors = new ArrayList<String>();
|
ArrayList<String> errors = new ArrayList<String>();
|
||||||
errors.addAll(Factions.validateTag(tag));
|
errors.addAll(Factions.validateTag(tag));
|
||||||
if (errors.size() > 0)
|
if (errors.size() > 0)
|
||||||
@ -48,12 +51,17 @@ public class CmdTag extends FCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// trigger the faction rename event (cancellable)
|
||||||
|
FactionRenameEvent renameEvent = new FactionRenameEvent(fme, tag);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(renameEvent);
|
||||||
|
if(renameEvent.isCancelled()) return;
|
||||||
|
|
||||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||||
if ( ! payForCommand(Conf.econCostTag, "to change the faction tag", "for changing the faction tag")) return;
|
if ( ! payForCommand(Conf.econCostTag, "to change the faction tag", "for changing the faction tag")) return;
|
||||||
|
|
||||||
String oldtag = myFaction.getTag();
|
String oldtag = myFaction.getTag();
|
||||||
myFaction.setTag(tag);
|
myFaction.setTag(tag);
|
||||||
|
|
||||||
// Inform
|
// Inform
|
||||||
myFaction.msg("%s<i> changed your faction tag to %s", fme.describeTo(myFaction, true), myFaction.getTag(myFaction));
|
myFaction.msg("%s<i> changed your faction tag to %s", fme.describeTo(myFaction, true), myFaction.getTag(myFaction));
|
||||||
for (Faction faction : Factions.i.get())
|
for (Faction faction : Factions.i.get())
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import com.massivecraft.factions.Board;
|
import com.massivecraft.factions.Board;
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
|
import com.massivecraft.factions.event.LandUnclaimEvent;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
@ -36,7 +39,7 @@ public class CmdUnclaim extends FCommand
|
|||||||
Faction otherFaction = Board.getFactionAt(flocation);
|
Faction otherFaction = Board.getFactionAt(flocation);
|
||||||
|
|
||||||
if ( ! FPerm.TERRITORY.has(sender, otherFaction, true)) return;
|
if ( ! FPerm.TERRITORY.has(sender, otherFaction, true)) return;
|
||||||
|
|
||||||
//String moneyBack = "<i>";
|
//String moneyBack = "<i>";
|
||||||
if (Econ.shouldBeUsed())
|
if (Econ.shouldBeUsed())
|
||||||
{
|
{
|
||||||
@ -52,6 +55,10 @@ public class CmdUnclaim extends FCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LandUnclaimEvent unclaimEvent = new LandUnclaimEvent(flocation, otherFaction, fme);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(unclaimEvent);
|
||||||
|
if(unclaimEvent.isCancelled()) return;
|
||||||
|
|
||||||
Board.removeAt(flocation);
|
Board.removeAt(flocation);
|
||||||
SpoutFeatures.updateTerritoryDisplayLoc(flocation);
|
SpoutFeatures.updateTerritoryDisplayLoc(flocation);
|
||||||
myFaction.msg("%s<i> unclaimed some land.", fme.describeTo(myFaction, true));
|
myFaction.msg("%s<i> unclaimed some land.", fme.describeTo(myFaction, true));
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import com.massivecraft.factions.Board;
|
import com.massivecraft.factions.Board;
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.P;
|
import com.massivecraft.factions.P;
|
||||||
|
import com.massivecraft.factions.event.LandUnclaimAllEvent;
|
||||||
import com.massivecraft.factions.integration.Econ;
|
import com.massivecraft.factions.integration.Econ;
|
||||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
@ -42,6 +45,10 @@ public class CmdUnclaimall extends FCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LandUnclaimAllEvent unclaimAllEvent = new LandUnclaimAllEvent(myFaction, fme);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(unclaimAllEvent);
|
||||||
|
// this event cannot be cancelled
|
||||||
|
|
||||||
Board.unclaimAll(myFaction.getId());
|
Board.unclaimAll(myFaction.getId());
|
||||||
myFaction.msg("%s<i> unclaimed ALL of your faction's land.", fme.describeTo(myFaction, true));
|
myFaction.msg("%s<i> unclaimed ALL of your faction's land.", fme.describeTo(myFaction, true));
|
||||||
SpoutFeatures.updateTerritoryDisplayLoc(null);
|
SpoutFeatures.updateTerritoryDisplayLoc(null);
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.event.FactionRelationEvent;
|
||||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||||
import com.massivecraft.factions.struct.FFlag;
|
import com.massivecraft.factions.struct.FFlag;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
@ -47,13 +50,22 @@ public abstract class FRelationCommand extends FCommand
|
|||||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||||
if ( ! payForCommand(targetRelation.getRelationCost(), "to change a relation wish", "for changing a relation wish")) return;
|
if ( ! payForCommand(targetRelation.getRelationCost(), "to change a relation wish", "for changing a relation wish")) return;
|
||||||
|
|
||||||
|
// try to set the new relation
|
||||||
|
Rel oldRelation = myFaction.getRelationTo(them, true);
|
||||||
myFaction.setRelationWish(them, targetRelation);
|
myFaction.setRelationWish(them, targetRelation);
|
||||||
Rel currentRelation = myFaction.getRelationTo(them, true);
|
Rel currentRelation = myFaction.getRelationTo(them, true);
|
||||||
|
|
||||||
|
// if the relation change was successful
|
||||||
if (targetRelation == currentRelation)
|
if (targetRelation == currentRelation)
|
||||||
{
|
{
|
||||||
|
// trigger the faction relation event
|
||||||
|
FactionRelationEvent relationEvent = new FactionRelationEvent(myFaction, them, oldRelation, currentRelation);
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(relationEvent);
|
||||||
|
|
||||||
them.msg("%s<i> is now %s.", myFaction.describeTo(them, true), targetRelation.getDescFactionOne());
|
them.msg("%s<i> is now %s.", myFaction.describeTo(them, true), targetRelation.getDescFactionOne());
|
||||||
myFaction.msg("%s<i> is now %s.", them.describeTo(myFaction, true), targetRelation.getDescFactionOne());
|
myFaction.msg("%s<i> is now %s.", them.describeTo(myFaction, true), targetRelation.getDescFactionOne());
|
||||||
}
|
}
|
||||||
|
// inform the other faction of your request
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
them.msg("%s<i> wishes to be %s.", myFaction.describeTo(them, true), targetRelation.getColor()+targetRelation.getDescFactionOne());
|
them.msg("%s<i> wishes to be %s.", myFaction.describeTo(them, true), targetRelation.getColor()+targetRelation.getDescFactionOne());
|
||||||
@ -62,6 +74,7 @@ public abstract class FRelationCommand extends FCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: The ally case should work!!
|
// TODO: The ally case should work!!
|
||||||
|
// * this might have to be bumped up to make that happen, & allow ALLY,NEUTRAL only
|
||||||
if ( targetRelation != Rel.TRUCE && them.getFlag(FFlag.PEACEFUL))
|
if ( targetRelation != Rel.TRUCE && them.getFlag(FFlag.PEACEFUL))
|
||||||
{
|
{
|
||||||
them.msg("<i>This will have no effect while your faction is peaceful.");
|
them.msg("<i>This will have no effect while your faction is peaceful.");
|
||||||
|
60
src/com/massivecraft/factions/event/FPlayerJoinEvent.java
Normal file
60
src/com/massivecraft/factions/event/FPlayerJoinEvent.java
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
package com.massivecraft.factions.event;
|
||||||
|
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
|
||||||
|
public class FPlayerJoinEvent extends Event implements Cancellable
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
FPlayer fplayer;
|
||||||
|
Faction faction;
|
||||||
|
PlayerJoinReason reason;
|
||||||
|
boolean cancelled = false;
|
||||||
|
public enum PlayerJoinReason
|
||||||
|
{
|
||||||
|
CREATE, LEADER, COMMAND
|
||||||
|
}
|
||||||
|
public FPlayerJoinEvent(FPlayer fp, Faction f, PlayerJoinReason r)
|
||||||
|
{
|
||||||
|
fplayer = fp;
|
||||||
|
faction = f;
|
||||||
|
reason = r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FPlayer getFPlayer()
|
||||||
|
{
|
||||||
|
return fplayer;
|
||||||
|
}
|
||||||
|
public Faction getFaction()
|
||||||
|
{
|
||||||
|
return faction;
|
||||||
|
}
|
||||||
|
public PlayerJoinReason getReason()
|
||||||
|
{
|
||||||
|
return reason;
|
||||||
|
}
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled()
|
||||||
|
{
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean c)
|
||||||
|
{
|
||||||
|
cancelled = c;
|
||||||
|
}
|
||||||
|
}
|
71
src/com/massivecraft/factions/event/FPlayerLeaveEvent.java
Normal file
71
src/com/massivecraft/factions/event/FPlayerLeaveEvent.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package com.massivecraft.factions.event;
|
||||||
|
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
|
||||||
|
public class FPlayerLeaveEvent extends Event implements Cancellable
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private PlayerLeaveReason reason;
|
||||||
|
FPlayer FPlayer;
|
||||||
|
Faction Faction;
|
||||||
|
boolean cancelled = false;
|
||||||
|
|
||||||
|
public enum PlayerLeaveReason
|
||||||
|
{
|
||||||
|
KICKED, DISBAND, RESET, JOINOTHER, LEAVE
|
||||||
|
}
|
||||||
|
|
||||||
|
public FPlayerLeaveEvent(FPlayer p, Faction f, PlayerLeaveReason r)
|
||||||
|
{
|
||||||
|
FPlayer = p;
|
||||||
|
Faction = f;
|
||||||
|
reason = r;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerLeaveReason getReason()
|
||||||
|
{
|
||||||
|
return reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FPlayer getFPlayer()
|
||||||
|
{
|
||||||
|
return FPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Faction getFaction()
|
||||||
|
{
|
||||||
|
return Faction;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled()
|
||||||
|
{
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean c)
|
||||||
|
{
|
||||||
|
if (reason == PlayerLeaveReason.DISBAND || reason == PlayerLeaveReason.RESET)
|
||||||
|
{
|
||||||
|
cancelled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cancelled = c;
|
||||||
|
}
|
||||||
|
}
|
63
src/com/massivecraft/factions/event/FactionCreateEvent.java
Normal file
63
src/com/massivecraft/factions/event/FactionCreateEvent.java
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
package com.massivecraft.factions.event;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.FPlayers;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
|
public class FactionCreateEvent extends Event implements Cancellable
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private String factionTag;
|
||||||
|
private Player sender;
|
||||||
|
private boolean cancelled;
|
||||||
|
|
||||||
|
public FactionCreateEvent(Player sender, String tag)
|
||||||
|
{
|
||||||
|
this.factionTag = tag;
|
||||||
|
this.sender = sender;
|
||||||
|
this.cancelled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FPlayer getFPlayer()
|
||||||
|
{
|
||||||
|
return FPlayers.i.get(sender);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFactionId()
|
||||||
|
{
|
||||||
|
return Factions.i.getNextId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFactionTag()
|
||||||
|
{
|
||||||
|
return factionTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled()
|
||||||
|
{
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean c)
|
||||||
|
{
|
||||||
|
this.cancelled = c;
|
||||||
|
}
|
||||||
|
}
|
64
src/com/massivecraft/factions/event/FactionDisbandEvent.java
Normal file
64
src/com/massivecraft/factions/event/FactionDisbandEvent.java
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
package com.massivecraft.factions.event;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.FPlayers;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.Factions;
|
||||||
|
|
||||||
|
public class FactionDisbandEvent extends Event implements Cancellable
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private boolean cancelled;
|
||||||
|
private String id;
|
||||||
|
private Player sender;
|
||||||
|
|
||||||
|
public FactionDisbandEvent(Player sender, String factionId)
|
||||||
|
{
|
||||||
|
cancelled = false;
|
||||||
|
this.sender = sender;
|
||||||
|
this.id = factionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Faction getFaction()
|
||||||
|
{
|
||||||
|
return Factions.i.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FPlayer getFPlayer()
|
||||||
|
{
|
||||||
|
return FPlayers.i.get(sender);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer()
|
||||||
|
{
|
||||||
|
return sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled()
|
||||||
|
{
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean c)
|
||||||
|
{
|
||||||
|
cancelled = c;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.massivecraft.factions.event;
|
||||||
|
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.struct.Rel;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
|
||||||
|
|
||||||
|
public class FactionRelationEvent extends Event {
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private Faction fsender;
|
||||||
|
private Faction ftarget;
|
||||||
|
private Rel foldrel;
|
||||||
|
private Rel frel;
|
||||||
|
|
||||||
|
public FactionRelationEvent(Faction sender, Faction target, Rel oldrel, Rel rel)
|
||||||
|
{
|
||||||
|
fsender = sender;
|
||||||
|
ftarget = target;
|
||||||
|
foldrel = oldrel;
|
||||||
|
frel = rel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rel getOldRelation()
|
||||||
|
{
|
||||||
|
return foldrel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Rel getRelation()
|
||||||
|
{
|
||||||
|
return frel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Faction getFaction()
|
||||||
|
{
|
||||||
|
return fsender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Faction getTargetFaction()
|
||||||
|
{
|
||||||
|
return ftarget;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
73
src/com/massivecraft/factions/event/FactionRenameEvent.java
Normal file
73
src/com/massivecraft/factions/event/FactionRenameEvent.java
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
package com.massivecraft.factions.event;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
|
||||||
|
public class FactionRenameEvent extends Event implements Cancellable {
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private boolean cancelled;
|
||||||
|
private FPlayer fplayer;
|
||||||
|
private Faction faction;
|
||||||
|
private String tag;
|
||||||
|
|
||||||
|
public FactionRenameEvent(FPlayer sender, String newTag)
|
||||||
|
{
|
||||||
|
fplayer = sender;
|
||||||
|
faction = sender.getFaction();
|
||||||
|
tag = newTag;
|
||||||
|
this.cancelled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Faction getFaction()
|
||||||
|
{
|
||||||
|
return(faction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FPlayer getFPlayer()
|
||||||
|
{
|
||||||
|
return(fplayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer()
|
||||||
|
{
|
||||||
|
return(fplayer.getPlayer());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOldFactionTag()
|
||||||
|
{
|
||||||
|
return(faction.getTag());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFactionTag()
|
||||||
|
{
|
||||||
|
return(tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled()
|
||||||
|
{
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean c)
|
||||||
|
{
|
||||||
|
this.cancelled = c;
|
||||||
|
}
|
||||||
|
}
|
81
src/com/massivecraft/factions/event/LandClaimEvent.java
Normal file
81
src/com/massivecraft/factions/event/LandClaimEvent.java
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
package com.massivecraft.factions.event;
|
||||||
|
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.FLocation;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class LandClaimEvent extends Event implements Cancellable
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private boolean cancelled;
|
||||||
|
private FLocation location;
|
||||||
|
private Faction faction;
|
||||||
|
private FPlayer fplayer;
|
||||||
|
|
||||||
|
public LandClaimEvent(FLocation loc, Faction f, FPlayer p)
|
||||||
|
{
|
||||||
|
cancelled = false;
|
||||||
|
location = loc;
|
||||||
|
faction = f;
|
||||||
|
fplayer = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FLocation getLocation()
|
||||||
|
{
|
||||||
|
return this.location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Faction getFaction()
|
||||||
|
{
|
||||||
|
return faction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFactionId()
|
||||||
|
{
|
||||||
|
return faction.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFactionTag()
|
||||||
|
{
|
||||||
|
return faction.getTag();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FPlayer getFPlayer()
|
||||||
|
{
|
||||||
|
return fplayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer()
|
||||||
|
{
|
||||||
|
return fplayer.getPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled()
|
||||||
|
{
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean c)
|
||||||
|
{
|
||||||
|
this.cancelled = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
68
src/com/massivecraft/factions/event/LandUnclaimAllEvent.java
Executable file
68
src/com/massivecraft/factions/event/LandUnclaimAllEvent.java
Executable file
@ -0,0 +1,68 @@
|
|||||||
|
package com.massivecraft.factions.event;
|
||||||
|
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
//import com.massivecraft.factions.FLocation;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class LandUnclaimAllEvent extends Event
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
// Location is commented out because there is no clean way to hook currently.
|
||||||
|
// faction and fplayer should be enough to filter needed information.
|
||||||
|
// private FLocation[] location;
|
||||||
|
private Faction faction;
|
||||||
|
private FPlayer fplayer;
|
||||||
|
|
||||||
|
public LandUnclaimAllEvent(Faction f, FPlayer p)
|
||||||
|
{
|
||||||
|
faction = f;
|
||||||
|
fplayer = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public FLocation getLocation()
|
||||||
|
{
|
||||||
|
return this.location;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Faction getFaction()
|
||||||
|
{
|
||||||
|
return faction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFactionId()
|
||||||
|
{
|
||||||
|
return faction.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFactionTag()
|
||||||
|
{
|
||||||
|
return faction.getTag();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FPlayer getFPlayer()
|
||||||
|
{
|
||||||
|
return fplayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer()
|
||||||
|
{
|
||||||
|
return fplayer.getPlayer();
|
||||||
|
}
|
||||||
|
}
|
79
src/com/massivecraft/factions/event/LandUnclaimEvent.java
Normal file
79
src/com/massivecraft/factions/event/LandUnclaimEvent.java
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
package com.massivecraft.factions.event;
|
||||||
|
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.FLocation;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class LandUnclaimEvent extends Event implements Cancellable
|
||||||
|
{
|
||||||
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
|
||||||
|
private boolean cancelled;
|
||||||
|
private FLocation location;
|
||||||
|
private Faction faction;
|
||||||
|
private FPlayer fplayer;
|
||||||
|
|
||||||
|
public LandUnclaimEvent(FLocation loc, Faction f, FPlayer p)
|
||||||
|
{
|
||||||
|
cancelled = false;
|
||||||
|
location = loc;
|
||||||
|
faction = f;
|
||||||
|
fplayer = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HandlerList getHandlers()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList()
|
||||||
|
{
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FLocation getLocation()
|
||||||
|
{
|
||||||
|
return this.location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Faction getFaction()
|
||||||
|
{
|
||||||
|
return faction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFactionId()
|
||||||
|
{
|
||||||
|
return faction.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFactionTag()
|
||||||
|
{
|
||||||
|
return faction.getTag();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FPlayer getFPlayer()
|
||||||
|
{
|
||||||
|
return fplayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer()
|
||||||
|
{
|
||||||
|
return fplayer.getPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCancelled()
|
||||||
|
{
|
||||||
|
return cancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCancelled(boolean c) {
|
||||||
|
cancelled = c;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user