Improve the Faction home system.

This commit is contained in:
Olof Larsson 2014-09-18 13:41:20 +02:00
parent a4ff2abd5c
commit aa350da005
49 changed files with 403 additions and 259 deletions

View File

@ -26,6 +26,7 @@ public enum Perm
FLAG("flag"),
FLAG_SET("flag.set"),
HOME("home"),
HOME_OTHER("home.other"),
INVITE("invite"),
JOIN("join"),
JOIN_ANY("join.any"),
@ -59,6 +60,8 @@ public enum Perm
TITLE_COLOR("title.color"),
UNCLAIM("unclaim"),
UNCLAIM_ALL("unclaimall"),
UNSETHOME("unsethome"),
UNSETHOME_OTHER("unsethome.other"),
VERSION("version"),
// END OF LIST

View File

@ -8,7 +8,7 @@ import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.cmd.HelpCommand;
import com.massivecraft.massivecore.cmd.VersionCommand;
public class CmdFactions extends FCommand
public class CmdFactions extends FactionsCommand
{
// -------------------------------------------- //
// FIELDS
@ -25,6 +25,7 @@ public class CmdFactions extends FCommand
public CmdFactionsName cmdFactionsName = new CmdFactionsName();
public CmdFactionsDescription cmdFactionsDescription = new CmdFactionsDescription();
public CmdFactionsSethome cmdFactionsSethome = new CmdFactionsSethome();
public CmdFactionsUnsethome cmdFactionsUnsethome = new CmdFactionsUnsethome();
public CmdFactionsOpen cmdFactionsOpen = new CmdFactionsOpen();
public CmdFactionsInvite cmdFactionsInvite = new CmdFactionsInvite();
public CmdFactionsKick cmdFactionsKick = new CmdFactionsKick();
@ -57,7 +58,7 @@ public class CmdFactions extends FCommand
public CmdFactions()
{
// Add SubCommands
// SubCommands
this.addSubCommand(HelpCommand.get());
this.addSubCommand(this.cmdFactionsList);
this.addSubCommand(this.cmdFactionsFaction);
@ -70,6 +71,7 @@ public class CmdFactions extends FCommand
this.addSubCommand(this.cmdFactionsName);
this.addSubCommand(this.cmdFactionsDescription);
this.addSubCommand(this.cmdFactionsSethome);
this.addSubCommand(this.cmdFactionsUnsethome);
this.addSubCommand(this.cmdFactionsOpen);
this.addSubCommand(this.cmdFactionsInvite);
this.addSubCommand(this.cmdFactionsKick);
@ -95,10 +97,6 @@ public class CmdFactions extends FCommand
this.addSubCommand(this.cmdFactionsAdmin);
this.addSubCommand(this.cmdFactionsPowerBoost);
this.addSubCommand(this.cmdFactionsVersion);
// Misc
this.setDesc("The faction base command");
this.setHelp("This command contains all faction stuff.");
}
// -------------------------------------------- //

View File

@ -6,7 +6,7 @@ import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
public class CmdFactionsAccess extends FCommand
public class CmdFactionsAccess extends FactionsCommand
{
// -------------------------------------------- //
// FIELDS

View File

@ -14,7 +14,7 @@ import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
import com.massivecraft.massivecore.util.Txt;
public abstract class CmdFactionsAccessAbstract extends FCommand
public abstract class CmdFactionsAccessAbstract extends FactionsCommand
{
// -------------------------------------------- //
// FIELDS
@ -53,10 +53,10 @@ public abstract class CmdFactionsAccessAbstract extends FCommand
public void sendAccessInfo()
{
sendMessage(Txt.titleize("Access at " + chunk.toString(PSFormatHumanSpace.get())));
msg("<k>Host Faction: %s", hostFaction.describeTo(usender, true));
msg("<k>Host Faction: %s", hostFaction.describeTo(msender, true));
msg("<k>Host Faction Allowed: %s", ta.isHostFactionAllowed() ? Txt.parse("<lime>TRUE") : Txt.parse("<rose>FALSE"));
msg("<k>Granted Players: %s", describeRelationParticipators(ta.getGrantedMPlayers(), usender));
msg("<k>Granted Factions: %s", describeRelationParticipators(ta.getGrantedFactions(), usender));
msg("<k>Granted Players: %s", describeRelationParticipators(ta.getGrantedMPlayers(), msender));
msg("<k>Granted Factions: %s", describeRelationParticipators(ta.getGrantedFactions(), msender));
}
public static String describeRelationParticipators(Collection<? extends RelationParticipator> relationParticipators, RelationParticipator observer)

View File

@ -42,7 +42,7 @@ public class CmdFactionsAccessFaction extends CmdFactionsAccessAbstract
if (newValue == null) return;
// FPerm
if (!FPerm.ACCESS.has(usender, hostFaction, true)) return;
if (!FPerm.ACCESS.has(msender, hostFaction, true)) return;
// Apply
ta = ta.withFactionId(faction.getId(), newValue);

View File

@ -42,7 +42,7 @@ public class CmdFactionsAccessPlayer extends CmdFactionsAccessAbstract
if (newValue == null) return;
// FPerm
if (!FPerm.ACCESS.has(usender, hostFaction, true)) return;
if (!FPerm.ACCESS.has(msender, hostFaction, true)) return;
// Apply
ta = ta.withPlayerId(mplayer.getId(), newValue);

View File

@ -5,7 +5,7 @@ import com.massivecraft.factions.Perm;
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsAdmin extends FCommand
public class CmdFactionsAdmin extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT

View File

@ -8,7 +8,7 @@ import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsAutoClaim extends FCommand
public class CmdFactionsAutoClaim extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -35,22 +35,22 @@ public class CmdFactionsAutoClaim extends FCommand
public void perform()
{
// Args
Faction forFaction = this.arg(0, ARFaction.get(), usenderFaction);
Faction forFaction = this.arg(0, ARFaction.get(), msenderFaction);
if (forFaction == null || forFaction == usender.getAutoClaimFaction())
if (forFaction == null || forFaction == msender.getAutoClaimFaction())
{
usender.setAutoClaimFaction(null);
msender.setAutoClaimFaction(null);
msg("<i>Auto-claiming of land disabled.");
return;
}
// FPerm
if (forFaction.isNormal() && !FPerm.TERRITORY.has(usender, forFaction, true)) return;
if (forFaction.isNormal() && !FPerm.TERRITORY.has(msender, forFaction, true)) return;
usender.setAutoClaimFaction(forFaction);
msender.setAutoClaimFaction(forFaction);
msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(usender));
usender.tryClaim(forFaction, PS.valueOf(me), true, true);
msg("<i>Now auto-claiming land for <h>%s<i>.", forFaction.describeTo(msender));
msender.tryClaim(forFaction, PS.valueOf(me), true, true);
}
}

View File

@ -12,7 +12,7 @@ import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsClaim extends FCommand
public class CmdFactionsClaim extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -43,11 +43,11 @@ public class CmdFactionsClaim extends FCommand
Integer radius = this.arg(0, ARInteger.get(), 1);
if (radius == null) return;
final Faction forFaction = this.arg(1, ARFaction.get(), usenderFaction);
final Faction forFaction = this.arg(1, ARFaction.get(), msenderFaction);
if (forFaction == null) return;
// FPerm
if (forFaction.isNormal() && !FPerm.TERRITORY.has(usender, forFaction, true)) return;
if (forFaction.isNormal() && !FPerm.TERRITORY.has(msender, forFaction, true)) return;
// Validate
if (radius < 1)
@ -56,7 +56,7 @@ public class CmdFactionsClaim extends FCommand
return;
}
if (radius > MConf.get().radiusClaimRadiusLimit && !usender.isUsingAdminMode())
if (radius > MConf.get().radiusClaimRadiusLimit && !msender.isUsingAdminMode())
{
msg("<b>The maximum radius allowed is <h>%s<b>.", MConf.get().radiusClaimRadiusLimit);
return;
@ -67,7 +67,7 @@ public class CmdFactionsClaim extends FCommand
// single chunk
if (radius < 2)
{
usender.tryClaim(forFaction, PS.valueOf(me), true, true);
msender.tryClaim(forFaction, PS.valueOf(me), true, true);
return;
}
@ -91,7 +91,7 @@ public class CmdFactionsClaim extends FCommand
@Override
public boolean work()
{
boolean success = usender.tryClaim(forFaction, PS.valueOf(this.currentLocation()), true, true);
boolean success = msender.tryClaim(forFaction, PS.valueOf(this.currentLocation()), true, true);
if (success)
{
this.failCount = 0;

View File

@ -17,7 +17,7 @@ import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipC
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.store.MStore;
public class CmdFactionsCreate extends FCommand
public class CmdFactionsCreate extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -72,24 +72,24 @@ public class CmdFactionsCreate extends FCommand
Faction faction = FactionColl.get().create(factionId);
faction.setName(newName);
usender.setRole(Rel.LEADER);
usender.setFaction(faction);
msender.setRole(Rel.LEADER);
msender.setFaction(faction);
EventFactionsMembershipChange joinEvent = new EventFactionsMembershipChange(sender, usender, faction, MembershipChangeReason.CREATE);
EventFactionsMembershipChange joinEvent = new EventFactionsMembershipChange(sender, msender, faction, MembershipChangeReason.CREATE);
joinEvent.run();
// NOTE: join event cannot be cancelled or you'll have an empty faction
// Inform
for (MPlayer follower : MPlayerColl.get().getAllOnline())
{
follower.msg("%s<i> created a new faction %s", usender.describeTo(follower, true), faction.getName(follower));
follower.msg("%s<i> created a new faction %s", msender.describeTo(follower, true), faction.getName(follower));
}
msg("<i>You should now: %s", Factions.get().getOuterCmdFactions().cmdFactionsDescription.getUseageTemplate());
if (MConf.get().logFactionCreate)
{
Factions.get().log(usender.getName()+" created a new faction: "+newName);
Factions.get().log(msender.getName()+" created a new faction: "+newName);
}
}

View File

@ -6,7 +6,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsDemote extends FCommand
public class CmdFactionsDemote extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -38,13 +38,13 @@ public class CmdFactionsDemote extends FCommand
MPlayer you = this.arg(0, ARMPlayer.getAny());
if (you == null) return;
if (you.getFaction() != usenderFaction)
if (you.getFaction() != msenderFaction)
{
msg("%s<b> is not a member in your faction.", you.describeTo(usender, true));
msg("%s<b> is not a member in your faction.", you.describeTo(msender, true));
return;
}
if (you == usender)
if (you == msender)
{
msg("<b>The target player mustn't be yourself.");
return;
@ -52,23 +52,23 @@ public class CmdFactionsDemote extends FCommand
if (you.getRole() == Rel.MEMBER)
{
if (!usender.getRole().isAtLeast(Rel.OFFICER))
if (!msender.getRole().isAtLeast(Rel.OFFICER))
{
msg("<b>You must be an officer to demote a member to recruit.");
return;
}
you.setRole(Rel.RECRUIT);
usenderFaction.msg("%s<i> was demoted to being a recruit in your faction.", you.describeTo(usenderFaction, true));
msenderFaction.msg("%s<i> was demoted to being a recruit in your faction.", you.describeTo(msenderFaction, true));
}
else if (you.getRole() == Rel.OFFICER)
{
if (!usender.getRole().isAtLeast(Rel.LEADER))
if (!msender.getRole().isAtLeast(Rel.LEADER))
{
msg("<b>You must be the leader to demote an officer to member.");
return;
}
you.setRole(Rel.MEMBER);
usenderFaction.msg("%s<i> was demoted to being a member in your faction.", you.describeTo(usenderFaction, true));
msenderFaction.msg("%s<i> was demoted to being a member in your faction.", you.describeTo(msenderFaction, true));
}
}

View File

@ -9,7 +9,7 @@ import com.massivecraft.factions.event.EventFactionsDescriptionChange;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.mixin.Mixin;
public class CmdFactionsDescription extends FCommand
public class CmdFactionsDescription extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -41,18 +41,18 @@ public class CmdFactionsDescription extends FCommand
String newDescription = this.argConcatFrom(0);
// Event
EventFactionsDescriptionChange event = new EventFactionsDescriptionChange(sender, usenderFaction, newDescription);
EventFactionsDescriptionChange event = new EventFactionsDescriptionChange(sender, msenderFaction, newDescription);
event.run();
if (event.isCancelled()) return;
newDescription = event.getNewDescription();
// Apply
usenderFaction.setDescription(newDescription);
msenderFaction.setDescription(newDescription);
// Inform
for (MPlayer follower : usenderFaction.getMPlayers())
for (MPlayer follower : msenderFaction.getMPlayers())
{
follower.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender, follower), usenderFaction.getDescription());
follower.msg("<i>%s <i>set your faction description to:\n%s", Mixin.getDisplayName(sender, follower), msenderFaction.getDescription());
}
}

