Added lots o commands

This commit is contained in:
TheTrouper
2024-03-28 15:57:36 -05:00
commit c3bce35dc4
37 changed files with 1581 additions and 0 deletions

42
.gitignore vendored Normal file
View File

@@ -0,0 +1,42 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

3
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

7
.idea/discord.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
</project>

17
.idea/gradle.xml generated Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

15
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,15 @@
<project version="4">
<component name="ASMSmaliIdeaPluginConfiguration">
<asm skipDebug="true" skipFrames="true" skipCode="false" expandFrames="false" />
<groovy codeStyle="LEGACY" />
</component>
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
</list>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

124
.idea/uiDesigner.xml generated Normal file
View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

76
build.gradle Normal file
View File

@@ -0,0 +1,76 @@
plugins {
id 'java'
}
group = project.group
version = project.version
jar {
from {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
repositories {
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
url = uri("https://repo.papermc.io/repository/maven-public/")
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
compileOnly 'io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT'
implementation 'com.google.code.gson:gson:2.10.1'
implementation files("libs/PDK-1.3.4.jar")
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
toolchain.languageVersion.set(JavaLanguageVersion.of(17))
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
tasks.register('copyDeps', Copy) {
from configurations.runtimeClasspath
into 'build/deps'
include '*.jar'
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
compileJava.options.encoding("UTF-8")
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}

8
gradle.properties Normal file
View File

@@ -0,0 +1,8 @@
# Plugin
group = 'me.trouper'
version = 0.0.1
# Minecraft
mc_version = 1.20.4

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#Fri Mar 22 10:18:19 CDT 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

234
gradlew vendored Normal file
View File

@@ -0,0 +1,234 @@
#!/bin/sh
#
# Copyright © 2015-2021 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.
#
##############################################################################
#
# 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/master/subprojects/plugins/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
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# 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"'
# 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
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# 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
which java >/dev/null 2>&1 || 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
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
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" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
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
# 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.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# 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" "$@"

89
gradlew.bat vendored Normal file
View File

@@ -0,0 +1,89 @@
@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
@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=.
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%" == "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.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
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.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="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!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

BIN
libs/PDK-1.3.4.jar Normal file

Binary file not shown.

2
settings.gradle Normal file
View File

@@ -0,0 +1,2 @@
rootProject.name = 'UltraUtils'

View File

@@ -0,0 +1,85 @@
package functions;
import me.trouper.ultrautils.UltraUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Text {
public static String regexHighlighter(String input, String regex, String startString, String endString) {
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(input);
StringBuffer result = new StringBuffer();
while (matcher.find()) {
matcher.appendReplacement(result, startString + matcher.group() + endString);
}
matcher.appendTail(result);
return result.toString();
}
public static final char SECTION_SYMBOL = (char)167;
public static String color(String msg) {
return msg.replace('&', SECTION_SYMBOL);
}
public static String prefix(String text) {
String prefix = UltraUtils.config.prefix;
return color(prefix + text);
}
public static String removeFirstColor(String input) {
if (input.startsWith("\u00a7")) {
if (input.length() > 2) {
return input.substring(2);
} else {
return "";
}
} else {
return input;
}
}
public static String replaceRepeatingLetters(String input) {
if (input == null || input.isEmpty()) {
return input;
}
StringBuilder simplifiedText = new StringBuilder();
char currentChar = input.charAt(0);
int count = 1;
for (int i = 1; i < input.length(); i++) {
char nextChar = input.charAt(i);
if (Character.toLowerCase(nextChar) == Character.toLowerCase(currentChar)) {
count++;
} else {
simplifiedText.append(currentChar);
if (count > 1) {
simplifiedText.append(currentChar);
}
currentChar = nextChar;
count = 1;
}
}
simplifiedText.append(currentChar);
if (count > 1) {
simplifiedText.append(currentChar);
}
return simplifiedText.toString();
}
public static String cleanName(String type) {
return type.replaceAll("_"," ").toLowerCase();
}
}

View File

@@ -0,0 +1,95 @@
package me.trouper.ultrautils;
import io.github.itzispyder.pdk.PDK;
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
import me.trouper.ultrautils.commands.UltraUtilsCommand;
import me.trouper.ultrautils.commands.gamemode.*;
import me.trouper.ultrautils.commands.mobility.FlyCommand;
import me.trouper.ultrautils.commands.mobility.SpeedCommand;
import me.trouper.ultrautils.commands.workstations.*;
import me.trouper.ultrautils.data.config.Config;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.util.logging.Logger;
public final class UltraUtils extends JavaPlugin {
private static UltraUtils instance;
private static final File configFile = new File("plugins/UltraUtils/main-config.json");
public static Config config = JsonSerializable.load(configFile, Config.class, new Config());
public static final Logger log = Bukkit.getLogger();
/**
* Plugin startup logic
*/
@Override
public void onEnable() {
log.info("\n]======------ Pre-load started ------======[");
PDK.init(this);
instance = this;
loadConfig();
startup();
}
public void startup() {
log.info("\n]======----- Loading UltraUtils-----======[");
// Plugin startup logic
log.info("Starting Up! (%s)...".formatted(getDescription().getVersion()));
new UltraUtilsCommand().register();
new GamemodeCommand().register();
new GMACommand().register();
new GMCCommand().register();
new GMSPCommand().register();
new GMSCommand().register();
new AnvilCommand().register();
new CartographyCommand().register();
new CraftingCommand().register();
new GrindstoneCommand().register();
new LoomCommand().register();
new SmithingCommand().register();
new StonecutterCommand().register();
new FlyCommand().register();
new SpeedCommand().register();
// Events
log.info("""
Finished!
UltraUtils has loaded.
""");
}
public void loadConfig() {
log.info("Loading Config...");
// Init
config = JsonSerializable.load(configFile, Config.class,new Config());
// Save
config.save();
}
/**
* Plugin shutdown logic
*/
@Override
public void onDisable() {
// Plugin shutdown logic
log.info("UltraUtils has disabled! (%s)".formatted(getDescription().getVersion()));
}
public static UltraUtils getInstance() {
return instance;
}
}

View File

@@ -0,0 +1,37 @@
package me.trouper.ultrautils.commands;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import me.trouper.ultrautils.UltraUtils;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandRegistry(value = "ultrautils", permission = @Permission("ultrautils.admin"), printStackTrace = true)
public class UltraUtilsCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender sender, Args args) {
Player p = (Player) sender;
switch (args.get(0).toString()) {
case "toggle" -> {
switch (args.get(1).toString()) {
case "debug" -> {
UltraUtils.config.debugMode = !UltraUtils.config.debugMode;
UltraUtils.config.save();
}
}
}
}
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
b.then(b.arg("toggle")
.then(b.arg("debug"))
);
}
}

View File

@@ -0,0 +1,44 @@
package me.trouper.ultrautils.commands.gamemode;
import functions.Text;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import io.github.itzispyder.pdk.utils.ServerUtils;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
@CommandRegistry(value = "gma",permission = @Permission("ultrautils.gamemode.adventure"))
public class GMACommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender commandSender, Args args) {
Player target = Bukkit.getPlayer(args.get(0).toString());
if (target == null && (commandSender instanceof Player)) target = (Player) commandSender;
if (target == null) {
commandSender.sendMessage(Text.prefix("Only players may execute that command"));
return;
}
if (!commandSender.hasPermission("ultrautils.gamemode")) {
commandSender.sendMessage(Text.prefix("You do not have the root permission to change gamemode."));
return;
}
GamemodeCommand.setGameMode(commandSender,target,GameMode.ADVENTURE,"ultrautils.gamemode.adventure");
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
List<String> players = new ArrayList<>();
for (Player player : ServerUtils.players()) {
players.add(player.getName());
}
b.then(b.arg(players));
}
}

