commit
3e530487d7
2
pom.xml
2
pom.xml
@ -108,7 +108,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.stefvanschie.inventoryframework</groupId>
|
<groupId>com.github.stefvanschie.inventoryframework</groupId>
|
||||||
<artifactId>IF</artifactId>
|
<artifactId>IF</artifactId>
|
||||||
<version>0.5.8</version>
|
<version>0.5.19</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
|
@ -57,6 +57,10 @@ public class CmdAdmin extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(fyou.isAlt()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
|
// only perform a FPlayerJoinEvent when newLeader isn't actually in the faction
|
||||||
if (fyou.getFaction() != targetFaction) {
|
if (fyou.getFaction() != targetFaction) {
|
||||||
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(context.player), targetFaction, FPlayerJoinEvent.PlayerJoinReason.LEADER);
|
FPlayerJoinEvent event = new FPlayerJoinEvent(FPlayers.getInstance().getByPlayer(context.player), targetFaction, FPlayerJoinEvent.PlayerJoinReason.LEADER);
|
||||||
|
@ -55,6 +55,10 @@ public class CmdColeader extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(you.isAlt()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) {
|
if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) {
|
||||||
context.msg(TL.COMMAND_COLEADER_NOTADMIN);
|
context.msg(TL.COMMAND_COLEADER_NOTADMIN);
|
||||||
return;
|
return;
|
||||||
|
@ -16,10 +16,6 @@ import java.util.Objects;
|
|||||||
|
|
||||||
public class CmdJoin extends FCommand {
|
public class CmdJoin extends FCommand {
|
||||||
|
|
||||||
/**
|
|
||||||
* @author FactionsUUID Team
|
|
||||||
*/
|
|
||||||
|
|
||||||
public CmdJoin() {
|
public CmdJoin() {
|
||||||
super();
|
super();
|
||||||
this.aliases.addAll(Aliases.join);
|
this.aliases.addAll(Aliases.join);
|
||||||
@ -81,7 +77,7 @@ public class CmdJoin extends FCommand {
|
|||||||
|
|
||||||
int altLimit = Conf.factionAltMemberLimit;
|
int altLimit = Conf.factionAltMemberLimit;
|
||||||
|
|
||||||
if (altLimit > 0 && faction.getAltPlayers().size() >= altLimit && faction.altInvited(context.fPlayer)) {
|
if (altLimit > 0 && faction.getAltPlayers().size() >= altLimit && !faction.altInvited(context.fPlayer)) {
|
||||||
context.msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(context.fPlayer), altLimit, fplayer.describeTo(context.fPlayer, false));
|
context.msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(context.fPlayer), altLimit, fplayer.describeTo(context.fPlayer, false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -115,6 +111,8 @@ public class CmdJoin extends FCommand {
|
|||||||
fplayer.msg(TL.COMMAND_JOIN_MOVED, context.fPlayer.describeTo(fplayer, true), faction.getTag(fplayer));
|
fplayer.msg(TL.COMMAND_JOIN_MOVED, context.fPlayer.describeTo(fplayer, true), faction.getTag(fplayer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
faction.msg(TL.COMMAND_JOIN_JOINED, fplayer.describeTo(faction, true));
|
||||||
|
|
||||||
fplayer.resetFactionData();
|
fplayer.resetFactionData();
|
||||||
|
|
||||||
if (faction.altInvited(fplayer)) {
|
if (faction.altInvited(fplayer)) {
|
||||||
@ -125,30 +123,13 @@ public class CmdJoin extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
faction.deinvite(fplayer);
|
faction.deinvite(fplayer);
|
||||||
|
context.fPlayer.setRole(faction.getDefaultRole());
|
||||||
try {
|
|
||||||
context.fPlayer.setRole(faction.getDefaultRole());
|
|
||||||
FactionsPlugin.instance.logFactionEvent(faction, FLogType.INVITES, context.fPlayer.getName(), CC.Green + "joined", "the faction");
|
|
||||||
if (Discord.useDiscord && context.fPlayer.discordSetup() && Discord.isInMainGuild(context.fPlayer.discordUser()) && Discord.mainGuild != null) {
|
|
||||||
Member m = Discord.mainGuild.getMember(context.fPlayer.discordUser());
|
|
||||||
if (Conf.factionRoles) {
|
|
||||||
Discord.mainGuild.getController().addSingleRoleToMember(m, Objects.requireNonNull(Discord.createFactionRole(faction.getTag()))).queue();
|
|
||||||
}
|
|
||||||
if (Conf.factionDiscordTags) {
|
|
||||||
Discord.mainGuild.getController().setNickname(m, Discord.getNicknameString(context.fPlayer)).queue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (HierarchyException e) {
|
|
||||||
System.out.print(e.getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
faction.msg(TL.COMMAND_JOIN_JOINED, fplayer.describeTo(faction, true));
|
|
||||||
|
|
||||||
if (Conf.logFactionJoin) {
|
if (Conf.logFactionJoin) {
|
||||||
if (samePlayer) {
|
if (samePlayer) {
|
||||||
FactionsPlugin.getInstance().log(TL.COMMAND_JOIN_JOINEDLOG.toString(), fplayer.getName(), faction.getTag());
|
FactionsPlugin.instance.log(TL.COMMAND_JOIN_JOINEDLOG.toString(), fplayer.getName(), faction.getTag());
|
||||||
} else {
|
} else {
|
||||||
FactionsPlugin.getInstance().log(TL.COMMAND_JOIN_MOVEDLOG.toString(), context.fPlayer.getName(), fplayer.getName(), faction.getTag());
|
FactionsPlugin.instance.log(TL.COMMAND_JOIN_MOVEDLOG.toString(), context.fPlayer.getName(), fplayer.getName(), faction.getTag());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd;
|
package com.massivecraft.factions.cmd;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.*;
|
||||||
import com.massivecraft.factions.FPlayer;
|
|
||||||
import com.massivecraft.factions.Faction;
|
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
|
||||||
import com.massivecraft.factions.cmd.audit.FLogType;
|
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||||
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
@ -115,6 +112,7 @@ public class CmdKick extends FCommand {
|
|||||||
toKickFaction.msg(TL.COMMAND_KICK_FACTION, context.fPlayer.describeTo(toKickFaction, true), toKick.describeTo(toKickFaction, true));
|
toKickFaction.msg(TL.COMMAND_KICK_FACTION, context.fPlayer.describeTo(toKickFaction, true), toKick.describeTo(toKickFaction, true));
|
||||||
|
|
||||||
toKick.msg(TL.COMMAND_KICK_KICKED, context.fPlayer.describeTo(toKick, true), toKickFaction.describeTo(toKick));
|
toKick.msg(TL.COMMAND_KICK_KICKED, context.fPlayer.describeTo(toKick, true), toKickFaction.describeTo(toKick));
|
||||||
|
|
||||||
if (toKickFaction != context.faction) {
|
if (toKickFaction != context.faction) {
|
||||||
context.fPlayer.msg(TL.COMMAND_KICK_KICKS, toKick.describeTo(context.fPlayer), toKickFaction.describeTo(context.fPlayer));
|
context.fPlayer.msg(TL.COMMAND_KICK_KICKS, toKick.describeTo(context.fPlayer), toKickFaction.describeTo(context.fPlayer));
|
||||||
}
|
}
|
||||||
@ -127,6 +125,9 @@ public class CmdKick extends FCommand {
|
|||||||
FactionsPlugin.instance.logFactionEvent(toKickFaction, FLogType.INVITES, context.fPlayer.getName(), CC.Red + "kicked", toKick.getName());
|
FactionsPlugin.instance.logFactionEvent(toKickFaction, FLogType.INVITES, context.fPlayer.getName(), CC.Red + "kicked", toKick.getName());
|
||||||
toKickFaction.deinvite(toKick);
|
toKickFaction.deinvite(toKick);
|
||||||
toKick.resetFactionData();
|
toKick.resetFactionData();
|
||||||
|
if(!CmdFly.checkBypassPerms(toKick, toKick.getPlayer(), toKickFaction, false)){
|
||||||
|
CmdFly.disableFlight(toKick);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,76 +42,75 @@ 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 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"))
|
if (!context.payForCommand(Conf.econCostList, "to list the factions", "for listing the factions"))
|
||||||
return;
|
return;
|
||||||
FactionsPlugin.getInstance().getServer().getScheduler().runTaskAsynchronously(FactionsPlugin.instance, () -> {
|
|
||||||
|
|
||||||
ArrayList<Faction> factionList = Factions.getInstance().getAllFactions();
|
ArrayList<Faction> factionList = Factions.getInstance().getAllFactions();
|
||||||
factionList.remove(Factions.getInstance().getWilderness());
|
factionList.remove(Factions.getInstance().getWilderness());
|
||||||
factionList.remove(Factions.getInstance().getSafeZone());
|
factionList.remove(Factions.getInstance().getSafeZone());
|
||||||
factionList.remove(Factions.getInstance().getWarZone());
|
factionList.remove(Factions.getInstance().getWarZone());
|
||||||
|
|
||||||
// remove exempt factions
|
// remove exempt factions
|
||||||
if (context.fPlayer != null && context.fPlayer.getPlayer() != null && !context.fPlayer.getPlayer().hasPermission("factions.show.bypassexempt")) {
|
if (context.fPlayer != null && context.fPlayer.getPlayer() != null && !context.fPlayer.getPlayer().hasPermission("factions.show.bypassexempt")) {
|
||||||
List<String> exemptFactions = FactionsPlugin.getInstance().getConfig().getStringList("show-exempt");
|
List<String> exemptFactions = FactionsPlugin.getInstance().getConfig().getStringList("show-exempt");
|
||||||
|
|
||||||
factionList.removeIf(next -> exemptFactions.contains(next.getTag()));
|
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;
|
||||||
}
|
}
|
||||||
|
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]);
|
||||||
|
assert header != null;
|
||||||
|
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
|
@Override
|
||||||
|
@ -50,6 +50,10 @@ public class CmdMod extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(you.isAlt()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) {
|
if (context.fPlayer != null && context.fPlayer.getRole() != Role.LEADER && !permAny) {
|
||||||
context.msg(TL.COMMAND_MOD_NOTADMIN);
|
context.msg(TL.COMMAND_MOD_NOTADMIN);
|
||||||
return;
|
return;
|
||||||
|
@ -74,6 +74,10 @@ public class FPromoteCommand extends FCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(target.isAlt()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Don't allow people to demote people who already have the lowest rank.
|
// Don't allow people to demote people who already have the lowest rank.
|
||||||
if (current.value == 0 && relative <= 0) {
|
if (current.value == 0 && relative <= 0) {
|
||||||
context.msg(TL.COMMAND_PROMOTE_LOWEST_RANK, target.getName());
|
context.msg(TL.COMMAND_PROMOTE_LOWEST_RANK, target.getName());
|
||||||
|
@ -115,5 +115,4 @@ public class CmdWild extends FCommand implements WaitedTask {
|
|||||||
player.sendMessage(TL.COMMAND_WILD_INTERUPTED.toString());
|
player.sendMessage(TL.COMMAND_WILD_INTERUPTED.toString());
|
||||||
teleportRange.remove(player);
|
teleportRange.remove(player);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
@ -19,6 +19,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class PermissableActionFrame {
|
public class PermissableActionFrame {
|
||||||
|
|
||||||
@ -30,9 +31,10 @@ public class PermissableActionFrame {
|
|||||||
|
|
||||||
public PermissableActionFrame(Faction f) {
|
public PermissableActionFrame(Faction f) {
|
||||||
ConfigurationSection section = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.action");
|
ConfigurationSection section = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.action");
|
||||||
|
assert section != null;
|
||||||
gui = new Gui(FactionsPlugin.getInstance(),
|
gui = new Gui(FactionsPlugin.getInstance(),
|
||||||
section.getInt("rows", 3),
|
section.getInt("rows", 4),
|
||||||
FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.action.name").replace("{faction}", f.getTag())));
|
FactionsPlugin.getInstance().color(Objects.requireNonNull(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.action.name")).replace("{faction}", f.getTag())));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildGUI(FPlayer fplayer, Permissable perm) {
|
public void buildGUI(FPlayer fplayer, Permissable perm) {
|
||||||
@ -40,8 +42,7 @@ public class PermissableActionFrame {
|
|||||||
List<GuiItem> GUIItems = new ArrayList<>();
|
List<GuiItem> GUIItems = new ArrayList<>();
|
||||||
ItemStack dumby = buildDummyItem();
|
ItemStack dumby = buildDummyItem();
|
||||||
// Fill background of GUI with dumbyitem & replace GUI assets after
|
// Fill background of GUI with dumbyitem & replace GUI assets after
|
||||||
for (int x = 0; x <= (gui.getRows() * 9) - 1; x++)
|
for (int x = 0; x <= (gui.getRows() * 9) - 1; x++) GUIItems.add(new GuiItem(dumby, e -> e.setCancelled(true)));
|
||||||
GUIItems.add(new GuiItem(dumby, e -> e.setCancelled(true)));
|
|
||||||
for (PermissableAction action : PermissableAction.values()) {
|
for (PermissableAction action : PermissableAction.values()) {
|
||||||
if (action.getSlot() == -1) continue;
|
if (action.getSlot() == -1) continue;
|
||||||
GUIItems.set(action.getSlot(), new GuiItem(action.buildAsset(fplayer, perm), e -> {
|
GUIItems.set(action.getSlot(), new GuiItem(action.buildAsset(fplayer, perm), e -> {
|
||||||
@ -53,17 +54,12 @@ public class PermissableActionFrame {
|
|||||||
case LEFT:
|
case LEFT:
|
||||||
access = Access.ALLOW;
|
access = Access.ALLOW;
|
||||||
success = fplayer.getFaction().setPermission(perm, action, access);
|
success = fplayer.getFaction().setPermission(perm, action, access);
|
||||||
FactionsPlugin.instance.logFactionEvent(fplayer.getFaction(), FLogType.PERM_EDIT_DEFAULTS, fplayer.getName(), ChatColor.GREEN.toString() + ChatColor.BOLD + "ALLOWED", action.getName(), perm.name());
|
|
||||||
break;
|
break;
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
access = Access.DENY;
|
access = Access.DENY;
|
||||||
success = fplayer.getFaction().setPermission(perm, action, access);
|
success = fplayer.getFaction().setPermission(perm, action, access);
|
||||||
FactionsPlugin.instance.logFactionEvent(fplayer.getFaction(), FLogType.PERM_EDIT_DEFAULTS, fplayer.getName(), ChatColor.RED.toString() + ChatColor.BOLD + "DENIED", action.getName(), perm.name());
|
|
||||||
break;
|
break;
|
||||||
case MIDDLE:
|
case MIDDLE:
|
||||||
access = Access.UNDEFINED;
|
|
||||||
success = fplayer.getFaction().setPermission(perm, action, access);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -93,9 +89,11 @@ public class PermissableActionFrame {
|
|||||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item");
|
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item");
|
||||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
if (meta != null) {
|
||||||
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||||
item.setItemMeta(meta);
|
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,9 +101,11 @@ public class PermissableActionFrame {
|
|||||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.back-item");
|
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.back-item");
|
||||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
if (meta != null) {
|
||||||
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||||
item.setItemMeta(meta);
|
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,6 +16,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class PermissableRelationFrame {
|
public class PermissableRelationFrame {
|
||||||
|
|
||||||
@ -27,9 +28,10 @@ public class PermissableRelationFrame {
|
|||||||
|
|
||||||
public PermissableRelationFrame(Faction f) {
|
public PermissableRelationFrame(Faction f) {
|
||||||
ConfigurationSection section = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.relation");
|
ConfigurationSection section = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.relation");
|
||||||
|
assert section != null;
|
||||||
gui = new Gui(FactionsPlugin.getInstance(),
|
gui = new Gui(FactionsPlugin.getInstance(),
|
||||||
section.getInt("rows", 3),
|
section.getInt("rows", 4),
|
||||||
FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.relation.name").replace("{faction}", f.getTag())));
|
FactionsPlugin.getInstance().color(Objects.requireNonNull(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.relation.name")).replace("{faction}", f.getTag())));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildGUI(FPlayer fplayer) {
|
public void buildGUI(FPlayer fplayer) {
|
||||||
@ -37,8 +39,7 @@ public class PermissableRelationFrame {
|
|||||||
List<GuiItem> GUIItems = new ArrayList<>();
|
List<GuiItem> GUIItems = new ArrayList<>();
|
||||||
ItemStack dumby = buildDummyItem();
|
ItemStack dumby = buildDummyItem();
|
||||||
// Fill background of GUI with dumbyitem & replace GUI assets after
|
// Fill background of GUI with dumbyitem & replace GUI assets after
|
||||||
for (int x = 0; x <= (gui.getRows() * 9) - 1; x++)
|
for (int x = 0; x <= (gui.getRows() * 9) - 1; x++) GUIItems.add(new GuiItem(dumby, e -> e.setCancelled(true)));
|
||||||
GUIItems.add(new GuiItem(dumby, e -> e.setCancelled(true)));
|
|
||||||
ConfigurationSection sec = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.relation");
|
ConfigurationSection sec = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.relation");
|
||||||
for (String key : sec.getConfigurationSection("slots").getKeys(false)) {
|
for (String key : sec.getConfigurationSection("slots").getKeys(false)) {
|
||||||
if (key == null || sec.getInt("slots." + key) < 0) continue;
|
if (key == null || sec.getInt("slots." + key) < 0) continue;
|
||||||
@ -58,8 +59,10 @@ public class PermissableRelationFrame {
|
|||||||
private ItemStack buildAsset(String loc, String relation) {
|
private ItemStack buildAsset(String loc, String relation) {
|
||||||
ItemStack item = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString(loc)).get().parseItem();
|
ItemStack item = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString(loc)).get().parseItem();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setDisplayName(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.relation.Placeholder-Item.Name").replace("{relation}", relation)));
|
if (meta != null) {
|
||||||
item.setItemMeta(meta);
|
meta.setDisplayName(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.relation.Placeholder-Item.Name").replace("{relation}", relation)));
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,9 +70,12 @@ public class PermissableRelationFrame {
|
|||||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item");
|
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item");
|
||||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||||
ItemMeta meta = item.getItemMeta();
|
ItemMeta meta = item.getItemMeta();
|
||||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
// So u can set it to air.
|
||||||
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
if (meta != null) {
|
||||||
item.setItemMeta(meta);
|
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||||
|
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
}
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user