View File

@ -17,7 +17,7 @@ import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.IdUtil;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsDisband extends FCommand
public class CmdFactionsDisband extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -43,11 +43,11 @@ public class CmdFactionsDisband extends FCommand
public void perform()
{
// Args
Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
// FPerm
if ( ! FPerm.DISBAND.has(usender, faction, true)) return;
if ( ! FPerm.DISBAND.has(msender, faction, true)) return;
// Verify
if (faction.getFlag(FFlag.PERMANENT))
@ -73,7 +73,7 @@ public class CmdFactionsDisband extends FCommand
// Inform all players
for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
{
String who = usender.describeTo(mplayer);
String who = msender.describeTo(mplayer);
if (mplayer.getFaction() == faction)
{
mplayer.msg("<h>%s<i> disbanded your faction.", who);
@ -86,7 +86,7 @@ public class CmdFactionsDisband extends FCommand
if (MConf.get().logFactionDisband)
{
Factions.get().log(Txt.parse("<i>The faction <h>%s <i>(<h>%s<i>) was disbanded by <h>%s<i>.", faction.getName(), faction.getId(), usender.getDisplayName(IdUtil.getConsole())));
Factions.get().log(Txt.parse("<i>The faction <h>%s <i>(<h>%s<i>) was disbanded by <h>%s<i>.", faction.getName(), faction.getId(), msender.getDisplayName(IdUtil.getConsole())));
}
faction.detach();

View File

@ -23,7 +23,7 @@ import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsFaction extends FCommand
public class CmdFactionsFaction extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -49,7 +49,7 @@ public class CmdFactionsFaction extends FCommand
public void perform()
{
// Args
Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
// Data precalculation
@ -57,7 +57,7 @@ public class CmdFactionsFaction extends FCommand
boolean normal = faction.isNormal();
// INFO: Title
msg(Txt.titleize("Faction " + faction.getName(usender)));
msg(Txt.titleize("Faction " + faction.getName(msender)));
// INFO: Description
msg("<a>Description: <i>%s", faction.getDescription());
@ -127,7 +127,7 @@ public class CmdFactionsFaction extends FCommand
String sepparator = Txt.parse("<i>")+", ";
// List the relations to other factions
Map<Rel, List<String>> relationNames = faction.getFactionNamesPerRelation(usender, true);
Map<Rel, List<String>> relationNames = faction.getFactionNamesPerRelation(msender, true);
if (faction.getFlag(FFlag.PEACEFUL))
{
@ -152,12 +152,12 @@ public class CmdFactionsFaction extends FCommand
{
if (follower.isOnline() && Mixin.canSee(sender, follower.getId()))
{
followerNamesOnline.add(follower.getNameAndTitle(usender));
followerNamesOnline.add(follower.getNameAndTitle(msender));
}
else if (normal)
{
// For the non-faction we skip the offline members since they are far to many (infinate almost)
followerNamesOffline.add(follower.getNameAndTitle(usender));
followerNamesOffline.add(follower.getNameAndTitle(msender));
}
}

View File

@ -9,7 +9,7 @@ import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsFlag extends FCommand
public class CmdFactionsFlag extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -36,12 +36,12 @@ public class CmdFactionsFlag extends FCommand
@Override
public void perform()
{
Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
if ( ! this.argIsSet(1))
{
msg(Txt.titleize("Flags for " + faction.describeTo(usender, true)));
msg(Txt.titleize("Flags for " + faction.describeTo(msender, true)));
for (FFlag flag : FFlag.values())
{
msg(flag.getStateInfo(faction.getFlag(flag), true));
@ -54,7 +54,7 @@ public class CmdFactionsFlag extends FCommand
if ( ! this.argIsSet(2))
{
msg(Txt.titleize("Flag for " + faction.describeTo(usender, true)));
msg(Txt.titleize("Flag for " + faction.describeTo(msender, true)));
msg(flag.getStateInfo(faction.getFlag(flag), true));
return;
}
@ -66,7 +66,7 @@ public class CmdFactionsFlag extends FCommand
if ( ! Perm.FLAG_SET.has(sender, true)) return;
// Do the change
msg(Txt.titleize("Flag for " + faction.describeTo(usender, true)));
msg(Txt.titleize("Flag for " + faction.describeTo(msender, true)));
faction.setFlag(flag, targetValue);
msg(flag.getStateInfo(faction.getFlag(flag), true));
}

View File

@ -5,10 +5,11 @@ import org.bukkit.World;
import org.bukkit.entity.Player;
import com.massivecraft.factions.FFlag;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.req.ReqHasFaction;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPlayer;
@ -21,7 +22,7 @@ import com.massivecraft.massivecore.mixin.TeleporterException;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsHome extends FCommand
public class CmdFactionsHome extends FactionsCommandHome
{
// -------------------------------------------- //
// CONSTRUCT
@ -31,13 +32,15 @@ public class CmdFactionsHome extends FCommand
{
// Aliases
this.addAliases("home");
// Args
this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.HOME.node));
this.addRequirements(ReqHasFaction.get());
this.addRequirements(ReqIsPlayer.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@ -45,64 +48,73 @@ public class CmdFactionsHome extends FCommand
@Override
public void perform()
{
// TODO: Hide this command on help also.
if ( ! MConf.get().homesEnabled)
{
usender.msg("<b>Sorry, Faction homes are disabled on this server.");
return;
}
if ( ! MConf.get().homesTeleportCommandEnabled)
{
usender.msg("<b>Sorry, the ability to teleport to Faction homes is disabled on this server.");
msender.msg("<b>Sorry, the ability to teleport to Faction homes is disabled on this server.");
return;
}
if ( ! usenderFaction.hasHome())
// Args
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
boolean other = faction != msenderFaction;
PS home = faction.getHome();
String homeDesc = "home for " + faction.describeTo(msender, false);
// Other Perm
if (other && !Perm.HOME_OTHER.has(sender, true)) return;
if (home == null)
{
usender.msg("<b>Your faction does not have a home. " + (usender.getRole().isLessThan(Rel.OFFICER) ? "<i> Ask your leader to:" : "<i>You should:"));
usender.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsSethome.getUseageTemplate());
msender.msg("<b>%s <b>does not have a home.", faction.describeTo(msender, true));
if (FPerm.SETHOME.has(msender, faction, false))
{
msender.msg("<i>You should:");
msender.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsSethome.getUseageTemplate());
}
return;
}
if ( ! MConf.get().homesTeleportAllowedFromEnemyTerritory && usender.isInEnemyTerritory())
if ( ! MConf.get().homesTeleportAllowedFromEnemyTerritory && msender.isInEnemyTerritory())
{
usender.msg("<b>You cannot teleport to your faction home while in the territory of an enemy faction.");
msender.msg("<b>You cannot teleport to %s <b>while in the territory of an enemy faction.", homeDesc);
return;
}
if ( ! MConf.get().homesTeleportAllowedFromDifferentWorld && !me.getWorld().getName().equalsIgnoreCase(usenderFaction.getHome().getWorld()))
if ( ! MConf.get().homesTeleportAllowedFromDifferentWorld && !me.getWorld().getName().equalsIgnoreCase(home.getWorld()))
{
usender.msg("<b>You cannot teleport to your faction home while in a different world.");
msender.msg("<b>You cannot teleport to %s <b>while in a different world.", homeDesc);
return;
}
Faction faction = BoardColl.get().getFactionAt(PS.valueOf(me));
Location loc = me.getLocation().clone();
Faction factionHere = BoardColl.get().getFactionAt(PS.valueOf(me));
Location locationHere = me.getLocation().clone();
// if player is not in a safe zone or their own faction territory, only allow teleport if no enemies are nearby
if
(
MConf.get().homesTeleportAllowedEnemyDistance > 0
&&
faction.getFlag(FFlag.PVP)
factionHere.getFlag(FFlag.PVP)
&&
(
! usender.isInOwnTerritory()
! msender.isInOwnTerritory()
||
(
usender.isInOwnTerritory()
msender.isInOwnTerritory()
&&
! MConf.get().homesTeleportIgnoreEnemiesIfInOwnTerritory
)
)
)
{
World w = loc.getWorld();
double x = loc.getX();
double y = loc.getY();
double z = loc.getZ();
World w = locationHere.getWorld();
double x = locationHere.getX();
double y = locationHere.getY();
double z = locationHere.getZ();
for (Player p : me.getServer().getOnlinePlayers())
{
@ -110,7 +122,7 @@ public class CmdFactionsHome extends FCommand
continue;
MPlayer fp = MPlayer.get(p);
if (usender.getRelationTo(fp) != Rel.ENEMY)
if (msender.getRelationTo(fp) != Rel.ENEMY)
continue;
Location l = p.getLocation();
@ -123,7 +135,7 @@ public class CmdFactionsHome extends FCommand
if (dx > max || dy > max || dz > max)
continue;
usender.msg("<b>You cannot teleport to your faction home while an enemy is within " + MConf.get().homesTeleportAllowedEnemyDistance + " blocks of you.");
msender.msg("<b>You cannot teleport to %s <b>while an enemy is within %f blocks of you.", homeDesc, MConf.get().homesTeleportAllowedEnemyDistance);
return;
}
}
@ -136,7 +148,7 @@ public class CmdFactionsHome extends FCommand
// Apply
try
{
Mixin.teleport(me, usenderFaction.getHome(), "your faction home", sender);
Mixin.teleport(me, home, homeDesc, sender);
}
catch (TeleporterException e)
{

View File

@ -11,7 +11,7 @@ import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
public class CmdFactionsInvite extends FCommand
public class CmdFactionsInvite extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -43,39 +43,39 @@ public class CmdFactionsInvite extends FCommand
MPlayer mplayer = this.arg(0, ARMPlayer.getAny());
if (mplayer == null) return;
Boolean newInvited = this.arg(1, ARBoolean.get(), !usenderFaction.isInvited(mplayer));
Boolean newInvited = this.arg(1, ARBoolean.get(), !msenderFaction.isInvited(mplayer));
if (newInvited == null) return;
// Allready member?
if (mplayer.getFaction() == usenderFaction)
if (mplayer.getFaction() == msenderFaction)
{
msg("%s<i> is already a member of %s", mplayer.getName(), usenderFaction.getName());
msg("%s<i> is already a member of %s", mplayer.getName(), msenderFaction.getName());
msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
return;
}
// FPerm
if ( ! FPerm.INVITE.has(usender, usenderFaction, true)) return;
if ( ! FPerm.INVITE.has(msender, msenderFaction, true)) return;
// Event
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, mplayer, usenderFaction, newInvited);
EventFactionsInvitedChange event = new EventFactionsInvitedChange(sender, mplayer, msenderFaction, newInvited);
event.run();
if (event.isCancelled()) return;
newInvited = event.isNewInvited();
// Apply
usenderFaction.setInvited(mplayer, newInvited);
msenderFaction.setInvited(mplayer, newInvited);
// Inform
if (newInvited)
{
mplayer.msg("%s<i> invited you to %s", usender.describeTo(mplayer, true), usenderFaction.describeTo(mplayer));
usenderFaction.msg("%s<i> invited %s<i> to your faction.", usender.describeTo(usenderFaction, true), mplayer.describeTo(usenderFaction));
mplayer.msg("%s<i> invited you to %s", msender.describeTo(mplayer, true), msenderFaction.describeTo(mplayer));
msenderFaction.msg("%s<i> invited %s<i> to your faction.", msender.describeTo(msenderFaction, true), mplayer.describeTo(msenderFaction));
}
else
{
mplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", usender.describeTo(mplayer), usenderFaction.describeTo(mplayer));
usenderFaction.msg("%s<i> revoked %s's<i> invitation.", usender.describeTo(usenderFaction), mplayer.describeTo(usenderFaction));
mplayer.msg("%s<i> revoked your invitation to <h>%s<i>.", msender.describeTo(mplayer), msenderFaction.describeTo(mplayer));
msenderFaction.msg("%s<i> revoked %s's<i> invitation.", msender.describeTo(msenderFaction), mplayer.describeTo(msenderFaction));
}
}

View File

@ -12,7 +12,7 @@ import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipC
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsJoin extends FCommand
public class CmdFactionsJoin extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -42,11 +42,11 @@ public class CmdFactionsJoin extends FCommand
Faction faction = this.arg(0, ARFaction.get());
if (faction == null) return;
MPlayer mplayer = this.arg(1, ARMPlayer.getAny(), usender);
MPlayer mplayer = this.arg(1, ARMPlayer.getAny(), msender);
if (mplayer == null) return;
Faction mplayerFaction = mplayer.getFaction();
boolean samePlayer = mplayer == usender;
boolean samePlayer = mplayer == msender;
// Validate
if (!samePlayer && ! Perm.JOIN_OTHERS.has(sender, false))
@ -57,29 +57,29 @@ public class CmdFactionsJoin extends FCommand
if (faction == mplayerFaction)
{
msg("<i>%s <i>%s already a member of %s<i>.", mplayer.describeTo(usender, true), (samePlayer ? "are" : "is"), faction.getName(usender));
msg("<i>%s <i>%s already a member of %s<i>.", mplayer.describeTo(msender, true), (samePlayer ? "are" : "is"), faction.getName(msender));
return;
}
if (MConf.get().factionMemberLimit > 0 && faction.getMPlayers().size() >= MConf.get().factionMemberLimit)
{
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getName(usender), MConf.get().factionMemberLimit, mplayer.describeTo(usender, false));
msg(" <b>!<white> The faction %s is at the limit of %d members, so %s cannot currently join.", faction.getName(msender), MConf.get().factionMemberLimit, mplayer.describeTo(msender, false));
return;
}
if (mplayerFaction.isNormal())
{
msg("<b>%s must leave %s current faction first.", mplayer.describeTo(usender, true), (samePlayer ? "your" : "their"));
msg("<b>%s must leave %s current faction first.", mplayer.describeTo(msender, true), (samePlayer ? "your" : "their"));
return;
}
if (!MConf.get().canLeaveWithNegativePower && mplayer.getPower() < 0)
{
msg("<b>%s cannot join a faction with a negative power level.", mplayer.describeTo(usender, true));
msg("<b>%s cannot join a faction with a negative power level.", mplayer.describeTo(msender, true));
return;
}
if( ! (faction.isOpen() || faction.isInvited(mplayer) || usender.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
if( ! (faction.isOpen() || faction.isInvited(mplayer) || msender.isUsingAdminMode() || Perm.JOIN_ANY.has(sender, false)))
{
msg("<i>This faction requires invitation.");
if (samePlayer)
@ -90,17 +90,17 @@ public class CmdFactionsJoin extends FCommand
}
// Event
EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, usender, faction, MembershipChangeReason.JOIN);
EventFactionsMembershipChange membershipChangeEvent = new EventFactionsMembershipChange(sender, msender, faction, MembershipChangeReason.JOIN);
membershipChangeEvent.run();
if (membershipChangeEvent.isCancelled()) return;
// Inform
if (!samePlayer)
{
mplayer.msg("<i>%s <i>moved you into the faction %s<i>.", usender.describeTo(mplayer, true), faction.getName(mplayer));
mplayer.msg("<i>%s <i>moved you into the faction %s<i>.", msender.describeTo(mplayer, true), faction.getName(mplayer));
}
faction.msg("<i>%s <i>joined <lime>your faction<i>.", mplayer.describeTo(faction, true));
usender.msg("<i>%s <i>successfully joined %s<i>.", mplayer.describeTo(usender, true), faction.getName(usender));
msender.msg("<i>%s <i>successfully joined %s<i>.", mplayer.describeTo(msender, true), faction.getName(msender));
// Apply
mplayer.resetFactionData();
@ -117,7 +117,7 @@ public class CmdFactionsJoin extends FCommand
}
else
{
Factions.get().log(Txt.parse("%s moved the player %s into the faction %s.", usender.getName(), mplayer.getName(), faction.getName()));
Factions.get().log(Txt.parse("%s moved the player %s into the faction %s.", msender.getName(), mplayer.getName(), faction.getName()));
}
}
}

View File

@ -14,7 +14,7 @@ import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipC
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.IdUtil;
public class CmdFactionsKick extends FCommand
public class CmdFactionsKick extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -44,14 +44,14 @@ public class CmdFactionsKick extends FCommand
if (mplayer == null) return;
// Validate
if (usender == mplayer)
if (msender == mplayer)
{
msg("<b>You cannot kick yourself.");
msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false));
return;
}
if (mplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || usender.isUsingAdminMode()))
if (mplayer.getRole() == Rel.LEADER && !(this.senderIsConsole || msender.isUsingAdminMode()))
{
msg("<b>The leader can not be kicked.");
return;
@ -65,7 +65,7 @@ public class CmdFactionsKick extends FCommand
// FPerm
Faction mplayerFaction = mplayer.getFaction();
if (!FPerm.KICK.has(usender, mplayerFaction, true)) return;
if (!FPerm.KICK.has(msender, mplayerFaction, true)) return;
// Event
EventFactionsMembershipChange event = new EventFactionsMembershipChange(sender, mplayer, FactionColl.get().getNone(), MembershipChangeReason.KICK);
@ -73,16 +73,16 @@ public class CmdFactionsKick extends FCommand
if (event.isCancelled()) return;
// Inform
mplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", usender.describeTo(mplayerFaction, true), mplayer.describeTo(mplayerFaction, true));
mplayer.msg("%s<i> kicked you from %s<i>! :O", usender.describeTo(mplayer, true), mplayerFaction.describeTo(mplayer));
if (mplayerFaction != usenderFaction)
mplayerFaction.msg("%s<i> kicked %s<i> from the faction! :O", msender.describeTo(mplayerFaction, true), mplayer.describeTo(mplayerFaction, true));
mplayer.msg("%s<i> kicked you from %s<i>! :O", msender.describeTo(mplayer, true), mplayerFaction.describeTo(mplayer));
if (mplayerFaction != msenderFaction)
{
usender.msg("<i>You kicked %s<i> from the faction %s<i>!", mplayer.describeTo(usender), mplayerFaction.describeTo(usender));
msender.msg("<i>You kicked %s<i> from the faction %s<i>!", mplayer.describeTo(msender), mplayerFaction.describeTo(msender));
}
if (MConf.get().logFactionKick)
{
Factions.get().log(usender.getDisplayName(IdUtil.getConsole()) + " kicked " + mplayer.getName() + " from the faction " + mplayerFaction.getName());
Factions.get().log(msender.getDisplayName(IdUtil.getConsole()) + " kicked " + mplayer.getName() + " from the faction " + mplayerFaction.getName());
}
// Apply

View File

@ -13,7 +13,7 @@ import com.massivecraft.factions.util.RelationUtil;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsLeader extends FCommand
public class CmdFactionsLeader extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -41,32 +41,32 @@ public class CmdFactionsLeader extends FCommand
MPlayer newLeader = this.arg(0, ARMPlayer.getAny());
if (newLeader == null) return;
Faction targetFaction = this.arg(1, ARFaction.get(), usenderFaction);
Faction targetFaction = this.arg(1, ARFaction.get(), msenderFaction);
if (targetFaction == null) return;
MPlayer targetFactionCurrentLeader = targetFaction.getLeader();
// We now have mplayer and the target faction
if (this.senderIsConsole || usender.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))
if (this.senderIsConsole || msender.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false))
{
// Do whatever you wish
}
else
{
// Follow the standard rules
if (usender.getRole() != Rel.LEADER || targetFaction != usenderFaction)
if (msender.getRole() != Rel.LEADER || targetFaction != msenderFaction)
{
sender.sendMessage(Txt.parse("<b>You must be leader of the faction to %s.", this.getDesc()));
return;
}
if (newLeader.getFaction() != usenderFaction)
if (newLeader.getFaction() != msenderFaction)
{
msg("%s<i> is not a member in the faction.", newLeader.describeTo(usender, true));
msg("%s<i> is not a member in the faction.", newLeader.describeTo(msender, true));
return;
}
if (newLeader == usender)
if (newLeader == msender)
{
msg("<b>The target player musn't be yourself.");
return;
@ -85,8 +85,8 @@ public class CmdFactionsLeader extends FCommand
if (targetFactionCurrentLeader == newLeader)
{
targetFaction.promoteNewLeader();
msg("<i>You have demoted %s<i> from the position of faction leader.", newLeader.describeTo(usender, true));
newLeader.msg("<i>You have been demoted from the position of faction leader by %s<i>.", usender.describeTo(newLeader, true));
msg("<i>You have demoted %s<i> from the position of faction leader.", newLeader.describeTo(msender, true));
newLeader.msg("<i>You have been demoted from the position of faction leader by %s<i>.", msender.describeTo(newLeader, true));
return;
}
@ -97,12 +97,12 @@ public class CmdFactionsLeader extends FCommand
}
newLeader.setFaction(targetFaction);
newLeader.setRole(Rel.LEADER);
msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(usender, true));
msg("<i>You have promoted %s<i> to the position of faction leader.", newLeader.describeTo(msender, true));
// Inform all players
for (MPlayer mplayer : MPlayerColl.get().getAllOnline())
{
mplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(usender, mplayer, true), newLeader.describeTo(mplayer), targetFaction.describeTo(mplayer));
mplayer.msg("%s<i> gave %s<i> the leadership of %s<i>.", senderIsConsole ? "A server admin" : RelationUtil.describeThatToMe(msender, mplayer, true), newLeader.describeTo(mplayer), targetFaction.describeTo(mplayer));
}
}

