23 Commits
Author SHA1 Message Date
FlorianMichael 8593bd7d7c 1.5.3 Release 2025-10-03 14:16:52 +02:00
FlorianMichael 054f899180 Auto: Gradle 9.1.0 2025-09-22 21:46:11 +02:00
FlorianMichael 8329a04a5c Gradle 9.0.0 2025-08-03 01:49:00 +02:00
TechirionandDieu 2be0cfd5b5 BlockCollisionChanges: Add 1.21.5+ support (#93)
Co-authored-by: Dieu <info@l4b.org>
2025-07-27 16:14:45 +02:00
Beanes e83dd73a66 Fix anvil cost on 1.8 spigot for versions lower than 1.8 (#94)
* Fix anvil cost on 1.8 spigot

* Remove debugs
2025-07-27 16:12:52 +02:00
FlorianMichael b6f89c9893 Update build files 2025-06-27 14:52:56 +02:00
FlorianMichael c98f0f8970 Bump version to 1.5.3-SNAPSHOT 2025-06-27 14:42:25 +02:00
FlorianMichael 6602e3ff67 Auto: Gradle 8.14.1 2025-05-22 17:51:04 +02:00
FlorianMichael 7910288083 Auto: Gradle 8.14 2025-04-26 16:25:07 +02:00
Leah Anderson a2ccc0a7de [ci skip] Fix grammar in README.md (#89) 2025-03-28 17:24:35 +01:00
FlorianMichael f01f255b2b Auto: Gradle 8.13, .editorconfig 2025-02-25 18:44:28 +01:00
FlorianMichael e8dc069437 Auto: Gradle 8.12.1 2025-01-24 15:44:23 +01:00
FlorianMichael baac8ae938 1.5.2 Release 2025-01-19 14:38:57 +01:00
FlorianMichael e22e37d975 Gradle 8.12 2025-01-02 22:52:45 +01:00
FlorianMichael 6b495ebb20 Sync various build script changes from VR 2025-01-02 15:34:50 +01:00
FlorianMichael 2e6acfaf04 Remove maven local 2025-01-02 15:31:21 +01:00
FlorianMichael 9dd1dc8e4d Auto: 2025 2025-01-01 01:07:59 +01:00
Dreeam 3030d07fec Fix AreaEffectCloudEmulator spawn logic on 1.20.5+ servers (#83) 2024-07-19 09:06:35 +02:00
FlorianMichael 081c9c9a6f Fix version check in area effect cloud emulation 2024-07-19 08:54:12 +02:00
FlorianMichael 64039f847c Gradle 8.9 2024-07-14 20:56:34 +02:00
FlorianMichael 5380fc9c1b Support Paper 1.21, print proper exception
Closes https://github.com/ViaVersion/ViaRewind-Legacy-Support/issues/82
2024-07-14 20:48:50 +02:00
FlorianMichael 28f14ce635 Updated publishing version range 2024-07-14 20:46:14 +02:00
FlorianMichael 30725d9545 Bump version to 1.5.2-SNAPSHOT 2024-07-14 20:45:49 +02:00
29 changed files with 307 additions and 202 deletions

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
[*]
charset = utf-8
indent_size = 4
indent_style = space
insert_final_newline = true
tab_width = 4
[*.java]
ij_java_class_count_to_use_import_on_demand = 999999
ij_java_names_count_to_use_import_on_demand = 999999
ij_java_imports_layout = *, |, $*
ij_java_generate_final_locals = true
ij_java_generate_final_parameters = true
[{*.json,*.yml}]
indent_size = 2
+1 -1
View File
@@ -1,2 +1,2 @@
github: FlorianMichael
custom: ['https://florianmichael.de/donate', 'https://viaversion.com/donate', 'https://creeper123123321.github.io/#donate']
custom: ['https://florianmichael.de/donate', 'https://creeper123123321.github.io/#donate']
+6 -13
View File
@@ -1,4 +1,4 @@
name: ViaRewind-Legacy-Support CI
name: Build
on: [pull_request, push, workflow_dispatch]
jobs:
@@ -7,22 +7,15 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
with:
persist-credentials: false
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
check-latest: true
- name: Cache Dependencies
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
run: ./gradlew build
run: ./gradlew build
+4 -2
View File
@@ -12,8 +12,10 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
with:
persist-credentials: false
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
+9 -4
View File
@@ -4,6 +4,7 @@
build/
out/
classes/
.kotlin/
# Eclipse
@@ -12,11 +13,13 @@ classes/
# Idea
.idea/
!.idea/copyright/*
!.idea/scopes/*
*.iml
*.ipr
*.iws
# VScode
# VSCode
.settings/
.vscode/
@@ -26,6 +29,8 @@ bin/
# macOS
.DS_Store
.AppleDouble
.LSOverride
DS_Store
# Misc
run/
+1 -1
View File
@@ -29,7 +29,7 @@ Installing this plugin requires nothing more than putting it in your plugins fol
- The **Lily Pad** bounding box is being modified. This prevents 1.7.x-1.8.x from glitching if they try to walk over **Lily Pads**.
- The **Ladder** bounding box is being modified. This prevents 1.7.x-1.8.x from glitching if they try to climb **Ladders**.
- If a 1.7.x player opens an **Enchantment Table** this plugin takes Lapis Lazuli from his/her inventory and puts it in the **Enchantment Table**.
- If a 1.7.x player opens an **Enchantment Table** this plugin takes Lapis Lazuli from their inventory and puts it in the **Enchantment Table**.
- 1.7.x-1.8.x can interact with **Brewing Stands** to add/remove Blaze Powder to/from them.
- Play block placement and item pickup **sounds** to 1.7.x-1.8.x players.
- Velocity is applied during **Elytra flight** for players below 1.9.
-120
View File
@@ -1,120 +0,0 @@
plugins {
id "java-library"
id "maven-publish"
id "io.papermc.hangar-publish-plugin" version "0.1.2"
}
repositories {
mavenLocal()
maven {
url = uri("https://repo.viaversion.com")
}
maven {
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}
maven {
url = uri("https://repo.maven.apache.org/maven2/")
}
}
version = project.maven_version
group = project.maven_group
dependencies {
compileOnly "com.viaversion:viaversion-api:4.10.0"
compileOnly "org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT"
}
java.sourceCompatibility = JavaVersion.VERSION_1_8
processResources {
inputs.property "version", project.version
filesMatching("plugin.yml") {
expand "version": project.version
}
}
java {
withSourcesJar()
}
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
tasks.withType(Javadoc) {
options.encoding = "UTF-8"
}
// -----------------------------------------------------
// Publishing
def latestCommitHash() {
def byteOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = byteOut
}
return byteOut.toString('UTF-8').trim()
}
def latestCommitMessage() {
def byteOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'log', '-1', '--pretty=%B'
standardOutput = byteOut
}
return byteOut.toString('UTF-8').trim()
}
def branchName() {
def byteOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD'
standardOutput = byteOut
}
return byteOut.toString('UTF-8').trim()
}
def baseVersion = project.maven_version
def isRelease = !baseVersion.contains('-')
def suffixedVersion = isRelease ? baseVersion : baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER")
def commitHash = latestCommitHash()
def changelogContent = "[${commitHash}](https://github.com/ViaVersion/iaRewind-Legacy-Support/commit/${commitHash}) ${latestCommitMessage()}"
def branch = branchName()
def isMainBranch = branch == "master"
hangarPublish {
publications.register("plugin") {
version.set(suffixedVersion)
id.set("ViaRewindLegacySupport")
channel.set(isRelease ? "Release" : isMainBranch ? "Snapshot" : "Alpha")
changelog.set(changelogContent)
apiKey.set(System.getenv("HANGAR_TOKEN"))
platforms {
PAPER {
jar.set(tasks.jar.archiveFile)
platformVersions.set([property('mcVersionRange') as String])
dependencies.hangar("ViaVersion") {
required.set(true)
}
dependencies.hangar("ViaBackwards") {
required.set(false)
}
dependencies.hangar("ViaRewind") {
required.set(false)
}
}
}
}
}
+70
View File
@@ -0,0 +1,70 @@
import de.florianmichael.baseproject.*
plugins {
`java-library`
id("io.papermc.hangar-publish-plugin")
id("de.florianmichael.baseproject.BaseProject")
}
repositories {
maven("https://repo.viaversion.com")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://repo.maven.apache.org/maven2/")
}
setupProject()
setupViaPublishing()
dependencies {
compileOnly("com.viaversion:viaversion-api:4.10.0")
compileOnly("org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT")
}
base {
archivesName.set("ViaRewind-Legacy-Support")
}
tasks {
processResources {
val projectVersion = project.version
val projectDescription = project.description
filesMatching("plugin.yml") {
expand(mapOf("version" to projectVersion, "description" to projectDescription))
}
}
}
val branch = branchName()
val baseVersion = version as String
val isRelease = !baseVersion.contains('-')
val suffixedVersion = if (isRelease) baseVersion else baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER")
val commitHash = latestCommitHash()
val changelogContent = "[${commitHash}](https://github.com/ViaVersion/iaRewind-Legacy-Support/commit/${commitHash}) ${latestCommitMessage()}"
val isMainBranch = branch == "master"
hangarPublish {
publications.register("plugin") {
version.set(suffixedVersion)
id.set("ViaRewindLegacySupport")
channel.set(if (isRelease) "Release" else if (isMainBranch) "Snapshot" else "Alpha")
changelog.set(changelogContent)
apiKey.set(System.getenv("HANGAR_TOKEN"))
platforms {
paper {
jar.set(tasks.jar.flatMap { it.archiveFile })
platformVersions.set(listOf(property("minecraft_version_range") as String))
dependencies.hangar("ViaVersion") {
required.set(true)
}
dependencies.hangar("ViaBackwards") {
required.set(false)
}
dependencies.hangar("ViaRewind") {
required.set(false)
}
}
}
}
}
tasks.named("publishPluginPublicationToHangar") {
notCompatibleWithConfigurationCache("")
}
+13 -5
View File
@@ -1,10 +1,18 @@
# gradle
# Gradle Properties
org.gradle.jvmargs=-Xmx8G
org.gradle.parallel=true
org.gradle.configuration-cache=true
# Project Details
project_jvm_version=8
# project
maven_version=1.5.1
maven_group=com.viaversion
project_group=com.viaversion
project_version=1.5.3
project_description=Provides additional features for ViaRewind for Paper servers.
mcVersionRange=1.8-1.20.6
publishing_dev_id=FlorianMichael
publishing_dev_name=EnZaXD
publishing_dev_mail=florian.michael07@gmail.com
# Hangar Publishing
minecraft_version_range=1.8-1.21.9
Binary file not shown.
+2 -1
View File
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionSha256Sum=a17ddd85a26b6a7f5ddb71ff8b05fc5104c0202c6e64782429790c933686c806
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+13 -14
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -112,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -145,7 +146,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -153,7 +154,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -170,7 +171,6 @@ fi
# 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" )
@@ -202,16 +202,15 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
Vendored
+13 -12
View File
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@@ -57,22 +59,21 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
: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 %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
-1
View File
@@ -1 +0,0 @@
rootProject.name = "ViaRewind-Legacy-Support"
+17
View File
@@ -0,0 +1,17 @@
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
plugins {
id("de.florianmichael.baseproject.BaseProject") version "1.1.1"
id("io.papermc.hangar-publish-plugin") version "0.1.3"
}
}
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
}
rootProject.name = "viarewind-legacy-support"
@@ -1,6 +1,6 @@
/*
* This file is part of ViaRewind-Legacy-Support - https://github.com/ViaVersion/ViaRewind-Legacy-Support
* Copyright (C) 2018-2024 ViaVersion and contributors
* Copyright (C) 2018-2025 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@
package com.viaversion.viarewind.legacysupport;
import com.viaversion.viarewind.legacysupport.feature.AnvilCostFix;
import com.viaversion.viarewind.legacysupport.feature.BlockCollisionChanges;
import com.viaversion.viarewind.legacysupport.versioninfo.VersionInformer;
import com.viaversion.viaversion.api.Via;
@@ -58,6 +59,13 @@ public class BukkitPlugin extends JavaPlugin {
}
final FileConfiguration config = getConfig();
if (serverProtocol.equals(ProtocolVersion.v1_8)) {
if (config.getBoolean("anvil-cost-fix")) {
Bukkit.getPluginManager().registerEvents(new AnvilCostFix(), BukkitPlugin.this);
}
}
if (serverProtocol.newerThanOrEqualTo(ProtocolVersion.v1_8)) {
if (config.getBoolean("enchanting-gui-fix")) {
Bukkit.getPluginManager().registerEvents(new EnchantingGuiEmulator(), BukkitPlugin.this);
@@ -66,6 +74,7 @@ public class BukkitPlugin extends JavaPlugin {
Bukkit.getPluginManager().registerEvents(new SlimeBounceEmulator(), BukkitPlugin.this);
}
}
if (serverProtocol.newerThanOrEqualTo(ProtocolVersion.v1_9)) {
if (config.getBoolean("sound-fix")) {
Bukkit.getPluginManager().registerEvents(new BlockPlaceSoundEmulator(BukkitPlugin.this), BukkitPlugin.this);
@@ -0,0 +1,63 @@
/*
* This file is part of ViaRewind-Legacy-Support - https://github.com/ViaVersion/ViaRewind-Legacy-Support
* Copyright (C) 2018-2025 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.viaversion.viarewind.legacysupport.feature;
import com.viaversion.viarewind.legacysupport.BukkitPlugin;
import com.viaversion.viarewind.legacysupport.util.NMSUtil;
import org.bukkit.Bukkit;
import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.AnvilInventory;
import org.bukkit.inventory.Inventory;
import java.util.logging.Level;
public class AnvilCostFix implements Listener {
@EventHandler
public void onInventoryClickEvent(InventoryClickEvent event) {
Inventory inventory = event.getInventory();
if (inventory instanceof AnvilInventory) {
Bukkit.getScheduler().runTaskLater(BukkitPlugin.getInstance(), () -> {
for (HumanEntity entity : inventory.getViewers()) {
if (entity instanceof Player) {
refreshAnvilInventoryPlayer((Player) entity);
}
}
}, 1L);
}
}
public void refreshAnvilInventoryPlayer(Player player) {
Object nmsPlayer = NMSUtil.getNMSPlayer(player);
try {
Object activeContainer = nmsPlayer.getClass().getField("activeContainer").get(nmsPlayer);
if (activeContainer.getClass().getSimpleName().equals("ContainerAnvil")) {
Object cost = activeContainer.getClass().getField("a").get(activeContainer);
nmsPlayer.getClass().getMethod("setContainerData", activeContainer.getClass().getSuperclass(), int.class, int.class).invoke(nmsPlayer, activeContainer, cost, cost);
}
} catch (Exception e) {
BukkitPlugin.getInstance().getLogger().log(Level.SEVERE, "Failed to refresh anvil inventory", e);
}
}
}
@@ -1,6 +1,6 @@
/*
* This file is part of ViaRewind-Legacy-Support - https://github.com/ViaVersion/ViaRewind-Legacy-Support
* Copyright (C) 2018-2024 ViaVersion and contributors
* Copyright (C) 2018-2025 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@
package com.viaversion.viarewind.legacysupport.feature;
import com.viaversion.viarewind.legacysupport.util.NMSUtil;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viarewind.legacysupport.BukkitPlugin;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
@@ -40,11 +41,14 @@ public class AreaEffectCloudEmulator implements Listener {
public AreaEffectCloudEmulator(final BukkitPlugin plugin) {
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
final Set<Player> affectedPlayers = Bukkit.getOnlinePlayers().stream().filter(p -> Via.getAPI().getPlayerProtocolVersion(p).newerThanOrEqualTo(ProtocolVersion.v1_8)).collect(Collectors.toSet());
final Set<Player> affectedPlayers = Bukkit.getOnlinePlayers().stream().filter(p -> Via.getAPI().getPlayerProtocolVersion(p).olderThanOrEqualTo(ProtocolVersion.v1_8)).collect(Collectors.toSet());
effectClouds.removeIf(e -> !e.isValid());
effectClouds.forEach(cloud -> {
final Location location = cloud.getLocation();
final float radius = cloud.getRadius();
final Object data = NMSUtil.NEWER_THAN_V1_20_5
? cloud.getColor()
: null;
float area = (float) Math.PI * radius * radius;
@@ -67,7 +71,8 @@ public class AreaEffectCloudEmulator implements Listener {
cloud.getParticle(),
location.getX() + f3, location.getY(), location.getZ() + f6,
0,
r / 255f, g / 255f, b / 255f
r / 255f, g / 255f, b / 255f,
data
);
});
}
@@ -1,6 +1,6 @@
/*
* This file is part of ViaRewind-Legacy-Support - https://github.com/ViaVersion/ViaRewind-Legacy-Support
* Copyright (C) 2018-2024 ViaVersion and contributors
* Copyright (C) 2018-2025 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,12 +18,14 @@
package com.viaversion.viarewind.legacysupport.feature;
import com.viaversion.viarewind.legacysupport.util.ReflectionUtil;
import com.viaversion.viaversion.api.protocol.version.ProtocolVersion;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -55,22 +57,48 @@ public class BlockCollisionChanges {
public static void fixLadder(final Logger logger, final ProtocolVersion serverVersion) {
try {
final boolean pre1_12_2 = serverVersion.olderThanOrEqualTo(ProtocolVersion.v1_12_2);
final boolean pre1_13_2 = serverVersion.olderThanOrEqualTo(ProtocolVersion.v1_13_2);
final boolean pre1_16_4 = serverVersion.olderThanOrEqualTo(ProtocolVersion.v1_16_4);
final boolean pre1_20_2 = serverVersion.olderThanOrEqualTo(ProtocolVersion.v1_20_2);
if(serverVersion.newerThanOrEqualTo(ProtocolVersion.v1_20_5))
{
final Class<?> blockLadderClass = getNMSBlockClass("BlockLadder");
final Field shapesField = getFieldAccessible(blockLadderClass, "d"); // SHAPES field
shapesField.setAccessible(true);
final Class<?> blockLadderClass = getNMSBlockClass("BlockLadder");
Class<?> blockClass = Class.forName("net.minecraft.world.level.block.Block");
Method boxZMethod = blockClass.getDeclaredMethod("boxZ", double.class, double.class, double.class);
boxZMethod.setAccessible(true);
Object voxelShape = boxZMethod.invoke(null, 16.0, 14.0, 16.0);
final Field boundingBoxEastField = getFieldAccessible(blockLadderClass, pre1_12_2 ? "b" : pre1_13_2 ? "c" : pre1_16_4 ? "c" : pre1_20_2 ? "d" : "e");
final Field boundingBoxWestField = getFieldAccessible(blockLadderClass, pre1_12_2 ? "c" : pre1_13_2 ? "o" : pre1_16_4 ? "d" : pre1_20_2 ? "e" : "f");
final Field boundingBoxSouthField = getFieldAccessible(blockLadderClass, pre1_12_2 ? "d" : pre1_13_2 ? "p" : pre1_16_4 ? "e" : pre1_20_2 ? "f" : "g");
final Field boundingBoxNorthField = getFieldAccessible(blockLadderClass, pre1_12_2 ? "e" : pre1_13_2 ? "q" : pre1_16_4 ? "f" : pre1_20_2 ? "g" : "h");
Class<?> shapesClass = Class.forName("net.minecraft.world.phys.shapes.Shapes");
Class<?> voxelShapeInterface = Class.forName("net.minecraft.world.phys.shapes.VoxelShape");
Method rotateHorizontalMethod = shapesClass.getDeclaredMethod("rotateHorizontal", voxelShapeInterface);
rotateHorizontalMethod.setAccessible(true);
@SuppressWarnings("unchecked")
Map<Object, Object> rotatedMap = (Map<Object, Object>) rotateHorizontalMethod.invoke(null, voxelShape);
setBoundingBox(boundingBoxEastField.get(null), 0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
setBoundingBox(boundingBoxWestField.get(null), 0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
setBoundingBox(boundingBoxSouthField.get(null), 0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
setBoundingBox(boundingBoxNorthField.get(null), 0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D);
@SuppressWarnings("unchecked")
Map<Object, Object> shapes = (Map<Object, Object>) shapesField.get(null);
shapes.clear();
shapes.putAll(rotatedMap);
}
else
{
final boolean pre1_12_2 = serverVersion.olderThanOrEqualTo(ProtocolVersion.v1_12_2);
final boolean pre1_13_2 = serverVersion.olderThanOrEqualTo(ProtocolVersion.v1_13_2);
final boolean pre1_16_4 = serverVersion.olderThanOrEqualTo(ProtocolVersion.v1_16_4);
final boolean pre1_20_2 = serverVersion.olderThanOrEqualTo(ProtocolVersion.v1_20_2);
final Class<?> blockLadderClass = getNMSBlockClass("BlockLadder");
final Field boundingBoxEastField = getFieldAccessible(blockLadderClass, pre1_12_2 ? "b" : pre1_13_2 ? "c" : pre1_16_4 ? "c" : pre1_20_2 ? "d" : "e");
final Field boundingBoxWestField = getFieldAccessible(blockLadderClass, pre1_12_2 ? "c" : pre1_13_2 ? "o" : pre1_16_4 ? "d" : pre1_20_2 ? "e" : "f");
final Field boundingBoxSouthField = getFieldAccessible(blockLadderClass, pre1_12_2 ? "d" : pre1_13_2 ? "p" : pre1_16_4 ? "e" : pre1_20_2 ? "f" : "g");
final Field boundingBoxNorthField = getFieldAccessible(blockLadderClass, pre1_12_2 ? "e" : pre1_13_2 ? "q" : pre1_16_4 ? "f" : pre1_20_2 ? "g" : "h");
setBoundingBox(boundingBoxEastField.get(null), 0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D);
setBoundingBox(boundingBoxWestField.get(null), 0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
setBoundingBox(boundingBoxSouthField.get(null), 0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D);
setBoundingBox(boundingBoxNorthField.get(null), 0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D);
}
} catch (Exception ex) {
logger.log(Level.SEVERE, "Could not fix ladder bounding box.", ex);
}
@@ -154,7 +182,10 @@ public class BlockCollisionChanges {
final Field isEmpty = getFieldAccessible(voxelShape, "isEmpty");
isEmpty.setBoolean(voxelShapeArray, true);
final Method initCache = voxelShape.getDeclaredMethod("initCache");
final Method initCache = ReflectionUtil.findMethod(voxelShape, new String[]{ "initCache", "moonrise$initCache" });
if (initCache == null) {
throw new IllegalStateException("Could not find initCache method in " + voxelShape.getName());
}
initCache.invoke(voxelShapeArray);
}
}
@@ -1,6 +1,6 @@
/*
* This file is part of ViaRewind-Legacy-Support - https://github.com/ViaVersion/ViaRewind-Legacy-Support
* Copyright (C) 2018-2024 ViaVersion and contributors
* Copyright (C) 2018-2025 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of ViaRewind-Legacy-Support - https://github.com/ViaVersion/ViaRewind-Legacy-Support
* Copyright (C) 2018-2024 ViaVersion and contributors
* Copyright (C) 2018-2025 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of ViaRewind-Legacy-Support - https://github.com/ViaVersion/ViaRewind-Legacy-Support
* Copyright (C) 2018-2024 ViaVersion and contributors
* Copyright (C) 2018-2025 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of ViaRewind-Legacy-Support - https://github.com/ViaVersion/ViaRewind-Legacy-Support
* Copyright (C) 2018-2024 ViaVersion and contributors
* Copyright (C) 2018-2025 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of ViaRewind-Legacy-Support - https://github.com/ViaVersion/ViaRewind-Legacy-Support
* Copyright (C) 2018-2024 ViaVersion and contributors
* Copyright (C) 2018-2025 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of ViaRewind-Legacy-Support - https://github.com/ViaVersion/ViaRewind-Legacy-Support
* Copyright (C) 2018-2024 ViaVersion and contributors
* Copyright (C) 2018-2025 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -34,6 +34,8 @@ public class NMSUtil {
public static String nmsVersionPackage;
private static Field playerConnectionField;
public static final boolean NEWER_THAN_V1_20_5 = BukkitPlugin.getInstance().getServerProtocol().newerThanOrEqualTo(ProtocolVersion.v1_20_5);
static {
if (BukkitPlugin.getInstance().getServerProtocol().olderThan(ProtocolVersion.v1_17)) {
nmsVersionPackage = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
@@ -1,6 +1,6 @@
/*
* This file is part of ViaRewind-Legacy-Support - https://github.com/ViaVersion/ViaRewind-Legacy-Support
* Copyright (C) 2018-2024 ViaVersion and contributors
* Copyright (C) 2018-2025 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -1,6 +1,6 @@
/*
* This file is part of ViaRewind-Legacy-Support - https://github.com/ViaVersion/ViaRewind-Legacy-Support
* Copyright (C) 2018-2024 ViaVersion and contributors
* Copyright (C) 2018-2025 ViaVersion and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
+4 -1
View File
@@ -6,6 +6,9 @@ brewing-stand-gui-fix: true
# Automatically put lapis lazuli in enchanting tables for clients lower than 1.8
enchanting-gui-fix: true
#
# Fixes anvil cost on 1.8 servers for clients lower than 1.8
anvil-cost-fix: true
#
# Fix the lily pad bounding box to prevent clients lower than 1.9 from glitching
lily-pad-fix: true
#
@@ -33,4 +36,4 @@ versioninfo:
active: false
max-version: 47
interval: JOIN
message: '&7[&6Info&7] This server is running Minecraft %version%. The best gameplay experience is only guaranteed if you are using this version.'
message: '&7[&6Info&7] This server is running Minecraft %version%. The best gameplay experience is only guaranteed if you are using this version.'
+1
View File
@@ -1,5 +1,6 @@
name: ViaRewind-Legacy-Support
version: ${version}
description: ${description}
main: com.viaversion.viarewind.legacysupport.BukkitPlugin
api-version: 1.13