a bit of cleanup
This commit is contained in:
parent
a53a556594
commit
28269b7455
@ -55,8 +55,8 @@ public class CmdDisband extends FCommand
|
|||||||
|
|
||||||
// Send FPlayerLeaveEvent for each player in the faction
|
// Send FPlayerLeaveEvent for each player in the faction
|
||||||
for ( FPlayer fplayer : faction.getFPlayers() )
|
for ( FPlayer fplayer : faction.getFPlayers() )
|
||||||
{
|
{
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new FPlayerLeaveEvent(fplayer, faction, FPlayerLeaveEvent.PlayerLeaveReason.DISBAND));
|
Bukkit.getServer().getPluginManager().callEvent(new FPlayerLeaveEvent(fplayer, faction, FPlayerLeaveEvent.PlayerLeaveReason.DISBAND));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Inform all players
|
// Inform all players
|
||||||
|
@ -79,13 +79,13 @@ public class CmdJoin 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 (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));
|
|
||||||
|
|
||||||
// trigger the join event (cancellable)
|
// trigger the join event (cancellable)
|
||||||
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.i.get(me),faction,FPlayerJoinEvent.PlayerJoinReason.COMMAND);
|
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.i.get(me),faction,FPlayerJoinEvent.PlayerJoinReason.COMMAND);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
|
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
|
||||||
if (joinEvent.isCancelled()) return;
|
if (joinEvent.isCancelled()) return;
|
||||||
|
|
||||||
|
fme.msg("<i>%s successfully joined %s.", fplayer.describeTo(fme, true), faction.getTag(fme));
|
||||||
|
|
||||||
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));
|
||||||
|
@ -68,13 +68,12 @@ public class CmdLeader extends FCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
|
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
|
||||||
// (only possibly triggered by console)
|
|
||||||
if (newLeader.getFaction() != targetFaction)
|
if (newLeader.getFaction() != targetFaction)
|
||||||
{
|
{
|
||||||
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.i.get(me),targetFaction,FPlayerJoinEvent.PlayerJoinReason.LEADER);
|
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.i.get(me),targetFaction,FPlayerJoinEvent.PlayerJoinReason.LEADER);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) return;
|
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)
|
||||||
|
@ -51,15 +51,15 @@ public class CmdTag extends FCommand
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// trigger the faction rename event (cancellable)
|
// trigger the faction rename event (cancellable)
|
||||||
FactionRenameEvent renameEvent = new FactionRenameEvent(fme, tag);
|
FactionRenameEvent renameEvent = new FactionRenameEvent(fme, tag);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(renameEvent);
|
Bukkit.getServer().getPluginManager().callEvent(renameEvent);
|
||||||
if(renameEvent.isCancelled()) return;
|
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
|
||||||
|
@ -58,9 +58,9 @@ public abstract class FRelationCommand extends FCommand
|
|||||||
// if the relation change was successful
|
// if the relation change was successful
|
||||||
if (targetRelation == currentRelation)
|
if (targetRelation == currentRelation)
|
||||||
{
|
{
|
||||||
// trigger the faction relation event
|
// trigger the faction relation event
|
||||||
FactionRelationEvent relationEvent = new FactionRelationEvent(myFaction, them, oldRelation, currentRelation);
|
FactionRelationEvent relationEvent = new FactionRelationEvent(myFaction, them, oldRelation, currentRelation);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(relationEvent);
|
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());
|
||||||
|
Loading…
Reference in New Issue
Block a user