View File

@ -4,7 +4,7 @@ import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.req.ReqHasFaction;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsLeave extends FCommand
public class CmdFactionsLeave extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -27,7 +27,7 @@ public class CmdFactionsLeave extends FCommand
@Override
public void perform()
{
usender.leave();
msender.leave();
}
}

View File

@ -12,7 +12,7 @@ import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsList extends FCommand
public class CmdFactionsList extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -67,7 +67,7 @@ public class CmdFactionsList extends FCommand
continue;
}
lines.add(Txt.parse("%s<i> %d/%d online, %d/%d/%d",
faction.getName(usender),
faction.getName(msender),
faction.getMPlayersWhereOnline(true).size(),
faction.getMPlayers().size(),
faction.getLandCount(),

View File

@ -7,7 +7,7 @@ import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsMap extends FCommand
public class CmdFactionsMap extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -58,7 +58,7 @@ public class CmdFactionsMap extends FCommand
public void showMap()
{
sendMessage(BoardColl.get().getMap(usenderFaction, PS.valueOf(me), me.getLocation().getYaw()));
sendMessage(BoardColl.get().getMap(msenderFaction, PS.valueOf(me), me.getLocation().getYaw()));
}
}

View File

@ -4,7 +4,7 @@ import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsMoney extends FCommand
public class CmdFactionsMoney extends FactionsCommand
{
// -------------------------------------------- //
// FIELDS

View File

@ -7,7 +7,7 @@ import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.Perm;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsMoneyBalance extends FCommand
public class CmdFactionsMoneyBalance extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -33,12 +33,12 @@ public class CmdFactionsMoneyBalance extends FCommand
@Override
public void perform()
{
Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
if (faction != usenderFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return;
if (faction != msenderFaction && ! Perm.MONEY_BALANCE_ANY.has(sender, true)) return;
Econ.sendBalanceInfo(usender, faction);
Econ.sendBalanceInfo(msender, faction);
}
}

View File

@ -14,7 +14,7 @@ import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyDeposit extends FCommand
public class CmdFactionsMoneyDeposit extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -44,14 +44,14 @@ public class CmdFactionsMoneyDeposit extends FCommand
Double amount = this.arg(0, ARDouble.get());
if (amount == null) return;
Faction faction = this.arg(1, ARFaction.get(), usenderFaction);
Faction faction = this.arg(1, ARFaction.get(), msenderFaction);
if (faction == null) return;
boolean success = Econ.transferMoney(usender, usender, faction, amount);
boolean success = Econ.transferMoney(msender, msender, faction, amount);
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", usender.getName(), Money.format(amount), faction.describeTo(null))));
Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", msender.getName(), Money.format(amount), faction.describeTo(null))));
}
}

