Maven Attempt 1
This commit is contained in:
@ -0,0 +1,61 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.req.ReqFactionsEnabled;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
|
||||
import com.massivecraft.factions.entity.UPlayer;
|
||||
import com.massivecraft.factions.event.EventFactionsDescriptionChange;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.mixin.Mixin;
|
||||
|
||||
public class CmdFactionsDescription extends FCommand
|
||||
{
|
||||
// -------------------------------------------- //
|
||||
// CONSTRUCT
|
||||
// -------------------------------------------- //
|
||||
|
||||
public CmdFactionsDescription()
|
||||
{
|
||||
// Aliases
|
||||
this.addAliases("desc");
|
||||
|
||||
// Args
|
||||
this.addRequiredArg("desc");
|
||||
this.setErrorOnToManyArgs(false);
|
||||
|
||||
// Requirements
|
||||
this.addRequirements(ReqFactionsEnabled.get());
|
||||
this.addRequirements(ReqHasPerm.get(Perm.DESCRIPTION.node));
|
||||
this.addRequirements(ReqHasFaction.get());
|
||||
this.addRequirements(ReqRoleIsAtLeast.get(Rel.OFFICER));
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
// OVERRIDE
|
||||
// -------------------------------------------- //
|
||||
|
||||
@Override
|
||||
public void perform()
|
||||
{
|
||||
// Args
|
||||
String newDescription = this.argConcatFrom(0);
|
||||
|
||||
// Event
|
||||
EventFactionsDescriptionChange event = new EventFactionsDescriptionChange(sender, usenderFaction, newDescription);
|
||||
event.run();
|
||||
if (event.isCancelled()) return;
|
||||
newDescription = event.getNewDescription();
|
||||
|
||||
// Apply
|
||||
usenderFaction.setDescription(newDescription);
|
||||
|
||||
// Inform
|
||||
for (UPlayer follower : usenderFaction.getUPlayers())
|
||||
{
|
||||
follower.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender, follower), usenderFaction.getDescription());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user