Fixed Indents on all files using the reformat option and optimized imports
This commit is contained in:
@@ -14,105 +14,105 @@ import java.util.ArrayList;
|
||||
|
||||
public class CmdCreate extends FCommand {
|
||||
|
||||
public CmdCreate() {
|
||||
super();
|
||||
this.aliases.add("create");
|
||||
public CmdCreate() {
|
||||
super();
|
||||
this.aliases.add("create");
|
||||
|
||||
this.requiredArgs.add("faction tag");
|
||||
//this.optionalArgs.put("", "");
|
||||
this.requiredArgs.add("faction tag");
|
||||
//this.optionalArgs.put("", "");
|
||||
|
||||
this.permission = Permission.CREATE.node;
|
||||
this.disableOnLock = true;
|
||||
this.permission = Permission.CREATE.node;
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = false;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
String tag = this.argAsString(0);
|
||||
@Override
|
||||
public void perform() {
|
||||
String tag = this.argAsString(0);
|
||||
|
||||
if (fme.hasFaction()) {
|
||||
msg(TL.COMMAND_CREATE_MUSTLEAVE);
|
||||
return;
|
||||
}
|
||||
if (fme.hasFaction()) {
|
||||
msg(TL.COMMAND_CREATE_MUSTLEAVE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Factions.getInstance().isTagTaken(tag)) {
|
||||
msg(TL.COMMAND_CREATE_INUSE);
|
||||
return;
|
||||
}
|
||||
if (Factions.getInstance().isTagTaken(tag)) {
|
||||
msg(TL.COMMAND_CREATE_INUSE);
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<String> tagValidationErrors = MiscUtil.validateTag(tag);
|
||||
if (tagValidationErrors.size() > 0) {
|
||||
sendMessage(tagValidationErrors);
|
||||
return;
|
||||
}
|
||||
ArrayList<String> tagValidationErrors = MiscUtil.validateTag(tag);
|
||||
if (tagValidationErrors.size() > 0) {
|
||||
sendMessage(tagValidationErrors);
|
||||
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.econCostCreate, TL.COMMAND_CREATE_TOCREATE.toString())) {
|
||||
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.econCostCreate, TL.COMMAND_CREATE_TOCREATE.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// trigger the faction creation event (cancellable)
|
||||
FactionCreateEvent createEvent = new FactionCreateEvent(me, tag);
|
||||
Bukkit.getServer().getPluginManager().callEvent(createEvent);
|
||||
if (createEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
// trigger the faction creation event (cancellable)
|
||||
FactionCreateEvent createEvent = new FactionCreateEvent(me, tag);
|
||||
Bukkit.getServer().getPluginManager().callEvent(createEvent);
|
||||
if (createEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// then make 'em pay (if applicable)
|
||||
if (!payForCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE, TL.COMMAND_CREATE_FORCREATE)) {
|
||||
return;
|
||||
}
|
||||
// then make 'em pay (if applicable)
|
||||
if (!payForCommand(Conf.econCostCreate, TL.COMMAND_CREATE_TOCREATE, TL.COMMAND_CREATE_FORCREATE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Faction faction = Factions.getInstance().createFaction();
|
||||
Faction faction = Factions.getInstance().createFaction();
|
||||
|
||||
// TODO: Why would this even happen??? Auto increment clash??
|
||||
if (faction == null) {
|
||||
msg(TL.COMMAND_CREATE_ERROR);
|
||||
return;
|
||||
}
|
||||
// TODO: Why would this even happen??? Auto increment clash??
|
||||
if (faction == null) {
|
||||
msg(TL.COMMAND_CREATE_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
// finish setting up the Faction
|
||||
faction.setTag(tag);
|
||||
// finish setting up the Faction
|
||||
faction.setTag(tag);
|
||||
|
||||
// trigger the faction join event for the creator
|
||||
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(me), faction, FPlayerJoinEvent.PlayerJoinReason.CREATE);
|
||||
Bukkit.getServer().getPluginManager().callEvent(joinEvent);
|
||||
// join event cannot be cancelled or you'll have an empty faction
|
||||
// trigger the faction join event for the creator
|
||||
FPlayerJoinEvent joinEvent = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(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.setFaction(faction);
|
||||
// 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.
|
||||
fme.setRole(Role.LEADER);
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("faction-creation-broadcast", true)) {
|
||||
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
follower.msg(TL.COMMAND_CREATE_CREATED, fme.describeTo(follower, true), faction.getTag(follower));
|
||||
}
|
||||
}
|
||||
msg(TL.COMMAND_CREATE_YOUSHOULD, p.cmdBase.cmdDescription.getUseageTemplate());
|
||||
// finish setting up the FPlayer
|
||||
fme.setFaction(faction);
|
||||
// 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.
|
||||
fme.setRole(Role.LEADER);
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("faction-creation-broadcast", true)) {
|
||||
for (FPlayer follower : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
follower.msg(TL.COMMAND_CREATE_CREATED, fme.describeTo(follower, true), faction.getTag(follower));
|
||||
}
|
||||
}
|
||||
msg(TL.COMMAND_CREATE_YOUSHOULD, p.cmdBase.cmdDescription.getUseageTemplate());
|
||||
|
||||
if (Conf.logFactionCreate) {
|
||||
SavageFactions.plugin.log(fme.getName() + TL.COMMAND_CREATE_CREATEDLOG.toString() + tag);
|
||||
}
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) {
|
||||
this.fme.msg(TL.COMMAND_PAYPALSET_CREATED);
|
||||
}
|
||||
if (Conf.useCustomDefaultPermissions) {
|
||||
faction.setDefaultPerms();
|
||||
if (Conf.usePermissionHints)
|
||||
this.fme.msg(TL.COMMAND_HINT_PERMISSION);
|
||||
}
|
||||
}
|
||||
if (Conf.logFactionCreate) {
|
||||
SavageFactions.plugin.log(fme.getName() + TL.COMMAND_CREATE_CREATEDLOG.toString() + tag);
|
||||
}
|
||||
if (SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) {
|
||||
this.fme.msg(TL.COMMAND_PAYPALSET_CREATED);
|
||||
}
|
||||
if (Conf.useCustomDefaultPermissions) {
|
||||
faction.setDefaultPerms();
|
||||
if (Conf.usePermissionHints)
|
||||
this.fme.msg(TL.COMMAND_HINT_PERMISSION);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_CREATE_DESCRIPTION;
|
||||
}
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_CREATE_DESCRIPTION;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user