View File

@ -15,7 +15,7 @@ import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyTransferFf extends FCommand
public class CmdFactionsMoneyTransferFf extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -52,11 +52,11 @@ public class CmdFactionsMoneyTransferFf extends FCommand
Faction to = this.arg(2, ARFaction.get());
if (to == null) return;
boolean success = Econ.transferMoney(usender, from, to, amount);
boolean success = Econ.transferMoney(msender, from, to, amount);
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", msender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
}
}

View File

@ -17,7 +17,7 @@ import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyTransferFp extends FCommand
public class CmdFactionsMoneyTransferFp extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -54,11 +54,11 @@ public class CmdFactionsMoneyTransferFp extends FCommand
MPlayer to = this.arg(2, ARMPlayer.getAny());
if (to == null) return;
boolean success = Econ.transferMoney(usender, from, to, amount);
boolean success = Econ.transferMoney(msender, from, to, amount);
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", msender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
}
}

View File

@ -17,7 +17,7 @@ import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyTransferPf extends FCommand
public class CmdFactionsMoneyTransferPf extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -54,11 +54,11 @@ public class CmdFactionsMoneyTransferPf extends FCommand
Faction to = this.arg(2, ARFaction.get());
if (to == null) return;
boolean success = Econ.transferMoney(usender, from, to, amount);
boolean success = Econ.transferMoney(msender, from, to, amount);
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", msender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
}
}

View File

@ -16,7 +16,7 @@ import com.massivecraft.massivecore.util.Txt;
import org.bukkit.ChatColor;
public class CmdFactionsMoneyWithdraw extends FCommand
public class CmdFactionsMoneyWithdraw extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -46,16 +46,16 @@ public class CmdFactionsMoneyWithdraw extends FCommand
Double amount = this.arg(0, ARDouble.get());
if (amount == null) return;
Faction from = this.arg(1, ARFaction.get(), usenderFaction);
Faction from = this.arg(1, ARFaction.get(), msenderFaction);
if (from == null) return;
MPlayer to = usender;
MPlayer to = msender;
boolean success = Econ.transferMoney(usender, from, to, amount);
boolean success = Econ.transferMoney(msender, from, to, amount);
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", usender.getName(), Money.format(amount), from.describeTo(null))));
Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", msender.getName(), Money.format(amount), from.describeTo(null))));
}
}

View File

@ -13,7 +13,7 @@ import com.massivecraft.factions.event.EventFactionsNameChange;
import com.massivecraft.factions.util.MiscUtil;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsName extends FCommand
public class CmdFactionsName extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -45,7 +45,7 @@ public class CmdFactionsName extends FCommand
// TODO does not first test cover selfcase?
if (FactionColl.get().isNameTaken(newName) && ! MiscUtil.getComparisonString(newName).equals(usenderFaction.getComparisonName()))
if (FactionColl.get().isNameTaken(newName) && ! MiscUtil.getComparisonString(newName).equals(msenderFaction.getComparisonName()))
{
msg("<b>That name is already taken");
return;
@ -60,26 +60,26 @@ public class CmdFactionsName extends FCommand
}
// Event
EventFactionsNameChange event = new EventFactionsNameChange(sender, usenderFaction, newName);
EventFactionsNameChange event = new EventFactionsNameChange(sender, msenderFaction, newName);
event.run();
if (event.isCancelled()) return;
newName = event.getNewName();
// Apply
String oldName = usenderFaction.getName();
usenderFaction.setName(newName);
String oldName = msenderFaction.getName();
msenderFaction.setName(newName);
// Inform
usenderFaction.msg("%s<i> changed your faction name to %s", usender.describeTo(usenderFaction, true), usenderFaction.getName(usenderFaction));
msenderFaction.msg("%s<i> changed your faction name to %s", msender.describeTo(msenderFaction, true), msenderFaction.getName(msenderFaction));
if (!MConf.get().broadcastNameChange) return;
for (Faction faction : FactionColl.get().getAll())
{
if (faction == usenderFaction)
if (faction == msenderFaction)
{
continue;
}
faction.msg("<i>The player %s<i> changed their faction name from %s<i> to %s<i>.", usender.describeTo(faction, true), usender.getColorTo(faction)+oldName, usenderFaction.getName(faction));
faction.msg("<i>The player %s<i> changed their faction name from %s<i> to %s<i>.", msender.describeTo(faction, true), msender.getColorTo(faction)+oldName, msenderFaction.getName(faction));
}
}

