Skip to content

Commit

Permalink
Merge pull request #115 from Nookure/dev
Browse files Browse the repository at this point in the history
1.3.0 Release
  • Loading branch information
Angelillo15 authored Jul 15, 2024
2 parents e3ffd10 + 3486a5e commit 4e6a94f
Show file tree
Hide file tree
Showing 81 changed files with 1,882 additions and 142 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
- name: Checkout main branch from GitHub
uses: actions/checkout@v4
# Runs a single command using the runners shell
- name: Seting up JDK 17
- name: Seting up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
uses: actions/checkout@v3

# Runs a single command using the runners shell
- name: Seting up JDK 17
- name: Seting up JDK 21
uses: actions/setup-java@v1
with:
java-version: 17
java-version: 21

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
- name: Checkout main branch from GitHub
uses: actions/checkout@v4
# Runs a single command using the runners shell
- name: Seting up JDK 17
- name: Seting up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Execute Gradle build
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ bin/
### Mac OS ###
.DS_Store

maven/
maven/
run/
1 change: 1 addition & 0 deletions NookureStaff-API/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ sourceSets {
property("branch", grgit.branch.current().name)
property("commit", grgit.head().abbreviatedId)
property("time", System.currentTimeMillis().toString())
property("nookureInventoryVersion", rootProject.libs.nookure.core.inventory.get().version)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public final class Constants {
public static final String COMMIT = "{{ commit }}";
public static final String VERSION_CODE = "{{ versionCode }}";
public static final String BUILD_TIME = "{{ time }}";
public static final String NOOKURE_INVENTORY_VERSION = "{{ nookureInventoryVersion }}";

private Constants() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,35 @@ public final class Permissions {
*/
public static final String STAFF_ADMIN_PERMISSION = "nookure.staff.admin";

/**
* Permission to use the player list command.
* This permission is required to use the player list command.
*/
public static final String PLAYER_LIST_PERMISSION = "nookure.staff.player-list";

/**
* Permission to use the player actions command.
* This permission is required to use the player actions command.
*/
public static final String PLAYER_ACTIONS_PERMISSION = "nookure.staff.players.actions";

/**
* Permission to use the helpop command.
* This permission is required to use the helpop command.
* The helpop command is used to request help from staff members.
* The staff members with the permission {@link #HELPOP_RECEIVE_PERMISSION}
*/
public static final String HELPOP_COMMAND_PERMISSION = "nookure.staff.helpop";

/**
* Permission to receive helpop requests.
* This permission is required to receive helpop requests.
* The helpop requests are sent by players with the permission {@link #HELPOP_COMMAND_PERMISSION}.
*/
public static final String HELPOP_RECEIVE_PERMISSION = "nookure.staff.helpop.receive";

public static final String ACTION_BAR_PERMISSION = "nookure.staff.actionbar";

/**
* Permission to build in staff mode.
* This permission is required to build in staff mode.
Expand All @@ -54,6 +83,22 @@ public final class Permissions {
*/
public static final String STAFF_FREEZE = "nookure.staff.freeze";

/**
* Permission to see the inventory of a player.
*/
public static final String STAFF_INVSEE = "nookure.staff.invsee";

/**
* Permission to see the enderchest of a player.
*/
public static final String STAFF_ENDERCHEST = "nookure.staff.enderchest";
/**
* Permission to modify the inventory of a player.
*/
public static final String STAFF_INVSEE_MODIFY = "nookure.staff.invsee.modify";

public static final String STAFF_ENDERCHEST_MODIFY = "nookure.staff.enderchest.modify";

/**
* Permission to bypass the freeze.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.nookure.staff.api;

import com.nookure.staff.api.command.CommandSender;
import com.nookure.staff.api.model.PlayerModel;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import java.io.Serializable;
Expand All @@ -21,12 +23,21 @@ public interface PlayerWrapper extends Serializable, CommandSender {
*
* @return a set containing all the plugin channels
*/
@NotNull Set<String> getListeningPluginChannels();
@NotNull
Set<String> getListeningPluginChannels();

/**
* Teleport the player to another player.
*
* @param to the player to teleport to
*/
void teleport(@NotNull PlayerWrapper to);

/**
* Get the player's model.
*
* @throws IllegalStateException if the player's model feature is disabled
* @return the player's model
*/
PlayerModel getPlayerModel();
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public List<String> getSuggestionFilter(@NotNull List<String> args, @NotNull Str
Objects.requireNonNull(message, "message can't be null");

return args.stream()
.filter(arg -> arg.startsWith(message))
.filter(arg -> arg.toLowerCase().startsWith(message.toLowerCase()))
.toList();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ public void prepare() {
@Override
public @NotNull List<String> onTabComplete(@NotNull CommandSender sender, @NotNull String label, @NotNull List<String> args) {
if (args.size() == 1) {
return subCommandNames;
return getSuggestionFilter(subCommandNames, args.getFirst());
}

Optional<Command> optionalCommand = Optional.ofNullable(subCommands.get(args.get(0)));
Optional<Command> optionalCommand = Optional.ofNullable(subCommands.get(args.getFirst()));
return optionalCommand.map(command -> command.onTabComplete(sender, label, args.subList(1, args.size()))).orElseGet(List::of);
}

Expand All @@ -109,4 +109,12 @@ public void onCommand(@NotNull CommandSender sender, @NotNull String label, @Not
parent.sendHelp(sender, label);
}
}

public Map<String, Command> getSubCommands() {
return subCommands;
}

public Map<String, CommandData> getSubCommandData() {
return subCommandData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ public class ConfigurationContainer<C> {
private final YamlConfigurationLoader loader;
private final Class<C> clazz;
private final String fileName;
private final CommentedConfigurationNode node;

private ConfigurationContainer(
final C config,
final Class<C> clazz,
final YamlConfigurationLoader loader,
final String fileName
final String fileName,
final CommentedConfigurationNode node
) {
this.config = new AtomicReference<>(config);
this.loader = loader;
this.clazz = clazz;
this.fileName = fileName;
this.node = node;
}

public static <C> ConfigurationContainer<C> load(Path path, Class<C> clazz) throws IOException {
Expand Down Expand Up @@ -67,7 +70,7 @@ public static <C> ConfigurationContainer<C> load(Path path, Class<C> clazz, Stri
loader.save(node);
}

ConfigurationContainer<C> container = new ConfigurationContainer<>(config, clazz, loader, fileName);
ConfigurationContainer<C> container = new ConfigurationContainer<>(config, clazz, loader, fileName, node);
container.save().join();

return container;
Expand Down Expand Up @@ -99,4 +102,8 @@ public CompletableFuture<Void> save() {
}
});
}

public CommentedConfigurationNode getNode() {
return node;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.nookure.staff.api.config.bukkit;

import com.nookure.staff.api.config.bukkit.partials.FreezePartial;
import com.nookure.staff.api.config.bukkit.partials.ModulesPartials;
import com.nookure.staff.api.config.bukkit.partials.StaffModePartial;
import com.nookure.staff.api.config.bukkit.partials.config.FreezePartial;
import com.nookure.staff.api.config.bukkit.partials.config.ModulesPartials;
import com.nookure.staff.api.config.bukkit.partials.config.PlayerActions;
import com.nookure.staff.api.config.bukkit.partials.config.StaffModePartial;
import com.nookure.staff.api.config.partials.DatabaseConfig;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
Expand All @@ -12,30 +13,41 @@
public class BukkitConfig {
@Setting
public final DatabaseConfig database = new DatabaseConfig();

@Setting
@Comment("""
Here you can enable or disable any part of the plugin.
If you disable a module, the commands and the features
of that module will be disabled.
""")
public final ModulesPartials modules = new ModulesPartials();

@Setting
@Comment("""
Here you can configure some settings for the staffmode
""")
public final StaffModePartial staffMode = new StaffModePartial();

@Setting
@Comment("""
Here you can configure some settings for the freeze module
""")
public final FreezePartial freeze = new FreezePartial();

@Setting
@Comment("""
Here you can configure some settings for the player actions
""")
public final PlayerActions playerActions = new PlayerActions();

@Setting
@Comment("""
Enable or disable debug mode.
This will print out more information to the console.
It's recommended to find bugs.
""")
private boolean debug = false;

@Setting
@Comment("""
The name of the server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public class BukkitMessages {
)
private String playerNotFound = "{prefix} <red>Could not find the player {player}.";

@Setting
@Comment("""
The message when you don't have a permission
""")
private String noPermission = "{prefix} <red>You don't have permission to do that.";

public String prefix() {
return prefix;
}
Expand All @@ -46,4 +52,8 @@ public String reload() {
public String playerNotFound() {
return playerNotFound;
}

public String noPermission() {
return noPermission;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.nookure.staff.api.config.bukkit.partials;
package com.nookure.staff.api.config.bukkit;

import org.spongepowered.configurate.objectmapping.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.nookure.staff.api.config.bukkit.partials;

public enum VanishType {
PREMIUM_VANISH,
SUPER_VANISH,
INTERNAL_VANISH
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.nookure.staff.api.config.bukkit.partials;
package com.nookure.staff.api.config.bukkit.partials.config;

import com.nookure.staff.api.util.NumberUtils;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.nookure.staff.api.config.bukkit.partials;
package com.nookure.staff.api.config.bukkit.partials.config;

import org.spongepowered.configurate.objectmapping.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
Expand Down Expand Up @@ -61,6 +61,14 @@ public class ModulesPartials {
""")
private boolean userNotes = true;

@Setting
@Comment("""
Enable or disble the player-list module.
This will allow you to list all the players on the server
and perform actions on them.
""")
private boolean playerList = true;

public boolean isStaffMode() {
return staffMode;
}
Expand Down Expand Up @@ -88,4 +96,8 @@ public boolean isPlayerData() {
public boolean isUserNotes() {
return userNotes;
}

public boolean isPlayerList() {
return playerList;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.nookure.staff.api.config.bukkit.partials.config;

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

@ConfigSerializable
public class PlayerActions {
@Comment("""
If true, the player will be able to inspect a player by
shift and right-clicking on them.
""")
private final boolean shiftAndRightClickToInspect = true;

public boolean shiftAndRightClickToInspect() {
return shiftAndRightClickToInspect;
}
}
Loading

0 comments on commit 4e6a94f

Please sign in to comment.