up 1.20->1.20.1

This commit is contained in:
Color_yr committed 2025-09-30 16:05:38 +08:00
1 parent 02af9b1157
commit b5ab92302b
73 files changed
+1053 -31

No files matched your search

+6 -6
View File
@@ -149,7 +149,7 @@ jobs:
with:
name: "allmusic_server_fabric_1_19_2"
path: build/libs/
build_fabric_1_20:
build_fabric_1_20_1:
runs-on: windows-latest
permissions:
contents: read
@@ -165,11 +165,11 @@ jobs:
- name: build
shell: cmd
run: |
link.cmd && cd fabric_1_20 && gradlew build
link.cmd && cd fabric_1_20_1 && gradlew build
- name: update
uses: actions/upload-artifact@v4
with:
name: "allmusic_server_fabric_1_20"
name: "allmusic_server_fabric_1_20_1"
path: build/libs/
build_fabric_1_20_2:
runs-on: windows-latest
@@ -413,7 +413,7 @@ jobs:
with:
name: "allmusic_server_forge_1_19_2"
path: build/libs/
build_forge_1_20:
build_forge_1_20_1:
runs-on: windows-latest
permissions:
contents: read
@@ -429,11 +429,11 @@ jobs:
- name: build
shell: cmd
run: |
link.cmd && cd forge_1_20 && gradlew build
link.cmd && cd forge_1_20_1 && gradlew build
- name: update
uses: actions/upload-artifact@v4
with:
name: "allmusic_server_forge_1_20"
name: "allmusic_server_forge_1_20_1"
path: build/libs/
build_neoforge_1_20_4:
runs-on: windows-latest
+2 -2
View File
@@ -7,12 +7,12 @@ set "PROJECTS[1]=forge_1_12_2"
set "PROJECTS[2]=forge_1_16_5"
set "PROJECTS[3]=forge_1_18_2"
set "PROJECTS[4]=forge_1_19_2"
set "PROJECTS[5]=forge_1_20"
set "PROJECTS[5]=forge_1_20_1"
set "PROJECTS[6]=fabric_1_16_5"
set "PROJECTS[7]=fabric_1_18_2"
set "PROJECTS[8]=fabric_1_19_2"
set "PROJECTS[9]=fabric_1_19_3"
set "PROJECTS[10]=fabric_1_20"
set "PROJECTS[10]=fabric_1_20_1"
set "PROJECTS[11]=fabric_1_20_2"
set "PROJECTS[12]=fabric_1_20_6"
set "PROJECTS[13]=fabric_1_21"
+2 -2
View File
@@ -7,12 +7,12 @@ $projects = @(
"forge_1_16_5",
"forge_1_18_2",
"forge_1_19_2",
"forge_1_20",
"forge_1_20_1",
"fabric_1_16_5",
"fabric_1_18_2",
"fabric_1_19_2",
"fabric_1_19_3",
"fabric_1_20",
"fabric_1_20_1",
"fabric_1_20_2",
"fabric_1_20_6",
"fabric_1_21",
+1 -1
Submodule client updated: d224513c8a...24874efbf5.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

+5 -5
View File
@@ -4,9 +4,9 @@ mkdir "build\libs"
setlocal enabledelayedexpansion
set array=folia server_top server forge_1_20 ^
set array=folia server_top server forge_1_20_1 ^
forge_1_19_2 forge_1_18_2 forge_1_16_5 forge_1_12_2 forge_1_7_10 ^
fabric_1_20_2 fabric_1_20 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 ^
fabric_1_20_2 fabric_1_20_1 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 ^
fabric_1_16_5 fabric_1_20_6 fabric_1_21 neoforge_1_20_4 neoforge_1_20_5 neoforge_1_21 ^
neoforge_1_21_4 fabric_1_21_4 fabric_1_21_5 neoforge_1_21_5 fabric_1_21_6 neoforge_1_21_6
@@ -15,9 +15,9 @@ for %%i in (%array%) do (
if not exist "%%i\build" mkdir "%%i\build" && mklink /j "%%i\build\libs" "build\libs"
)
set array1=folia server_top forge_1_20 ^
set array1=folia server_top forge_1_20_1 ^
forge_1_19_2 forge_1_18_2 forge_1_16_5 forge_1_12_2 forge_1_7_10 ^
fabric_1_20_2 fabric_1_20 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 ^
fabric_1_20_2 fabric_1_20_1 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 ^
fabric_1_16_5 fabric_1_20_6 fabric_1_21 neoforge_1_20_4 neoforge_1_20_5 neoforge_1_21 ^
neoforge_1_21_4 fabric_1_21_4 fabric_1_21_5 neoforge_1_21_5 fabric_1_21_6 neoforge_1_21_6
@@ -31,7 +31,7 @@ for %%i in (%array2%) do (
if not exist "%%i\src\main\java\com\coloryr\allmusic\server\bstats" mklink /j "%%i\src\main\java\com\coloryr\allmusic\server\bstats" "bstats"
)
set array3=neoforge_1_21_6 fabric_1_21_6
set array3=neoforge_1_21_6 fabric_1_21_6 forge_1_20_1 fabric_1_20_1
for %%i in (%array3%) do (
+4 -4
View File
@@ -6,9 +6,9 @@ if (-not (Test-Path -Path $buildLibs)) {
# 定义模块数组
$array = @(
"folia", "server_top", "server", "forge_1_20",
"folia", "server_top", "server", "forge_1_20_1",
"forge_1_19_2", "forge_1_18_2", "forge_1_16_5", "forge_1_12_2", "forge_1_7_10",
"fabric_1_20_2", "fabric_1_20", "fabric_1_19_3", "fabric_1_19_2", "fabric_1_18_2",
"fabric_1_20_2", "fabric_1_20_1", "fabric_1_19_3", "fabric_1_19_2", "fabric_1_18_2",
"fabric_1_16_5", "fabric_1_20_6", "fabric_1_21", "neoforge_1_20_4", "neoforge_1_20_5", "neoforge_1_21",
"neoforge_1_21_4", "fabric_1_21_4", "fabric_1_21_5", "neoforge_1_21_5", "fabric_1_21_6", "neoforge_1_21_6"
)
@@ -32,9 +32,9 @@ foreach ($module in $array) {
# 定义需要 codec 链接的模块
$array1 = @(
"folia", "server_top", "forge_1_20",
"folia", "server_top", "forge_1_20_1",
"forge_1_19_2", "forge_1_18_2", "forge_1_16_5", "forge_1_12_2", "forge_1_7_10",
"fabric_1_20_2", "fabric_1_20", "fabric_1_19_3", "fabric_1_19_2", "fabric_1_18_2",
"fabric_1_20_2", "fabric_1_20_1", "fabric_1_19_3", "fabric_1_19_2", "fabric_1_18_2",
"fabric_1_16_5", "fabric_1_20_6", "fabric_1_21", "neoforge_1_20_4", "neoforge_1_20_5", "neoforge_1_21",
"neoforge_1_21_4", "fabric_1_21_4", "fabric_1_21_5", "neoforge_1_21_5", "fabric_1_21_6", "neoforge_1_21_6"
)
+8 -2
View File
@@ -4,7 +4,10 @@
mkdir -p "build/libs"
# 定义模块数组
array="folia server_top server forge_1_20 forge_1_19_2 forge_1_18_2 forge_1_16_5 forge_1_12_2 forge_1_7_10 fabric_1_20_2 fabric_1_20 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 fabric_1_16_5 fabric_1_20_6 fabric_1_21 neoforge_1_20_4 neoforge_1_20_5 neoforge_1_21 neoforge_1_21_4 fabric_1_21_4 fabric_1_21_5 neoforge_1_21_5 fabric_1_21_6 neoforge_1_21_6"
array="folia server_top server forge_1_20_1 forge_1_19_2 forge_1_18_2 forge_1_16_5 forge_1_12_2 \
forge_1_7_10 fabric_1_20_2 fabric_1_20_1 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 fabric_1_16_5 \
fabric_1_20_6 fabric_1_21 neoforge_1_20_4 neoforge_1_20_5 neoforge_1_21 neoforge_1_21_4 fabric_1_21_4 \
fabric_1_21_5 neoforge_1_21_5 fabric_1_21_6 neoforge_1_21_6"
# 处理核心链接和库链接
for module in $array; do
@@ -24,7 +27,10 @@ for module in $array; do
done
# 定义需要 codec 链接的模块
array1="folia server_top forge_1_20 forge_1_19_2 forge_1_18_2 forge_1_16_5 forge_1_12_2 forge_1_7_10 fabric_1_20_2 fabric_1_20 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 fabric_1_16_5 fabric_1_20_6 fabric_1_21 neoforge_1_20_4 neoforge_1_20_5 neoforge_1_21 neoforge_1_21_4 fabric_1_21_4 fabric_1_21_5 neoforge_1_21_5 fabric_1_21_6 neoforge_1_21_6"
array1="folia server_top forge_1_20_1 forge_1_19_2 forge_1_18_2 forge_1_16_5 forge_1_12_2 forge_1_7_10 \
fabric_1_20_2 fabric_1_20_1 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 fabric_1_16_5 fabric_1_20_6 \
fabric_1_21 neoforge_1_20_4 neoforge_1_20_5 neoforge_1_21 neoforge_1_21_4 fabric_1_21_4 fabric_1_21_5 \
neoforge_1_21_5 fabric_1_21_6 neoforge_1_21_6"
# 创建 codec 符号链接
for module in $array1; do
+40
View File
@@ -0,0 +1,40 @@
# gradle
.gradle/
build/
out/
classes/
# eclipse
*.launch
# idea
.idea/
*.iml
*.ipr
*.iws
# vscode
.settings/
.vscode/
bin/
.classpath
.project
# macos
*.DS_Store
# fabric
run/
# java
hs_err_*.log
replay_*.log
*.hprof
*.jfr
+102
View File
@@ -0,0 +1,102 @@
plugins {
id 'fabric-loom' version '1.10-SNAPSHOT'
id 'maven-publish'
// id "org.jetbrains.kotlin.jvm" version "1.9.+"
}
def getVersionFromFile() {
def versionFile = file('../version')
if (versionFile.exists()) {
return versionFile.text.trim()
} else {
throw new GradleException("Version file not found: ${versionFile.absolutePath}")
}
}
version = getVersionFromFile()
group = project.maven_group
base {
archivesName = project.archives_base_name
}
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modImplementation "net.fabricmc:fabric-language-kotlin:${project.fabric_kotlin_version}"
include modImplementation('com.squareup.okio:okio-jvm:3.6.0')
include modImplementation('com.squareup.okhttp3:okhttp:4.12.0')
include modImplementation('org.xerial:sqlite-jdbc:3.48.0.0')
// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}
//tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
// kotlinOptions {
// jvmTarget = 17
// }
//}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
}
}
// configure the maven publication
publishing {
publications {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
}
}
+17
View File
@@ -0,0 +1,17 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
loader_version=0.16.10
fabric_kotlin_version=1.10.19+kotlin.1.9.23
# Mod Properties
maven_group = com.coloryr.allmusic.server
archives_base_name =[fabric-1.20]AllMusic_Server
# Dependencies
fabric_version=0.92.3+1.20.1
Binary file not shown.
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+244
View File
@@ -0,0 +1,244 @@
#!/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/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/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# 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*)
# 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
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 \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"
+92
View File
@@ -0,0 +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
+12
View File
@@ -0,0 +1,12 @@
pluginManagement {
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
gradlePluginPortal()
}
}
rootProject.name = 'AllMusic_Server'
@@ -0,0 +1,47 @@
package com.coloryr.allmusic.server;
import com.coloryr.allmusic.server.core.AllMusic;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.Identifier;
import okio.Buffer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
public class AllMusicFabric implements ModInitializer {
public static MinecraftServer server;
public static final Logger LOGGER = LoggerFactory.getLogger("AllMusic Server");
public static final Identifier ID = new Identifier("allmusic", "channel");
public static final String dir = "allmusic_server/";
@Override
public void onInitialize() {
AllMusic.log = new LogFabric();
AllMusic.side = new SideFabric();
new AllMusic().init(new File(dir));
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> CommandFabric.instance.register(dispatcher));
Buffer buffer = new Buffer();
buffer.close();
ServerLifecycleEvents.SERVER_STARTED.register((a) -> {
server = a;
AllMusic.start();
Tasks.init();
});
ServerLifecycleEvents.SERVER_STOPPING.register((a) -> {
AllMusic.stop();
});
}
}
@@ -0,0 +1,69 @@
package com.coloryr.allmusic.server;
import com.coloryr.allmusic.server.core.command.CommandEX;
import com.mojang.brigadier.Command;
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.suggestion.SuggestionProvider;
import com.mojang.brigadier.suggestion.Suggestions;
import com.mojang.brigadier.suggestion.SuggestionsBuilder;
import net.minecraft.server.command.CommandManager;
import net.minecraft.server.command.ServerCommandSource;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;
public class CommandFabric implements Command<ServerCommandSource>, Predicate<ServerCommandSource>, SuggestionProvider<ServerCommandSource> {
public static CommandFabric instance = new CommandFabric();
public void register(CommandDispatcher<ServerCommandSource> dispatcher) {
dispatcher.register(((CommandManager.literal("music").requires(this)).executes(this))
.then(CommandManager.argument("args", StringArgumentType.greedyString())
.suggests(this).executes(this)));
}
@Override
public int run(CommandContext<ServerCommandSource> context) {
var item = context.getSource();
var input = context.getInput();
var temp = input.split(" ");
var arg = new String[temp.length - 1];
System.arraycopy(temp, 1, arg, 0, arg.length);
CommandEX.execute(item, context.getSource().getName(), arg);
return 0;
}
@Override
public boolean test(ServerCommandSource stack) {
return true;
}
@Override
public CompletableFuture<Suggestions> getSuggestions(CommandContext<ServerCommandSource> context, SuggestionsBuilder builder) {
var item = context.getSource();
var input = context.getInput();
var temp = input.split(" ");
var arg = new String[input.endsWith(" ") ? temp.length : temp.length - 1];
System.arraycopy(temp, 1, arg, 0, temp.length - 1);
builder = builder.createOffset(builder.getInput().lastIndexOf(32) + 1);
List<String> results = CommandEX.getTabList(item, item.getName(), arg);
String remaining = builder.getRemaining().trim();
for (String s : results) {
if (s.startsWith(remaining)){
builder.suggest(s);
}
}
return builder.buildFuture();
}
}
@@ -0,0 +1,42 @@
package com.coloryr.allmusic.server;
import net.minecraft.network.packet.s2c.play.OverlayMessageS2CPacket;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.ClickEvent;
import net.minecraft.text.MutableText;
import net.minecraft.text.Text;
public class FabricApi {
public static void sendMessageRun(ServerCommandSource obj, String message, String end, String command) {
MutableText send = Text.literal(message);
var endText = Text.literal(end);
endText.setStyle(endText.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command)));
send.append(endText);
obj.sendMessage(send);
}
public static void sendMessageSuggest(ServerCommandSource obj, String message, String end, String command) {
MutableText send = Text.literal(message);
var endText = Text.literal(end);
endText.setStyle(endText.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command)));
send.append(endText);
obj.sendMessage(send);
}
public static void sendBar(ServerPlayerEntity player, String message) {
var pack = new OverlayMessageS2CPacket(Text.literal(message));
player.networkHandler.sendPacket(pack);
}
public static void sendMessageBqRun(String message, String end, String command) {
MutableText send = Text.literal(message);
MutableText endText = Text.literal(end);
endText.setStyle(endText.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command)));
send.append(endText);
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
player.sendMessage(send, false);
}
}
}
@@ -0,0 +1,15 @@
package com.coloryr.allmusic.server;
import com.coloryr.allmusic.server.core.side.IMyLogger;
public class LogFabric implements IMyLogger {
@Override
public void warning(String data) {
AllMusicFabric.LOGGER.warn(data);
}
@Override
public void info(String data) {
AllMusicFabric.LOGGER.info(data);
}
}
@@ -0,0 +1,172 @@
package com.coloryr.allmusic.server;
import com.coloryr.allmusic.server.codec.PacketCodec;
import com.coloryr.allmusic.server.core.AllMusic;
import com.coloryr.allmusic.server.core.objs.enums.ComType;
import com.coloryr.allmusic.server.core.objs.music.MusicObj;
import com.coloryr.allmusic.server.core.objs.music.SongInfoObj;
import com.coloryr.allmusic.server.core.side.BaseSide;
import com.coloryr.allmusic.server.event.MusicAddEvent;
import com.coloryr.allmusic.server.event.MusicPlayEvent;
import io.netty.buffer.ByteBuf;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import java.io.File;
import java.util.Collection;
public class SideFabric extends BaseSide {
@Override
public void runTask(Runnable run) {
AllMusicFabric.server.execute(run);
}
@Override
public void runTask(Runnable run1, int delay) {
Tasks.add(new TaskItem() {{
tick = delay;
run = run1;
}});
}
@Override
public boolean checkPermission(Object player) {
ServerCommandSource source = (ServerCommandSource) player;
return source.hasPermissionLevel(2);
}
@Override
public boolean isPlayer(Object player) {
ServerCommandSource source = (ServerCommandSource) player;
return source.isExecutedByPlayer();
}
@Override
public boolean checkPermission(Object player, String permission) {
return checkPermission(player);
}
@Override
public boolean needPlay(boolean islist) {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (!AllMusic.isSkip(player.getName().getString(), null, false, islist)) {
return true;
}
}
return false;
}
@Override
public Collection<?> getPlayers() {
return AllMusicFabric.server.getPlayerManager().getPlayerList();
}
@Override
public String getPlayerName(Object player) {
if (player instanceof ServerPlayerEntity player1) {
return player1.getName().getString();
}
return null;
}
@Override
public String getPlayerServer(Object player) {
return null;
}
@Override
public void send(Object player, ComType type, String data, int data1) {
if (player instanceof ServerPlayerEntity player1) {
send(player1, PacketCodec.pack(type, data, data1));
}
}
@Override
public Object getPlayer(String player) {
return AllMusicFabric.server.getPlayerManager().getPlayer(player);
}
@Override
public void sendBar(Object player, String data) {
if (player instanceof ServerPlayerEntity player1) {
FabricApi.sendBar(player1, data);
}
}
@Override
public File getFolder() {
return new File(AllMusicFabric.dir);
}
@Override
public void broadcast(String message) {
if (message == null || message.isEmpty()) {
return;
}
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (!AllMusic.isSkip(player.getName().getString(), null, false)) {
player.sendMessage(Text.of(message), false);
}
}
}
@Override
public void broadcastWithRun(String message, String end, String command) {
if (message == null || message.isEmpty()) {
return;
}
FabricApi.sendMessageBqRun(message, end, command);
}
@Override
public void sendMessage(Object obj, String message) {
if (message == null || message.isEmpty()) {
return;
}
ServerCommandSource source = (ServerCommandSource) obj;
source.sendMessage(Text.of(message));
}
@Override
public void sendMessageRun(Object obj, String message, String end, String command) {
if (message == null || message.isEmpty()) {
return;
}
FabricApi.sendMessageRun((ServerCommandSource) obj, message, end, command);
}
@Override
public void sendMessageSuggest(Object obj, String message, String end, String command) {
if (message == null || message.isEmpty()) {
return;
}
FabricApi.sendMessageSuggest((ServerCommandSource) obj, message, end, command);
}
@Override
public boolean onMusicPlay(SongInfoObj obj) {
return MusicPlayEvent.EVENT.invoker().interact(obj) != ActionResult.PASS;
}
@Override
public boolean onMusicAdd(Object obj, MusicObj music) {
ServerCommandSource source = (ServerCommandSource) obj;
return MusicAddEvent.EVENT.invoker().interact(source.getPlayer(), music) != ActionResult.PASS;
}
private void send(ServerPlayerEntity players, ByteBuf data) {
if (players == null)
return;
try {
runTask(() -> ServerPlayNetworking.send(players, AllMusicFabric.ID, new PacketByteBuf(data)));
} catch (Exception e) {
AllMusic.log.warning("§c数据发送发生错误");
e.printStackTrace();
}
}
}
@@ -0,0 +1,6 @@
package com.coloryr.allmusic.server;
public class TaskItem {
public int tick;
public Runnable run;
}
@@ -0,0 +1,27 @@
package com.coloryr.allmusic.server;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
public class Tasks {
private static final List<TaskItem> taskItems = new CopyOnWriteArrayList<>();
public static void init() {
AllMusicFabric.server.addServerGuiTickable(Tasks::tick);
}
public static void tick() {
for (var item : new ArrayList<>(taskItems)) {
item.tick--;
if (item.tick <= 0) {
taskItems.remove(item);
item.run.run();
}
}
}
public static void add(TaskItem item) {
taskItems.add(item);
}
}
@@ -0,0 +1,24 @@
package com.coloryr.allmusic.server.event;
import com.coloryr.allmusic.server.core.objs.music.MusicObj;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.ActionResult;
public interface MusicAddEvent {
Event<MusicAddEvent> EVENT = EventFactory.createArrayBacked(MusicAddEvent.class,
(listeners) -> (player, music) -> {
for (MusicAddEvent listener : listeners) {
ActionResult result = listener.interact(player, music);
if (result != ActionResult.PASS) {
return result;
}
}
return ActionResult.PASS;
});
ActionResult interact(ServerPlayerEntity player, MusicObj music);
}
@@ -0,0 +1,23 @@
package com.coloryr.allmusic.server.event;
import com.coloryr.allmusic.server.core.objs.music.SongInfoObj;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.util.ActionResult;
public interface MusicPlayEvent {
Event<MusicPlayEvent> EVENT = EventFactory.createArrayBacked(MusicPlayEvent.class,
(listeners) -> (music) -> {
for (MusicPlayEvent listener : listeners) {
ActionResult result = listener.interact(music);
if (result != ActionResult.PASS) {
return result;
}
}
return ActionResult.PASS;
});
ActionResult interact(SongInfoObj music);
}
@@ -0,0 +1,23 @@
package com.coloryr.allmusic.server.mixin;
import com.coloryr.allmusic.server.core.AllMusic;
import net.minecraft.network.ClientConnection;
import net.minecraft.server.PlayerManager;
import net.minecraft.server.network.ServerPlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(PlayerManager.class)
public class ServerPlayerMixin {
@Inject(at = @At("HEAD"), method = "remove")
private void remove(ServerPlayerEntity entity, CallbackInfo info) {
AllMusic.removeNowPlayPlayer(entity.getName().getString());
}
@Inject(at = @At("TAIL"), method = "onPlayerConnect")
private void add(ClientConnection connection, ServerPlayerEntity player, CallbackInfo info) {
AllMusic.joinPlay(player.getName().getString());
}
}
@@ -0,0 +1,15 @@
{
"required": true,
"minVersion": "0.8",
"package": "com.coloryr.allmusic.server.mixin",
"compatibilityLevel": "JAVA_17",
"server": [
],
"mixins": [
"ServerPlayerMixin"
],
"injectors": {
"defaultRequire": 1
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

@@ -0,0 +1,39 @@
{
"schemaVersion": 1,
"id": "allmusic_server",
"version": "3.0.0",
"name": "AllMusic Server",
"description": "AllMusic Server Mod",
"authors": [
"Color_yr"
],
"contact": {
"homepage": "https://github.com/Coloryr/AllMusic_Server",
"sources": "https://github.com/Coloryr/AllMusic_Server"
},
"license": "GPL-3.0",
"icon": "assets/allmusic_server/icon.png",
"environment": "*",
"entrypoints": {
"main": [
"com.coloryr.allmusic.server.AllMusicFabric"
]
},
"mixins": [
"allmusic_server.mixins.json"
],
"depends": {
"fabricloader": ">=0.15.11",
"fabric-api": "*",
"minecraft": "~1.20",
"java": ">=17",
"fabric-language-kotlin": ">=1.10.19"
},
"suggests": {
}
}
+1 -1
View File
@@ -9,4 +9,4 @@ pluginManagement {
}
}
rootProject.name = 'AllMusic_Server'
rootProject.name = 'AllMusic'
+4 -4
View File
@@ -5,9 +5,9 @@
setlocal enabledelayedexpansion
set array=folia server_top server forge_1_20 ^
set array=folia server_top server forge_1_20_1 ^
forge_1_19_2 forge_1_18_2 forge_1_16_5 forge_1_12_2 forge_1_7_10 ^
fabric_1_20_2 fabric_1_20 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 ^
fabric_1_20_2 fabric_1_20_1 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 ^
fabric_1_16_5 fabric_1_20_6 fabric_1_21 neoforge_1_20_4 neoforge_1_20_5 neoforge_1_21 ^
neoforge_1_21_4 fabric_1_21_4 fabric_1_21_5 neoforge_1_21_5 fabric_1_21_6 neoforge_1_21_6
@@ -18,9 +18,9 @@ for %%i in (%array%) do (
if exist "%%i\.idea" rmdir /s /q "%%i\.idea"
)
set array1=folia server_top forge_1_20 ^
set array1=folia server_top forge_1_20_1 ^
forge_1_19_2 forge_1_18_2 forge_1_16_5 forge_1_12_2 forge_1_7_10 ^
fabric_1_20_2 fabric_1_20 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 ^
fabric_1_20_2 fabric_1_20_1 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 ^
fabric_1_16_5 fabric_1_20_6 fabric_1_21 neoforge_1_20_4 neoforge_1_20_5 neoforge_1_21 ^
neoforge_1_21_4 fabric_1_21_4 fabric_1_21_5 neoforge_1_21_5 fabric_1_21_6 neoforge_1_21_6
+4 -4
View File
@@ -3,9 +3,9 @@
# mkdir "build"
# mkdir ".gradle"
array="folia server_top server forge_1_20 \
array="folia server_top server forge_1_20_1 \
forge_1_19_2 forge_1_18_2 forge_1_16_5 forge_1_12_2 forge_1_7_10 \
fabric_1_20_2 fabric_1_20 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 \
fabric_1_20_2 fabric_1_20_1 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 \
fabric_1_16_5 fabric_1_20_6 fabric_1_21 neoforge_1_20_4 neoforge_1_20_5 neoforge_1_21 \
neoforge_1_21_4 fabric_1_21_4 fabric_1_21_5 neoforge_1_21_5 fabric_1_21_6 neoforge_1_21_6"
@@ -23,9 +23,9 @@ for dir in $array; do
fi
done
array1="folia server_top forge_1_20 \
array1="folia server_top forge_1_20_1 \
forge_1_19_2 forge_1_18_2 forge_1_16_5 forge_1_12_2 forge_1_7_10 \
fabric_1_20_2 fabric_1_20 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 \
fabric_1_20_2 fabric_1_20_1 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 \
fabric_1_16_5 fabric_1_20_6 fabric_1_21 neoforge_1_20_4 neoforge_1_20_5 neoforge_1_21 \
neoforge_1_21_4 fabric_1_21_4 fabric_1_21_5 neoforge_1_21_5 fabric_1_21_6 neoforge_1_21_6"