This commit is contained in:
drtshock
2014-07-01 15:10:18 -05:00
parent 5066934a95
commit 8a6a97cc90
110 changed files with 3131 additions and 1228 deletions

View File

@@ -12,23 +12,32 @@ import org.bukkit.Bukkit;
public class CmdKick extends FCommand {
public CmdKick() {
super(); this.aliases.add("kick");
super();
this.aliases.add("kick");
this.requiredArgs.add("player name");
//this.optionalArgs.put("", "");
this.permission = Permission.KICK.node; this.disableOnLock = false;
this.permission = Permission.KICK.node;
this.disableOnLock = false;
senderMustBePlayer = true; senderMustBeMember = false; senderMustBeModerator = true; senderMustBeAdmin = false;
senderMustBePlayer = true;
senderMustBeMember = false;
senderMustBeModerator = true;
senderMustBeAdmin = false;
}
@Override
public void perform() {
FPlayer you = this.argAsBestFPlayerMatch(0); if (you == null) { return; }
FPlayer you = this.argAsBestFPlayerMatch(0);
if (you == null) {
return;
}
if (fme == you) {
msg("<b>You cannot kick yourself.");
msg("<i>You might want to: %s", p.cmdBase.cmdLeave.getUseageTemplate(false)); return;
msg("<i>You might want to: %s", p.cmdBase.cmdLeave.getUseageTemplate(false));
return;
}
Faction yourFaction = you.getFaction();
@@ -36,25 +45,33 @@ public class CmdKick extends FCommand {
// players with admin-level "disband" permission can bypass these requirements
if (!Permission.KICK_ANY.has(sender)) {
if (yourFaction != myFaction) {
msg("%s<b> is not a member of %s", you.describeTo(fme, true), myFaction.describeTo(fme)); return;
msg("%s<b> is not a member of %s", you.describeTo(fme, true), myFaction.describeTo(fme));
return;
}
if (you.getRole().value >= fme.getRole().value) {
// TODO add more informative messages.
msg("<b>Your rank is too low to kick this player."); return;
msg("<b>Your rank is too low to kick this player.");
return;
}
if (!Conf.canLeaveWithNegativePower && you.getPower() < 0) {
msg("<b>You cannot kick that member until their power is positive."); return;
msg("<b>You cannot kick that member until their power is positive.");
return;
}
}
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
if (!canAffordCommand(Conf.econCostKick, "to kick someone from the faction")) { return; }
if (!canAffordCommand(Conf.econCostKick, "to kick 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; }
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
// then make 'em pay (if applicable)
if (!payForCommand(Conf.econCostKick, "to kick someone from the faction", "for kicking someone from the faction")) {
@@ -71,9 +88,12 @@ public class CmdKick extends FCommand {
P.p.log((senderIsConsole ? "A console command" : fme.getName()) + " kicked " + you.getName() + " from the faction: " + yourFaction.getTag());
}
if (you.getRole() == Role.ADMIN) { yourFaction.promoteNewLeader(); }
if (you.getRole() == Role.ADMIN) {
yourFaction.promoteNewLeader();
}
yourFaction.deinvite(you); you.resetFactionData();
yourFaction.deinvite(you);
you.resetFactionData();
}
}