View File

@ -7,7 +7,7 @@ import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsOfficer extends FCommand
public class CmdFactionsOfficer extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -38,19 +38,19 @@ public class CmdFactionsOfficer extends FCommand
boolean permAny = Perm.OFFICER_ANY.has(sender, false);
Faction targetFaction = you.getFaction();
if (targetFaction != usenderFaction && !permAny)
if (targetFaction != msenderFaction && !permAny)
{
msg("%s<b> is not a member in your faction.", you.describeTo(usender, true));
msg("%s<b> is not a member in your faction.", you.describeTo(msender, true));
return;
}
if (usender != null && usender.getRole() != Rel.LEADER && !permAny)
if (msender != null && msender.getRole() != Rel.LEADER && !permAny)
{
msg("<b>You are not the faction leader.");
return;
}
if (you == usender && !permAny)
if (you == msender && !permAny)
{
msg("<b>The target player musn't be yourself.");
return;
@ -67,14 +67,14 @@ public class CmdFactionsOfficer extends FCommand
// Revoke
you.setRole(Rel.MEMBER);
targetFaction.msg("%s<i> is no longer officer in your faction.", you.describeTo(targetFaction, true));
msg("<i>You have removed officer status from %s<i>.", you.describeTo(usender, true));
msg("<i>You have removed officer status from %s<i>.", you.describeTo(msender, true));
}
else
{
// Give
you.setRole(Rel.OFFICER);
targetFaction.msg("%s<i> was promoted to officer in your faction.", you.describeTo(targetFaction, true));
msg("<i>You have promoted %s<i> to officer.", you.describeTo(usender, true));
msg("<i>You have promoted %s<i> to officer.", you.describeTo(msender, true));
}
}

View File

@ -8,7 +8,7 @@ import com.massivecraft.factions.event.EventFactionsOpenChange;
import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsOpen extends FCommand
public class CmdFactionsOpen extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -36,21 +36,21 @@ public class CmdFactionsOpen extends FCommand
public void perform()
{
// Args
Boolean newOpen = this.arg(0, ARBoolean.get(), !usenderFaction.isOpen());
Boolean newOpen = this.arg(0, ARBoolean.get(), !msenderFaction.isOpen());
if (newOpen == null) return;
// Event
EventFactionsOpenChange event = new EventFactionsOpenChange(sender, usenderFaction, newOpen);
EventFactionsOpenChange event = new EventFactionsOpenChange(sender, msenderFaction, newOpen);
event.run();
if (event.isCancelled()) return;
newOpen = event.isNewOpen();
// Apply
usenderFaction.setOpen(newOpen);
msenderFaction.setOpen(newOpen);
// Inform
String descTarget = usenderFaction.isOpen() ? "open" : "closed";
usenderFaction.msg("%s<i> changed the faction to <h>%s<i>.", usender.describeTo(usenderFaction, true), descTarget);
String descTarget = msenderFaction.isOpen() ? "open" : "closed";
msenderFaction.msg("%s<i> changed the faction to <h>%s<i>.", msender.describeTo(msenderFaction, true), descTarget);
}
}

View File

@ -11,7 +11,7 @@ import com.massivecraft.massivecore.cmd.arg.ARBoolean;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsPerm extends FCommand
public class CmdFactionsPerm extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -40,12 +40,12 @@ public class CmdFactionsPerm extends FCommand
@Override
public void perform()
{
Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
if ( ! this.argIsSet(1))
{
msg(Txt.titleize("Perms for " + faction.describeTo(usender, true)));
msg(Txt.titleize("Perms for " + faction.describeTo(msender, true)));
msg(FPerm.getStateHeaders());
for (FPerm perm : FPerm.values())
{
@ -60,14 +60,14 @@ public class CmdFactionsPerm extends FCommand
if ( ! this.argIsSet(2))
{
msg(Txt.titleize("Perm for " + faction.describeTo(usender, true)));
msg(Txt.titleize("Perm for " + faction.describeTo(msender, true)));
msg(FPerm.getStateHeaders());
msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
return;
}
// Do the sender have the right to change perms for this faction?
if ( ! FPerm.PERMS.has(usender, faction, true)) return;
if ( ! FPerm.PERMS.has(msender, faction, true)) return;
Rel rel = this.arg(2, ARRel.get());
if (rel == null) return;
@ -91,7 +91,7 @@ public class CmdFactionsPerm extends FCommand
faction.setRelationPermitted(FPerm.PERMS, Rel.LEADER, true);
}
msg(Txt.titleize("Perm for " + faction.describeTo(usender, true)));
msg(Txt.titleize("Perm for " + faction.describeTo(msender, true)));
msg(FPerm.getStateHeaders());
msg(perm.getStateInfo(faction.getPermittedRelations(perm), true));
}

View File

@ -11,7 +11,7 @@ import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsPlayer extends FCommand
public class CmdFactionsPlayer extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -37,11 +37,11 @@ public class CmdFactionsPlayer extends FCommand
public void perform()
{
// Args
MPlayer mplayer = this.arg(0, ARMPlayer.getAny(), usender);
MPlayer mplayer = this.arg(0, ARMPlayer.getAny(), msender);
if (mplayer == null) return;
// INFO: Title
msg(Txt.titleize("Player " + mplayer.describeTo(usender)));
msg(Txt.titleize("Player " + mplayer.describeTo(msender)));
// INFO: Power (as progress bar)
double progressbarQuota = mplayer.getPower() / mplayer.getPowerMax();

View File

@ -9,7 +9,7 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.cmd.arg.ARDouble;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsPowerBoost extends FCommand
public class CmdFactionsPowerBoost extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -72,7 +72,7 @@ public class CmdFactionsPowerBoost extends FCommand
}
msg("<i>"+target+" now has a power bonus/penalty of "+targetPower+" to min and max power levels.");
Factions.get().log(usender.getName()+" has set the power bonus/penalty for "+target+" to "+targetPower+".");
Factions.get().log(msender.getName()+" has set the power bonus/penalty for "+target+" to "+targetPower+".");
}
}

View File

