Some refactoring and better messages

This commit is contained in:
Olof Larsson
2011-10-24 11:07:06 +02:00
parent bb5a676430
commit 0c46809952
13 changed files with 111 additions and 131 deletions

View File

@ -52,7 +52,7 @@ public class CmdKick extends FCommand
return;
}
if (you.getRole().value >= fme.getRole().value)
if (you.getRole().isAtLeast(fme.getRole()))
{
// TODO add more informative messages.
msg("<b>Your rank is too low to kick this player.");

View File

@ -138,7 +138,7 @@ public abstract class FCommand extends MCommand<P>
{
if (me == null) return true;
if (fme.getRole().value < role.value)
if (fme.getRole().isLessThan(role))
{
msg("<b>You <h>must be "+role+"<b> to "+this.getHelpShort()+".");
return false;
@ -356,7 +356,7 @@ public abstract class FCommand extends MCommand<P>
return false;
}
if (i.getRole().value > you.getRole().value || i.getRole().equals(Rel.LEADER) )
if (i.getRole().isMoreThan(you.getRole()) || i.getRole().equals(Rel.LEADER) )
{
return true;
}

View File

@ -1,7 +1,5 @@
package com.massivecraft.factions.cmd;
import org.bukkit.ChatColor;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.integration.SpoutFeatures;
@ -51,26 +49,26 @@ public abstract class FRelationCommand extends FCommand
myFaction.setRelationWish(them, targetRelation);
Rel currentRelation = myFaction.getRelationTo(them, true);
ChatColor currentRelationColor = currentRelation.getColor();
if (targetRelation.value == currentRelation.value)
if (targetRelation == currentRelation)
{
them.msg("<i>Your faction is now "+currentRelationColor+targetRelation.toString()+"<i> to "+currentRelationColor+myFaction.getTag());
myFaction.msg("<i>Your faction is now "+currentRelationColor+targetRelation.toString()+"<i> to "+currentRelationColor+them.getTag());
them.msg("%s<i> is now %s.", myFaction.describeTo(them, true), targetRelation.getDescFactionOne());
myFaction.msg("%s<i> is now %s.", them.describeTo(myFaction, true), targetRelation.getDescFactionOne());
}
else
{
them.msg(currentRelationColor+myFaction.getTag()+"<i> wishes to be your "+targetRelation.getColor()+targetRelation.toString());
them.msg("%s<i> wishes to be %s.", myFaction.describeTo(them, true), targetRelation.getColor()+targetRelation.getDescFactionOne());
them.msg("<i>Type <c>/"+Conf.baseCommandAliases.get(0)+" "+targetRelation+" "+myFaction.getTag()+"<i> to accept.");
myFaction.msg(currentRelationColor+them.getTag()+"<i> were informed that you wish to be "+targetRelation.getColor()+targetRelation);
myFaction.msg("%s<i> were informed that you wish to be %s<i>.", them.describeTo(myFaction, true), targetRelation.getColor()+targetRelation.getDescFactionOne());
}
if ( targetRelation != Rel.NEUTRAL && them.getFlag(FFlag.PEACEFUL))
// TODO: The ally case should work!!
if ( targetRelation != Rel.TRUCE && them.getFlag(FFlag.PEACEFUL))
{
them.msg("<i>This will have no effect while your faction is peaceful.");
myFaction.msg("<i>This will have no effect while their faction is peaceful.");
}
if ( targetRelation != Rel.NEUTRAL && myFaction.getFlag(FFlag.PEACEFUL))
if ( targetRelation != Rel.TRUCE && myFaction.getFlag(FFlag.PEACEFUL))
{
them.msg("<i>This will have no effect while their faction is peaceful.");
myFaction.msg("<i>This will have no effect while your faction is peaceful.");