View File

@@ -0,0 +1,43 @@
package me.trouper.ultrautils.commands.gamemode;
import functions.Text;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import io.github.itzispyder.pdk.utils.ServerUtils;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
@CommandRegistry(value = "gmc",permission = @Permission("ultrautils.gamemode.creative"))
public class GMCCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender commandSender, Args args) {
Player target = Bukkit.getPlayer(args.get(0).toString());
if (target == null && (commandSender instanceof Player)) target = (Player) commandSender;
if (target == null) {
commandSender.sendMessage(Text.prefix("Only players may execute that command"));
return;
}
if (!commandSender.hasPermission("ultrautils.gamemode")) {
commandSender.sendMessage(Text.prefix("You do not have the root permission to change gamemode."));
return;
}
GamemodeCommand.setGameMode(commandSender,target,GameMode.CREATIVE,"ultrautils.gamemode.creative");}
@Override
public void dispatchCompletions(CompletionBuilder b) {
List<String> players = new ArrayList<>();
for (Player player : ServerUtils.players()) {
players.add(player.getName());
}
b.then(b.arg(players));
}
}

View File

@@ -0,0 +1,43 @@
package me.trouper.ultrautils.commands.gamemode;
import functions.Text;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import io.github.itzispyder.pdk.utils.ServerUtils;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
@CommandRegistry(value = "gms",permission = @Permission("ultrautils.gamemode.survival"))
public class GMSCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender commandSender, Args args) {
Player target = Bukkit.getPlayer(args.get(0).toString());
if (target == null && (commandSender instanceof Player)) target = (Player) commandSender;
if (target == null) {
commandSender.sendMessage(Text.prefix("Only players may execute that command"));
return;
}
if (!commandSender.hasPermission("ultrautils.gamemode")) {
commandSender.sendMessage(Text.prefix("You do not have the root permission to change gamemode."));
return;
}
GamemodeCommand.setGameMode(commandSender,target,GameMode.SURVIVAL,"ultrautils.gamemode.survival");}
@Override
public void dispatchCompletions(CompletionBuilder b) {
List<String> players = new ArrayList<>();
for (Player player : ServerUtils.players()) {
players.add(player.getName());
}
b.then(b.arg(players));
}
}

