Compare commits
22 Commits
8e28ba0b87
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ab2c9bf1d6 | |||
| 7aec608825 | |||
| e980768210 | |||
| 5064ac5903 | |||
| 55881630bc | |||
|
|
4cd24ad467 | ||
| db3649a2f5 | |||
| fec5f78cbc | |||
| 7d3363812f | |||
|
|
1329b616f5 | ||
|
|
4e65e1bcb2 | ||
| c89d885fd8 | |||
| a61436effa | |||
|
|
5913a8060a | ||
| 48fd811f2a | |||
|
|
4b4063701f | ||
|
|
7a971f8188 | ||
|
|
04f894a2f7 | ||
|
|
79ab10e9ce | ||
|
|
ebf5321604 | ||
|
|
43c49c06ee | ||
|
|
99d67631ec |
12
.gitattributes
vendored
Normal file
12
.gitattributes
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#
|
||||||
|
# https://help.github.com/articles/dealing-with-line-endings/
|
||||||
|
#
|
||||||
|
# Linux start script should use lf
|
||||||
|
/gradlew text eol=lf
|
||||||
|
|
||||||
|
# These are Windows script files and should use crlf
|
||||||
|
*.bat text eol=crlf
|
||||||
|
|
||||||
|
# Binary files should be left untouched
|
||||||
|
*.jar binary
|
||||||
|
|
||||||
16
.gitea/workflows/build.yml
Normal file
16
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
name: Build
|
||||||
|
run-name: ${{ gitea.ref }} - ${{ gitea.sha }}
|
||||||
|
on: [push, workflow_dispatch]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Explore-Gitea-Actions:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: actions/setup-java@v5
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '25'
|
||||||
|
- run: ./gradlew assemble
|
||||||
|
- run: ./gradlew test
|
||||||
|
- run: ./gradlew jar
|
||||||
19
.gitea/workflows/demo.yml
Normal file
19
.gitea/workflows/demo.yml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
name: Gitea Actions Demo
|
||||||
|
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||||
|
on: [workflow_dispatch]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Explore-Gitea-Actions:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||||
|
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||||
|
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||||
|
- name: Check out repository code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||||
|
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||||
|
- name: List files in the repository
|
||||||
|
run: |
|
||||||
|
ls ${{ gitea.workspace }}
|
||||||
|
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||||
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
.gradle
|
||||||
|
build
|
||||||
|
*.iml
|
||||||
@@ -32,3 +32,12 @@ If you have DiscordSRV installed, you can add this to it's alerts.yml:
|
|||||||
Content: "${getAlert()}"
|
Content: "${getAlert()}"
|
||||||
```
|
```
|
||||||
You'll also have to specify the grief-alerts channel in config.yml.
|
You'll also have to specify the grief-alerts channel in config.yml.
|
||||||
|
|
||||||
|
# Development
|
||||||
|
|
||||||
|
|
||||||
|
* Use `./gradlew clean` to clean the project
|
||||||
|
* Use `./gradlew assemble` to compile the project
|
||||||
|
* Use `./gradlew test` to test the project
|
||||||
|
* Use `./gradlew jar` to create the jar
|
||||||
|
* Use `./gradlew build` to compile, test and create the jar
|
||||||
43
build.gradle
Normal file
43
build.gradle
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
plugins{
|
||||||
|
id "java"
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "net.ardakaz.griefalert"
|
||||||
|
version = "0.6"
|
||||||
|
|
||||||
|
repositories{
|
||||||
|
mavenCentral()
|
||||||
|
|
||||||
|
maven{
|
||||||
|
name = "papermc"
|
||||||
|
url = "https://repo.papermc.io/repository/maven-public/"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = "core-protect"
|
||||||
|
url = "https://maven.playpro.com/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compileOnly "io.papermc.paper:paper-api:26.1.2.build.72-stable"
|
||||||
|
compileOnly "net.coreprotect:coreprotect:23.2"
|
||||||
|
|
||||||
|
testImplementation(platform('org.junit:junit-bom:5.10.5'))
|
||||||
|
testImplementation('org.junit.jupiter:junit-jupiter')
|
||||||
|
testRuntimeOnly('org.junit.platform:junit-platform-launcher')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
java{
|
||||||
|
toolchain{
|
||||||
|
languageVersion = JavaLanguageVersion.of(25)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.processResources {
|
||||||
|
filteringCharset = "UTF-8"
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
7
gradle.properties
Normal file
7
gradle.properties
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# This file was generated by the Gradle 'init' task.
|
||||||
|
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties
|
||||||
|
|
||||||
|
org.gradle.configuration-cache=true
|
||||||
|
org.gradle.parallel=true
|
||||||
|
org.gradle.caching=true
|
||||||
|
|
||||||
2
gradle/libs.versions.toml
Normal file
2
gradle/libs.versions.toml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# This file was generated by the Gradle 'init' task.
|
||||||
|
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
|
||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
248
gradlew
vendored
Executable file
248
gradlew
vendored
Executable file
@@ -0,0 +1,248 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# 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/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
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=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=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
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 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" \
|
||||||
|
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
93
gradlew.bat
vendored
Executable file
93
gradlew.bat
vendored
Executable file
@@ -0,0 +1,93 @@
|
|||||||
|
@rem
|
||||||
|
@rem Copyright 2015 the original author or authors.
|
||||||
|
@rem
|
||||||
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
@rem you may not use this file except in compliance with the License.
|
||||||
|
@rem You may obtain a copy of the License at
|
||||||
|
@rem
|
||||||
|
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@rem
|
||||||
|
@rem Unless required by applicable law or agreed to in writing, software
|
||||||
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@rem See the License for the specific language governing permissions and
|
||||||
|
@rem limitations under the License.
|
||||||
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
|
@if "%DEBUG%"=="" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||||
|
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
1
settings.gradle
Normal file
1
settings.gradle
Normal file
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'GriefAlert'
|
||||||
@@ -41,7 +41,6 @@ import java.util.stream.Collectors;
|
|||||||
public class GriefAlert extends JavaPlugin implements Listener {
|
public class GriefAlert extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
private static CoreProtectAPI coreProtectAPI;
|
private static CoreProtectAPI coreProtectAPI;
|
||||||
private final String DB_FILE = "ignored_locations.db";
|
|
||||||
private Integer identicalAlerts = 1;
|
private Integer identicalAlerts = 1;
|
||||||
private String lastAlert;
|
private String lastAlert;
|
||||||
private Set<Material> EXCLUDED_BLOCKS;
|
private Set<Material> EXCLUDED_BLOCKS;
|
||||||
@@ -50,6 +49,10 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
private Boolean ALLOW_STEALING;
|
private Boolean ALLOW_STEALING;
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
|
|
||||||
|
/*
|
||||||
|
UTILITY FUNCTIONS
|
||||||
|
*/
|
||||||
|
|
||||||
// Block inspector: only the most recent placement counts for ownership.
|
// Block inspector: only the most recent placement counts for ownership.
|
||||||
private static String inspectBlock(Block block, Player player) {
|
private static String inspectBlock(Block block, Player player) {
|
||||||
List<String[]> lookup = coreProtectAPI.blockLookup(block, 50000000);
|
List<String[]> lookup = coreProtectAPI.blockLookup(block, 50000000);
|
||||||
@@ -70,7 +73,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If we see a break before a placement, stop (block is gone)
|
// If we see a break before a placement, stop (block is gone)
|
||||||
if (parseResult.getActionId() == 0) {
|
if (parseResult.getActionId() == 0 && !parseResult.isRolledBack()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,6 +93,65 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sends the alert (or cancels it)
|
||||||
|
private void alert(String message, String playerName, String mapLink, String target, int x, int y, int z, String world) {
|
||||||
|
// Exclude trusted people
|
||||||
|
Player griefer = Bukkit.getPlayer(playerName);
|
||||||
|
if (griefer.hasPermission("griefalert.exclude") || griefer.hasPermission("griefalert.exclude." + target)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Spam limiter
|
||||||
|
String realAlertMessage = message;
|
||||||
|
String[] alert1 = null;
|
||||||
|
if (lastAlert != null) {
|
||||||
|
alert1 = lastAlert.split(" ");
|
||||||
|
}
|
||||||
|
String[] alert2 = message.split(" ");
|
||||||
|
if (alert1 != null) {
|
||||||
|
if (alert1[2].equals(alert2[2]) && alert1[5].equals(alert2[5]) && alert1[1].equals("broke") && alert2[1].equals("broke")) {
|
||||||
|
identicalAlerts += 1;
|
||||||
|
} else if (Arrays.equals(alert1, alert2)) {
|
||||||
|
identicalAlerts += 1;
|
||||||
|
} else {
|
||||||
|
identicalAlerts = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (identicalAlerts == 4) {
|
||||||
|
message = ChatColor.GRAY + "Same behavior continues.";
|
||||||
|
mapLink = null;
|
||||||
|
}
|
||||||
|
if (identicalAlerts > 4) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use direct location check
|
||||||
|
if (world != null && isLocationIgnored(x, y, z, world)) {
|
||||||
|
return; // Do not alert if location is ignored
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send an event for external hooks
|
||||||
|
GriefAlertEvent griefalert_event;
|
||||||
|
if (MAP_LINK != null && !MAP_LINK.isEmpty() && mapLink != null) {
|
||||||
|
griefalert_event = new GriefAlertEvent(message + " (" + mapLink + ")");
|
||||||
|
} else {
|
||||||
|
griefalert_event = new GriefAlertEvent(message);
|
||||||
|
}
|
||||||
|
getServer().getPluginManager().callEvent(griefalert_event);
|
||||||
|
|
||||||
|
// Notify staff ingame
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
if (player.hasPermission("griefalert.notify")) {
|
||||||
|
player.sendMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lastAlert = realAlertMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
INITIALIZATION
|
||||||
|
*/
|
||||||
|
|
||||||
// Init GriefAlert
|
// Init GriefAlert
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
@@ -131,16 +193,26 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setupDatabase() {
|
private void setupDatabase() {
|
||||||
|
String jdbcUrl = getConfig().getString("jdbc-url");
|
||||||
try {
|
try {
|
||||||
connection = DriverManager.getConnection("jdbc:sqlite:" + getDataFolder().getAbsolutePath() + "/" + DB_FILE);
|
connection = DriverManager.getConnection(jdbcUrl);
|
||||||
Statement stmt = connection.createStatement();
|
Statement stmt = connection.createStatement();
|
||||||
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS ignored_locations (x INTEGER, y INTEGER, z INTEGER, world TEXT, PRIMARY KEY (x, y, z, world))");
|
stmt.executeUpdate(Migrations.CREATE_TABLE_IGNORED_LOCATIONS);
|
||||||
|
stmt.executeUpdate(Migrations.CREATE_TABLE_PLAYERS);
|
||||||
|
stmt.executeUpdate(Migrations.CREATE_TABLE_ACTIONS);
|
||||||
|
stmt.executeUpdate(Migrations.CREATE_TABLE_ALERTS);
|
||||||
|
stmt.executeUpdate(Migrations.CREATE_TABLE_REPORTS);
|
||||||
stmt.close();
|
stmt.close();
|
||||||
|
getLogger().info("Connected to "+jdbcUrl);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
getLogger().severe("Could not set up SQLite database: " + e.getMessage());
|
getLogger().severe("Could not set up SQLite database: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
LOCATION IGNORING
|
||||||
|
*/
|
||||||
|
|
||||||
private boolean isLocationIgnored(int x, int y, int z, String world) {
|
private boolean isLocationIgnored(int x, int y, int z, String world) {
|
||||||
try {
|
try {
|
||||||
PreparedStatement ps = connection.prepareStatement("SELECT 1 FROM ignored_locations WHERE x=? AND y=? AND z=? AND world=?");
|
PreparedStatement ps = connection.prepareStatement("SELECT 1 FROM ignored_locations WHERE x=? AND y=? AND z=? AND world=?");
|
||||||
@@ -191,6 +263,10 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
EVENT LISTENERS
|
||||||
|
*/
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
// Block break alerts
|
// Block break alerts
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
@@ -272,15 +348,14 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
// Armor Stand break alerts
|
// Armor Stand break alerts
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onArmorStandBreak(EntityDamageByEntityEvent event) {
|
public void onArmorStandBreak(EntityDeathEvent event) {
|
||||||
if (!(event.getEntity() instanceof ArmorStand armorStand)) return;
|
if (!(event.getEntity() instanceof ArmorStand armorStand)) return;
|
||||||
if (!(event.getDamager() instanceof Player player)) return;
|
if(!(event.getDamageSource().getCausingEntity() instanceof Player player)) return;
|
||||||
int x = armorStand.getLocation().getBlockX();
|
int x = armorStand.getLocation().getBlockX();
|
||||||
int y = armorStand.getLocation().getBlockY();
|
int y = armorStand.getLocation().getBlockY();
|
||||||
int z = armorStand.getLocation().getBlockZ();
|
int z = armorStand.getLocation().getBlockZ();
|
||||||
String worldName = armorStand.getWorld().getName();
|
String worldName = armorStand.getWorld().getName();
|
||||||
if (isLocationIgnored(x, y, z, worldName)) {
|
if (isLocationIgnored(x, y, z, worldName)) {
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String playerName = player.getName();
|
String playerName = player.getName();
|
||||||
@@ -289,6 +364,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
String message = ChatColor.GRAY + playerName + " broke an armor stand placed by " + target + " at " + x + " " + y + " " + z + getHumanWorldName(worldName);
|
String message = ChatColor.GRAY + playerName + " broke an armor stand placed by " + target + " at " + x + " " + y + " " + z + getHumanWorldName(worldName);
|
||||||
alert(message, playerName, "[Map Link](" + MAP_LINK + "/?worldname=" + worldName + "&zoom=7&x=" + x + "&y=" + y + "&z=" + z + ")", target, x, y, z, worldName);
|
alert(message, playerName, "[Map Link](" + MAP_LINK + "/?worldname=" + worldName + "&zoom=7&x=" + x + "&y=" + y + "&z=" + z + ")", target, x, y, z, worldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Armor Stand item interaction alerts
|
// Armor Stand item interaction alerts
|
||||||
@@ -301,7 +377,6 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
int z = armorStand.getLocation().getBlockZ();
|
int z = armorStand.getLocation().getBlockZ();
|
||||||
String worldName = armorStand.getWorld().getName();
|
String worldName = armorStand.getWorld().getName();
|
||||||
if (isLocationIgnored(x, y, z, worldName)) {
|
if (isLocationIgnored(x, y, z, worldName)) {
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String target = inspectBlock(armorStand.getLocation().getBlock(), player);
|
String target = inspectBlock(armorStand.getLocation().getBlock(), player);
|
||||||
@@ -337,7 +412,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//event handler for item frames
|
// Placing item to an item frame
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
|
||||||
if (!(event.getRightClicked() instanceof ItemFrame frame)) return;
|
if (!(event.getRightClicked() instanceof ItemFrame frame)) return;
|
||||||
@@ -348,7 +423,6 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
int z = frame.getLocation().getBlockZ();
|
int z = frame.getLocation().getBlockZ();
|
||||||
String worldName = frame.getWorld().getName();
|
String worldName = frame.getWorld().getName();
|
||||||
if (isLocationIgnored(x, y, z, worldName)) {
|
if (isLocationIgnored(x, y, z, worldName)) {
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String target = inspectBlock(frame.getLocation().getBlock(), player);
|
String target = inspectBlock(frame.getLocation().getBlock(), player);
|
||||||
@@ -372,7 +446,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Breaking item frame item (uses a different event then placing an item)
|
// Item frame stealing alerts
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onItemFrameDamage(EntityDamageByEntityEvent event) {
|
public void onItemFrameDamage(EntityDamageByEntityEvent event) {
|
||||||
if (!(event.getEntity() instanceof ItemFrame frame)) return;
|
if (!(event.getEntity() instanceof ItemFrame frame)) return;
|
||||||
@@ -387,7 +461,6 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
String worldName = frame.getWorld().getName();
|
String worldName = frame.getWorld().getName();
|
||||||
|
|
||||||
if (isLocationIgnored(x, y, z, worldName)) {
|
if (isLocationIgnored(x, y, z, worldName)) {
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,6 +474,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
alert(message, playerName, "[Map Link](" + MAP_LINK + "/?worldname=" + worldName + "&zoom=7&x=" + x + "&y=" + y + "&z=" + z + ")", target, x, y, z, worldName);
|
alert(message, playerName, "[Map Link](" + MAP_LINK + "/?worldname=" + worldName + "&zoom=7&x=" + x + "&y=" + y + "&z=" + z + ")", target, x, y, z, worldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Item frame breaking alerts
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onItemFrameBreak(HangingBreakByEntityEvent event) {
|
public void onItemFrameBreak(HangingBreakByEntityEvent event) {
|
||||||
if (!(event.getEntity() instanceof ItemFrame frame)) return;
|
if (!(event.getEntity() instanceof ItemFrame frame)) return;
|
||||||
@@ -415,7 +489,6 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
String worldName = loc.getWorld().getName();
|
String worldName = loc.getWorld().getName();
|
||||||
|
|
||||||
if (isLocationIgnored(x, y, z, worldName)) {
|
if (isLocationIgnored(x, y, z, worldName)) {
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String target = inspectBlock(loc.getBlock(), player);
|
String target = inspectBlock(loc.getBlock(), player);
|
||||||
@@ -427,6 +500,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Command handler
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
if (!command.getName().equalsIgnoreCase("griefalert")) return false;
|
if (!command.getName().equalsIgnoreCase("griefalert")) return false;
|
||||||
@@ -588,57 +662,6 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sends the alert (or cancels it)
|
|
||||||
private void alert(String message, String playerName, String mapLink, String target, int x, int y, int z, String world) {
|
|
||||||
// Exclude trusted people
|
|
||||||
Player griefer = Bukkit.getPlayer(playerName);
|
|
||||||
if (griefer.hasPermission("griefalert.exclude") || griefer.hasPermission("griefalert.exclude." + target)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Spam limiter
|
|
||||||
String realAlertMessage = message;
|
|
||||||
String[] alert1 = null;
|
|
||||||
if (lastAlert != null) {
|
|
||||||
alert1 = lastAlert.split(" ");
|
|
||||||
}
|
|
||||||
String[] alert2 = message.split(" ");
|
|
||||||
if (alert1 != null) {
|
|
||||||
if (alert1[2].equals(alert2[2]) && alert1[5].equals(alert2[5]) && alert1[1].equals("broke") && alert2[1].equals("broke")) {
|
|
||||||
identicalAlerts += 1;
|
|
||||||
} else if (Arrays.equals(alert1, alert2)) {
|
|
||||||
identicalAlerts += 1;
|
|
||||||
} else {
|
|
||||||
identicalAlerts = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (identicalAlerts == 4) {
|
|
||||||
message = ChatColor.GRAY + "Same behavior continues.";
|
|
||||||
mapLink = null;
|
|
||||||
}
|
|
||||||
if (identicalAlerts > 4) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Use direct location check
|
|
||||||
if (world != null && isLocationIgnored(x, y, z, world)) {
|
|
||||||
return; // Do not alert if location is ignored
|
|
||||||
}
|
|
||||||
// Send an event for external hooks
|
|
||||||
GriefAlertEvent griefalert_event;
|
|
||||||
if (MAP_LINK != null && !MAP_LINK.isEmpty() && mapLink != null) {
|
|
||||||
griefalert_event = new GriefAlertEvent(message + " (" + mapLink + ")");
|
|
||||||
} else {
|
|
||||||
griefalert_event = new GriefAlertEvent(message);
|
|
||||||
}
|
|
||||||
getServer().getPluginManager().callEvent(griefalert_event);
|
|
||||||
// Notify staff ingame
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
if (player.hasPermission("griefalert.notify")) {
|
|
||||||
player.sendMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lastAlert = realAlertMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
//pet alert(dog and cat only)
|
//pet alert(dog and cat only)
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPetKill(EntityDeathEvent event) {
|
public void onPetKill(EntityDeathEvent event) {
|
||||||
@@ -666,7 +689,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//farm animal handler
|
// Mob killing alerts
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onFarmAnimalDeath(EntityDeathEvent event) {
|
public void onFarmAnimalDeath(EntityDeathEvent event) {
|
||||||
if (!(event.getEntity().getKiller() instanceof Player killer)) return;
|
if (!(event.getEntity().getKiller() instanceof Player killer)) return;
|
||||||
@@ -702,6 +725,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
and its waxed, ill assume ur unwaxing, and therefor sending an alert
|
and its waxed, ill assume ur unwaxing, and therefor sending an alert
|
||||||
but some of this code was written at 1am so idk how and why im why and howing */
|
but some of this code was written at 1am so idk how and why im why and howing */
|
||||||
|
|
||||||
|
// Waxing/unwaxing alerts
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockClick(PlayerInteractEvent event) {
|
public void onBlockClick(PlayerInteractEvent event) {
|
||||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||||
@@ -764,7 +788,7 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
}, 1L);
|
}, 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
//stripping logs
|
// Log stripping alerts
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onLogStrip(PlayerInteractEvent event) {
|
public void onLogStrip(PlayerInteractEvent event) {
|
||||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
|
||||||
@@ -815,6 +839,10 @@ public class GriefAlert extends JavaPlugin implements Listener {
|
|||||||
}, 1L);
|
}, 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
CoreProtect API
|
||||||
|
*/
|
||||||
|
|
||||||
private CoreProtectAPI getCoreProtect() {
|
private CoreProtectAPI getCoreProtect() {
|
||||||
Plugin plugin = getServer().getPluginManager().getPlugin("CoreProtect");
|
Plugin plugin = getServer().getPluginManager().getPlugin("CoreProtect");
|
||||||
|
|
||||||
68
src/main/java/net/ardakaz/griefalert/Migrations.java
Normal file
68
src/main/java/net/ardakaz/griefalert/Migrations.java
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
package net.ardakaz.griefalert;
|
||||||
|
|
||||||
|
public class Migrations {
|
||||||
|
|
||||||
|
public static final String CREATE_TABLE_IGNORED_LOCATIONS =
|
||||||
|
"CREATE TABLE IF NOT EXISTS ignored_locations (" +
|
||||||
|
"x INTEGER, " +
|
||||||
|
"y INTEGER, " +
|
||||||
|
"z INTEGER, " +
|
||||||
|
"world TEXT, " +
|
||||||
|
"PRIMARY KEY (x, y, z, world)" +
|
||||||
|
")";
|
||||||
|
|
||||||
|
public static final String CREATE_TABLE_PLAYERS =
|
||||||
|
"CREATE TABLE IF NOT EXISTS players (" +
|
||||||
|
"id TEXT PRIMARY KEY, " +
|
||||||
|
"names TEXT NOT NULL, " +
|
||||||
|
"playtime INTEGER NOT NULL DEFAULT 0, " +
|
||||||
|
"firstseen INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
|
||||||
|
"lastseen INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP" +
|
||||||
|
")";
|
||||||
|
|
||||||
|
public static final String CREATE_TABLE_ACTIONS =
|
||||||
|
"CREATE TABLE IF NOT EXISTS actions (" +
|
||||||
|
"id INTEGER PRIMARY KEY, " +
|
||||||
|
"player TEXT NOT NULL, " +
|
||||||
|
"type TEXT NOT NULL, " +
|
||||||
|
"moderator TEXT NOT NULL, " +
|
||||||
|
"reason TEXT, " +
|
||||||
|
"time TEXT, " +
|
||||||
|
"timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
|
||||||
|
"FOREIGN KEY(player) REFERENCES players(id)" +
|
||||||
|
")";
|
||||||
|
|
||||||
|
public static final String CREATE_TABLE_ALERTS =
|
||||||
|
"CREATE TABLE IF NOT EXISTS alerts (" +
|
||||||
|
"id INTEGER PRIMARY KEY, " +
|
||||||
|
"player TEXT NOT NULL, " +
|
||||||
|
"action TEXT NOT NULL, " +
|
||||||
|
"target TEXT NOT NULL, " +
|
||||||
|
"target_amount INTEGER, " +
|
||||||
|
"target_player TEXT NOT NULL, " +
|
||||||
|
"x INTEGER NOT NULL, " +
|
||||||
|
"y INTEGER NOT NULL, " +
|
||||||
|
"z INTEGER NOT NULL, " +
|
||||||
|
"world TEXT NOT NULL, " +
|
||||||
|
"is_flagged INTEGER, " +
|
||||||
|
"flag_text TEXT, " +
|
||||||
|
"resolved_by TEXT, " +
|
||||||
|
"state TEXT NOT NULL DEFAULT 'UNRESOLVED', " +
|
||||||
|
"timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
|
||||||
|
"FOREIGN KEY(player) REFERENCES players(id)" +
|
||||||
|
")";
|
||||||
|
|
||||||
|
public static final String CREATE_TABLE_REPORTS =
|
||||||
|
"CREATE TABLE IF NOT EXISTS reports (" +
|
||||||
|
"id INTEGER PRIMARY KEY, " +
|
||||||
|
"player TEXT NOT NULL, " +
|
||||||
|
"x INTEGER NOT NULL, " +
|
||||||
|
"y INTEGER NOT NULL, " +
|
||||||
|
"z INTEGER NOT NULL, " +
|
||||||
|
"world TEXT NOT NULL, " +
|
||||||
|
"text TEXT NOT NULL, " +
|
||||||
|
"resolved_by TEXT, " +
|
||||||
|
"timestamp INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP, " +
|
||||||
|
"state TEXT NOT NULL DEFAULT 'UNRESOLVED'" +
|
||||||
|
")";
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
# Ignore all stealing?
|
# Ignore all stealing?
|
||||||
allow-stealing: false
|
allow-stealing: false
|
||||||
|
|
||||||
|
jdbc-url: "./plugins/GriefAlert/database.db"
|
||||||
|
|
||||||
# Breaking these blocks don't cause alerts. (Material)
|
# Breaking these blocks don't cause alerts. (Material)
|
||||||
excluded-blocks:
|
excluded-blocks:
|
||||||
- WHEAT
|
- WHEAT
|
||||||
12
src/test/java/net/ardakaz/griefalert/GriefAlertTest.java
Normal file
12
src/test/java/net/ardakaz/griefalert/GriefAlertTest.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package net.ardakaz.griefalert;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
class GriefAlertTest {
|
||||||
|
@Test
|
||||||
|
public void placeholderTest() {
|
||||||
|
assertTrue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user