Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.alpsbte.alpslib.utils.item.Item;
import com.cryptomorin.xseries.XMaterial;
import net.buildtheearth.buildteamtools.modules.network.model.Permissions;
import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu;
import org.bukkit.Material;
import org.bukkit.entity.Player;
Expand All @@ -19,7 +20,6 @@ public class ChoosePaletteMenu extends AbstractMenu {

private static final int BACK_SLOT = 36;
private static final int ADD_PALETTE_SLOT = 44;
private static final String EDIT_PERMISSION = "btt.bp.edit";

private static final String BACK_HEAD =
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90"
Expand Down Expand Up @@ -226,7 +226,7 @@ protected void setItemClickEventsAsync() {

private boolean hasEditPermission() {
try {
return getMenuPlayer().hasPermission(EDIT_PERMISSION);
return getMenuPlayer().hasPermission(Permissions.BLOCK_PALETTE_EDIT);
} catch (Exception e) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.cryptomorin.xseries.XMaterial;
import io.papermc.paper.event.player.AsyncChatEvent;
import lombok.Getter;
import net.buildtheearth.buildteamtools.modules.network.model.Permissions;
import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu;
import net.kyori.adventure.text.logger.slf4j.ComponentLogger;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
Expand Down Expand Up @@ -44,7 +45,6 @@ public class CreatePaletteMenu extends AbstractMenu {

private static final int MAX_NAME_LENGTH = 32;
private static final int MAX_DESCRIPTION_LENGTH = 256;
private static final String EDIT_PERMISSION = "btt.bp.edit";

private final BlockPaletteManager manager;
private final JavaPlugin plugin;
Expand Down Expand Up @@ -162,7 +162,7 @@ protected void setItemClickEventsAsync() {

// Apply
getMenu().getSlot(APPLY_SLOT).setClickHandler((p, i) -> {
if (!p.hasPermission(EDIT_PERMISSION)) {
if (!p.hasPermission(Permissions.BLOCK_PALETTE_EDIT)) {
p.sendMessage("§cYou do not have permission to create palettes.");
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.alpsbte.alpslib.utils.item.Item;
import com.cryptomorin.xseries.XMaterial;
import io.papermc.paper.event.player.AsyncChatEvent;
import net.buildtheearth.buildteamtools.modules.network.model.Permissions;
import net.buildtheearth.buildteamtools.utils.menus.AbstractMenu;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.bukkit.Bukkit;
Expand Down Expand Up @@ -42,7 +43,6 @@ public class EditPaletteMenu extends AbstractMenu {

private static final int MAX_NAME_LENGTH = 32;
private static final int MAX_DESCRIPTION_LENGTH = 256;
private static final String EDIT_PERMISSION = "btt.bp.edit";

private final BlockPaletteManager manager;
private final JavaPlugin plugin;
Expand Down Expand Up @@ -122,7 +122,7 @@ protected void setMenuItemsAsync() {
protected void setItemClickEventsAsync() {
// Name
getMenu().getSlot(NAME_SLOT).setClickHandler((p, i) -> {
if (!p.hasPermission(EDIT_PERMISSION)) {
if (!p.hasPermission(Permissions.BLOCK_PALETTE_EDIT)) {
p.sendMessage("§cYou do not have permission to edit palettes.");
return;
}
Expand All @@ -140,7 +140,7 @@ protected void setItemClickEventsAsync() {

// Description
getMenu().getSlot(DESCRIPTION_SLOT).setClickHandler((p, i) -> {
if (!p.hasPermission(EDIT_PERMISSION)) {
if (!p.hasPermission(Permissions.BLOCK_PALETTE_EDIT)) {
p.sendMessage("§cYou do not have permission to edit palettes.");
return;
}
Expand All @@ -158,7 +158,7 @@ protected void setItemClickEventsAsync() {

// Blocks
getMenu().getSlot(BLOCKS_SLOT).setClickHandler((p, i) -> {
if (!p.hasPermission(EDIT_PERMISSION)) {
if (!p.hasPermission(Permissions.BLOCK_PALETTE_EDIT)) {
p.sendMessage("§cYou do not have permission to edit palettes.");
return;
}
Expand All @@ -175,7 +175,7 @@ protected void setItemClickEventsAsync() {

// Delete
getMenu().getSlot(DELETE_SLOT).setClickHandler((p, i) -> {
if (!p.hasPermission(EDIT_PERMISSION)) {
if (!p.hasPermission(Permissions.BLOCK_PALETTE_EDIT)) {
p.sendMessage("§cYou do not have permission to delete palettes.");
return;
}
Expand All @@ -201,7 +201,7 @@ protected void setItemClickEventsAsync() {

// Apply
getMenu().getSlot(APPLY_SLOT).setClickHandler((p, i) -> {
if (!p.hasPermission(EDIT_PERMISSION)) {
if (!p.hasPermission(Permissions.BLOCK_PALETTE_EDIT)) {
p.sendMessage("§cYou do not have permission to edit palettes.");
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public class Permissions {
public static final String GENERATOR_USE = "btt.generator.use";


public static final String BLOCK_PALETTE_EDIT = "btt.bp.edit";


public static final String NAVIGATOR_USE = "btt.navigator.use";


Expand Down