Implement Mson UsageTemplate.
This commit is contained in:
parent
fe68d57b23
commit
13b7bd5581
@ -2,6 +2,8 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
@ -15,6 +17,7 @@ import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipC
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARString;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.store.MStore;
|
||||
|
||||
public class CmdFactionsCreate extends FactionsCommand
|
||||
@ -81,7 +84,7 @@ public class CmdFactionsCreate extends FactionsCommand
|
||||
|
||||
// Inform
|
||||
msg("<i>You created the faction %s", faction.getName(msender));
|
||||
msg("<i>You should now: %s", Factions.get().getOuterCmdFactions().cmdFactionsDescription.getUseageTemplate());
|
||||
message(Mson.mson(mson("You should now: ").color(ChatColor.YELLOW), Factions.get().getOuterCmdFactions().cmdFactionsDescription.getUseageTemplate()));
|
||||
|
||||
// Log
|
||||
if (MConf.get().logFactionCreate)
|
||||
|
@ -2,6 +2,8 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||
@ -11,6 +13,8 @@ import com.massivecraft.factions.event.EventFactionsInvitedChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARSet;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class CmdFactionsInviteAdd extends FactionsCommand
|
||||
{
|
||||
@ -71,9 +75,18 @@ public class CmdFactionsInviteAdd extends FactionsCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mson
|
||||
String command = Factions.get().getOuterCmdFactions().cmdFactionsInvite.cmdFactionsInviteRemove.getCommandLine(mplayer.getName());
|
||||
String tooltip = Txt.parse("<i>Click to <c>%s<i>.", command);
|
||||
|
||||
Mson remove = Mson.mson(
|
||||
mson("You might want to remove him. ").color(ChatColor.YELLOW),
|
||||
mson("Click to " + command).color(ChatColor.RED).tooltip(tooltip).suggest(command)
|
||||
);
|
||||
|
||||
// Inform
|
||||
msg("%s <i>is already invited to %s<i>.", mplayer.getName(), msenderFaction.getName());
|
||||
msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsInvite.cmdFactionsInviteRemove.getUseageTemplate(false));
|
||||
message(remove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,12 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||
@ -13,6 +16,8 @@ import com.massivecraft.factions.event.EventFactionsInvitedChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.arg.ARSet;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class CmdFactionsInviteRemove extends FactionsCommand
|
||||
{
|
||||
@ -67,8 +72,18 @@ public class CmdFactionsInviteRemove extends FactionsCommand
|
||||
// Already member?
|
||||
if (mplayer.getFaction() == msenderFaction)
|
||||
{
|
||||
// Mson
|
||||
String command = Factions.get().getOuterCmdFactions().cmdFactionsKick.getCommandLine(mplayer.getName());
|
||||
String tooltip = Txt.parse("Click to <c>%s<i>.", command);
|
||||
|
||||
Mson kick = Mson.mson(
|
||||
mson("You might want to kick him. ").color(ChatColor.YELLOW),
|
||||
mson(ChatColor.RED.toString() + tooltip).tooltip(ChatColor.YELLOW.toString() + tooltip).suggest(command)
|
||||
);
|
||||
|
||||
// Inform
|
||||
msg("%s<i> is already a member of %s<i>.", mplayer.getName(), msenderFaction.getName());
|
||||
msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsKick.getUseageTemplate(false));
|
||||
message(kick);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -97,16 +112,37 @@ public class CmdFactionsInviteRemove extends FactionsCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mson
|
||||
String command = Factions.get().getOuterCmdFactions().cmdFactionsInvite.cmdFactionsInviteAdd.getCommandLine(mplayer.getName());
|
||||
String tooltip = Txt.parse("Click to <c>%s<i>.", command);
|
||||
|
||||
Mson invite = Mson.mson(
|
||||
mson("You might want to invite him. ").color(ChatColor.YELLOW),
|
||||
mson(ChatColor.GREEN.toString() + tooltip).tooltip(ChatColor.YELLOW.toString() + tooltip).suggest(command)
|
||||
);
|
||||
|
||||
// Inform
|
||||
msg("%s <i>is not invited to %s<i>.", mplayer.describeTo(msender, true), msenderFaction.describeTo(mplayer));
|
||||
msg("<i>You might want to: " + Factions.get().getOuterCmdFactions().cmdFactionsInvite.cmdFactionsInviteAdd.getUseageTemplate(false));
|
||||
message(invite);
|
||||
}
|
||||
}
|
||||
|
||||
// Inform Faction if all
|
||||
if (all)
|
||||
{
|
||||
msenderFaction.msg("%s<i> revoked all <h>%s <i>pending invitations from your faction.", msender.describeTo(msenderFaction), mplayers.size());
|
||||
List<String> names = new ArrayList<String>();
|
||||
for (MPlayer mplayer : mplayers)
|
||||
{
|
||||
names.add(mplayer.describeTo(msender, true));
|
||||
}
|
||||
|
||||
Mson factionsRevokeAll = mson(
|
||||
Mson.parse("%s<i> revoked ", msender.describeTo(msenderFaction)),
|
||||
Mson.parse("<i>all <h>%s <i>pending invitations", mplayers.size()).tooltip(names),
|
||||
mson(" from your faction.").color(ChatColor.YELLOW)
|
||||
);
|
||||
|
||||
msenderFaction.sendMessage(factionsRevokeAll);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARMPlayer;
|
||||
@ -12,6 +14,7 @@ import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public class CmdFactionsJoin extends FactionsCommand
|
||||
@ -57,7 +60,15 @@ public class CmdFactionsJoin extends FactionsCommand
|
||||
|
||||
if (faction == mplayerFaction)
|
||||
{
|
||||
msg("<i>%s <i>%s already a member of %s<i>.", mplayer.describeTo(msender, true), (samePlayer ? "are" : "is"), faction.getName(msender));
|
||||
String command = Factions.get().getOuterCmdFactions().cmdFactionsKick.getCommandLine(mplayer.getName());
|
||||
|
||||
// Mson creation
|
||||
Mson alreadyMember = Mson.mson(
|
||||
Mson.parse(mplayer.describeTo(msender, true)),
|
||||
mson((samePlayer ? " are" : " is") + " already a member of " + faction.getName(msender) + ".").color(ChatColor.YELLOW)
|
||||
);
|
||||
|
||||
message(alreadyMember.suggest(command).tooltip(Txt.parse("<i>Click to <c>%s<i>.", command)));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -69,7 +80,15 @@ public class CmdFactionsJoin extends FactionsCommand
|
||||
|
||||
if (mplayerFaction.isNormal())
|
||||
{
|
||||
msg("<b>%s must leave %s current faction first.", mplayer.describeTo(msender, true), (samePlayer ? "your" : "their"));
|
||||
String command = Factions.get().getOuterCmdFactions().cmdFactionsLeave.getCommandLine(mplayer.getName());
|
||||
|
||||
// Mson creation
|
||||
Mson leaveFirst = Mson.mson(
|
||||
Mson.parse(mplayer.describeTo(msender, true)),
|
||||
mson(" must leave " + (samePlayer ? "your" : "their") + " current faction first.").color(ChatColor.RED)
|
||||
);
|
||||
|
||||
message(leaveFirst.suggest(command).tooltip(Txt.parse("<i>Click to <c>%s<i>.", command)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
@ -13,6 +15,7 @@ import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
||||
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.IdUtil;
|
||||
|
||||
public class CmdFactionsKick extends FactionsCommand
|
||||
@ -47,7 +50,7 @@ public class CmdFactionsKick extends FactionsCommand
|
||||
if (msender == mplayer)
|
||||
{
|
||||
msg("<b>You can't kick yourself.");
|
||||
msg("<i>You might want to: %s", Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false));
|
||||
message(Mson.mson(mson("You might want to: ").color(ChatColor.YELLOW), Factions.get().getOuterCmdFactions().cmdFactionsLeave.getUseageTemplate(false)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,19 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.Rel;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.cmd.req.ReqHasFaction;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.entity.MFlag;
|
||||
import com.massivecraft.factions.entity.MPerm;
|
||||
import com.massivecraft.factions.event.EventFactionsRelationChange;
|
||||
import com.massivecraft.massivecore.MassiveException;
|
||||
import com.massivecraft.massivecore.cmd.MassiveCommand;
|
||||
import com.massivecraft.massivecore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.massivecore.mson.Mson;
|
||||
import com.massivecraft.massivecore.util.Txt;
|
||||
|
||||
public abstract class CmdFactionsRelationAbstract extends FactionsCommand
|
||||
{
|
||||
@ -84,8 +87,22 @@ public abstract class CmdFactionsRelationAbstract extends FactionsCommand
|
||||
// inform the other faction of your request
|
||||
else
|
||||
{
|
||||
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.");
|
||||
MassiveCommand relationshipCommand = null;
|
||||
if (newRelation.equals(Rel.NEUTRAL)) relationshipCommand = Factions.get().getOuterCmdFactions().cmdFactionsRelationNeutral;
|
||||
else if (newRelation.equals(Rel.TRUCE)) relationshipCommand = Factions.get().getOuterCmdFactions().cmdFactionsRelationTruce;
|
||||
else if (newRelation.equals(Rel.ALLY)) relationshipCommand = Factions.get().getOuterCmdFactions().cmdFactionsRelationAlly;
|
||||
else if (newRelation.equals(Rel.ENEMY)) relationshipCommand = Factions.get().getOuterCmdFactions().cmdFactionsRelationEnemy;
|
||||
|
||||
String command = relationshipCommand.getCommandLine(msenderFaction.getName());
|
||||
String tooltip = Txt.parse("<g>Click to <c>%s<i>.", command);
|
||||
|
||||
// Mson creation
|
||||
Mson factionsRelationshipChange = mson(
|
||||
Mson.parse("%s<i> wishes to be %s. ", msenderFaction.describeTo(otherFaction, true), newRelation.getColor()+newRelation.getDescFactionOne()),
|
||||
mson(tooltip).tooltipParse(tooltip).command(command)
|
||||
);
|
||||
|
||||
otherFaction.sendMessage(factionsRelationshipChange);
|
||||
msenderFaction.msg("%s<i> were informed that you wish to be %s<i>.", otherFaction.describeTo(msenderFaction, true), newRelation.getColor()+newRelation.getDescFactionOne());
|
||||
}
|
||||
|
||||
|
@ -1207,17 +1207,17 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
|
||||
|
||||
// CONVENIENCE SEND MESSAGE
|
||||
|
||||
public boolean sendMessage(String message)
|
||||
public boolean sendMessage(Object message)
|
||||
{
|
||||
return Mixin.messagePredictate(new FactionEqualsPredictate(this), message);
|
||||
}
|
||||
|
||||
public boolean sendMessage(String... messages)
|
||||
public boolean sendMessage(Object... messages)
|
||||
{
|
||||
return Mixin.messagePredictate(new FactionEqualsPredictate(this), messages);
|
||||
}
|
||||
|
||||
public boolean sendMessage(Collection<String> messages)
|
||||
public boolean sendMessage(Collection<Object> messages)
|
||||
{
|
||||
return Mixin.messagePredictate(new FactionEqualsPredictate(this), messages);
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable
|
||||
Player player = mplayer.getPlayer();
|
||||
if (player != null && Perm.ADMIN.has(player))
|
||||
{
|
||||
ret += Txt.parse("\n<i>You can bypass by using " + Factions.get().getOuterCmdFactions().cmdFactionsAdmin.getUseageTemplate(false));
|
||||
ret += Txt.parse("\n<i>You can bypass by using " + Factions.get().getOuterCmdFactions().cmdFactionsAdmin.getUseageTemplate(false).toPlain(true));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user