@ -6,7 +6,7 @@ import com.massivecraft.factions.cmd.arg.ARMPlayer;
import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsPromote extends FCommand
public class CmdFactionsPromote extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -38,13 +38,13 @@ public class CmdFactionsPromote extends FCommand
MPlayer you = this.arg(0, ARMPlayer.getAny());
if (you == null) return;
if (you.getFaction() != usenderFaction)
if (you.getFaction() != msenderFaction)
{
msg("%s<b> is not a member in your faction.", you.describeTo(usender, true));
msg("%s<b> is not a member in your faction.", you.describeTo(msender, true));
return;
}
if (you == usender)
if (you == msender)
{
msg("<b>The target player mustn't be yourself.");
return;
@ -52,24 +52,24 @@ public class CmdFactionsPromote extends FCommand
if (you.getRole() == Rel.RECRUIT)
{
if (!usender.getRole().isAtLeast(Rel.OFFICER))
if (!msender.getRole().isAtLeast(Rel.OFFICER))
{
msg("<b>You must be an officer to promote someone to member.");
return;
}
you.setRole(Rel.MEMBER);
usenderFaction.msg("%s<i> was promoted to being a member of your faction.", you.describeTo(usenderFaction, true));
msenderFaction.msg("%s<i> was promoted to being a member of your faction.", you.describeTo(msenderFaction, true));
}
else if (you.getRole() == Rel.MEMBER)
{
if (!usender.getRole().isAtLeast(Rel.LEADER))
if (!msender.getRole().isAtLeast(Rel.LEADER))
{
msg("<b>You must be the leader to promote someone to officer.");
return;
}
// Give
you.setRole(Rel.OFFICER);
usenderFaction.msg("%s<i> was promoted to being a officer in your faction.", you.describeTo(usenderFaction, true));
msenderFaction.msg("%s<i> was promoted to being a officer in your faction.", you.describeTo(msenderFaction, true));
}
}

View File

@ -11,7 +11,7 @@ import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.EventFactionsRelationChange;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public abstract class CmdFactionsRelationAbstract extends FCommand
public abstract class CmdFactionsRelationAbstract extends FactionsCommand
{
public Rel targetRelation;
@ -51,40 +51,40 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
// Verify
if (otherFaction == usenderFaction)
if (otherFaction == msenderFaction)
{
msg("<b>Nope! You can't declare a relation to yourself :)");
return;
}
if (usenderFaction.getRelationWish(otherFaction) == newRelation)
if (msenderFaction.getRelationWish(otherFaction) == newRelation)
{
msg("<b>You already have that relation wish set with %s.", otherFaction.getName());
return;
}
// Event
EventFactionsRelationChange event = new EventFactionsRelationChange(sender, usenderFaction, otherFaction, newRelation);
EventFactionsRelationChange event = new EventFactionsRelationChange(sender, msenderFaction, otherFaction, newRelation);
event.run();
if (event.isCancelled()) return;
newRelation = event.getNewRelation();
// try to set the new relation
usenderFaction.setRelationWish(otherFaction, newRelation);
Rel currentRelation = usenderFaction.getRelationTo(otherFaction, true);
msenderFaction.setRelationWish(otherFaction, newRelation);
Rel currentRelation = msenderFaction.getRelationTo(otherFaction, true);
// if the relation change was successful
if (newRelation == currentRelation)
{
otherFaction.msg("%s<i> is now %s.", usenderFaction.describeTo(otherFaction, true), newRelation.getDescFactionOne());
usenderFaction.msg("%s<i> is now %s.", otherFaction.describeTo(usenderFaction, true), newRelation.getDescFactionOne());
otherFaction.msg("%s<i> is now %s.", msenderFaction.describeTo(otherFaction, true), newRelation.getDescFactionOne());
msenderFaction.msg("%s<i> is now %s.", otherFaction.describeTo(msenderFaction, true), newRelation.getDescFactionOne());
}
// inform the other faction of your request
else
{
otherFaction.msg("%s<i> wishes to be %s.", usenderFaction.describeTo(otherFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
otherFaction.msg("<i>Type <c>/"+MConf.get().aliasesF.get(0)+" "+newRelation+" "+usenderFaction.getName()+"<i> to accept.");
usenderFaction.msg("%s<i> were informed that you wish to be %s<i>.", otherFaction.describeTo(usenderFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
otherFaction.msg("%s<i> wishes to be %s.", msenderFaction.describeTo(otherFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
otherFaction.msg("<i>Type <c>/"+MConf.get().aliasesF.get(0)+" "+newRelation+" "+msenderFaction.getName()+"<i> to accept.");
msenderFaction.msg("%s<i> were informed that you wish to be %s<i>.", otherFaction.describeTo(msenderFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
}
// TODO: The ally case should work!!
@ -92,13 +92,13 @@ public abstract class CmdFactionsRelationAbstract extends FCommand
if ( newRelation != Rel.TRUCE && otherFaction.getFlag(FFlag.PEACEFUL))
{
otherFaction.msg("<i>This will have no effect while your faction is peaceful.");
usenderFaction.msg("<i>This will have no effect while their faction is peaceful.");
msenderFaction.msg("<i>This will have no effect while their faction is peaceful.");
}
if ( newRelation != Rel.TRUCE && usenderFaction.getFlag(FFlag.PEACEFUL))
if ( newRelation != Rel.TRUCE && msenderFaction.getFlag(FFlag.PEACEFUL))
{
otherFaction.msg("<i>This will have no effect while their faction is peaceful.");
usenderFaction.msg("<i>This will have no effect while your faction is peaceful.");
msenderFaction.msg("<i>This will have no effect while your faction is peaceful.");
}
}

View File

@ -12,7 +12,7 @@ import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.ps.PSFormatHumanSpace;
public class CmdFactionsSeeChunk extends FCommand
public class CmdFactionsSeeChunk extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT

View File

@ -5,13 +5,12 @@ import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.EventFactionsHomeChange;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsSethome extends FCommand
public class CmdFactionsSethome extends FactionsCommandHome
{
// -------------------------------------------- //
// CONSTRUCT
@ -26,8 +25,8 @@ public class CmdFactionsSethome extends FCommand
this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqIsPlayer.get());
this.addRequirements(ReqHasPerm.get(Perm.SETHOME.node));
this.addRequirements(ReqIsPlayer.get());
}
// -------------------------------------------- //
@ -38,25 +37,18 @@ public class CmdFactionsSethome extends FCommand
public void perform()
{
// Args
Faction faction = this.arg(0, ARFaction.get(), usenderFaction);
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
PS newHome = PS.valueOf(me.getLocation());
// Validate
if ( ! MConf.get().homesEnabled)
{
usender.msg("<b>Sorry, Faction homes are disabled on this server.");
return;
}
// FPerm
if ( ! FPerm.SETHOME.has(usender, faction, true)) return;
if ( ! FPerm.SETHOME.has(msender, faction, true)) return;
// Verify
if (!usender.isUsingAdminMode() && !faction.isValidHome(newHome))
if (!msender.isUsingAdminMode() && !faction.isValidHome(newHome))
{
usender.msg("<b>Sorry, your faction home can only be set inside your own claimed territory.");
msender.msg("<b>Sorry, your faction home can only be set inside your own claimed territory.");
return;
}
@ -70,11 +62,11 @@ public class CmdFactionsSethome extends FCommand
faction.setHome(newHome);
// Inform
faction.msg("%s<i> set the home for your faction. You can now use:", usender.describeTo(usenderFaction, true));
faction.msg("%s<i> set the home for your faction. You can now use:", msender.describeTo(msenderFaction, true));
faction.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsHome.getUseageTemplate());
if (faction != usenderFaction)
if (faction != msenderFaction)
{
usender.msg("<b>You have set the home for the "+faction.getName(usender)+"<i> faction.");
msender.msg("<i>You have set the home for " + faction.getName(msender) + "<i>.");
}
}

View File

@ -12,7 +12,7 @@ import com.massivecraft.massivecore.cmd.arg.ARString;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.util.Txt;
public class CmdFactionsTitle extends FCommand
public class CmdFactionsTitle extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -53,7 +53,7 @@ public class CmdFactionsTitle extends FCommand
}
// Verify
if ( ! canIAdministerYou(usender, you)) return;
if ( ! canIAdministerYou(msender, you)) return;
// Event
EventFactionsTitleChange event = new EventFactionsTitleChange(sender, you, newTitle);
@ -65,7 +65,7 @@ public class CmdFactionsTitle extends FCommand
you.setTitle(newTitle);
// Inform
usenderFaction.msg("%s<i> changed a title: %s", usender.describeTo(usenderFaction, true), you.describeTo(usenderFaction, true));
msenderFaction.msg("%s<i> changed a title: %s", msender.describeTo(msenderFaction, true), you.describeTo(msenderFaction, true));
}
}

View File

@ -8,7 +8,7 @@ import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.cmd.req.ReqIsPlayer;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsUnclaim extends FCommand
public class CmdFactionsUnclaim extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -37,7 +37,7 @@ public class CmdFactionsUnclaim extends FCommand
Faction newFaction = FactionColl.get().getNone();
// Apply
if (usender.tryClaim(newFaction, chunk, true, true)) return;
if (msender.tryClaim(newFaction, chunk, true, true)) return;
}
}

View File

@ -16,7 +16,7 @@ import com.massivecraft.factions.event.EventFactionsChunkChange;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
import com.massivecraft.massivecore.ps.PS;
public class CmdFactionsUnclaimall extends FCommand
public class CmdFactionsUnclaimall extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
@ -41,11 +41,11 @@ public class CmdFactionsUnclaimall extends FCommand
public void perform()
{
// Args
Faction faction = usenderFaction;
Faction faction = msenderFaction;
Faction newFaction = FactionColl.get().getNone();
// FPerm
if (!FPerm.TERRITORY.has(usender, faction, true)) return;
if (!FPerm.TERRITORY.has(msender, faction, true)) return;
// Apply
Set<PS> chunks = BoardColl.get().getChunks(faction);
@ -68,12 +68,12 @@ public class CmdFactionsUnclaimall extends FCommand
}
// Inform
usenderFaction.msg("%s<i> unclaimed <h>%d <i>of your <h>%d <i>faction land. You now have <h>%d <i>land claimed.", usender.describeTo(usenderFaction, true), countSuccess, countTotal, countFail);
msenderFaction.msg("%s<i> unclaimed <h>%d <i>of your <h>%d <i>faction land. You now have <h>%d <i>land claimed.", msender.describeTo(msenderFaction, true), countSuccess, countTotal, countFail);
// Log
if (MConf.get().logLandUnclaims)
{
Factions.get().log(usender.getName()+" unclaimed everything for the faction: "+usenderFaction.getName());
Factions.get().log(msender.getName()+" unclaimed everything for the faction: "+msenderFaction.getName());
}
}

