Initial Release Commit
Standard Feature Placement.
This commit is contained in:
@@ -8,6 +8,7 @@ import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CmdAdmin extends FCommand {
|
||||
|
||||
@@ -40,6 +41,11 @@ public class CmdAdmin extends FCommand {
|
||||
boolean permAny = Permission.ADMIN_ANY.has(sender, false);
|
||||
Faction targetFaction = fyou.getFaction();
|
||||
|
||||
if(fyou.isAlt()){
|
||||
msg(ChatColor.RED + "You can not promote alt accounts.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetFaction != myFaction && !permAny) {
|
||||
msg(TL.COMMAND_ADMIN_NOTMEMBER, fyou.describeTo(fme, true));
|
||||
return;
|
||||
|
||||
@@ -51,6 +51,11 @@ public class CmdColeader extends FCommand {
|
||||
boolean permAny = Permission.COLEADER_ANY.has(sender, false);
|
||||
Faction targetFaction = you.getFaction();
|
||||
|
||||
if(you.isAlt()){
|
||||
msg(ChatColor.RED + "You can not promote alt accounts.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetFaction != myFaction && !permAny) {
|
||||
msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true));
|
||||
return;
|
||||
|
||||
@@ -86,7 +86,7 @@ public class CmdCreate extends FCommand {
|
||||
// join event cannot be cancelled or you'll have an empty faction
|
||||
|
||||
// finish setting up the FPlayer
|
||||
fme.setFaction(faction);
|
||||
fme.setFaction(faction, false);
|
||||
// We should consider adding the role just AFTER joining the faction.
|
||||
// That way we don't have to mess up deleting more stuff.
|
||||
// And prevent the user from being returned to NORMAL after deleting his old faction.
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.SavageFactions;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import mkremins.fanciful.FancyMessage;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class CmdInviteAlt extends FCommand {
|
||||
|
||||
public CmdInviteAlt() {
|
||||
super();
|
||||
this.aliases.add("altinvite");
|
||||
this.aliases.add("altinv");
|
||||
this.aliases.add("invalt");
|
||||
this.aliases.add("invitealt");
|
||||
|
||||
this.requiredArgs.add("player name");
|
||||
// this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.INVITE.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if(!SavageFactions.plugin.getConfig().getBoolean("f-alts.Enabled", false)){
|
||||
fme.msg(TL.GENERIC_DISABLED);
|
||||
return;
|
||||
}
|
||||
|
||||
FPlayer target = this.argAsBestFPlayerMatch(0);
|
||||
if (target == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (target.getFaction() == myFaction) {
|
||||
msg(TL.COMMAND_INVITE_ALREADYMEMBER, target.getName(), myFaction.getTag());
|
||||
msg(TL.GENERIC_YOUMAYWANT.toString() + p.cmdBase.cmdAltKick.getUseageTemplate(false));
|
||||
return;
|
||||
}
|
||||
|
||||
// if economy is enabled, they're not on the bypass list, and this
|
||||
// command has a cost set, make 'em pay
|
||||
if (!payForCommand(Conf.econCostInvite, TL.COMMAND_INVITE_TOINVITE.toString(), TL.COMMAND_INVITE_FORINVITE.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
Access access = myFaction.getAccess(target, PermissableAction.INVITEALT);
|
||||
if (access == Access.DENY || (access == Access.UNDEFINED && !assertMinRole(Role.MODERATOR))) {
|
||||
fme.msg(TL.GENERIC_FPERM_NOPERMISSION, "invitealt");
|
||||
return;
|
||||
}
|
||||
|
||||
if (myFaction.isBanned(target)) {
|
||||
fme.msg(TL.COMMAND_INVITE_BANNED, target.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
myFaction.deinvite(target);
|
||||
myFaction.altInvite(target);
|
||||
if (!target.isOnline()) {
|
||||
return;
|
||||
}
|
||||
|
||||
FancyMessage message = new FancyMessage(fme.describeTo(target, true))
|
||||
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
||||
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag())
|
||||
.then(TL.COMMAND_INVITE_INVITEDYOU.toString())
|
||||
.color(ChatColor.YELLOW)
|
||||
.tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
||||
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag())
|
||||
.then(myFaction.describeTo(target)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString())
|
||||
.command("/" + Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag());
|
||||
|
||||
message.send(target.getPlayer());
|
||||
|
||||
myFaction.msg(TL.COMMAND_INVITE_INVITED, fme.describeTo(myFaction, true), target.describeTo(myFaction));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_ALTINVITE_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
@@ -76,6 +76,13 @@ public class CmdJoin extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
int altLimit = Conf.factionAltMemberLimit;
|
||||
|
||||
if (altLimit > 0 && faction.getAltPlayers().size() >= altLimit && !faction.altInvited(fme)) {
|
||||
msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(fme), altLimit, fplayer.describeTo(fme, false));
|
||||
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 (samePlayer && !canAffordCommand(Conf.econCostJoin, TL.COMMAND_JOIN_TOJOIN.toString())) {
|
||||
return;
|
||||
@@ -107,7 +114,14 @@ public class CmdJoin extends FCommand {
|
||||
faction.msg(TL.COMMAND_JOIN_JOINED, fplayer.describeTo(faction, true));
|
||||
|
||||
fplayer.resetFactionData();
|
||||
fplayer.setFaction(faction);
|
||||
|
||||
if(faction.altInvited(fplayer)){
|
||||
fplayer.setAlt(true);
|
||||
fplayer.setFaction(faction, true);
|
||||
} else {
|
||||
fplayer.setFaction(faction, false);
|
||||
}
|
||||
|
||||
faction.deinvite(fplayer);
|
||||
fme.setRole(faction.getDefaultRole());
|
||||
|
||||
|
||||
@@ -67,6 +67,11 @@ public class CmdKick extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(toKick.isAlt()){
|
||||
msg(TL.GENERIC_YOUMAYWANT.toString() + p.cmdBase.cmdAltKick.getUseageTemplate(false));
|
||||
return;
|
||||
}
|
||||
|
||||
Faction toKickFaction = toKick.getFaction();
|
||||
|
||||
if (toKickFaction.isWilderness()) {
|
||||
|
||||
@@ -48,6 +48,12 @@ public class CmdMod extends FCommand {
|
||||
|
||||
boolean permAny = Permission.MOD_ANY.has(sender, false);
|
||||
Faction targetFaction = you.getFaction();
|
||||
|
||||
if(you.isAlt()){
|
||||
msg(ChatColor.RED + "You can not promote alt accounts.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetFaction != myFaction && !permAny) {
|
||||
msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(fme, true));
|
||||
return;
|
||||
|
||||
@@ -33,6 +33,7 @@ public class CmdShow extends FCommand {
|
||||
defaults.add("<a>Allies(<i>{allies}<a>/<i>{max-allies}<a>): {allies-list}");
|
||||
defaults.add("<a>Online: (<i>{online}<a>/<i>{members}<a>): {online-list}");
|
||||
defaults.add("<a>Offline: (<i>{offline}<a>/<i>{members}<a>): {offline-list}");
|
||||
defaults.add("<a>Alt List: <i>{alts}");
|
||||
|
||||
// this.requiredArgs.add("");
|
||||
this.optionalArgs.put("faction tag", "yours");
|
||||
|
||||
@@ -107,6 +107,9 @@ public class FCmdRoot extends FCommand {
|
||||
public CmdSetBanner cmdSetBanner = new CmdSetBanner();
|
||||
public CmdStrike cmdStrike = new CmdStrike();
|
||||
public CmdSetStrikes cmdSetStrikes = new CmdSetStrikes();
|
||||
public CmdKickAlt cmdAltKick = new CmdKickAlt();
|
||||
public CmdInviteAlt cmdAltInvite = new CmdInviteAlt();
|
||||
|
||||
|
||||
|
||||
public FCmdRoot() {
|
||||
@@ -221,6 +224,11 @@ public class FCmdRoot extends FCommand {
|
||||
this.addSubCommand(this.cmdChest);
|
||||
this.addSubCommand(this.cmdSetBanner);
|
||||
|
||||
if(SavageFactions.plugin.getConfig().getBoolean("f-alts.Enabled")){
|
||||
this.addSubCommand(this.cmdAltInvite);
|
||||
this.addSubCommand(this.cmdAltKick);
|
||||
}
|
||||
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("f-grace.Enabled")) {
|
||||
this.addSubCommand(this.cmdGrace);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public class FPromoteCommand extends FCommand {
|
||||
|
||||
@@ -38,6 +39,11 @@ public class FPromoteCommand extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
if(target.isAlt()){
|
||||
msg(ChatColor.RED + "You can not edit the rank of alt accounts.");
|
||||
return;
|
||||
}
|
||||
|
||||
Role current = target.getRole();
|
||||
Role promotion = Role.getRelative(current, +relative);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user