Skip to content

Commit

Permalink
1.4.1 update
Browse files Browse the repository at this point in the history
  • Loading branch information
ChromMob committed Nov 10, 2024
1 parent ebccdc7 commit 75ba262
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 35 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group = 'me.chrommob'
version = '1.4.0'
version = '1.4.1'

repositories {
mavenCentral()
Expand Down Expand Up @@ -33,14 +33,16 @@ dependencies {
compileOnly "org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT"
implementation "net.kyori:adventure-text-minimessage:4.14.0"
implementation "net.kyori:adventure-platform-bukkit:4.2.0"
implementation 'com.github.retrooper:packetevents-spigot:2.4.0'
implementation 'com.github.retrooper:packetevents-spigot:2.6.0'
implementation 'org.bstats:bstats-bukkit:3.0.2'
implementation "co.aikar:acf-paper:0.5.1-SNAPSHOT"
implementation "net.kyori:adventure-text-serializer-plain:4.17.0"

}

shadowJar {
relocate 'io.github.retrooper.packetevents', 'me.chrommob.baritoneremover.libs.packetevents'
relocate 'io.github.retrooper.packetevents', 'me.chrommob.baritoneremover.libs.io.packetevents'
relocate 'com.github.retrooper.packetevents', 'me.chrommob.baritoneremover.libs.com.packetevents'
relocate 'org.bstats', 'me.chrommob.baritoneremover.libs.bstats'
relocate 'net.kyori', 'me.chrommob.baritoneremover.libs.kyori'
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
24 changes: 14 additions & 10 deletions gradlew
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -83,7 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -130,26 +131,29 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -198,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
20 changes: 11 additions & 9 deletions src/main/java/me/chrommob/baritoneremover/checks/inter/Check.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import me.chrommob.baritoneremover.config.ConfigManager;
import me.chrommob.baritoneremover.data.PlayerData;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextReplacementConfig;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
import org.bukkit.Bukkit;

public abstract class Check {
Expand Down Expand Up @@ -67,15 +69,15 @@ public void resetVl() {

private void alert() {
int currentVl = this.currentVl;
String message = "Player " + playerName + " has been flagged for " + name + " (" + identifier + ") (VL: " + currentVl + "/" + punishVl + ")";
ConfigManager.getInstance().appendDebug(message);
ConfigManager.getInstance().adventure().permission("br.alert").sendMessage(
ConfigManager.getInstance().prefix()
.append(Component.text("Player ").color(NamedTextColor.WHITE))
.append(Component.text(playerName).color(NamedTextColor.RED))
.append(Component.text(" has been flagged for ").color(NamedTextColor.WHITE))
.append(Component.text(name + " (" + identifier + ")").color(NamedTextColor.RED))
.append(Component.text(" (VL: " + currentVl + "/" + punishVl + ")").color(NamedTextColor.WHITE)).hoverEvent(Component.text(description).color(NamedTextColor.AQUA)));
Component message = ConfigManager.getInstance().punishmentMessage()
.replaceText(TextReplacementConfig.builder().matchLiteral("{player}").replacement(playerName).build())
.replaceText(TextReplacementConfig.builder().matchLiteral("{check}").replacement(name + " (" + identifier + ")").build())
.replaceText(TextReplacementConfig.builder().matchLiteral("{vl}").replacement(String.valueOf(currentVl)).build())
.replaceText(TextReplacementConfig.builder().matchLiteral("{punish-vl}").replacement(String.valueOf(punishVl)).build())
.hoverEvent(Component.text(description).color(NamedTextColor.AQUA));
ConfigManager.getInstance().adventure().permission("br.alert").sendMessage(message);
String messageString = PlainTextComponentSerializer.plainText().serialize(message);
ConfigManager.getInstance().appendDebug(messageString);
String json = "{\"content\": \"Player " + playerName + " has been flagged for " + name + " (" + identifier + ") (VL: " + currentVl + "/" + punishVl + ")\"}";
ConfigManager.getInstance().sender().add(json, playerName,currentVl >= punishVl);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class ConfigManager {
private final Sender sender = new Sender(this);
private final Map<Class<? extends Check>, ConfigData> configDataMap = new HashMap<>();
private Component prefix;
private Component punishmentMessage;
private double minTps;
private boolean webHookEnabled;
private String webHookUrl;
Expand Down Expand Up @@ -96,7 +97,7 @@ public void loadConfig() {
Component.text("[").color(NamedTextColor.WHITE)
.append(Component.text("BaritoneRemover").color(NamedTextColor.RED))
.append(Component.text("] ").color(NamedTextColor.WHITE)));

punishmentMessage = miniMessage.deserialize((String) config.get("punishment-message"));
Map<String, Object> webHook = (Map<String, Object>) config.get("webhook");
webHookEnabled = (boolean) webHook.get("enable");
webHookUrl = (String) webHook.get("url");
Expand Down Expand Up @@ -169,6 +170,8 @@ private void propagateDefault() {

config.put("prefix", "[<red>BaritoneRemover<white>] ");

config.put("punishment-message", "Player <red>{player}</red> has been flagged for <red>{check}</red> (VL: {vl}/{punish-vl})");

config.put("min-tps", 18.0);

Map<String, Object> webHook = new LinkedHashMap<>();
Expand Down Expand Up @@ -232,6 +235,10 @@ public Component prefix() {
return prefix;
}

public Component punishmentMessage() {
return punishmentMessage;
}

public static ConfigManager getInstance() {
return instance;
}
Expand Down

0 comments on commit 75ba262

Please sign in to comment.