View File

@ -0,0 +1,68 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.FPerm;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.event.EventFactionsHomeChange;
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
public class CmdFactionsUnsethome extends FactionsCommandHome
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public CmdFactionsUnsethome()
{
// Aliases
this.addAliases("unsethome");
// Args
this.addOptionalArg("faction", "you");
// Requirements
this.addRequirements(ReqHasPerm.get(Perm.UNSETHOME.node));
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public void perform()
{
// Args
Faction faction = this.arg(0, ARFaction.get(), msenderFaction);
if (faction == null) return;
// Other Perm
if (faction != msenderFaction && !Perm.HOME_OTHER.has(sender, true)) return;
// FPerm
if ( ! FPerm.SETHOME.has(msender, faction, true)) return;
// NoChange
if ( ! faction.hasHome())
{
msender.msg("<i>%s <i>does already not have a home.", faction.describeTo(msender));
return;
}
// Event
EventFactionsHomeChange event = new EventFactionsHomeChange(sender, faction, null);
event.run();
if (event.isCancelled()) return;
// Apply
faction.setHome(null);
// Inform
faction.msg("%s<i> unset the home for your faction.", msender.describeTo(msenderFaction, true));
if (faction != msenderFaction)
{
msender.msg("<i>You have unset the home for " + faction.getName(msender) + "<i>.");
}
}
}

View File

@ -6,15 +6,14 @@ import com.massivecraft.factions.entity.Faction;
import com.massivecraft.massivecore.cmd.MassiveCommand;
import com.massivecraft.massivecore.util.Txt;
public abstract class FCommand extends MassiveCommand
public abstract class FactionsCommand extends MassiveCommand
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
public MPlayer msender;
public MPlayer usender;
public Faction usenderFaction;
public Faction msenderFaction;
// -------------------------------------------- //
// OVERRIDE
@ -24,12 +23,7 @@ public abstract class FCommand extends MassiveCommand
public void fixSenderVars()
{
this.msender = MPlayer.get(sender);
this.usender = null;
this.usenderFaction = null;
this.usender = MPlayer.get(this.sender);
this.usenderFaction = this.usender.getFaction();
this.msenderFaction = this.msender.getFaction();
}
@ -37,8 +31,7 @@ public abstract class FCommand extends MassiveCommand
public void unsetSenderVars()
{
this.msender = null;
this.usender = null;
this.usenderFaction = null;
this.msenderFaction = null;
}
// -------------------------------------------- //

View File

@ -0,0 +1,28 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.cmd.req.ReqFactionHomesEnabled;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.cmd.VisibilityMode;
public class FactionsCommandHome extends FactionsCommand
{
// -------------------------------------------- //
// CONSTRUCT
// -------------------------------------------- //
public FactionsCommandHome()
{
this.addRequirements(ReqFactionHomesEnabled.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public VisibilityMode getVisibilityMode()
{
return MConf.get().homesEnabled ? super.getVisibilityMode() : VisibilityMode.INVISIBLE;
}
}

View File

@ -0,0 +1,37 @@
package com.massivecraft.factions.cmd.req;
import org.bukkit.command.CommandSender;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.cmd.MassiveCommand;
import com.massivecraft.massivecore.cmd.req.ReqAbstract;
import com.massivecraft.massivecore.util.Txt;
public class ReqFactionHomesEnabled extends ReqAbstract
{
private static final long serialVersionUID = 1L;
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static ReqFactionHomesEnabled i = new ReqFactionHomesEnabled();
public static ReqFactionHomesEnabled get() { return i; }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public boolean apply(CommandSender sender, MassiveCommand command)
{
return MConf.get().homesEnabled;
}
@Override
public String createErrorMessage(CommandSender sender, MassiveCommand command)
{
return Txt.parse("<b>Homes must be enabled on the server to "+(command == null ? "do that" : command.getDesc())+".");
}
}

View File

@ -29,6 +29,10 @@ public class RelationUtil
if (that instanceof Faction)
{
if (thatFaction.isNone())
{
ret = thatFaction.getName();
}
if (me instanceof MPlayer && myFaction == thatFaction)
{
ret = "your faction";

View File

@ -26,6 +26,7 @@ permissions:
factions.flag: {description: manage faction flags, default: false}
factions.flag.set: {description: set faction flags, default: false}
factions.home: {description: teleport to faction home, default: false}
factions.home.other: {description: teleport to another faction home, default: false}
factions.invite: {description: set if player is invited, default: false}
factions.join: {description: join faction, default: false}
factions.join.any: {description: join closed faction, default: false}
@ -59,6 +60,8 @@ permissions:
factions.title.color: {description: set player title with color, default: false}
factions.unclaim: {description: unclaim land where you stand, default: false}
factions.unclaimall: {description: unclaim all land, default: false}
factions.unsethome: {description: unset faction home, default: false}
factions.unsethome.other: {description: unset other faction home, default: false}
factions.version: {description: see plugin version, default: false}
# -------------------------------------------- #
# STAR NOTATION
@ -81,6 +84,7 @@ permissions:
factions.flag: true
factions.flag.set: true
factions.home: true
factions.home.other: true
factions.invite: true
factions.join: true
factions.join.any: true
@ -114,6 +118,8 @@ permissions:
factions.title.color: true
factions.unclaim: true
factions.unclaimall: true
factions.unsethome: true
factions.unsethome.other: true
factions.version: true
# -------------------------------------------- #
# KITS
@ -142,6 +148,8 @@ permissions:
children:
factions.kit.rank0: true
factions.admin: true
factions.home.other: true
factions.unsethome.other: true
factions.kit.rank0:
default: false
children:
@ -187,6 +195,7 @@ permissions:
factions.title.color: true
factions.unclaim: true
factions.unclaimall: true
factions.unsethome: true
factions.version: true
factions.kit.default:
default: true