Skip to content

Commit

Permalink
Merge pull request #120 from Nookure/dev
Browse files Browse the repository at this point in the history
Merge dev -> feature/staff-pin
  • Loading branch information
Angelillo15 authored Jul 23, 2024
2 parents 043b398 + 152edae commit 4a670a0
Show file tree
Hide file tree
Showing 47 changed files with 591 additions and 267 deletions.
3 changes: 2 additions & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Java format
a1aaddd46eaee1130f1d128869077cb8e5a7755b
a1aaddd46eaee1130f1d128869077cb8e5a7755b
43147aa669a9573ccfc7fd91393bc02928f094e8
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Checkout main branch from GitHub
uses: actions/checkout@v4
# Runs a single command using the runners shell
- name: Seting up JDK 21
- name: Setting up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ jobs:
uses: actions/checkout@v3

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

- name: Setup Gradle
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: NookureStaff Test

on:
push:
branches: [ release/1.x, dev ]
pull_request:
branches: [ release/1.x, dev ]
jobs:
build-on-ubuntu:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout main branch from GitHub
uses: actions/checkout@v4
# Runs a single command using the runners shell
- name: Setting up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Execute Gradle test
run: |
chmod +x gradlew
./gradlew test
6 changes: 3 additions & 3 deletions NookureStaff-API/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ java {
}

dependencies {
testImplementation(platform("org.junit:junit-bom:5.9.1"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
implementation(libs.configurateYaml)
compileOnly(libs.protocol.buffers.lite)
compileOnlyApi(libs.paperApi)
Expand Down Expand Up @@ -115,5 +115,5 @@ sourceSets {
}

ebean {
debugLevel = 1
debugLevel = 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,17 @@ 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 CommentedConfigurationNode node
final String fileName
) {
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 All @@ -56,6 +53,7 @@ public static <C> ConfigurationContainer<C> load(Path path, Class<C> clazz, Stri
Remember to join my Discord server if you need help:
https://discord.nookure.com/
""")
)
.path(path)
Expand All @@ -69,7 +67,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, node);
ConfigurationContainer<C> container = new ConfigurationContainer<>(config, clazz, loader, fileName);
container.save().join();

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

public CommentedConfigurationNode getNode() {
return node;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ public class BukkitConfig {
This will print out more information to the console.
It's recommended to find bugs.
""")
private final boolean debug = false;
private boolean debug = false;

@Setting
@Comment("""
The name of the server.
This will be used in the messages or identifiers.
""")
private final String serverName = "Server 1";
private String serverName = "Server 1";

public boolean isDebug() {
return debug;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,41 @@

@ConfigSerializable
public class BukkitMessages {
public final StaffModePartial staffMode = new StaffModePartial();
public final VanishPartial vanish = new VanishPartial();
public final FreezeMessagePartial freeze = new FreezeMessagePartial();
public final StaffChatPartial staffChat = new StaffChatPartial();
public final PlaceholderPartial placeholder = new PlaceholderPartial();
public final PinMessagePartial pin = new PinMessagePartial();
public StaffModePartial staffMode = new StaffModePartial();
public VanishPartial vanish = new VanishPartial();
public FreezeMessagePartial freeze = new FreezeMessagePartial();
public StaffChatPartial staffChat = new StaffChatPartial();
public PlaceholderPartial placeholder = new PlaceholderPartial();
public PinMessagePartial pin = new PinMessagePartial();

@Setting
@Comment("""
The prefix for all staff messages.
If you want to use the prefix in a message, use {prefix}.
""")
private final String prefix = "<b><red>Staff</red> <gray>»</gray></b>";
@Comment(
"""
The prefix for all staff messages.
If you want to use the prefix in a message, use {prefix}.
"""
)
private String prefix = "<b><red>Staff</red> <gray>»</gray></b>";
@Setting
@Comment(
"""
Reload message
"""
)
private final String reload = "{prefix} <gray>Configuration reloaded, mayor changes may not take effect until the server is restarted.";
private String reload = "{prefix} <gray>Configuration reloaded, mayor changes may not take effect until the server is restarted.";
@Setting
@Comment(
"""
Player not found message
"""
)
private final String playerNotFound = "{prefix} <red>Could not find the player {player}.";
private String playerNotFound = "{prefix} <red>Could not find the player {player}.";

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

public String prefix() {
return prefix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ItemsConfig {
@ConfigSerializable
public static class StaffItems {
@Setting
private final Map<String, ItemPartial> items = new HashMap<>();
private Map<String, ItemPartial> items = new HashMap<>();

public StaffItems() {
items.put(Items.RANDOM_PLAYER_TELEPORT.toString(), new ItemPartial(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public class StaffModeBlockedCommands {
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 final String blockedCommandUsage = "You are not allowed to use this command while in staff mode.";
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 final List<String> blockedCommands = List.of("yourcommand1", "yourcommand2", "yourcommand3");
private List<String> blockedCommands = List.of("yourcommand1", "yourcommand2", "yourcommand3");

public String getBlockedCommandUsage() {
return blockedCommandUsage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ public class FreezePartial {
Execute a command when the player is frozen and he or she
exits of the servers.
""")
private final boolean executeCommandOnExit = true;
private boolean executeCommandOnExit = true;

@Setting
@Comment("""
Ask the player to execute a command when he or she exits
of the server.
""")
private final boolean askToExecuteCommandOnExit = true;
private boolean askToExecuteCommandOnExit = true;

@Setting
@Comment("""
Enable or disable the chat freeze.
This will prevent the player from sending messages in the chat
and he will be able to chat with the staff members only.
""")
private final boolean freezeChat = true;
private boolean freezeChat = true;

@Setting
@Comment("""
The value is with the following format: 1h 1m 1s
Set "false" to disable the freeze timer.
If the timer gets to 0, the player will be banned.
""")
private final String freezeTimer = "5m";
""")
private String freezeTimer = "5m";

@Setting
@Comment("""
Expand All @@ -48,7 +48,7 @@ public class FreezePartial {
↳ {staff} - Staff member name
Use the proxy: prefix to execute a command in the proxy.
""")
private final List<String> commands = List.of("ban {player} <red>You have been baned for ss evading");
private List<String> commands = List.of("ban {player} <red>You have been baned for ss evading");

public boolean executeCommandOnExit() {
return executeCommandOnExit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,30 @@ public class ModulesPartials {
This include /staff command and the staff
vault.
""")
private final boolean staffMode = true;
private boolean staffMode = true;

@Setting
@Comment("""
Enable or disable the freeze module.
This include /freeze command
""")
private final boolean freeze = true;
private boolean freeze = true;

@Setting
@Comment("""
Enable or disable the vanish module.
This include /vanish command and the plugin vanish
on StaffMode.
""")
private final boolean vanish = true;
private boolean vanish = true;

@Setting
@Comment("""
Enable or disable the StaffChat module.
This include /staffchat command and
the staff chat prefix.
""")
private final boolean staffChat = true;
private boolean staffChat = true;

@Setting
@Comment("""
Expand All @@ -44,23 +44,23 @@ public class ModulesPartials {
player data like user notes
"""
)
private final boolean playerData = true;
private boolean playerData = true;

@Setting
@Comment("""
Enable or disable the user notes module.
This include /note command and the user notes
vault.
""")
private final boolean userNotes = true;
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 final boolean playerList = true;
private boolean playerList = true;

@Setting
@Comment("""
Expand Down
Loading

0 comments on commit 4a670a0

Please sign in to comment.