View File

@@ -0,0 +1,44 @@
package me.trouper.ultrautils.commands.gamemode;
import functions.Text;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import io.github.itzispyder.pdk.utils.ServerUtils;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
@CommandRegistry(value = "gmc",permission = @Permission("ultrautils.gamemode.spectator"))
public class GMSPCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender commandSender, Args args) {
Player target = Bukkit.getPlayer(args.get(0).toString());
if (target == null && (commandSender instanceof Player)) target = (Player) commandSender;
if (target == null) {
commandSender.sendMessage(Text.prefix("Only players may execute that command"));
return;
}
if (!commandSender.hasPermission("ultrautils.gamemode")) {
commandSender.sendMessage(Text.prefix("You do not have the root permission to change gamemode."));
return;
}
GamemodeCommand.setGameMode(commandSender,target,GameMode.SPECTATOR,"ultrautils.gamemode.spectator");
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
List<String> players = new ArrayList<>();
for (Player player : ServerUtils.players()) {
players.add(player.getName());
}
b.then(b.arg(players));
}
}

View File

@@ -0,0 +1,72 @@
package me.trouper.ultrautils.commands.gamemode;
import functions.Text;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import io.github.itzispyder.pdk.utils.ServerUtils;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
@CommandRegistry(value = "gamemode", permission = @Permission("ultrautils.gamemode"))
public class GamemodeCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender sender, Args args) {
Player target = Bukkit.getPlayer(args.get(1).toString());
if (target == null && (sender instanceof Player)) target = (Player) sender;
if (target == null) {
sender.sendMessage(Text.prefix("Only players may execute that command"));
return;
}
switch (args.get(0).toString()) {
case "a","adventure","adv","gma" -> setGameMode(sender,target,GameMode.ADVENTURE, "ultrautils.gamemode.adventure");
case "c","creative","cre","gmc" -> setGameMode(sender,target,GameMode.CREATIVE,"ultrautils.gamemode.creative");
case "s","survival","sur","gms" -> setGameMode(sender,target,GameMode.SURVIVAL,"ultrautils.gamemode.survival");
case "sp","spectator","spec","gmsp" -> setGameMode(sender,target,GameMode.SPECTATOR,"ultrautils.gamemode.spectator");
}
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
List<String> players = new ArrayList<>();
for (Player player : ServerUtils.players()) {
players.add(player.getName());
}
b.then(b.arg("adventure","creative","survival","spectator")
.then(b.arg(players))
);
}
public static void setGameMode(CommandSender user, @Nullable Player target, GameMode gm, String permission) {
if (!user.hasPermission(permission)) {
user.sendMessage(Text.prefix("You lack the permission to swith gamemodes to %c%s&7."));
return;
}
if (target == null && user instanceof Player) target = (Player) user;
if (target == null) {
user.sendMessage(Text.prefix("Only players can execute self-effecting commands."));
return;
}
if (user.equals(target)) {
target.setGameMode(gm);
user.sendMessage(Text.prefix("Set your gamemode to &a%s&7.".formatted(target.getGameMode().toString().toLowerCase())));
} else if (user.hasPermission("ultrautils.gamemode.others")) {
target.setGameMode(gm);
user.sendMessage(Text.prefix("Set the gamemode of &e%s&7 to &a%s&7.".formatted(target.getName(),target.getGameMode().toString().toLowerCase())));
target.sendMessage(Text.prefix("Your gamemode has been set to &a%s&7.".formatted(target.getGameMode().toString().toLowerCase())));
} else {
user.sendMessage(Text.prefix("You lack the permission to set other player's gamemode."));
}
}
}

