Skip to content

Commit

Permalink
flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Angeschossen committed Jan 7, 2025
1 parent 3b35474 commit 85655f3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
3 changes: 2 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group = "com.github.angeschossen"
version = "1.1.4"
version = "1.1.5"
description = "PluginFrameworkAPI"

plugins {
Expand Down Expand Up @@ -37,6 +37,7 @@ repositories {
dependencies {
compileOnly("org.spigotmc:spigot-api:1.21.1-R0.1-SNAPSHOT")
compileOnly("org.realityforge.org.jetbrains.annotations:org.jetbrains.annotations:1.7.0")
compileOnly("org.apache.commons:commons-lang3:3.17.0")
}

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.angeschossen.pluginframework.api.player.PlayerData;
import com.github.angeschossen.pluginframework.api.utils.Checks;
import org.apache.commons.lang3.ArrayUtils;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand All @@ -16,6 +17,28 @@ protected RoleFlag(@NotNull Plugin plugin, @NotNull String name) {
this.name = Checks.requireNonNull(name, "name");
}

public void sendDeniedMessage(@NotNull PlayerData playerData, @Nullable String[] strings, @Nullable String[] strings1) {
String key = getMessageKey();
if (key == null) {
return;
}

String[] p, v;
if (strings != null && strings1 != null) {
p = ArrayUtils.addAll(getDefaultPlaceholders(), strings);
v = ArrayUtils.addAll(getDefaultPlaceholderValues(), strings1);
} else {
p = null;
v = null;
}

playerData.sendMessage(key, p, v);
}

protected @Nullable String getMessageKey(){
return null;
}

public final @NotNull Plugin getPlugin() {
return plugin;
}
Expand Down Expand Up @@ -43,6 +66,4 @@ protected static String[] getDefaultPlaceholders() {
protected final String[] getDefaultPlaceholderValues() {
return new String[]{getName(), getBypassPermission()};
}

public abstract void sendDeniedMessage(@NotNull PlayerData playerData, @Nullable String[] placeholders, @Nullable String[] values);
}

0 comments on commit 85655f3

Please sign in to comment.