[+] 1.15 Support Added!
[+] Greatly optmized ALOT of Commands! [+] Removed Portal Travel Agent (Recoding) [+] Added Administrator Command F Lookup
This commit is contained in:
parent
897fdbf83a
commit
86f92a7fb0
2
pom.xml
2
pom.xml
@ -105,7 +105,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13-R0.1-SNAPSHOT</version>
|
||||
<version>1.15.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.event.FPlayerJoinEvent;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
@ -29,65 +30,67 @@ public class CmdAdmin extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if (context.player == null) {
|
||||
context.msg(TL.GENERIC_PLAYERONLY);
|
||||
return;
|
||||
}
|
||||
// Allows admins bypass this.
|
||||
if (!context.fPlayer.isAdminBypassing() && !context.fPlayer.getRole().equals(Role.LEADER)) {
|
||||
context.msg(TL.COMMAND_ADMIN_NOTADMIN);
|
||||
return;
|
||||
}
|
||||
FPlayer fyou = context.argAsBestFPlayerMatch(0);
|
||||
if (fyou == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean permAny = Permission.ADMIN_ANY.has(context.sender, false);
|
||||
Faction targetFaction = fyou.getFaction();
|
||||
|
||||
if (targetFaction != context.faction && !permAny) {
|
||||
context.msg(TL.COMMAND_ADMIN_NOTMEMBER, fyou.describeTo(context.fPlayer, true));
|
||||
return;
|
||||
}
|
||||
|
||||
if (fyou == context.fPlayer && !permAny) {
|
||||
context.msg(TL.COMMAND_ADMIN_TARGETSELF);
|
||||
return;
|
||||
}
|
||||
|
||||
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
|
||||
if (fyou.getFaction() != targetFaction) {
|
||||
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(context.player), targetFaction, FPlayerJoinEvent.PlayerJoinReason.LEADER);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||
if (context.player == null) {
|
||||
context.msg(TL.GENERIC_PLAYERONLY);
|
||||
return;
|
||||
}
|
||||
// Allows admins bypass this.
|
||||
if (!context.fPlayer.isAdminBypassing() && !context.fPlayer.getRole().equals(Role.LEADER)) {
|
||||
context.msg(TL.COMMAND_ADMIN_NOTADMIN);
|
||||
return;
|
||||
}
|
||||
FPlayer fyou = context.argAsBestFPlayerMatch(0);
|
||||
if (fyou == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FPlayer admin = targetFaction.getFPlayerAdmin();
|
||||
boolean permAny = Permission.ADMIN_ANY.has(context.sender, false);
|
||||
Faction targetFaction = fyou.getFaction();
|
||||
|
||||
// if target player is currently admin, demote and replace him
|
||||
if (fyou == admin) {
|
||||
targetFaction.promoteNewLeader();
|
||||
context.msg(TL.COMMAND_ADMIN_DEMOTES, fyou.describeTo(context.fPlayer, true));
|
||||
fyou.msg(TL.COMMAND_ADMIN_DEMOTED, context.player == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fyou, true));
|
||||
return;
|
||||
}
|
||||
if (targetFaction != context.faction && !permAny) {
|
||||
context.msg(TL.COMMAND_ADMIN_NOTMEMBER, fyou.describeTo(context.fPlayer, true));
|
||||
return;
|
||||
}
|
||||
|
||||
// promote target player, and demote existing admin if one exists
|
||||
if (admin != null) {
|
||||
admin.setRole(Role.COLEADER);
|
||||
}
|
||||
fyou.setRole(Role.LEADER);
|
||||
context.msg(TL.COMMAND_ADMIN_PROMOTES, fyou.describeTo(context.fPlayer, true));
|
||||
if (fyou == context.fPlayer && !permAny) {
|
||||
context.msg(TL.COMMAND_ADMIN_TARGETSELF);
|
||||
return;
|
||||
}
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
fplayer.msg(TL.COMMAND_ADMIN_PROMOTED,
|
||||
context.player == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fplayer, true),
|
||||
fyou.describeTo(fplayer), targetFaction.describeTo(fplayer));
|
||||
}
|
||||
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
|
||||
if (fyou.getFaction() != targetFaction) {
|
||||
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(context.player), targetFaction, FPlayerJoinEvent.PlayerJoinReason.LEADER);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FPlayer admin = targetFaction.getFPlayerAdmin();
|
||||
|
||||
// if target player is currently admin, demote and replace him
|
||||
if (fyou == admin) {
|
||||
targetFaction.promoteNewLeader();
|
||||
context.msg(TL.COMMAND_ADMIN_DEMOTES, fyou.describeTo(context.fPlayer, true));
|
||||
fyou.msg(TL.COMMAND_ADMIN_DEMOTED, context.player == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fyou, true));
|
||||
return;
|
||||
}
|
||||
|
||||
// promote target player, and demote existing admin if one exists
|
||||
if (admin != null) {
|
||||
admin.setRole(Role.COLEADER);
|
||||
}
|
||||
fyou.setRole(Role.LEADER);
|
||||
context.msg(TL.COMMAND_ADMIN_PROMOTES, fyou.describeTo(context.fPlayer, true));
|
||||
|
||||
// Inform all players
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
fplayer.msg(TL.COMMAND_ADMIN_PROMOTED,
|
||||
context.player == null ? TL.GENERIC_SERVERADMIN.toString() : context.fPlayer.describeTo(fplayer, true),
|
||||
fyou.describeTo(fplayer), targetFaction.describeTo(fplayer));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public TL getUsageTranslation() {
|
||||
|
@ -32,51 +32,47 @@ public class CmdDeinvite extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
|
||||
|
||||
if (context.args.size() == 0) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
}
|
||||
context.sendFancyMessage(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||
if (!context.fPlayer.isAdminBypassing()) {
|
||||
Access access = context.faction.getAccess(context.fPlayer, PermissableAction.INVITE);
|
||||
if (access != Access.ALLOW && context.fPlayer.getRole() != Role.LEADER) {
|
||||
context.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
|
||||
if (context.args.size() == 0) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
}
|
||||
context.sendFancyMessage(msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (you == null) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
if(context.faction.getInvites().isEmpty()) return;
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||
if (!context.fPlayer.isAdminBypassing()) {
|
||||
Access access = context.faction.getAccess(context.fPlayer, PermissableAction.INVITE);
|
||||
if (access != Access.ALLOW && context.fPlayer.getRole() != Role.LEADER) {
|
||||
context.msg(TL.GENERIC_FPERM_NOPERMISSION, "manage invites");
|
||||
return;
|
||||
}
|
||||
}
|
||||
context.sendFancyMessage(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.getFaction() == context.faction) {
|
||||
context.msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), context.faction.getTag());
|
||||
context.msg(TL.COMMAND_DEINVITE_MIGHTWANT, FactionsPlugin.getInstance().cmdBase.cmdKick.getUsageTemplate(context));
|
||||
return;
|
||||
}
|
||||
if (you == null) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_DEINVITE_CANDEINVITE.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
if (context.faction.getInvites().isEmpty()) return;
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_DEINVITE_CLICKTODEINVITE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
}
|
||||
context.sendFancyMessage(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
context.faction.deinvite(you);
|
||||
if (you.getFaction() == context.faction) {
|
||||
context.msg(TL.COMMAND_DEINVITE_ALREADYMEMBER, you.getName(), context.faction.getTag());
|
||||
context.msg(TL.COMMAND_DEINVITE_MIGHTWANT, FactionsPlugin.getInstance().cmdBase.cmdKick.getUsageTemplate(context));
|
||||
return;
|
||||
}
|
||||
|
||||
you.msg(TL.COMMAND_DEINVITE_REVOKED, context.fPlayer.describeTo(you), context.faction.describeTo(you));
|
||||
|
||||
context.faction.msg(TL.COMMAND_DEINVITE_REVOKES, context.fPlayer.describeTo(context.faction), you.describeTo(context.faction));
|
||||
context.faction.deinvite(you);
|
||||
you.msg(TL.COMMAND_DEINVITE_REVOKED, context.fPlayer.describeTo(you), context.faction.describeTo(you));
|
||||
context.faction.msg(TL.COMMAND_DEINVITE_REVOKES, context.fPlayer.describeTo(context.faction), you.describeTo(context.faction));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||
@ -29,26 +30,28 @@ public class CmdDescription extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!context.payForCommand(Conf.econCostDesc, TL.COMMAND_DESCRIPTION_TOCHANGE, TL.COMMAND_DESCRIPTION_FORCHANGE)) {
|
||||
return;
|
||||
}
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!context.payForCommand(Conf.econCostDesc, TL.COMMAND_DESCRIPTION_TOCHANGE, TL.COMMAND_DESCRIPTION_FORCHANGE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// since "&" color tags seem to work even through plain old FPlayer.sendMessage() for some reason, we need to break those up
|
||||
// And replace all the % because it messes with string formatting and this is easy way around that.
|
||||
context.faction.setDescription(TextUtil.implode(context.args, " ").replaceAll("%", "").replaceAll("(&([a-f0-9klmnor]))", "& $2"));
|
||||
// since "&" color tags seem to work even through plain old FPlayer.sendMessage() for some reason, we need to break those up
|
||||
// And replace all the % because it messes with string formatting and this is easy way around that.
|
||||
context.faction.setDescription(TextUtil.implode(context.args, " ").replaceAll("%", "").replaceAll("(&([a-f0-9klmnor]))", "& $2"));
|
||||
|
||||
if (!Conf.broadcastDescriptionChanges) {
|
||||
context.msg(TL.COMMAND_DESCRIPTION_CHANGED, context.faction.describeTo(context.fPlayer));
|
||||
context.sendMessage(context.faction.getDescription());
|
||||
return;
|
||||
}
|
||||
if (!Conf.broadcastDescriptionChanges) {
|
||||
context.msg(TL.COMMAND_DESCRIPTION_CHANGED, context.faction.describeTo(context.fPlayer));
|
||||
context.sendMessage(context.faction.getDescription());
|
||||
return;
|
||||
}
|
||||
|
||||
// Broadcast the description to everyone
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
fplayer.msg(TL.COMMAND_DESCRIPTION_CHANGES, context.faction.describeTo(fplayer));
|
||||
fplayer.sendMessage(context.faction.getDescription()); // players can inject "&" or "`" or "<i>" or whatever in their description; &k is particularly interesting looking
|
||||
}
|
||||
// Broadcast the description to everyone
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
fplayer.msg(TL.COMMAND_DESCRIPTION_CHANGES, context.faction.describeTo(fplayer));
|
||||
fplayer.sendMessage(context.faction.getDescription()); // players can inject "&" or "`" or "<i>" or whatever in their description; &k is particularly interesting looking
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -43,74 +43,76 @@ public class CmdList extends FCommand {
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!context.payForCommand(Conf.econCostList, "to list the factions", "for listing the factions"))
|
||||
return;
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||
|
||||
ArrayList<Faction> factionList = Factions.getInstance().getAllFactions();
|
||||
factionList.remove(Factions.getInstance().getWilderness());
|
||||
factionList.remove(Factions.getInstance().getSafeZone());
|
||||
factionList.remove(Factions.getInstance().getWarZone());
|
||||
ArrayList<Faction> factionList = Factions.getInstance().getAllFactions();
|
||||
factionList.remove(Factions.getInstance().getWilderness());
|
||||
factionList.remove(Factions.getInstance().getSafeZone());
|
||||
factionList.remove(Factions.getInstance().getWarZone());
|
||||
|
||||
// remove exempt factions
|
||||
if (context.fPlayer != null && context.fPlayer.getPlayer() != null && !context.fPlayer.getPlayer().hasPermission("factions.show.bypassexempt")) {
|
||||
List<String> exemptFactions = FactionsPlugin.getInstance().getConfig().getStringList("show-exempt");
|
||||
// remove exempt factions
|
||||
if (context.fPlayer != null && context.fPlayer.getPlayer() != null && !context.fPlayer.getPlayer().hasPermission("factions.show.bypassexempt")) {
|
||||
List<String> exemptFactions = FactionsPlugin.getInstance().getConfig().getStringList("show-exempt");
|
||||
|
||||
factionList.removeIf(next -> exemptFactions.contains(next.getTag()));
|
||||
}
|
||||
|
||||
// Sort by total followers first
|
||||
factionList.sort((f1, f2) -> {
|
||||
int f1Size = f1.getFPlayers().size();
|
||||
int f2Size = f2.getFPlayers().size();
|
||||
if (f1Size < f2Size) {
|
||||
return 1;
|
||||
} else if (f1Size > f2Size) {
|
||||
return -1;
|
||||
factionList.removeIf(next -> exemptFactions.contains(next.getTag()));
|
||||
}
|
||||
return 0;
|
||||
|
||||
// Sort by total followers first
|
||||
factionList.sort((f1, f2) -> {
|
||||
int f1Size = f1.getFPlayers().size();
|
||||
int f2Size = f2.getFPlayers().size();
|
||||
if (f1Size < f2Size) {
|
||||
return 1;
|
||||
} else if (f1Size > f2Size) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
// Then sort by how many members are online now
|
||||
factionList.sort((f1, f2) -> {
|
||||
int f1Size = f1.getFPlayersWhereOnline(true).size();
|
||||
int f2Size = f2.getFPlayersWhereOnline(true).size();
|
||||
if (f1Size < f2Size) {
|
||||
return 1;
|
||||
} else if (f1Size > f2Size) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
ArrayList<String> lines = new ArrayList<>();
|
||||
|
||||
factionList.add(0, Factions.getInstance().getWilderness());
|
||||
|
||||
final int pageheight = 9;
|
||||
int pagenumber = context.argAsInt(0, 1);
|
||||
int pagecount = (factionList.size() / pageheight) + 1;
|
||||
if (pagenumber > pagecount) {
|
||||
pagenumber = pagecount;
|
||||
} else if (pagenumber < 1) {
|
||||
pagenumber = 1;
|
||||
}
|
||||
int start = (pagenumber - 1) * pageheight;
|
||||
int end = start + pageheight;
|
||||
if (end > factionList.size()) {
|
||||
end = factionList.size();
|
||||
}
|
||||
|
||||
|
||||
String header = FactionsPlugin.getInstance().getConfig().getString("list.header", defaults[0]);
|
||||
header = header.replace("{pagenumber}", String.valueOf(pagenumber)).replace("{pagecount}", String.valueOf(pagecount));
|
||||
lines.add(FactionsPlugin.getInstance().txt.parse(header));
|
||||
|
||||
for (Faction faction : factionList.subList(start, end)) {
|
||||
if (faction.isWilderness()) {
|
||||
lines.add(FactionsPlugin.getInstance().txt.parse(TagUtil.parsePlain(faction, FactionsPlugin.getInstance().getConfig().getString("list.factionless", defaults[1]))));
|
||||
continue;
|
||||
}
|
||||
lines.add(FactionsPlugin.getInstance().txt.parse(TagUtil.parsePlain(faction, context.fPlayer, FactionsPlugin.getInstance().getConfig().getString("list.entry", defaults[2]))));
|
||||
}
|
||||
context.sendMessage(lines);
|
||||
});
|
||||
|
||||
// Then sort by how many members are online now
|
||||
factionList.sort((f1, f2) -> {
|
||||
int f1Size = f1.getFPlayersWhereOnline(true).size();
|
||||
int f2Size = f2.getFPlayersWhereOnline(true).size();
|
||||
if (f1Size < f2Size) {
|
||||
return 1;
|
||||
} else if (f1Size > f2Size) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
ArrayList<String> lines = new ArrayList<>();
|
||||
|
||||
factionList.add(0, Factions.getInstance().getWilderness());
|
||||
|
||||
final int pageheight = 9;
|
||||
int pagenumber = context.argAsInt(0, 1);
|
||||
int pagecount = (factionList.size() / pageheight) + 1;
|
||||
if (pagenumber > pagecount) {
|
||||
pagenumber = pagecount;
|
||||
} else if (pagenumber < 1) {
|
||||
pagenumber = 1;
|
||||
}
|
||||
int start = (pagenumber - 1) * pageheight;
|
||||
int end = start + pageheight;
|
||||
if (end > factionList.size()) {
|
||||
end = factionList.size();
|
||||
}
|
||||
|
||||
|
||||
String header = FactionsPlugin.getInstance().getConfig().getString("list.header", defaults[0]);
|
||||
header = header.replace("{pagenumber}", String.valueOf(pagenumber)).replace("{pagecount}", String.valueOf(pagecount));
|
||||
lines.add(FactionsPlugin.getInstance().txt.parse(header));
|
||||
|
||||
for (Faction faction : factionList.subList(start, end)) {
|
||||
if (faction.isWilderness()) {
|
||||
lines.add(FactionsPlugin.getInstance().txt.parse(TagUtil.parsePlain(faction, FactionsPlugin.getInstance().getConfig().getString("list.factionless", defaults[1]))));
|
||||
continue;
|
||||
}
|
||||
lines.add(FactionsPlugin.getInstance().txt.parse(TagUtil.parsePlain(faction, context.fPlayer, FactionsPlugin.getInstance().getConfig().getString("list.entry", defaults[2]))));
|
||||
}
|
||||
context.sendMessage(lines);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
54
src/main/java/com/massivecraft/factions/cmd/CmdLookup.java
Normal file
54
src/main/java/com/massivecraft/factions/cmd/CmdLookup.java
Normal file
@ -0,0 +1,54 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Board;
|
||||
import com.massivecraft.factions.FLocation;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Saser
|
||||
*/
|
||||
public class CmdLookup extends FCommand {
|
||||
|
||||
private DecimalFormat format = new DecimalFormat("#.#");
|
||||
|
||||
public CmdLookup() {
|
||||
super();
|
||||
this.aliases.add("lookup");
|
||||
this.requiredArgs.add("faction name");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.LOOKUP)
|
||||
.playerOnly()
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
Faction faction = context.argAsFaction(0);
|
||||
if (faction == null) {
|
||||
context.msg(TL.COMMAND_LOOKUP_INVALID);
|
||||
return;
|
||||
}
|
||||
if (faction.isNormal()) {
|
||||
if (faction.getHome() != null) {
|
||||
context.msg(TL.COMMAND_LOOKUP_FACTION_HOME, this.format.format(faction.getHome().getX()), this.format.format(faction.getHome().getY()), this.format.format(faction.getHome().getZ()));
|
||||
}
|
||||
Set<FLocation> locations = Board.getInstance().getAllClaims(faction);
|
||||
context.msg(TL.COMMAND_LOOKUP_CLAIM_COUNT, locations.size(), faction.getTag());
|
||||
for (FLocation flocation : locations) {
|
||||
context.msg(TL.COMMAND_LOOKUP_CLAIM_LIST, flocation.getWorldName(), flocation.getX() * 16L, flocation.getZ() * 16L);
|
||||
}
|
||||
} else {
|
||||
context.msg(TL.COMMAND_LOOKUP_ONLY_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_LOOKUP_DESCRIPTION;
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
@ -32,51 +33,51 @@ public class CmdMod extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||
if (you == null) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_MOD_CANDIDATES.toString()).color(ChatColor.GOLD);
|
||||
for (FPlayer player : context.faction.getFPlayersWhereRole(Role.NORMAL)) {
|
||||
String s = player.getName();
|
||||
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " mod " + s);
|
||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||
if (you == null) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_MOD_CANDIDATES.toString()).color(ChatColor.GOLD);
|
||||
for (FPlayer player : context.faction.getFPlayersWhereRole(Role.NORMAL)) {
|
||||
String s = player.getName();
|
||||
msg.then(s + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_MOD_CLICKTOPROMOTE.toString() + s).command("/" + Conf.baseCommandAliases.get(0) + " mod " + s);
|
||||
}
|
||||
|
||||
context.sendFancyMessage(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
context.sendFancyMessage(msg);
|
||||
return;
|
||||
}
|
||||
boolean permAny = Permission.MOD_ANY.has(context.sender, false);
|
||||
Faction targetFaction = you.getFaction();
|
||||
if (targetFaction != context.faction && !permAny) {
|
||||
context.msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(context.fPlayer, true));
|
||||
return;
|
||||
}
|
||||
|
||||
boolean permAny = Permission.MOD_ANY.has(context.sender, false);
|
||||
Faction targetFaction = you.getFaction();
|
||||
if (targetFaction != context.faction && !permAny) {
|
||||
context.msg(TL.COMMAND_MOD_NOTMEMBER, you.describeTo(context.fPlayer, true));
|
||||
return;
|
||||
}
|
||||
if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) {
|
||||
context.msg(TL.COMMAND_MOD_NOTADMIN);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) {
|
||||
context.msg(TL.COMMAND_MOD_NOTADMIN);
|
||||
return;
|
||||
}
|
||||
if (you == context.fPlayer && !permAny) {
|
||||
context.msg(TL.COMMAND_MOD_SELF);
|
||||
return;
|
||||
}
|
||||
|
||||
if (you == context.fPlayer && !permAny) {
|
||||
context.msg(TL.COMMAND_MOD_SELF);
|
||||
return;
|
||||
}
|
||||
if (you.getRole() == Role.LEADER) {
|
||||
context.msg(TL.COMMAND_MOD_TARGETISADMIN);
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.getRole() == Role.LEADER) {
|
||||
context.msg(TL.COMMAND_MOD_TARGETISADMIN);
|
||||
return;
|
||||
}
|
||||
|
||||
if (you.getRole() == Role.MODERATOR) {
|
||||
// Revoke
|
||||
you.setRole(Role.NORMAL);
|
||||
targetFaction.msg(TL.COMMAND_MOD_REVOKED, you.describeTo(targetFaction, true));
|
||||
context.msg(TL.COMMAND_MOD_REVOKES, you.describeTo(context.fPlayer, true));
|
||||
} else {
|
||||
// Give
|
||||
you.setRole(Role.MODERATOR);
|
||||
targetFaction.msg(TL.COMMAND_MOD_PROMOTED, you.describeTo(targetFaction, true));
|
||||
context.msg(TL.COMMAND_MOD_PROMOTES, you.describeTo(context.fPlayer, true));
|
||||
}
|
||||
if (you.getRole() == Role.MODERATOR) {
|
||||
// Revoke
|
||||
you.setRole(Role.NORMAL);
|
||||
targetFaction.msg(TL.COMMAND_MOD_REVOKED, you.describeTo(targetFaction, true));
|
||||
context.msg(TL.COMMAND_MOD_REVOKES, you.describeTo(context.fPlayer, true));
|
||||
} else {
|
||||
// Give
|
||||
you.setRole(Role.MODERATOR);
|
||||
targetFaction.msg(TL.COMMAND_MOD_PROMOTED, you.describeTo(targetFaction, true));
|
||||
context.msg(TL.COMMAND_MOD_PROMOTES, you.describeTo(context.fPlayer, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
@ -27,23 +28,25 @@ public class CmdOpen extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!context.payForCommand(Conf.econCostOpen, TL.COMMAND_OPEN_TOOPEN, TL.COMMAND_OPEN_FOROPEN)) {
|
||||
return;
|
||||
}
|
||||
|
||||
context.faction.setOpen(context.argAsBool(0, !context.faction.getOpen()));
|
||||
|
||||
String open = context.faction.getOpen() ? TL.COMMAND_OPEN_OPEN.toString() : TL.COMMAND_OPEN_CLOSED.toString();
|
||||
|
||||
// Inform
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
if (fplayer.getFactionId().equals(context.faction.getId())) {
|
||||
fplayer.msg(TL.COMMAND_OPEN_CHANGES, context.fPlayer.getName(), open);
|
||||
continue;
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!context.payForCommand(Conf.econCostOpen, TL.COMMAND_OPEN_TOOPEN, TL.COMMAND_OPEN_FOROPEN)) {
|
||||
return;
|
||||
}
|
||||
fplayer.msg(TL.COMMAND_OPEN_CHANGED, context.faction.getTag(fplayer.getFaction()), open);
|
||||
}
|
||||
|
||||
context.faction.setOpen(context.argAsBool(0, !context.faction.getOpen()));
|
||||
|
||||
String open = context.faction.getOpen() ? TL.COMMAND_OPEN_OPEN.toString() : TL.COMMAND_OPEN_CLOSED.toString();
|
||||
|
||||
// Inform
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
if (fplayer.getFactionId().equals(context.faction.getId())) {
|
||||
fplayer.msg(TL.COMMAND_OPEN_CHANGES, context.fPlayer.getName(), open);
|
||||
continue;
|
||||
}
|
||||
fplayer.msg(TL.COMMAND_OPEN_CHANGED, context.faction.getTag(fplayer.getFaction()), open);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,44 +16,46 @@ public class CmdSethome extends FCommand {
|
||||
this.optionalArgs.put("faction tag", "mine");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.SETHOME)
|
||||
.playerOnly()
|
||||
.playerOnly()
|
||||
.memberOnly()
|
||||
.withAction(PermissableAction.SETHOME)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
if (!Conf.homesEnabled) {
|
||||
context.msg(TL.COMMAND_SETHOME_DISABLED);
|
||||
return;
|
||||
}
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||
if (!Conf.homesEnabled) {
|
||||
context.msg(TL.COMMAND_SETHOME_DISABLED);
|
||||
return;
|
||||
}
|
||||
|
||||
Faction faction = context.argAsFaction(0, context.faction);
|
||||
if (faction == null) {
|
||||
return;
|
||||
}
|
||||
Faction faction = context.argAsFaction(0, context.faction);
|
||||
if (faction == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Can the player set the faction home HERE?
|
||||
if (!Permission.BYPASS.has(context.player) &&
|
||||
Conf.homesMustBeInClaimedTerritory &&
|
||||
Board.getInstance().getFactionAt(new FLocation(context.player)) != faction) {
|
||||
context.msg(TL.COMMAND_SETHOME_NOTCLAIMED);
|
||||
return;
|
||||
}
|
||||
// Can the player set the faction home HERE?
|
||||
if (!Permission.BYPASS.has(context.player) &&
|
||||
Conf.homesMustBeInClaimedTerritory &&
|
||||
Board.getInstance().getFactionAt(new FLocation(context.player)) != faction) {
|
||||
context.msg(TL.COMMAND_SETHOME_NOTCLAIMED);
|
||||
return;
|
||||
}
|
||||
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!context.payForCommand(Conf.econCostSethome, TL.COMMAND_SETHOME_TOSET, TL.COMMAND_SETHOME_FORSET)) {
|
||||
return;
|
||||
}
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!context.payForCommand(Conf.econCostSethome, TL.COMMAND_SETHOME_TOSET, TL.COMMAND_SETHOME_FORSET)) {
|
||||
return;
|
||||
}
|
||||
|
||||
faction.setHome(context.player.getLocation());
|
||||
faction.setHome(context.player.getLocation());
|
||||
|
||||
faction.msg(TL.COMMAND_SETHOME_SET, context.fPlayer.describeTo(context.faction, true));
|
||||
faction.sendMessage(FactionsPlugin.getInstance().cmdBase.cmdHome.getUsageTemplate(context));
|
||||
if (faction != context.faction) {
|
||||
context.msg(TL.COMMAND_SETHOME_SETOTHER, faction.getTag(context.fPlayer));
|
||||
}
|
||||
faction.msg(TL.COMMAND_SETHOME_SET, context.fPlayer.describeTo(context.faction, true));
|
||||
faction.sendMessage(FactionsPlugin.getInstance().cmdBase.cmdHome.getUsageTemplate(context));
|
||||
if (faction != context.faction) {
|
||||
context.msg(TL.COMMAND_SETHOME_SETOTHER, faction.getTag(context.fPlayer));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import mkremins.fanciful.FancyMessage;
|
||||
@ -27,14 +28,12 @@ public class CmdShowInvites extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_SHOWINVITES_PENDING.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_SHOWINVITES_CLICKTOREVOKE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
}
|
||||
|
||||
context.sendFancyMessage(msg);
|
||||
FancyMessage msg = new FancyMessage(TL.COMMAND_SHOWINVITES_PENDING.toString()).color(ChatColor.GOLD);
|
||||
for (String id : context.faction.getInvites()) {
|
||||
FPlayer fp = FPlayers.getInstance().getById(id);
|
||||
String name = fp != null ? fp.getName() : id;
|
||||
msg.then(name + " ").color(ChatColor.WHITE).tooltip(TL.COMMAND_SHOWINVITES_CLICKTOREVOKE.format(name)).command("/" + Conf.baseCommandAliases.get(0) + " deinvite " + name);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,56 +33,59 @@ public class CmdTag extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
String tag = context.argAsString(0);
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||
|
||||
// TODO does not first test cover selfcase?
|
||||
if (Factions.getInstance().isTagTaken(tag) && !MiscUtil.getComparisonString(tag).equals(context.faction.getComparisonTag())) {
|
||||
context.msg(TL.COMMAND_TAG_TAKEN);
|
||||
return;
|
||||
}
|
||||
String tag = context.argAsString(0);
|
||||
|
||||
ArrayList<String> errors = MiscUtil.validateTag(tag);
|
||||
if (errors.size() > 0) {
|
||||
context.sendMessage(errors);
|
||||
return;
|
||||
}
|
||||
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
|
||||
if (!context.canAffordCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// trigger the faction rename event (cancellable)
|
||||
FactionRenameEvent renameEvent = new FactionRenameEvent(context.fPlayer, tag);
|
||||
Bukkit.getServer().getPluginManager().callEvent(renameEvent);
|
||||
if (renameEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// then make 'em pay (if applicable)
|
||||
if (!context.payForCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE, TL.COMMAND_TAG_FORCHANGE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String oldtag = context.faction.getTag();
|
||||
context.faction.setTag(tag);
|
||||
Discord.changeFactionTag(context.faction, oldtag);
|
||||
|
||||
// Inform
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
if (fplayer.getFactionId().equals(context.faction.getId())) {
|
||||
fplayer.msg(TL.COMMAND_TAG_FACTION, context.fPlayer.describeTo(context.faction, true), context.faction.getTag(context.faction));
|
||||
continue;
|
||||
// TODO does not first test cover selfcase?
|
||||
if (Factions.getInstance().isTagTaken(tag) && !MiscUtil.getComparisonString(tag).equals(context.faction.getComparisonTag())) {
|
||||
context.msg(TL.COMMAND_TAG_TAKEN);
|
||||
return;
|
||||
}
|
||||
|
||||
// Broadcast the tag change (if applicable)
|
||||
if (Conf.broadcastTagChanges) {
|
||||
Faction faction = fplayer.getFaction();
|
||||
fplayer.msg(TL.COMMAND_TAG_CHANGED, context.fPlayer.getColorTo(faction) + oldtag, context.faction.getTag(faction));
|
||||
ArrayList<String> errors = MiscUtil.validateTag(tag);
|
||||
if (errors.size() > 0) {
|
||||
context.sendMessage(errors);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
FTeamWrapper.updatePrefixes(context.faction);
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make sure they can pay
|
||||
if (!context.canAffordCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE.toString())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// trigger the faction rename event (cancellable)
|
||||
FactionRenameEvent renameEvent = new FactionRenameEvent(context.fPlayer, tag);
|
||||
Bukkit.getServer().getPluginManager().callEvent(renameEvent);
|
||||
if (renameEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// then make 'em pay (if applicable)
|
||||
if (!context.payForCommand(Conf.econCostTag, TL.COMMAND_TAG_TOCHANGE, TL.COMMAND_TAG_FORCHANGE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String oldtag = context.faction.getTag();
|
||||
context.faction.setTag(tag);
|
||||
Discord.changeFactionTag(context.faction, oldtag);
|
||||
|
||||
// Inform
|
||||
for (FPlayer fplayer : FPlayers.getInstance().getOnlinePlayers()) {
|
||||
if (fplayer.getFactionId().equals(context.faction.getId())) {
|
||||
fplayer.msg(TL.COMMAND_TAG_FACTION, context.fPlayer.describeTo(context.faction, true), context.faction.getTag(context.faction));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Broadcast the tag change (if applicable)
|
||||
if (Conf.broadcastTagChanges) {
|
||||
Faction faction = fplayer.getFaction();
|
||||
fplayer.msg(TL.COMMAND_TAG_CHANGED, context.fPlayer.getColorTo(faction) + oldtag, context.faction.getTag(faction));
|
||||
}
|
||||
}
|
||||
|
||||
FTeamWrapper.updatePrefixes(context.faction);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import com.massivecraft.factions.zcore.util.TextUtil;
|
||||
@ -24,16 +25,19 @@ public class CmdTitle extends FCommand {
|
||||
|
||||
@Override
|
||||
public void perform(CommandContext context) {
|
||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||
if (you == null) return;
|
||||
context.args.remove(0);
|
||||
String title = TextUtil.implode(context.args, " ");
|
||||
if (!context.canIAdministerYou(context.fPlayer, you)) return;
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!context.payForCommand(Conf.econCostTitle, TL.COMMAND_TITLE_TOCHANGE, TL.COMMAND_TITLE_FORCHANGE)) return;
|
||||
you.setTitle(context.sender, title);
|
||||
// Inform
|
||||
context.faction.msg(TL.COMMAND_TITLE_CHANGED, context.fPlayer.describeTo(context.faction, true), you.describeTo(context.faction, true));
|
||||
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
||||
FPlayer you = context.argAsBestFPlayerMatch(0);
|
||||
if (you == null) return;
|
||||
context.args.remove(0);
|
||||
String title = TextUtil.implode(context.args, " ");
|
||||
if (!context.canIAdministerYou(context.fPlayer, you)) return;
|
||||
// if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay
|
||||
if (!context.payForCommand(Conf.econCostTitle, TL.COMMAND_TITLE_TOCHANGE, TL.COMMAND_TITLE_FORCHANGE))
|
||||
return;
|
||||
you.setTitle(context.sender, title);
|
||||
// Inform
|
||||
context.faction.msg(TL.COMMAND_TITLE_CHANGED, context.fPlayer.describeTo(context.faction, true), you.describeTo(context.faction, true));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,8 +29,6 @@ public class CmdTpBanner extends FCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
final FactionsPlayerListener fpl = new FactionsPlayerListener();
|
||||
|
||||
if (FactionsBlockListener.bannerLocations.containsKey(context.fPlayer.getTag())) {
|
||||
context.msg(TL.COMMAND_TPBANNER_SUCCESS);
|
||||
context.doWarmUp(WarmUpUtil.Warmup.BANNER, TL.WARMUPS_NOTIFY_TELEPORT, "Banner", () -> {
|
||||
|
@ -163,6 +163,7 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
||||
public CmdDiscord cmdDiscord = new CmdDiscord();
|
||||
public CmdDebug cmdDebug = new CmdDebug();
|
||||
public CmdDrain cmdDrain = new CmdDrain();
|
||||
public CmdLookup cmdLookup = new CmdLookup();
|
||||
//Variables to know if we already setup certain sub commands
|
||||
public Boolean discordEnabled = false;
|
||||
public Boolean checkEnabled = false;
|
||||
@ -293,6 +294,7 @@ public class FCmdRoot extends FCommand implements CommandExecutor {
|
||||
this.addSubCommand(this.cmdConvertConfig);
|
||||
this.addSubCommand(this.cmdSpawnerLock);
|
||||
this.addSubCommand(this.cmdDrain);
|
||||
this.addSubCommand(this.cmdLookup);
|
||||
addVariableCommands();
|
||||
if (CommodoreProvider.isSupported()) brigadierManager.build();
|
||||
}
|
||||
|
@ -11,10 +11,12 @@ import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class WildGUI implements FactionGUI {
|
||||
Player player;
|
||||
@ -44,14 +46,16 @@ public class WildGUI implements FactionGUI {
|
||||
inv = Bukkit.createInventory(this, FactionsPlugin.getInstance().getConfig().getInt("Wild.GUI.Size"), FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("Wild.GUI.Name")));
|
||||
ItemStack fillItem = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("Wild.GUI.FillMaterial")).parseItem();
|
||||
ItemMeta meta = fillItem.getItemMeta();
|
||||
if(meta == null) return;
|
||||
meta.setDisplayName("");
|
||||
fillItem.setItemMeta(meta);
|
||||
for (int fill = 0; fill < FactionsPlugin.getInstance().getConfig().getInt("Wild.GUI.Size"); ++fill) {
|
||||
inv.setItem(fill, fillItem);
|
||||
}
|
||||
for (String key : FactionsPlugin.getInstance().getConfig().getConfigurationSection("Wild.Zones").getKeys(false)) {
|
||||
for (String key : Objects.requireNonNull(FactionsPlugin.getInstance().getConfig().getConfigurationSection("Wild.Zones")).getKeys(false)) {
|
||||
ItemStack zoneItem = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString("Wild.Zones." + key + ".Material")).parseItem();
|
||||
ItemMeta zoneMeta = zoneItem.getItemMeta();
|
||||
if(zoneMeta == null) return;
|
||||
List<String> lore = new ArrayList<>();
|
||||
for (String s : FactionsPlugin.getInstance().getConfig().getStringList("Wild.Zones." + key + ".Lore")) {
|
||||
lore.add(FactionsPlugin.getInstance().color(s));
|
||||
@ -65,6 +69,7 @@ public class WildGUI implements FactionGUI {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Inventory getInventory() {
|
||||
if (inv == null) {build();}
|
||||
|
@ -626,6 +626,7 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@EventHandler
|
||||
public void onTravel(PlayerPortalEvent event) {
|
||||
if (!FactionsPlugin.getInstance().getConfig().getBoolean("portals.limit", false))
|
||||
@ -653,6 +654,7 @@ public class FactionsEntityListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@EventHandler
|
||||
public void onHit(EntityDamageByEntityEvent e) {
|
||||
|
@ -68,6 +68,7 @@ public enum Permission {
|
||||
LOCK("lock"),
|
||||
LOCKSPAWNERS("lockspawners"),
|
||||
LOGOUT("logout"),
|
||||
LOOKUP("lookup"),
|
||||
MAP("map"),
|
||||
MAPHEIGHT("mapheight"),
|
||||
MOD("mod"),
|
||||
|
@ -279,7 +279,7 @@ public class FUpgradesGUI implements Listener {
|
||||
String invName = FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fchest.Inventory-Title"));
|
||||
|
||||
for (HumanEntity player : faction.getChestInventory().getViewers()) {
|
||||
if (player.getInventory().getTitle() != null && player.getInventory().getTitle().equalsIgnoreCase(invName))
|
||||
if (player.getOpenInventory().getTitle() != null && player.getOpenInventory().getTitle().equalsIgnoreCase(invName))
|
||||
player.closeInventory();
|
||||
}
|
||||
|
||||
|
@ -515,6 +515,14 @@ public enum TL {
|
||||
COMMAND_LOWPOWER_FORMAT("&c{player} &8(&c{player_power}&8/&c{maxpower}&8)"),
|
||||
COMMAND_LOWPOWER_DESCRIPTION("Shows a list of players in your faction with lower power levels"),
|
||||
|
||||
COMMAND_LOOKUP_INVALID("&c&l[!] &cInvalid Faction Found!"),
|
||||
COMMAND_LOOKUP_FACTION_HOME("&c&l[!] &cFaction Home: &f%1$dx %2$sy %3$sz"),
|
||||
COMMAND_LOOKUP_CLAIM_COUNT("&c&l[!] &cFound &c&n%1$s &cClaimed Chunk(s) for &f%2$s"),
|
||||
COMMAND_LOOKUP_CLAIM_LIST("&f%1$s &7(%2$sx, %2$sz"),
|
||||
COMMAND_LOOKUP_ONLY_NORMAL("&cYou can only enter normal factions."),
|
||||
COMMAND_LOOKUP_DESCRIPTION("Lookup claim & home stats for faction"),
|
||||
|
||||
|
||||
COMMAND_MAP_TOSHOW("to show the map"),
|
||||
COMMAND_MAP_FORSHOW("for showing the map"),
|
||||
COMMAND_MAP_UPDATE_ENABLED("&c&l[!]&7 Map auto update &aENABLED."),
|
||||
|
@ -154,6 +154,8 @@ permissions:
|
||||
description: auto-claim land as you walk around
|
||||
factions.bypass:
|
||||
description: enable admin bypass mode
|
||||
factions.lookup:
|
||||
description: Lookup claim & home stats for faction
|
||||
factions.chat:
|
||||
description: change chat mode
|
||||
factions.chatspy:
|
||||
|
Loading…
Reference in New Issue
Block a user