View File

@@ -0,0 +1,51 @@
package me.trouper.ultrautils.commands.mobility;
import functions.Text;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import io.github.itzispyder.pdk.utils.ServerUtils;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
@CommandRegistry(value = "fly", permission = @Permission("ultrautils.flight"))
public class FlyCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender sender, Args args) {
Player user = (Player) sender;
Player target = Bukkit.getPlayer(args.get(1).toString());
if (target == null && (sender instanceof Player)) target = (Player) sender;
if (target == null) {
sender.sendMessage(Text.prefix("Only players may execute that command"));
return;
}
boolean current = target.getAllowFlight();
if (user.equals(target)) {
target.setAllowFlight(!current);
sender.sendMessage(Text.prefix("Flight &a%s&7.".formatted(!current ? "&aenabled" : "&cdisabled")));
} else if (sender.hasPermission("ultrautils.flight.others")) {
target.setAllowFlight(!current);
sender.sendMessage(Text.prefix("&a%s&7 the flight of &e%s&7.".formatted(!current ? "&aenabled" : "&cdisabled",target.getName())));
target.sendMessage(Text.prefix("Your flight has been &a%s&7.".formatted(!current ? "&aenabled" : "&cdisabled")));
} else {
sender.sendMessage(Text.prefix("You lack the permission to set other player's flight status."));
}
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
List<String> players = new ArrayList<>();
for (Player player : ServerUtils.players()) {
players.add(player.getName());
}
b.then(b.arg(players));
}
}

View File

@@ -0,0 +1,96 @@
package me.trouper.ultrautils.commands.mobility;
import functions.Text;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import io.github.itzispyder.pdk.utils.ServerUtils;
import me.trouper.ultrautils.UltraUtils;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
@CommandRegistry(value = "speed", permission = @Permission("ultrautils.speed"))
public class SpeedCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender sender, Args args) {
String type = args.get(1).toString();
float speed = args.get(0).toFloat();
Player user = (Player) sender;
Player target = Bukkit.getPlayer(args.get(2).toString());
if (target == null && (sender instanceof Player)) target = (Player) sender;
if (target == null) {
sender.sendMessage(Text.prefix("Only players may execute that command"));
return;
}
switch (type) {
case "walk" -> {
setWalkSpeed(sender,user,target,speed);
}
case "flight" -> {
setFlySpeed(sender,user,target,speed);
}
default -> {
if (target.isFlying()) {
setFlySpeed(sender,user,target,speed);
return;
}
setWalkSpeed(sender,user,target,speed);
}
}
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
List<String> players = new ArrayList<>();
for (Player player : ServerUtils.players()) {
players.add(player.getName());
}
b.then(b.arg("[<int>]")
.then(b.arg("walk","flight")
.then(b.arg(players))
)
);
}
public static void setFlySpeed(CommandSender sender, Player user, Player target, float speed) {
if (!user.hasPermission("ultrautils.speed.flight")) {
sender.sendMessage("You lack the permission to set walk speed.");
return;
}
if (user.equals(target)) {
target.setFlySpeed(speed);
user.sendMessage(Text.prefix("Set your flight speed to &a%s&7.".formatted(speed)));
} else if (user.hasPermission("ultrautils.speed.fly.others")) {
target.setFlySpeed(speed);
user.sendMessage(Text.prefix("Set the flight speed of &e%s&7 to &a%s&7.".formatted(target.getName(),speed)));
target.sendMessage(Text.prefix("Your flight speed has been set to &a%s&7.".formatted(speed)));
} else {
user.sendMessage(Text.prefix("You lack the permission to set other player's flight speed."));
}
}
public static void setWalkSpeed(CommandSender sender, Player user, Player target, float speed) {
if (!user.hasPermission("ultrautils.speed.walk")) {
sender.sendMessage("You lack the permission to set walk speed.");
return;
}
if (user.equals(target)) {
target.setWalkSpeed(speed);
user.sendMessage(Text.prefix("Set your walk speed to &a%s&7.".formatted(speed)));
} else if (user.hasPermission("ultrautils.speed.walk.others")) {
target.setWalkSpeed(speed);
user.sendMessage(Text.prefix("Set the walk speed of &e%s&7 to &a%s&7.".formatted(target.getName(),speed)));
target.sendMessage(Text.prefix("Your walk speed has been set to &a%s&7.".formatted(speed)));
} else {
user.sendMessage(Text.prefix("You lack the permission to set other player's walk speed."));
}
}
}

View File

@@ -0,0 +1,23 @@
package me.trouper.ultrautils.commands.workstations;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandRegistry(value = "anvil", permission = @Permission("ultrautils.anvil"),playersOnly = true)
public class AnvilCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender sender, Args args) {
Player p = (Player) sender;
p.openAnvil(p.getLocation(),true);
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
}
}

View File

@@ -0,0 +1,23 @@
package me.trouper.ultrautils.commands.workstations;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandRegistry(value = "cartography", permission = @Permission("ultrautils.cartography"),playersOnly = true)
public class CartographyCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender sender, Args args) {
Player p = (Player) sender;
p.openCartographyTable(p.getLocation(),true);
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
}
}

View File

@@ -0,0 +1,23 @@
package me.trouper.ultrautils.commands.workstations;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandRegistry(value = "craft", permission = @Permission("ultrautils.craft"),playersOnly = true)
public class CraftingCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender sender, Args args) {
Player p = (Player) sender;
p.openWorkbench(p.getLocation(),true);
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
}
}

View File

@@ -0,0 +1,23 @@
package me.trouper.ultrautils.commands.workstations;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandRegistry(value = "grindstone", permission = @Permission("ultrautils.grind"),playersOnly = true)
public class GrindstoneCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender sender, Args args) {
Player p = (Player) sender;
p.openGrindstone(p.getLocation(),true);
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
}
}

View File

@@ -0,0 +1,23 @@
package me.trouper.ultrautils.commands.workstations;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandRegistry(value = "smith", permission = @Permission("ultrautils.smith"),playersOnly = true)
public class LoomCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender sender, Args args) {
Player p = (Player) sender;
p.openLoom(p.getLocation(),true);
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
}
}

View File

@@ -0,0 +1,23 @@
package me.trouper.ultrautils.commands.workstations;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandRegistry(value = "smith", permission = @Permission("ultrautils.smith"),playersOnly = true)
public class SmithingCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender sender, Args args) {
Player p = (Player) sender;
p.openSmithingTable(p.getLocation(),true);
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
}
}

View File

@@ -0,0 +1,23 @@
package me.trouper.ultrautils.commands.workstations;
import io.github.itzispyder.pdk.commands.Args;
import io.github.itzispyder.pdk.commands.CommandRegistry;
import io.github.itzispyder.pdk.commands.CustomCommand;
import io.github.itzispyder.pdk.commands.Permission;
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandRegistry(value = "stonecutter", permission = @Permission("ultrautils.stonecut"),playersOnly = true)
public class StonecutterCommand implements CustomCommand {
@Override
public void dispatchCommand(CommandSender sender, Args args) {
Player p = (Player) sender;
p.openStonecutter(p.getLocation(),true);
}
@Override
public void dispatchCompletions(CompletionBuilder b) {
}
}

View File

@@ -0,0 +1,4 @@
package me.trouper.ultrautils.data;
public class Items {
}

View File

@@ -0,0 +1,4 @@
package me.trouper.ultrautils.data;
public class Storage {
}

View File

