Fixed Kicked Player Staying In Fly Map & FPerms GUI Returning Only Black Stained Glass Pane
This commit is contained in:
parent
2676f048d6
commit
6f293dce17
2
pom.xml
2
pom.xml
@ -108,7 +108,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.stefvanschie.inventoryframework</groupId>
|
||||
<artifactId>IF</artifactId>
|
||||
<version>0.5.8</version>
|
||||
<version>0.5.19</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
|
@ -1,9 +1,6 @@
|
||||
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.*;
|
||||
import com.massivecraft.factions.cmd.audit.FLogType;
|
||||
import com.massivecraft.factions.event.FPlayerLeaveEvent;
|
||||
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));
|
||||
|
||||
toKick.msg(TL.COMMAND_KICK_KICKED, context.fPlayer.describeTo(toKick, true), toKickFaction.describeTo(toKick));
|
||||
|
||||
if (toKickFaction != context.faction) {
|
||||
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());
|
||||
toKickFaction.deinvite(toKick);
|
||||
toKick.resetFactionData();
|
||||
if(!CmdFly.checkBypassPerms(toKick, toKick.getPlayer(), toKickFaction, false)){
|
||||
CmdFly.disableFlight(toKick);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,6 +19,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class PermissableActionFrame {
|
||||
|
||||
@ -30,9 +31,10 @@ public class PermissableActionFrame {
|
||||
|
||||
public PermissableActionFrame(Faction f) {
|
||||
ConfigurationSection section = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.action");
|
||||
assert section != null;
|
||||
gui = new Gui(FactionsPlugin.getInstance(),
|
||||
section.getInt("rows", 3),
|
||||
FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.action.name").replace("{faction}", f.getTag())));
|
||||
section.getInt("rows", 4),
|
||||
FactionsPlugin.getInstance().color(Objects.requireNonNull(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.action.name")).replace("{faction}", f.getTag())));
|
||||
}
|
||||
|
||||
public void buildGUI(FPlayer fplayer, Permissable perm) {
|
||||
@ -40,8 +42,7 @@ public class PermissableActionFrame {
|
||||
List<GuiItem> GUIItems = new ArrayList<>();
|
||||
ItemStack dumby = buildDummyItem();
|
||||
// Fill background of GUI with dumbyitem & replace GUI assets after
|
||||
for (int x = 0; x <= (gui.getRows() * 9) - 1; x++)
|
||||
GUIItems.add(new GuiItem(dumby, e -> e.setCancelled(true)));
|
||||
for (int x = 0; x <= (gui.getRows() * 9) - 1; x++) GUIItems.add(new GuiItem(dumby, e -> e.setCancelled(true)));
|
||||
for (PermissableAction action : PermissableAction.values()) {
|
||||
if (action.getSlot() == -1) continue;
|
||||
GUIItems.set(action.getSlot(), new GuiItem(action.buildAsset(fplayer, perm), e -> {
|
||||
@ -53,17 +54,12 @@ public class PermissableActionFrame {
|
||||
case LEFT:
|
||||
access = Access.ALLOW;
|
||||
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;
|
||||
case RIGHT:
|
||||
access = Access.DENY;
|
||||
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;
|
||||
case MIDDLE:
|
||||
access = Access.UNDEFINED;
|
||||
success = fplayer.getFaction().setPermission(perm, action, access);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -93,9 +89,11 @@ public class PermissableActionFrame {
|
||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item");
|
||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -103,9 +101,11 @@ public class PermissableActionFrame {
|
||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.back-item");
|
||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class PermissableRelationFrame {
|
||||
|
||||
@ -27,9 +28,10 @@ public class PermissableRelationFrame {
|
||||
|
||||
public PermissableRelationFrame(Faction f) {
|
||||
ConfigurationSection section = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.relation");
|
||||
assert section != null;
|
||||
gui = new Gui(FactionsPlugin.getInstance(),
|
||||
section.getInt("rows", 3),
|
||||
FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.relation.name").replace("{faction}", f.getTag())));
|
||||
section.getInt("rows", 4),
|
||||
FactionsPlugin.getInstance().color(Objects.requireNonNull(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.relation.name")).replace("{faction}", f.getTag())));
|
||||
}
|
||||
|
||||
public void buildGUI(FPlayer fplayer) {
|
||||
@ -37,8 +39,7 @@ public class PermissableRelationFrame {
|
||||
List<GuiItem> GUIItems = new ArrayList<>();
|
||||
ItemStack dumby = buildDummyItem();
|
||||
// Fill background of GUI with dumbyitem & replace GUI assets after
|
||||
for (int x = 0; x <= (gui.getRows() * 9) - 1; x++)
|
||||
GUIItems.add(new GuiItem(dumby, e -> e.setCancelled(true)));
|
||||
for (int x = 0; x <= (gui.getRows() * 9) - 1; x++) GUIItems.add(new GuiItem(dumby, e -> e.setCancelled(true)));
|
||||
ConfigurationSection sec = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.relation");
|
||||
for (String key : sec.getConfigurationSection("slots").getKeys(false)) {
|
||||
if (key == null || sec.getInt("slots." + key) < 0) continue;
|
||||
@ -58,8 +59,10 @@ public class PermissableRelationFrame {
|
||||
private ItemStack buildAsset(String loc, String relation) {
|
||||
ItemStack item = XMaterial.matchXMaterial(FactionsPlugin.getInstance().getConfig().getString(loc)).get().parseItem();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
meta.setDisplayName(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fperm-gui.relation.Placeholder-Item.Name").replace("{relation}", relation)));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -67,9 +70,12 @@ public class PermissableRelationFrame {
|
||||
ConfigurationSection config = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.dummy-item");
|
||||
ItemStack item = XMaterial.matchXMaterial(config.getString("Type")).get().parseItem();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
// So u can set it to air.
|
||||
if (meta != null) {
|
||||
meta.setLore(FactionsPlugin.getInstance().colorList(config.getStringList("Lore")));
|
||||
meta.setDisplayName(FactionsPlugin.getInstance().color(config.getString("Name")));
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user