Maintenance Update (#6)

* Update to gradle 8.7, change API access scheme

* Fix API import scheme

* Update Kotlin API
This commit is contained in:
NotAlexNoyle authored and GitHub committed 2024-04-29 08:05:58 -04:00
1 parent c1c6c4ac33
commit 22e35ff81a
18 files changed
+203 -189

No files matched your search

+51 -30
View File
@@ -1,11 +1,41 @@
plugins {
id 'java'
id 'maven-publish'
id("com.github.johnrengelman.shadow") version "7.1.2"
id 'java' // Tell gradle this is a java project.
id 'com.github.johnrengelman.shadow' version '8.1.1' // Import utility to package libraries into .jar file.
id 'eclipse' // Import eclipse plugin for IDE integration.
id 'org.jetbrains.kotlin.jvm' version '1.9.23' // Import kotlin jvm plugin for kotlin/java integration.
}
java {
// Declare java version.
sourceCompatibility = JavaVersion.VERSION_17
}
group = 'me.barny1094875'
version = '2.1'
version = '2.1.1'
def apiVersion = "1.19" // Declare minecraft server target version.
processResources {
def props = [
version: version,
apiVersion: apiVersion,
]
inputs.properties props // Indicates to rerun if version changes.
filesMatching("plugin.yml") {
expand props
}
}
repositories {
@@ -36,45 +66,36 @@ repositories {
dependencies {
compileOnly "org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT" // Declare purpur API version to be packaged.
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.8'
compileOnly("de.tr7zw:item-nbt-api-plugin:2.11.2")
implementation "net.kyori:adventure-text-minimessage:4.13.1"
compileOnly "com.sk89q.worldguard:worldguard-bukkit:7.0.8"
compileOnly 'de.tr7zw:item-nbt-api-plugin:2.11.2'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' // Declare kotlin library to be packaged.
}
shadowJar {
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
minimize()
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'me.barny1094875'
artifactId = 'utilities-og'
version = '1.3.2'
from components.java
}
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs += ["-parameters"]
options.encoding = 'UTF-8' // Override the system character set with a universal set.
options.fork = true // Enable compilation in a separate daemon process.
}
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+92 -92
View File
@@ -1,92 +1,92 @@
@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=.
@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.
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% 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
@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=.
@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.
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% 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
-7
View File
@@ -1,7 +0,0 @@
jdk:
- 17.0.8
before_install:
- sdk install java 17.0.8-graalce
- sdk use java 17.0.8-graalce
install:
- ./gradlew build publishToMavenLocal
@@ -8,7 +8,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
// Import required libraries.
import me.barny1094875.utilitiesog.Utilities_OG;
import me.barny1094875.utilitiesog.UtilitiesOG;
public class DisableEntityCramming implements Listener {
@@ -20,7 +20,7 @@ public class DisableEntityCramming implements Listener {
if(event.getCause().equals(DamageCause.CRAMMING)) {
// If disabling entity cramming is set to "true" in config.yml, do this...
if(Utilities_OG.config().getBoolean("disableEntityCramming")) {
if(UtilitiesOG.config().getBoolean("disableEntityCramming")) {
event.setCancelled(true);
@@ -2,7 +2,7 @@
// Authors: christianniehaus, NotAlexNoyle.
package me.barny1094875.utilitiesog.Listeners;
import me.barny1094875.utilitiesog.Utilities_OG;
import me.barny1094875.utilitiesog.UtilitiesOG;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.EntityType;
@@ -19,7 +19,7 @@ public class DisablePhantomSpawns implements Listener {
// If the mob that spawned is a phantom, do this...
if (event.getEntityType().equals(EntityType.PHANTOM)) {
// Store the contents of phantomDisabledUsers.yml file as a YAML object.
YamlConfiguration phantomsAreDisabled = Utilities_OG.getPhantomPreferences();
YamlConfiguration phantomsAreDisabled = UtilitiesOG.getPhantomPreferences();
// get every player currently on the server in the world that the phantom spawned
for (Player player : Bukkit.getServer().getOnlinePlayers()
.stream()
@@ -19,10 +19,10 @@ import org.bukkit.scheduler.BukkitTask;
import java.io.File;
import java.io.IOException;
public final class Utilities_OG extends JavaPlugin {
public final class UtilitiesOG extends JavaPlugin {
private File file;
private static Utilities_OG plugin;
private static UtilitiesOG plugin;
private static final MiniMessage mm = MiniMessage.miniMessage();
private static FileConfiguration config;
private static File phantomPreferencesFile;
@@ -155,7 +155,7 @@ public final class Utilities_OG extends JavaPlugin {
return new PingModule();
}
public static Utilities_OG getPlugin() {
public static UtilitiesOG getPlugin() {
return plugin;
}
@@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import me.barny1094875.utilitiesog.Utilities_OG;
import me.barny1094875.utilitiesog.UtilitiesOG;
import net.kyori.adventure.text.Component;
public class AboutModule implements CommandExecutor
@@ -23,7 +23,7 @@ public class AboutModule implements CommandExecutor
Player player = (Player) sender;
// Send formatted about message using MiniMessage API.
Component parsed = Utilities_OG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#FFAA00>A collection of small utilities used by <#00AA00>True<#AA0000>OG<#FFAA00> <#FFFF55>Network<#FFAA00>. Developed by <#FFFF55>christianniehaus <#FFAA00>& <#FFFF55>NotAlexNoyle<#FFAA00>.");
Component parsed = UtilitiesOG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#FFAA00>A collection of small utilities used by <#00AA00>True<#AA0000>OG<#FFAA00> <#FFFF55>Network<#FFAA00>. Developed by <#FFFF55>christianniehaus <#FFAA00>& <#FFFF55>NotAlexNoyle<#FFAA00>.");
player.sendMessage(parsed);
}
else
@@ -1,6 +1,6 @@
package me.barny1094875.utilitiesog.modules;
import me.barny1094875.utilitiesog.Utilities_OG;
import me.barny1094875.utilitiesog.UtilitiesOG;
import net.kyori.adventure.text.format.TextDecoration;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@@ -15,9 +15,9 @@ public class BambooWood {
public static void Enable() {
ItemStack bambooWood = new ItemStack(Material.OAK_PLANKS);
ItemMeta bambooWoodMeta = bambooWood.getItemMeta();
bambooWoodMeta.displayName(Utilities_OG.getMM().deserialize("Bamboo Wood").decoration(TextDecoration.ITALIC, false));
bambooWoodMeta.displayName(UtilitiesOG.getMM().deserialize("Bamboo Wood").decoration(TextDecoration.ITALIC, false));
bambooWood.setItemMeta(bambooWoodMeta);
ShapedRecipe BambooWood = new ShapedRecipe(new NamespacedKey(Utilities_OG.getPlugin(), "Bamboo_Wood"),
ShapedRecipe BambooWood = new ShapedRecipe(new NamespacedKey(UtilitiesOG.getPlugin(), "Bamboo_Wood"),
bambooWood)
.shape("bb", "bb")
.setIngredient('b', Material.BAMBOO);
@@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import me.barny1094875.utilitiesog.Utilities_OG;
import me.barny1094875.utilitiesog.UtilitiesOG;
import net.kyori.adventure.text.Component;
// Initialize command manager class.
@@ -25,7 +25,7 @@ public class BingModule implements CommandExecutor
Player player = (Player) sender;
// Send player a connection confirmation message.
Component parsed = Utilities_OG.getMM().deserialize("<#FFFFFF> Bong!");
Component parsed = UtilitiesOG.getMM().deserialize("<#FFFFFF> Bong!");
player.sendMessage(parsed);
}
// Healthy exit status.
@@ -1,6 +1,6 @@
package me.barny1094875.utilitiesog.modules;
import me.barny1094875.utilitiesog.Utilities_OG;
import me.barny1094875.utilitiesog.UtilitiesOG;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
@@ -10,28 +10,28 @@ import org.bukkit.inventory.ShapedRecipe;
public class ChainArmour {
public static void Enable() {
ShapedRecipe ChainHelmet = new ShapedRecipe(new NamespacedKey(Utilities_OG.getPlugin(), "Chainmail_Helmet1"),
ShapedRecipe ChainHelmet = new ShapedRecipe(new NamespacedKey(UtilitiesOG.getPlugin(), "Chainmail_Helmet1"),
new ItemStack(Material.CHAINMAIL_HELMET))
.shape("ccc", "c c")
.setIngredient('c', Material.CHAIN);
Bukkit.addRecipe(ChainHelmet);
// recipe for chain chestplate
ShapedRecipe ChainChestPlate = new ShapedRecipe(new NamespacedKey(Utilities_OG.getPlugin(), "Chainmail_Chestplate"),
ShapedRecipe ChainChestPlate = new ShapedRecipe(new NamespacedKey(UtilitiesOG.getPlugin(), "Chainmail_Chestplate"),
new ItemStack(Material.CHAINMAIL_CHESTPLATE))
.shape("c c", "ccc", "ccc")
.setIngredient('c', Material.CHAIN);
Bukkit.addRecipe(ChainChestPlate);
// recipe for chain leggings
ShapedRecipe ChainLeggings = new ShapedRecipe(new NamespacedKey(Utilities_OG.getPlugin(), "Chainmail_Leggings"),
ShapedRecipe ChainLeggings = new ShapedRecipe(new NamespacedKey(UtilitiesOG.getPlugin(), "Chainmail_Leggings"),
new ItemStack(Material.CHAINMAIL_LEGGINGS))
.shape("ccc", "c c", "c c")
.setIngredient('c', Material.CHAIN);
Bukkit.addRecipe(ChainLeggings);
// recipe for chain boots
ShapedRecipe ChainBoots = new ShapedRecipe(new NamespacedKey(Utilities_OG.getPlugin(), "Chainmail_Boots1"),
ShapedRecipe ChainBoots = new ShapedRecipe(new NamespacedKey(UtilitiesOG.getPlugin(), "Chainmail_Boots1"),
new ItemStack(Material.CHAINMAIL_BOOTS))
.shape("c c", "c c")
.setIngredient('c', Material.CHAIN);
@@ -1,6 +1,6 @@
package me.barny1094875.utilitiesog.modules;
import me.barny1094875.utilitiesog.Utilities_OG;
import me.barny1094875.utilitiesog.UtilitiesOG;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@@ -30,18 +30,18 @@ public class ColorCodes implements CommandExecutor {
Player player = (Player) sender;
// Send the color code cheat sheet to the player.
player.sendMessage(Utilities_OG.getMM().deserialize("<dark_aqua><bold>-=-=-=-=- <dark_purple>C<dark_aqua>o<green>l<yellow>o<red>r <aqua>C<light_purple>o<white>d<light_purple>e<aqua>s: -=-=-=-=-"));
player.sendMessage(Utilities_OG.getMM().deserialize("&0 = <black>Black <reset> &1 = <dark_blue>Dark Blue"));
player.sendMessage(Utilities_OG.getMM().deserialize("&2 = <dark_green>Dark Green <reset> &3 = <dark_aqua>Dark Aqua"));
player.sendMessage(Utilities_OG.getMM().deserialize("&4 = <dark_red>Dark Red <reset> &5 = <dark_purple>Dark Purple"));
player.sendMessage(Utilities_OG.getMM().deserialize("&6 = <gold>Gold <reset> &7 = <gray>Grey"));
player.sendMessage(Utilities_OG.getMM().deserialize("&8 = <dark_gray>Dark Grey <reset> &9 = <blue>Blue"));
player.sendMessage(Utilities_OG.getMM().deserialize("&a = <green>Green <reset> &b = <aqua>Aqua"));
player.sendMessage(Utilities_OG.getMM().deserialize("&c = <red>Red <reset> &d = <light_purple>Light Purple"));
player.sendMessage(Utilities_OG.getMM().deserialize("&e = <yellow>Yellow <reset> &f = <white>White"));
player.sendMessage(Utilities_OG.getMM().deserialize("&k = <obfuscated>Magic <reset> &l = <bold>Bold"));
player.sendMessage(Utilities_OG.getMM().deserialize("&m = <strikethrough>Strikethrough <reset> &n = <underlined>Underline"));
player.sendMessage(Utilities_OG.getMM().deserialize("&o = <italic>Italic <reset> &r = Reset"));
player.sendMessage(UtilitiesOG.getMM().deserialize("<dark_aqua><bold>-=-=-=-=- <dark_purple>C<dark_aqua>o<green>l<yellow>o<red>r <aqua>C<light_purple>o<white>d<light_purple>e<aqua>s: -=-=-=-=-"));
player.sendMessage(UtilitiesOG.getMM().deserialize("&0 = <black>Black <reset> &1 = <dark_blue>Dark Blue"));
player.sendMessage(UtilitiesOG.getMM().deserialize("&2 = <dark_green>Dark Green <reset> &3 = <dark_aqua>Dark Aqua"));
player.sendMessage(UtilitiesOG.getMM().deserialize("&4 = <dark_red>Dark Red <reset> &5 = <dark_purple>Dark Purple"));
player.sendMessage(UtilitiesOG.getMM().deserialize("&6 = <gold>Gold <reset> &7 = <gray>Grey"));
player.sendMessage(UtilitiesOG.getMM().deserialize("&8 = <dark_gray>Dark Grey <reset> &9 = <blue>Blue"));
player.sendMessage(UtilitiesOG.getMM().deserialize("&a = <green>Green <reset> &b = <aqua>Aqua"));
player.sendMessage(UtilitiesOG.getMM().deserialize("&c = <red>Red <reset> &d = <light_purple>Light Purple"));
player.sendMessage(UtilitiesOG.getMM().deserialize("&e = <yellow>Yellow <reset> &f = <white>White"));
player.sendMessage(UtilitiesOG.getMM().deserialize("&k = <obfuscated>Magic <reset> &l = <bold>Bold"));
player.sendMessage(UtilitiesOG.getMM().deserialize("&m = <strikethrough>Strikethrough <reset> &n = <underlined>Underline"));
player.sendMessage(UtilitiesOG.getMM().deserialize("&o = <italic>Italic <reset> &r = Reset"));
}
// If the command executor is not a player, do this...
else {
@@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
//Import required libraries.
import me.barny1094875.utilitiesog.Utilities_OG;
import me.barny1094875.utilitiesog.UtilitiesOG;
import net.kyori.adventure.text.Component;
public class EntityCrammingToggleModule implements CommandExecutor
@@ -27,13 +27,13 @@ public class EntityCrammingToggleModule implements CommandExecutor
if (player.hasPermission("utilities.togglecramming"))
{
// Fetch config file from data folder.
FileConfiguration config = Utilities_OG.getPlugin().getConfig();
FileConfiguration config = UtilitiesOG.getPlugin().getConfig();
// Flip the true/false value to the opposite of what it currently is.
config.set("doEntityCramming", ! config.getBoolean("doEntityCramming"));
// Send formatted confirmation message using MiniMessage API.
Component parsed = Utilities_OG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#FFAA00>Entity cramming has been set to <#FFFF55>" + config.getBoolean("doEntityCramming") + "<#FFAA00>.");
Component parsed = UtilitiesOG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#FFAA00>Entity cramming has been set to <#FFFF55>" + config.getBoolean("doEntityCramming") + "<#FFAA00>.");
player.sendMessage(parsed);
}
}
@@ -6,7 +6,7 @@ import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.regions.RegionContainer;
import com.sk89q.worldguard.protection.regions.RegionQuery;
import me.barny1094875.utilitiesog.Utilities_OG;
import me.barny1094875.utilitiesog.UtilitiesOG;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@@ -68,7 +68,7 @@ public class NoFlippy implements Listener {
ApplicableRegionSet set = query.getApplicableRegions(blockLocation);
// If the Flippy Flag is set to DENY, cancel the event.
if (!set.testState(null, Utilities_OG.getFlippyFlag())) {
if (!set.testState(null, UtilitiesOG.getFlippyFlag())) {
// Cancel the trapdoor flip.
event.setCancelled(true);
@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
// Import required libraries.
import me.barny1094875.utilitiesog.Utilities_OG;
import me.barny1094875.utilitiesog.UtilitiesOG;
import net.kyori.adventure.text.Component;
public class PhantomToggleModule implements CommandExecutor
@@ -29,7 +29,7 @@ public class PhantomToggleModule implements CommandExecutor
if (player.hasPermission("utilities.togglephantoms"))
{
// Store the contents of phantomDisabledUsers.yml file as a YAML object.
YamlConfiguration phantomPreferences = Utilities_OG.getPhantomPreferences();
YamlConfiguration phantomPreferences = UtilitiesOG.getPhantomPreferences();
// Cherry pick the command runner's phantom status from the YAML data set.
boolean phantomToggleState = phantomPreferences.getBoolean(player.getUniqueId().toString());
@@ -41,21 +41,21 @@ public class PhantomToggleModule implements CommandExecutor
if (phantomToggleState)
{
// Send formatted "true" message using MiniMessage API.
Component parsed = Utilities_OG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#55FF55>Phantom spawning turned <#00AA00>ON<#55FF55>.");
Component parsed = UtilitiesOG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#55FF55>Phantom spawning turned <#00AA00>ON<#55FF55>.");
player.sendMessage(parsed);
}
// If the command sender's phantom spawning is turned off, do this...
else
{
// Send formatted "false" message using MiniMessage API.
Component parsed = Utilities_OG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#FFAA00>Phantom spawning turned <#FF5555>OFF<#FFAA00>.");
Component parsed = UtilitiesOG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#FFAA00>Phantom spawning turned <#FF5555>OFF<#FFAA00>.");
player.sendMessage(parsed);
}
try
{
// Save changes to YAML data to disk.
phantomPreferences.save(Utilities_OG.getPhantomDisabledPlayersFile());
phantomPreferences.save(UtilitiesOG.getPhantomDisabledPlayersFile());
}
catch (IOException error)
{
@@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;
import me.barny1094875.utilitiesog.Utilities_OG;
import me.barny1094875.utilitiesog.UtilitiesOG;
import net.kyori.adventure.text.Component;
// Initialize command manager class.
@@ -34,7 +34,7 @@ public class PingModule implements CommandExecutor
if(args.length == 0) {
// Send player their own ping using a formatted message with the MiniMessage API.
Component parsed = Utilities_OG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#00AA00>Your current ping is: <#FFAA00>" + player.getPing() + "<#00AA00>.");
Component parsed = UtilitiesOG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#00AA00>Your current ping is: <#FFAA00>" + player.getPing() + "<#00AA00>.");
player.sendMessage(parsed);
}
@@ -48,7 +48,7 @@ public class PingModule implements CommandExecutor
if(target != null) {
// Send player their specified player's ping using formatting with the MiniMessage API.
Component parsed = Utilities_OG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#00AA00>" + target.getName() + "'s current ping is: <#FFAA00>" + target.getPing() + "<#00AA00>.");
Component parsed = UtilitiesOG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#00AA00>" + target.getName() + "'s current ping is: <#FFAA00>" + target.getPing() + "<#00AA00>.");
player.sendMessage(parsed);
}
@@ -56,7 +56,7 @@ public class PingModule implements CommandExecutor
else {
// Send a "player not found" error message using formatting with the MiniMessage API.
Component parsed = Utilities_OG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#AA0000> ERROR: The player " + args[0] + " was not found!");
Component parsed = UtilitiesOG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#AA0000> ERROR: The player " + args[0] + " was not found!");
player.sendMessage(parsed);
}
@@ -66,7 +66,7 @@ public class PingModule implements CommandExecutor
else {
// Send a "too many arguments" error message using formatting with the MiniMessage API.
Component parsed = Utilities_OG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#AA0000> ERROR: Too many arguments provided. Syntax: <#FFFF55>/ping <player>");
Component parsed = UtilitiesOG.getMM().deserialize("<#AAAAAA>[<#00AA00>Utilities<#AA0000>-OG<#AAAAAA>] <#AA0000> ERROR: Too many arguments provided. Syntax: <#FFFF55>/ping <player>");
player.sendMessage(parsed);
}
@@ -2,7 +2,7 @@
// Authors: christianniehaus, NotAlexNoyle.
package me.barny1094875.utilitiesog.modules;
import me.barny1094875.utilitiesog.Utilities_OG;
import me.barny1094875.utilitiesog.UtilitiesOG;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.event.ClickEvent;
import org.bukkit.command.Command;
@@ -24,19 +24,19 @@ public class RanksModule implements CommandExecutor {
// If the player did not provide any arguments, do this...
if (args.length == 0) {
// Send the available ranks to the user.
player.sendMessage(Utilities_OG.getMM().deserialize("<bold><dark_purple>-=-=-=-=- <dark_green>True<dark_red>OG <aqua>Donation Store: <dark_purple>-=-=-=-=-"));
player.sendMessage(UtilitiesOG.getMM().deserialize("<bold><dark_purple>-=-=-=-=- <dark_green>True<dark_red>OG <aqua>Donation Store: <dark_purple>-=-=-=-=-"));
player.sendMessage("");
player.sendMessage("Each donor rank requires the rank before it.");
player.sendMessage("");
player.sendMessage(Utilities_OG.getMM().deserialize("<green>Rank Overview: <dark_aqua><underlined>https://shop.true-og.net"));
player.sendMessage(UtilitiesOG.getMM().deserialize("<green>Rank Overview: <dark_aqua><underlined>https://shop.true-og.net"));
player.sendMessage("");
player.sendMessage(Utilities_OG.getMM().deserialize("<white>[OG] <gray>(<dark_green>$10 Once<gray>) <dark_aqua><underlined>https://true-og.net/og"));
player.sendMessage(UtilitiesOG.getMM().deserialize("<white>[OG] <gray>(<dark_green>$10 Once<gray>) <dark_aqua><underlined>https://true-og.net/og"));
sendClickableMessage(player, "/ranks og");
player.sendMessage("");
player.sendMessage(Utilities_OG.getMM().deserialize("<red>[OG Pro] <gray>(<dark_green>$50 Once<gray>) <dark_aqua><underlined>https://true-og.net/og-pro"));
player.sendMessage(UtilitiesOG.getMM().deserialize("<red>[OG Pro] <gray>(<dark_green>$50 Once<gray>) <dark_aqua><underlined>https://true-og.net/og-pro"));
sendClickableMessage(player, "/ranks og-pro");
player.sendMessage("");
player.sendMessage(Utilities_OG.getMM().deserialize("<dark_red><bold>[OG Master] <gray>(<gold>$10 Monthly<gray>) <dark_aqua><underlined>https://true-og.net/og-master"));
player.sendMessage(UtilitiesOG.getMM().deserialize("<dark_red><bold>[OG Master] <gray>(<gold>$10 Monthly<gray>) <dark_aqua><underlined>https://true-og.net/og-master"));
sendClickableMessage(player, "/ranks og-master");
}
// If the player provided one or more arguments, do this...
@@ -44,7 +44,7 @@ public class RanksModule implements CommandExecutor {
// If the OG text was clicked, do this...
if (args[0].equalsIgnoreCase("og")) {
// Share the OG benefits with the user.
player.sendMessage(Utilities_OG.getMM().deserialize("<dark_purple><bold>-=-=-=-=- <dark_green>True<dark_red>OG <white>OG Rank: <dark_purple>-=-=-=-=-"));
player.sendMessage(UtilitiesOG.getMM().deserialize("<dark_purple><bold>-=-=-=-=- <dark_green>True<dark_red>OG <white>OG Rank: <dark_purple>-=-=-=-=-"));
player.sendMessage("- Use /afk for an unlimited amount of time.");
player.sendMessage("- Prominent white chat prefix");
player.sendMessage("- Create unions with /union create.");
@@ -56,7 +56,7 @@ public class RanksModule implements CommandExecutor {
// If the OG Pro text was clicked, do this...
else if (args[0].equalsIgnoreCase("og-pro")) {
// Share the OG Pro benefits with the user.
player.sendMessage(Utilities_OG.getMM().deserialize("<dark_purple><bold>-=-=-=-=- <dark_green>True&<dark_red>OG <red>OG Pro Rank: <dark_purple>-=-=-=-=-"));
player.sendMessage(UtilitiesOG.getMM().deserialize("<dark_purple><bold>-=-=-=-=- <dark_green>True&<dark_red>OG <red>OG Pro Rank: <dark_purple>-=-=-=-=-"));
player.sendMessage("- All OG Benefits.");
player.sendMessage("- Rent up to 2 shops at the player market.");
player.sendMessage("- Special chat formatting (bold, italics, magic, etc).");
@@ -72,7 +72,7 @@ public class RanksModule implements CommandExecutor {
// If the OG Master text was clicked, do this...
else if (args[0].equalsIgnoreCase("og-master")) {
// Share the OG Master benefits to the user.
player.sendMessage(Utilities_OG.getMM().deserialize("<dark_purple><bold>-=-=-=-=- <dark_green>True<dark_red>OG <dark_red>OG Master Rank: <dark_purple>-=-=-=-=-"));
player.sendMessage(UtilitiesOG.getMM().deserialize("<dark_purple><bold>-=-=-=-=- <dark_green>True<dark_red>OG <dark_red>OG Master Rank: <dark_purple>-=-=-=-=-"));
player.sendMessage("- All OG and OG Pro Benefits.");
player.sendMessage("- Rent up to 3 shops at the player market.");
player.sendMessage("- World inspection with /co inspect.");
@@ -84,7 +84,7 @@ public class RanksModule implements CommandExecutor {
} else {
// Send the player an error message if they typed too many command arguments.
player.sendMessage(Utilities_OG.getMM().deserialize("<gray>[<dark_green>True<dark_red>OG<gray>] <red>ERROR: Too many arguments! <gold>Syntax: <yellow>/ranks"));
player.sendMessage(UtilitiesOG.getMM().deserialize("<gray>[<dark_green>True<dark_red>OG<gray>] <red>ERROR: Too many arguments! <gold>Syntax: <yellow>/ranks"));
}
}
@@ -97,7 +97,7 @@ public class RanksModule implements CommandExecutor {
public static void sendClickableMessage(Player player, String command) {
// Declare a TextComponent with contents.
TextComponent clickableText = (TextComponent) Utilities_OG.getMM().deserialize("<aqua><bold>Click here to see the benefits!");
TextComponent clickableText = (TextComponent) UtilitiesOG.getMM().deserialize("<aqua><bold>Click here to see the benefits!");
// Create a click event on the chat text.
clickableText = clickableText.clickEvent(ClickEvent.clickEvent(ClickEvent.Action.RUN_COMMAND, command));
+1 -1
View File
@@ -1,7 +1,7 @@
name: Utilities-OG
authors: [ christianniehaus, NotAlexNoyle ]
version: '2.1.2'
main: me.barny1094875.utilitiesog.Utilities_OG
main: me.barny1094875.utilitiesog.UtilitiesOG
api-version: 1.19
depend: [ WorldGuard ]
commands: