Skip to content

Commit

Permalink
Merge pull request #112 from Nookure/dev
Browse files Browse the repository at this point in the history
Release 1.2.2
  • Loading branch information
Angelillo15 authored Jun 24, 2024
2 parents b5d4ea2 + ddd49b4 commit ab4e542
Show file tree
Hide file tree
Showing 32 changed files with 2,343 additions and 70 deletions.
3 changes: 2 additions & 1 deletion NookureStaff-API/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ java {
dependencies {
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
implementation(libs.configurateYaml)
compileOnly(libs.protocol.buffers.lite)
compileOnlyApi(libs.paperApi)
compileOnlyApi(libs.guava)
compileOnlyApi(libs.guice)
compileOnlyApi(libs.apacheCommons)
implementation(libs.configurateYaml)
compileOnlyApi(libs.jedis)
compileOnlyApi(libs.adventureApi)
compileOnlyApi(libs.miniMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,57 @@ public final class Permissions {
* instead of a {@link PlayerWrapper}.
*/
public static final String STAFF_PERMISSION = "nookure.staff";

/**
* Permission to use the staff mode.
* This permission is required to use the staff mode.
*/
public static final String STAFF_MODE_PERMISSION = "nookure.staff.mode";

/**
* Permission to bypass the blocked commands in staff mode.
* This permission is required to bypass the blocked
* commands in staff mode.
*/
public static final String STAFF_MODE_COMMANDS_BYPASS = "nookure.staff.mode.commands.bypass";

/**
* Permission to use the admin commands.
* This permission is required to use any admin command.
*/
public static final String STAFF_ADMIN_PERMISSION = "nookure.staff.admin";

/**
* Permission to build in staff mode.
* This permission is required to build in staff mode.
*/
public static final String STAFF_MODE_BUILD = "nookure.staff.build";

/**
* Permission to enter in vanish.
*/
public static final String STAFF_VANISH = "nookure.staff.vanish";

/**
* Permission to see the players in vanish.
*/
public static final String STAFF_VANISH_SEE = "nookure.staff.vanish.see";

/**
* Permission to freeze a player.
*/
public static final String STAFF_FREEZE = "nookure.staff.freeze";

/**
* Permission to bypass the freeze.
*/
public static final String STAFF_FREEZE_BYPASS = "nookure.staff.freeze.bypass";

/**
* Permission to use the staff chat.
*/
public static final String STAFF_CHAT = "nookure.staff.staffchat";

/**
* Permissions to have administrator notes.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.nookure.staff.api.config.bukkit.partials;

import org.spongepowered.configurate.objectmapping.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
import org.spongepowered.configurate.objectmapping.meta.Setting;

import java.util.List;

@ConfigSerializable
public class StaffModeBlockedCommands {
@Setting
@Comment("""
The message that is sent to a player when they try to use a blocked command while in staff mode.
This message is sent to the player when they try to use a command that is in the blockedCommands list.
""")
private String blockedCommandUsage = "You are not allowed to use this command while in staff mode.";

@Setting
@Comment("""
A list of commands that are blocked when a player is in staff mode.
This is useful for preventing staff members from using commands that could give them an unfair advantage.
You can bypass this by giving the player the permission 'nookure.staff.mode.commands.bypass'.
""")
private List<String> blockedCommands = List.of("yourcommand1", "yourcommand2", "yourcommand3");

public String getBlockedCommandUsage() {
return blockedCommandUsage;
}

public List<String> getBlockedCommands() {
return blockedCommands;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.nookure.staff.api.item;

import com.nookure.staff.api.config.bukkit.partials.ItemPartial;
import com.nookure.staff.api.util.ServerUtils;
import com.nookure.staff.api.util.TextUtils;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
Expand All @@ -24,13 +26,25 @@ public abstract class StaffItem {
private final ItemStack itemStack;
private final int slot;

@SuppressWarnings("deprecation")
public StaffItem(ItemPartial itemConfig) {
this.itemConfig = itemConfig;
ItemStack itemStack = new ItemStack(itemConfig.getMaterial());
ItemMeta meta = itemStack.getItemMeta();

meta.displayName(TextUtils.toComponent(itemConfig.getName()));
meta.lore(itemConfig.lore());
if (ServerUtils.isPaper) {
meta.displayName(TextUtils.toComponent(itemConfig.getName()));
meta.lore(itemConfig.lore());
} else {
meta.setDisplayName(
LegacyComponentSerializer.legacySection().serialize(TextUtils.toComponent(itemConfig.getName()))
);
meta.setLore(
itemConfig.lore().stream()
.map(cmp -> LegacyComponentSerializer.legacySection().serialize(cmp)).toList()
);
}

meta.getPersistentDataContainer().set(key, PersistentDataType.INTEGER, itemConfig.getSlot());

slot = itemConfig.getSlot();
Expand Down
Loading

0 comments on commit ab4e542

Please sign in to comment.