Changed FancyMessage.command() to accept command aliases.
Also adds support for servers where slash-less commands are disabled.
This commit is contained in:
parent
728b6b0fbc
commit
0d75b1164a
@ -1,5 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
@ -34,7 +35,7 @@ public class CmdDeinvite extends FCommand {
|
|||||||
for (String id : myFaction.getInvites()) {
|
for (String id : myFaction.getInvites()) {
|
||||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||||
String name = fp != null ? fp.getName() : id;
|
String name = fp != null ? fp.getName() : id;
|
||||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("f deinvite " + name);
|
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command(Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||||
}
|
}
|
||||||
sendFancyMessage(msg);
|
sendFancyMessage(msg);
|
||||||
return;
|
return;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.P;
|
import com.massivecraft.factions.P;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
@ -30,7 +31,7 @@ public class CmdFWarp extends FCommand {
|
|||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_FWARP_WARPS.toString()).color(ChatColor.GOLD);
|
FancyMessage msg = new FancyMessage(TL.COMMAND_FWARP_WARPS.toString()).color(ChatColor.GOLD);
|
||||||
Map<String, LazyLocation> warps = myFaction.getWarps();
|
Map<String, LazyLocation> warps = myFaction.getWarps();
|
||||||
for (String s : warps.keySet()) {
|
for (String s : warps.keySet()) {
|
||||||
msg.then(s + " ").tooltip(TL.COMMAND_FWARP_CLICKTOWARP.toString()).command("f warp " + s).color(ChatColor.WHITE);
|
msg.then(s + " ").tooltip(TL.COMMAND_FWARP_CLICKTOWARP.toString()).command(Conf.baseCommandAliases.get(0) + " warp " + s).color(ChatColor.WHITE);
|
||||||
}
|
}
|
||||||
sendFancyMessage(msg);
|
sendFancyMessage(msg);
|
||||||
} else if (args.size() > 1) {
|
} else if (args.size() > 1) {
|
||||||
|
@ -50,7 +50,7 @@ public class CmdInvite extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Tooltips, colors, and commands only apply to the string immediately before it.
|
// Tooltips, colors, and commands only apply to the string immediately before it.
|
||||||
FancyMessage message = new FancyMessage(fme.describeTo(you, true)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString()).command("f join " + myFaction.getTag()).then(TL.COMMAND_INVITE_INVITEDYOU.toString()).color(ChatColor.YELLOW).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString()).command("f join " + myFaction.getTag()).then(myFaction.describeTo(you)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString()).command("f join " + myFaction.getTag());
|
FancyMessage message = new FancyMessage(fme.describeTo(you, true)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString()).command(Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag()).then(TL.COMMAND_INVITE_INVITEDYOU.toString()).color(ChatColor.YELLOW).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString()).command(Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag()).then(myFaction.describeTo(you)).tooltip(TL.COMMAND_INVITE_CLICKTOJOIN.toString()).command(Conf.baseCommandAliases.get(0) + " join " + myFaction.getTag());
|
||||||
|
|
||||||
message.send(you.getPlayer());
|
message.send(you.getPlayer());
|
||||||
|
|
||||||
|
@ -37,12 +37,12 @@ public class CmdKick extends FCommand {
|
|||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_KICK_CANDIDATES.toString()).color(ChatColor.GOLD);
|
FancyMessage msg = new FancyMessage(TL.COMMAND_KICK_CANDIDATES.toString()).color(ChatColor.GOLD);
|
||||||
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) {
|
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) {
|
||||||
String s = player.getName();
|
String s = player.getName();
|
||||||
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("f kick " + s);
|
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command(Conf.baseCommandAliases.get(0) + " kick " + s);
|
||||||
}
|
}
|
||||||
if (fme.getRole() == Role.ADMIN) {
|
if (fme.getRole() == Role.ADMIN) {
|
||||||
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.MODERATOR)) {
|
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.MODERATOR)) {
|
||||||
String s = player.getName();
|
String s = player.getName();
|
||||||
msg.then(s + " ").color(ChatColor.GRAY).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command("f kick " + s);
|
msg.then(s + " ").color(ChatColor.GRAY).tooltip(TL.COMMAND_KICK_CLICKTOKICK.toString() + s).command(Conf.baseCommandAliases.get(0) + " kick " + s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
@ -33,7 +34,7 @@ public class CmdMod extends FCommand {
|
|||||||
FancyMessage msg = new FancyMessage(TL.COMMAND_MOD_CANDIDATES.toString()).color(ChatColor.GOLD);
|
FancyMessage msg = new FancyMessage(TL.COMMAND_MOD_CANDIDATES.toString()).color(ChatColor.GOLD);
|
||||||
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) {
|
for (FPlayer player : myFaction.getFPlayersWhereRole(Role.NORMAL)) {
|
||||||
String s = player.getName();
|
String s = player.getName();
|
||||||
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("f mod " + s);
|
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command(Conf.baseCommandAliases.get(0) + " mod " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendFancyMessage(msg);
|
sendFancyMessage(msg);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
import com.massivecraft.factions.FPlayers;
|
import com.massivecraft.factions.FPlayers;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
@ -24,7 +25,7 @@ public class CmdShowInvites extends FCommand {
|
|||||||
for (String id : myFaction.getInvites()) {
|
for (String id : myFaction.getInvites()) {
|
||||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||||
String name = fp != null ? fp.getName() : id;
|
String name = fp != null ? fp.getName() : id;
|
||||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_SHOWINVITES_CLICKTOREVOKE.format(name)).command("f deinvite " + name);
|
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_SHOWINVITES_CLICKTOREVOKE.format(name)).command(Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendFancyMessage(msg);
|
sendFancyMessage(msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user