@@ -0,0 +1,24 @@
package me.trouper.ultrautils.data.config;
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
import java.io.File;
public class Config implements JsonSerializable<Config> {
@Override
public File getFile() {
File file = new File("plugins/UltraUtils/main-config.json");
file.getParentFile().mkdirs();
return file;
}
public String prefix = "&9UltraCore> &7";
public boolean debugMode = false;
public Plugin plugin = new Plugin();
public class Plugin {
public String joinMessage = "&8[&2+&8] &a%s&7 has joined.";
public String leaveMessage = "&8[&4-&8] &c%s&7 has left.";
}
}

View File

@@ -0,0 +1,31 @@
package me.trouper.ultrautils.events;
import functions.Text;
import io.github.itzispyder.pdk.events.CustomListener;
import me.trouper.ultrautils.UltraUtils;
import me.trouper.ultrautils.data.config.Config;
import net.kyori.adventure.text.Component;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
public class JoinLeaveEvent implements CustomListener {
@EventHandler
public void onJoin(PlayerJoinEvent e) {
if (UltraUtils.config.plugin.joinMessage.isBlank()) {
e.joinMessage(null);
return;
}
e.joinMessage(Component.text(Text.color(UltraUtils.config.plugin.joinMessage)));
}
@EventHandler
public void onLeave(PlayerQuitEvent e) {
if (UltraUtils.config.plugin.leaveMessage.isBlank()) {
e.quitMessage(null);
return;
}
e.quitMessage(Component.text(Text.color(UltraUtils.config.plugin.leaveMessage)));
}
}

View File

@@ -0,0 +1,118 @@
name: UltraUtils
version: '${version}'
main: me.trouper.ultrautils.UltraUtils
api-version: 1.19
authors: [ obvWolf ]
description: A Utility plugin for server management and moderation.
website: https://trouper.me/
permissions:
ultrautils.admin:
default: op
description: Access to the admin command
ultrautils.gamemode:
default: op
description: This permission is required to use ANY gamemode commands. It does not give permission to switch to any gamemodes.
ultrautils.gamemode.adventure:
default: op
description: Allows changing gamemode to adventure
ultrautils.gamemode.creative:
default: op
description: Allows changing gamemode to creative
ultrautils.gamemode.survival:
default: op
description: Allows changing gamemode to survival
ultrautils.gamemode.spectator:
default: op
description: Allows changing gamemode to spectator
ultrautils.gamemode.others:
default: op
description: Allows setting the gamemode of other players
ultrautils.craft:
default: op
description: Access to the portable crafting table
ultrautils.anvil:
default: op
description: Access to the portable anvil
ultrautils.cartography:
default: op
description: Access to the portable cartography table
ultrautils.grindstone:
default: op
description: Access to the portable grindstone
ultrautils.loom:
default: op
description: Access to the portable loom
ultrautils.smithing:
default: op
description: Access to the portable smithing table
ultrautils.stonecutter:
default: op
description: Access to the portable stonecutter
ultrautils.flight:
default: op
description: Enable or disable flight (only the sender)
ultrautils.flight.others:
defualt: op
description: Enable or disable flight for specific players
commands:
ultrautils:
description: Admin command for admin things
usage: /ultrautils
permission: ultrautils.admin
aliases:
- uu
gma:
description: Change gamemode to adventure
permission: ultrautils.gamemode.adventure
usage: /gma [<player>]
gmc:
description: Change gamemode to creative
permission: ultrautils.gamemode.creative
usage: /gmc [<player>]
gms:
description: Change gamemode to survival
permission: ultrautils.gamemode.survival
usage: /gms [<player>]
gmsp:
description: Change gamemode to spectator
permission: ultrautils.gamemode.spectator
usage: /gmsp [<player>]
gamemode:
description: Root gamemode changing command. Required for all the other gamemode commands.
permission: ultrautils.gamemode
usage: /gamemode <gamemode> [<player>]
anvil:
permission: ultrautils.anvil
description: a portable anvil
cartography:
permission: ultrautils.cartography
description: a portable cartography table
aliases:
- mapstation
craft:
permission: ultrautils.craft
description: a portable crafting table
aliases:
- workbench
grindstone:
permission: ultrautils.grindstone
description: a portable grindstone
loom:
permission: ultrautils.loom
description: a portable loom
smithingtable:
description: a portable smithing table
permission: ultrautils.smithing
aliases:
- upgradetable
stonecutter:
description: a portable stonecutter
permission: ultrautils.stonecutter
fly:
description: Toggle flight status
permission: ultrautils.flight
usage: /fly [<player>]
aliases:
- flight