forked from upstream/AxSmithing
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d1161bb15 | ||
|
|
bfbe454b71 | ||
|
|
97ed8ad6e2 | ||
|
|
cbcd7f5855 | ||
|
|
cf4416d562 | ||
|
|
f214bf44b3 | ||
|
|
e9d941e872 | ||
|
|
532fda45f3 | ||
|
|
2a4dd534a5 | ||
|
|
39d0e36e72 | ||
|
|
f5bdb77c0e | ||
|
|
b06b4e7156 | ||
|
|
05c131cbff | ||
|
|
e3b71c2141 | ||
|
|
7c52af372f |
No files matched your search
Generated
+1
-1
@@ -5,7 +5,7 @@
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleHome" value="C:/Gradle/gradle-7.5.1" />
|
||||
<option name="gradleJvm" value="17" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
|
||||
Generated
+1
-1
@@ -5,7 +5,7 @@
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" default="true" project-jdk-name="temurin-16" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
+5
-6
@@ -1,10 +1,10 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'com.github.johnrengelman.shadow' version '8.1.1'
|
||||
id 'io.github.goooler.shadow' version '8.1.7'
|
||||
}
|
||||
|
||||
group = 'com.artillexstudios.axsmithing'
|
||||
version = '1.5'
|
||||
version = '1.10'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -28,11 +28,11 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
implementation 'net.byteflux:libby-bukkit:1.2.0'
|
||||
implementation 'com.artillexstudios.axapi:axapi:1.4.10'
|
||||
implementation 'com.artillexstudios.axapi:axapi:1.4.190:all'
|
||||
implementation 'org.bstats:bstats-bukkit:3.0.2'
|
||||
compileOnly 'com.google.code.gson:gson:2.10.1'
|
||||
compileOnly 'org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT'
|
||||
compileOnly 'com.viaversion:viaversion-api:4.7.0'
|
||||
compileOnly 'com.viaversion:viaversion-api:4.10.0'
|
||||
}
|
||||
|
||||
compileJava {
|
||||
@@ -50,9 +50,8 @@ shadowJar {
|
||||
relocate("net.byteflux.libby", "com.artillexstudios.axsmithing.libs.libby")
|
||||
relocate("org.bstats", "com.artillexstudios.axsmithing.libs.bstats")
|
||||
relocate("com.artillexstudios.axapi", "com.artillexstudios.axsmithing.libs.axapi")
|
||||
minimize()
|
||||
}
|
||||
|
||||
build {
|
||||
dependsOn(shadowJar)
|
||||
}
|
||||
}
|
||||
Vendored
BIN
Binary file not shown.
+3
-2
@@ -1,6 +1,7 @@
|
||||
#Sat Aug 19 14:47:24 CEST 2023
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -55,7 +55,7 @@
|
||||
# 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
|
||||
# https://github.com/gradle/gradle/blob/HEAD/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/.
|
||||
@@ -80,13 +80,10 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
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"'
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -133,22 +130,29 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -193,6 +197,10 @@ if "$cygwin" || "$msys" ; then
|
||||
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 $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
@@ -205,6 +213,12 @@ set -- \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# 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.
|
||||
|
||||
Vendored
+9
-6
@@ -14,7 +14,7 @@
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,7 +25,8 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
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!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
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
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.artillexstudios.axapi.libs.boostedyaml.boostedyaml.settings.dumper.Du
|
||||
import com.artillexstudios.axapi.libs.boostedyaml.boostedyaml.settings.general.GeneralSettings;
|
||||
import com.artillexstudios.axapi.libs.boostedyaml.boostedyaml.settings.loader.LoaderSettings;
|
||||
import com.artillexstudios.axapi.libs.boostedyaml.boostedyaml.settings.updater.UpdaterSettings;
|
||||
import com.artillexstudios.axapi.utils.Version;
|
||||
import com.artillexstudios.axapi.scheduler.Scheduler;
|
||||
import com.artillexstudios.axsmithing.command.AxSmithingCommand;
|
||||
import com.artillexstudios.axsmithing.command.AxSmithingTabComplete;
|
||||
import com.artillexstudios.axsmithing.gui.SmithingTable;
|
||||
@@ -69,6 +69,11 @@ public class AxSmithingPlugin extends AxPlugin {
|
||||
Bukkit.getPluginCommand("axsmithing").setTabCompleter(new AxSmithingTabComplete());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
Scheduler.get().cancelAll();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
try {
|
||||
config.reload();
|
||||
@@ -80,7 +85,7 @@ public class AxSmithingPlugin extends AxPlugin {
|
||||
}
|
||||
|
||||
private void initializeSmithingTableImpl() {
|
||||
if (Version.getServerVersion().isNewerThanOrEqualTo(Version.v1_20_1)) {
|
||||
if (!Bukkit.getBukkitVersion().startsWith("1.1")) {
|
||||
v1_20 = true;
|
||||
smithingTableImpl = new SmithingTable_V1_20();
|
||||
} else {
|
||||
|
||||
@@ -196,7 +196,7 @@ public class SmithingTable_V1_16 implements SmithingTable, InventoryHolder {
|
||||
addition = new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
if (base == null || addition.getType().isAir()) {
|
||||
if (base == null || base.getType().isAir()) {
|
||||
base = new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ public class SmithingTable_V1_16 implements SmithingTable, InventoryHolder {
|
||||
boolean successful = checkRecipe(inv, finalBase, finalAddition);
|
||||
|
||||
if (!successful) {
|
||||
checkRecipe(inv, finalAddition, finalBase);
|
||||
successful = checkRecipe(inv, finalAddition, finalBase);
|
||||
}
|
||||
|
||||
return successful;
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.artillexstudios.axsmithing.utils.ItemBuilder;
|
||||
import com.artillexstudios.axsmithing.utils.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Registry;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
@@ -33,6 +35,7 @@ import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -233,15 +236,21 @@ public class SmithingTable_V1_20 implements SmithingTable, InventoryHolder {
|
||||
addition = new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
if (base == null || addition.getType().isAir()) {
|
||||
if (base == null || base.getType().isAir()) {
|
||||
base = new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
if (template == null || addition.getType().isAir()) {
|
||||
if (!needNetheriteTemplate) {
|
||||
if (template == null || template.getType().isAir()) {
|
||||
template = new ItemStack(Material.AIR);
|
||||
}
|
||||
|
||||
if (!needNetheriteTemplate && !hasTemplate(addition, base, template)) {
|
||||
if (template.getType().isAir()) {
|
||||
template = new ItemStack(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||
} else {
|
||||
template = new ItemStack(Material.AIR);
|
||||
} else if (base.getType().isAir()) {
|
||||
base = new ItemStack(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);
|
||||
} else if (addition.getType().isAir()) {
|
||||
addition = new ItemStack(Material.NETHERITE_UPGRADE_SMITHING_TEMPLATE);;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,12 +278,26 @@ public class SmithingTable_V1_20 implements SmithingTable, InventoryHolder {
|
||||
successful = checkRecipe(inv, finalAddition, finalBase, finalTemplate);
|
||||
}
|
||||
if (!successful) {
|
||||
checkRecipe(inv, finalAddition, finalTemplate, finalBase);
|
||||
successful = checkRecipe(inv, finalAddition, finalTemplate, finalBase);
|
||||
}
|
||||
|
||||
return successful;
|
||||
}
|
||||
|
||||
private boolean hasTemplate(ItemStack item1, ItemStack item2, ItemStack item3) {
|
||||
if (isTemplate(item1)) {
|
||||
return true;
|
||||
} else if (isTemplate(item2)) {
|
||||
return true;
|
||||
} else {
|
||||
return isTemplate(item3);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isTemplate(ItemStack item) {
|
||||
return item.getType().name().contains("SMITHING_TEMPLATE");
|
||||
}
|
||||
|
||||
private boolean checkRecipe(Inventory inventory, ItemStack finalTemplate, ItemStack finalBase, ItemStack finalAddition) {
|
||||
Iterator<Recipe> recipeIterator = Bukkit.getServer().recipeIterator();
|
||||
while (recipeIterator.hasNext()) {
|
||||
@@ -424,24 +447,7 @@ public class SmithingTable_V1_20 implements SmithingTable, InventoryHolder {
|
||||
default -> material = null;
|
||||
}
|
||||
|
||||
switch (finalTemplate.getType()) {
|
||||
case COAST_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.COAST;
|
||||
case DUNE_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.DUNE;
|
||||
case EYE_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.EYE;
|
||||
case SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.SENTRY;
|
||||
case HOST_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.HOST;
|
||||
case SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.SHAPER;
|
||||
case SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.SILENCE;
|
||||
case RAISER_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.RAISER;
|
||||
case RIB_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.RIB;
|
||||
case SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.SNOUT;
|
||||
case SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.SPIRE;
|
||||
case TIDE_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.TIDE;
|
||||
case VEX_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.VEX;
|
||||
case WARD_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.WARD;
|
||||
case WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE -> pattern = TrimPattern.WAYFINDER;
|
||||
default -> pattern = null;
|
||||
}
|
||||
pattern = Registry.TRIM_PATTERN.get(NamespacedKey.minecraft(finalTemplate.getType().name().replace("_ARMOR_TRIM_SMITHING_TEMPLATE", "").toLowerCase(Locale.ENGLISH)));
|
||||
|
||||
if (pattern == null || material == null) {
|
||||
return null;
|
||||
|
||||
@@ -25,11 +25,11 @@ public class InteractListener implements Listener {
|
||||
if (!AxSmithingPlugin.getConfiguration().getBoolean("listen-to-interact-event")) return;
|
||||
|
||||
if (AxSmithingPlugin.is1_20()) {
|
||||
if (Via.getAPI().getPlayerVersion(event.getPlayer()) >= Version.v1_20_1.protocolId && !AxSmithingPlugin.getConfiguration().getBoolean("menu.1_20.force-for-1_20-clients")) {
|
||||
if (Via.getAPI().getPlayerVersion(event.getPlayer()) >= 762 && !AxSmithingPlugin.getConfiguration().getBoolean("menu.1_20.force-for-1_20-clients")) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (Via.getAPI().getPlayerVersion(event.getPlayer()) != Version.v1_20_1.protocolId && Via.getAPI().getPlayerVersion(event.getPlayer()) != Version.v1_20_2.protocolId) {
|
||||
if (!AxSmithingPlugin.getConfiguration().getBoolean("menu.1_16.force")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -46,11 +46,11 @@ public class InteractListener implements Listener {
|
||||
if (event.getInventory().getType() != InventoryType.SMITHING) return;
|
||||
|
||||
if (AxSmithingPlugin.is1_20()) {
|
||||
if (Via.getAPI().getPlayerVersion(event.getPlayer()) >= Version.v1_20_1.protocolId && !AxSmithingPlugin.getConfiguration().getBoolean("menu.1_20.force-for-1_20-clients")) {
|
||||
if (Via.getAPI().getPlayerVersion(event.getPlayer()) >= 762 && !AxSmithingPlugin.getConfiguration().getBoolean("menu.1_20.force-for-1_20-clients")) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (Via.getAPI().getPlayerVersion(event.getPlayer()) != Version.v1_20_1.protocolId && Via.getAPI().getPlayerVersion(event.getPlayer()) != Version.v1_20_2.protocolId) {
|
||||
if (!AxSmithingPlugin.getConfiguration().getBoolean("menu.1_16.force")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class StringUtils {
|
||||
private static final LegacyComponentSerializer LEGACY_COMPONENT_SERIALIZER = LegacyComponentSerializer.builder().character('\u00a7').useUnusualXRepeatedCharacterHexFormat().hexColors().build();
|
||||
private static final LegacyComponentSerializer LEGACY_FORMATTER = LegacyComponentSerializer.legacyAmpersand().toBuilder().useUnusualXRepeatedCharacterHexFormat().hexColors().build();
|
||||
private static final LegacyComponentSerializer LEGACY_FORMATTER = LegacyComponentSerializer.builder().character('&').useUnusualXRepeatedCharacterHexFormat().hexColors().build();
|
||||
private static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage();
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -32,6 +32,7 @@ menu:
|
||||
upgrade-slot: 12
|
||||
output-slot: 14
|
||||
dont-convert-with-modeldata: false
|
||||
force: false
|
||||
items:
|
||||
'1':
|
||||
slots:
|
||||
@@ -50,4 +51,4 @@ messages:
|
||||
no-permission: "&cYou do not have permission to do this!"
|
||||
reload: "&aPlugin reloaded in %time%ms!"
|
||||
|
||||
config-version: 2
|
||||
config-version: 3
|
||||
Reference in new issue
Block a user