This commit is contained in:
Coloryr committed 2024-04-29 08:33:18 +08:00
1 parent 025e54b25c
commit 161a8f2aa5
27 files changed
+1550 -11

No files matched your search

+22
View File
@@ -368,4 +368,26 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: "allmusic_server_neoforge_1_20_4"
path: build/libs/
build_neoforge_1_20_5:
runs-on: windows-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
- name: build
shell: cmd
run: |
link.cmd && cd neoforge_1_20_5 && gradlew build
- name: update
uses: actions/upload-artifact@v4
with:
name: "allmusic_server_neoforge_1_20_5"
path: build/libs/
+2 -1
View File
@@ -313,7 +313,8 @@ public class APIMain {
List<songs> res1 = obj.getResult();
SearchMusicObj item;
for (songs temp : res1) {
item = new SearchMusicObj(String.valueOf(temp.getId()), temp.getName(), temp.getArtists(), temp.getAlbum());
item = new SearchMusicObj(String.valueOf(temp.getId()), temp.getName(),
temp.getArtists(), temp.getAlbum());
resData.add(item);
}
maxpage = res1.size() / 10;
+2 -2
View File
@@ -3,12 +3,12 @@ package com.coloryr.allmusic.server.core.objs.api.music.search;
import java.util.List;
public class songs {
private int id;
private long id;
private String name;
private List<artists> artists;
private album album;
public int getId() {
public long getId() {
return id;
}
+1 -1
View File
@@ -8,7 +8,7 @@ setlocal enabledelayedexpansion
set array=folia server_top server forge_1_20 forge_1_19_3 ^
forge_1_19_2 forge_1_18_2 forge_1_16_5 forge_1_12_2 ^
fabric_1_20_2 fabric_1_20 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 ^
fabric_1_16_5 neoforge_1_20_4
fabric_1_16_5 neoforge_1_20_4 neoforge_1_20_5
for %%i in (%array%) do (
if not exist "%%i\src\main\java\com\coloryr\allmusic\server\core" mklink /j "%%i\src\main\java\com\coloryr\allmusic\server\core" "core"
@@ -39,6 +39,7 @@ public class AllMusicForge {
public AllMusicForge(IEventBus modEventBus) {
// Register the commonSetup method for modloading
modEventBus.addListener(this::commonSetup);
modEventBus.addListener(this::register);
// Register ourselves for server and other game events we are interested in
NeoForge.EVENT_BUS.register(this);
@@ -53,12 +54,10 @@ public class AllMusicForge {
new AllMusic().init(new File(path));
}
// @SubscribeEvent
// public void register(final RegisterPayloadHandlerEvent event) {
//// final IPayloadRegistrar registrar = event.registrar("allmusic");
//// registrar.play(channel, PackData::new, handler -> handler
//// .client(ClientPayloadHandler.getInstance()::handleData));
// }
public void register(final RegisterPayloadHandlerEvent event) {
final IPayloadRegistrar registrar = event.registrar("allmusic");
registrar.versioned("1.0").optional();
}
@SubscribeEvent
public void onRegisterCommands(RegisterCommandsEvent event) {
+5
View File
@@ -0,0 +1,5 @@
# Disable autocrlf on generated files, they always generate with LF
# Add any extra files or paths here to make git stop saying they
# are changed when only line endings change.
src/generated/**/.cache/cache text eol=lf
src/generated/**/*.json text eol=lf
+25
View File
@@ -0,0 +1,25 @@
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project
# idea
out
*.ipr
*.iws
*.iml
.idea
# gradle
build
.gradle
# other
eclipse
run
# Files from Forge MDK
forge*changelog.txt
+153
View File
@@ -0,0 +1,153 @@
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.+'
}
repositories {
mavenLocal()
}
version = mod_version
group = mod_group_id
base {
archivesName = file_name
}
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
// Enable the Jar-in-Jar system for your mod
jarJar.enable()
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
// applies to all the run configs below
configureEach {
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
systemProperty 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
systemProperty 'forge.logging.console.level', 'debug'
modSource project.sourceSets.main
}
client {
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}
server {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
programArgument '--nogui'
}
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}
data {
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
// workingDirectory project.file('run-data')
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
}
jarJar {
// Include or exclude dependencies here from runtime configuration
dependencies {
// Exclude any dependency which begins with 'com.google.gson.'
//exclude(dependency('org.gradle:gradle-core:2.2'))
}
}
// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }
dependencies {
// Specify the version of Minecraft to use.
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
// The "userdev" classifier will be requested and setup by ForgeGradle.
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
implementation "net.neoforged:neoforge:${neo_version}"
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
implementation 'com.squareup.okhttp3:okhttp:4.+'
implementation 'org.xerial:sqlite-jdbc:3.+'
jarJar (group: 'com.squareup.okhttp3', name: 'okhttp', version: '[4.10, 5.0)')
jarJar (group: 'com.squareup.okio', name: 'okio-jvm', version: '[3.6, 4.0)') {
jarJar.pin(it, '3.6.0')
}
jarJar (group: 'org.xerial', name: 'sqlite-jdbc', version: '[3.42, 4.0)')
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
tasks.withType(ProcessResources).configureEach {
var replaceProperties = [
minecraft_version : minecraft_version,
minecraft_version_range: minecraft_version_range,
neo_version : neo_version,
neo_version_range : neo_version_range,
loader_version_range : loader_version_range,
mod_id : mod_id,
mod_name : mod_name,
mod_license : mod_license,
mod_version : mod_version,
mod_authors : mod_authors,
mod_description : mod_description
]
inputs.properties replaceProperties
filesMatching(['META-INF/mods.toml']) {
expand replaceProperties
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
+45
View File
@@ -0,0 +1,45 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
# This is required to provide enough memory for the Minecraft decompilation process.
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
#read more on this at https://github.com/neoforged/NeoGradle/blob/NG_7.0/README.md#apply-parchment-mappings
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
neogradle.subsystems.parchment.minecraftVersion=1.20.4
neogradle.subsystems.parchment.mappingsVersion=2024.04.14
# Environment Properties
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
# The Minecraft version must agree with the Neo version to get a valid artifact
minecraft_version=1.20.5
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.20.5,1.21)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=20.5.3-beta
# The Neo version range can use any version of Neo as bounds
neo_version_range=[20.5,)
# The loader version range can only use the major version of FML as bounds
loader_version_range=[2,)
## Mod Properties
file_name = [NeoForge1.20.5]AllMusic_Server
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=allmusic_server
# The human-readable display name for the mod.
mod_name=AllMusic Server
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=GPL-3.0
# The mod version. See https://semver.org/
mod_version=3.0.0
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=com.coloryr.allmusic.server
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
mod_authors=Color_yr
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=AllMusic Server Mod
Binary file not shown.
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+240
View File
@@ -0,0 +1,240 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# 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" "$@"
+91
View File
@@ -0,0 +1,91 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% 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
+13
View File
@@ -0,0 +1,13 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
maven { url = 'https://maven.neoforged.net/releases' }
}
}
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}
rootProject.name = 'AllMusic_Server'
@@ -0,0 +1,105 @@
package com.coloryr.allmusic.server;
import com.coloryr.allmusic.server.core.AllMusic;
import com.coloryr.allmusic.server.side.forge.*;
import com.mojang.brigadier.CommandDispatcher;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.RegisterCommandsEvent;
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
import net.neoforged.neoforge.event.server.ServerStartedEvent;
import net.neoforged.neoforge.event.server.ServerStoppingEvent;
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
import net.neoforged.neoforge.network.handling.IPayloadContext;
import net.neoforged.neoforge.network.handling.IPayloadHandler;
import net.neoforged.neoforge.network.registration.PayloadRegistrar;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.Locale;
// The value here should match an entry in the META-INF/mods.toml file
@Mod(AllMusicForge.MODID)
public class AllMusicForge {
public static MinecraftServer server;
public static final ResourceLocation channel = new ResourceLocation("allmusic", "channel");
// Define mod id in a common place for everything to reference
public static final String MODID = "allmusic_server";
// Directly reference a slf4j logger
public static final Logger LOGGER = LoggerFactory.getLogger("AllMusic_Server");
// Create a Deferred Register to hold Blocks which will all be registered under the "examplemod" namespace
private static class HandelPack implements IPayloadHandler<PackData> {
@Override
public void handle(@NotNull PackData payload, IPayloadContext context) {
context.handle(payload);
}
}
public AllMusicForge(IEventBus modEventBus) {
// Register the commonSetup method for modloading
modEventBus.addListener(this::commonSetup);
modEventBus.addListener(this::register);
// Register ourselves for server and other game events we are interested in
NeoForge.EVENT_BUS.register(this);
}
private void commonSetup(final FMLCommonSetupEvent event) {
String path = String.format(Locale.ROOT, "config/%s/", "AllMusic3");
AllMusic.log = new LogForge();
AllMusic.side = new SideForge();
new AllMusic().init(new File(path));
}
@SubscribeEvent
public void register(final RegisterPayloadHandlersEvent event) {
final PayloadRegistrar registrar = event.registrar("allmusic")
.versioned("1.0")
.optional();
registrar.playBidirectional(PackData.TYPE, PackData.CODEC, new HandelPack());
}
@SubscribeEvent
public void onRegisterCommands(RegisterCommandsEvent event) {
CommandDispatcher<CommandSourceStack> dispatcher = event.getDispatcher();
CommandForge.instance.register(dispatcher);
}
// You can use SubscribeEvent and let the Event Bus discover methods to call
@SubscribeEvent
public void onServerStarting(ServerStartedEvent event) {
server = event.getServer();
AllMusic.start();
Tasks.init();
}
@SubscribeEvent
public void onServerStopping(ServerStoppingEvent event) {
AllMusic.stop();
}
@SubscribeEvent
public void onPlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent event) {
AllMusic.removeNowPlayPlayer(event.getEntity().getName().getString());
}
@SubscribeEvent
public void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
AllMusic.joinPlay(event.getEntity().getName().getString());
}
}
@@ -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() {
AllMusicForge.server.addTickable(Tasks::tick);
}
public static void tick() {
for (TaskItem 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,65 @@
package com.coloryr.allmusic.server.side.forge;
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.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;
public class CommandForge implements Command<CommandSourceStack>, Predicate<CommandSourceStack>, SuggestionProvider<CommandSourceStack> {
public static CommandForge instance = new CommandForge();
public void register(CommandDispatcher<CommandSourceStack> dispatcher) {
dispatcher.register(((Commands.literal("music").requires(this)).executes(this))
.then(Commands.argument("args", StringArgumentType.greedyString())
.suggests(this).executes(this)));
}
@Override
public int run(CommandContext<CommandSourceStack> context) {
var item = context.getSource();
var source = item.source;
var input = context.getInput();
var temp = input.split(" ");
var arg = new String[temp.length - 1];
System.arraycopy(temp, 1, arg, 0, arg.length);
CommandEX.ex(source, context.getSource().getTextName(), arg);
return 0;
}
@Override
public boolean test(CommandSourceStack stack) {
return true;
}
@Override
public CompletableFuture<Suggestions> getSuggestions(CommandContext<CommandSourceStack> context, SuggestionsBuilder builder) {
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);
if (input.endsWith(" "))
builder = builder.createOffset(builder.getInput().lastIndexOf(32) + 1);
List<String> results = CommandEX.getTabList(context.getSource().getTextName(), arg);
for (String s : results) {
builder.suggest(s);
}
return builder.buildFuture();
}
}
@@ -0,0 +1,47 @@
package com.coloryr.allmusic.server.side.forge;
import com.coloryr.allmusic.server.AllMusicForge;
import com.coloryr.allmusic.server.core.AllMusic;
import net.minecraft.commands.CommandSource;
import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.protocol.game.ClientboundSetActionBarTextPacket;
import net.minecraft.server.level.ServerPlayer;
public class ForgeApi {
public static void sendMessageRun(Object obj, String message, String end, String command) {
CommandSource sender = (CommandSource) obj;
MutableComponent send = Component.literal(message);
MutableComponent endtext = Component.literal(end);
endtext.setStyle(endtext.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command)));
send.append(endtext);
sender.sendSystemMessage(send);
}
public static void sendMessageSuggest(Object obj, String message, String end, String command) {
CommandSource sender = (CommandSource) obj;
MutableComponent send = Component.literal(message);
MutableComponent endtext = Component.literal(end);
endtext.setStyle(endtext.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command)));
send.append(endtext);
sender.sendSystemMessage(send);
}
public static void sendBar(ServerPlayer player, String message) {
var pack = new ClientboundSetActionBarTextPacket(Component.literal(message));
player.connection.send(pack);
}
public static void sendMessageBqRun(String message, String end, String command) {
MutableComponent send = Component.literal(message);
MutableComponent endtext = Component.literal(end);
endtext.setStyle(endtext.getStyle().withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, command)));
send.append(endtext);
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
if (!AllMusic.getConfig().mutePlayer.contains(player.getName().getString())) {
player.sendSystemMessage(send);
}
}
}
}
@@ -0,0 +1,16 @@
package com.coloryr.allmusic.server.side.forge;
import com.coloryr.allmusic.server.AllMusicForge;
import com.coloryr.allmusic.server.core.side.IMyLogger;
public class LogForge implements IMyLogger {
@Override
public void warning(String data) {
AllMusicForge.LOGGER.warn(data);
}
@Override
public void info(String data) {
AllMusicForge.LOGGER.info(data);
}
}
@@ -0,0 +1,31 @@
package com.coloryr.allmusic.server.side.forge;
import com.coloryr.allmusic.server.AllMusicForge;
import io.netty.buffer.ByteBuf;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
public record PackData(ByteBuf buffer) implements CustomPacketPayload {
public static final Type<PackData> TYPE = new Type<>(AllMusicForge.channel);
public static final StreamCodec<RegistryFriendlyByteBuf, PackData> CODEC = new PackCodec();
public static class PackCodec implements StreamCodec<RegistryFriendlyByteBuf, PackData> {
@Override
public PackData decode(RegistryFriendlyByteBuf pack) {
return new PackData(pack.asByteBuf());
}
@Override
public void encode(RegistryFriendlyByteBuf pack, PackData buffer) {
pack.writeBytes(buffer.buffer);
}
}
@Override
public Type<? extends CustomPacketPayload> type() {
return TYPE;
}
}
@@ -0,0 +1,483 @@
package com.coloryr.allmusic.server.side.forge;
import com.coloryr.allmusic.server.AllMusicForge;
import com.coloryr.allmusic.server.TaskItem;
import com.coloryr.allmusic.server.Tasks;
import com.coloryr.allmusic.server.core.AllMusic;
import com.coloryr.allmusic.server.core.objs.config.SaveObj;
import com.coloryr.allmusic.server.core.objs.enums.ComType;
import com.coloryr.allmusic.server.core.objs.enums.HudType;
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.ISide;
import com.coloryr.allmusic.server.core.utils.HudUtils;
import com.coloryr.allmusic.server.side.forge.event.MusicAddEvent;
import com.coloryr.allmusic.server.side.forge.event.MusicPlayEvent;
import com.google.gson.Gson;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.commands.CommandSource;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.network.PacketDistributor;
import net.neoforged.neoforge.network.registration.NetworkChannel;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
public class SideForge extends ISide {
@Override
public void reload() {
String path = String.format(Locale.ROOT, "config/%s/", "AllMusic");
new AllMusic().init(new File(path));
}
@Override
public int getAllPlayer() {
return AllMusicForge.server.getPlayerCount();
}
@Override
public void runTask(Runnable run) {
AllMusicForge.server.execute(run);
}
@Override
public void runTask(Runnable run1, int delay) {
Tasks.add(new TaskItem() {{
tick = delay;
run = run1;
}});
}
@Override
public boolean checkPermission(String player, String permission) {
ServerPlayer player1 = AllMusicForge.server.getPlayerList().getPlayerByName(player);
if (player1 == null)
return false;
return player1.hasPermissions(2);
}
@Override
public boolean needPlay() {
int online = getAllPlayer();
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
if (AllMusic.getConfig().mutePlayer.contains(player.getName().getString())) {
online--;
}
}
return online > 0;
}
@Override
protected void topSendStop() {
try {
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.STOP.ordinal());
send(player, buf);
}
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
e.printStackTrace();
}
}
@Override
protected void topSendStop(String name) {
try {
ServerPlayer player = AllMusicForge.server.getPlayerList().getPlayerByName(name);
if (player == null)
return;
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.STOP.ordinal());
send(player, buf);
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
e.printStackTrace();
}
}
@Override
public void sendMusic(String url) {
try {
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
if (AllMusic.isOK(player.getName().getString(), null, false))
continue;
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.PLAY.ordinal());
writeString(buf, url);
send(player, buf);
AllMusic.addNowPlayPlayer(player.getName().getString());
}
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c歌曲指令发送出错");
e.printStackTrace();
}
}
@Override
protected void topSendMusic(String player, String url) {
try {
ServerPlayer player1 = AllMusicForge.server.getPlayerList().getPlayerByName(player);
if (player1 == null)
return;
if (AllMusic.isOK(player, null, false))
return;
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.PLAY.ordinal());
writeString(buf, url);
send(player1, buf);
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c歌曲指令发送出错");
e.printStackTrace();
}
}
@Override
public void sendPic(String url) {
try {
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
if (!obj.pic.enable)
continue;
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.IMG.ordinal());
writeString(buf, url);
send(player, buf);
}
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c图片指令发送出错");
e.printStackTrace();
}
}
@Override
public void sendPic(String player, String url) {
try {
ServerPlayer player1 = AllMusicForge.server.getPlayerList().getPlayerByName(player);
if (player1 == null)
return;
if (AllMusic.isOK(player1.getName().getString(), null, true))
return;
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.IMG.ordinal());
writeString(buf, url);
send(player1, buf);
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c图片指令发送出错");
e.printStackTrace();
}
}
@Override
public void sendPos(String player, int pos) {
try {
ServerPlayer player1 = AllMusicForge.server.getPlayerList().getPlayerByName(player);
if (player1 == null)
return;
if (AllMusic.isOK(player1.getName().getString(), null, true))
return;
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.POS.ordinal());
buf.writeInt(pos);
send(player1, buf);
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c清空Hud发生出错");
e.printStackTrace();
}
}
@Override
public void sendHudLyric(String data) {
try {
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
if (!obj.lyric.enable)
continue;
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.LYRIC.ordinal());
writeString(buf, data);
send(player, buf);
}
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c歌词发送出错");
e.printStackTrace();
}
}
@Override
public void sendHudInfo(String data) {
try {
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
if (!obj.info.enable)
continue;
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.INFO.ordinal());
writeString(buf, data);
send(player, buf);
}
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c歌词信息发送出错");
e.printStackTrace();
}
}
@Override
public void sendHudPos(String name) {
try {
ServerPlayer player = AllMusicForge.server.getPlayerList().getPlayerByName(name);
if (player == null)
return;
SaveObj obj = HudUtils.get(name);
String data = AllMusic.gson.toJson(obj);
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.HUD.ordinal());
writeString(buf, data);
send(player, buf);
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c界面位置发送出错");
e.printStackTrace();
}
}
@Override
public void sendHud(String name, HudType pos, String data) {
try {
if (pos == HudType.PIC) {
return;
}
ServerPlayer player = AllMusicForge.server.getPlayerList().getPlayerByName(name);
if (player == null)
return;
if (AllMusic.isOK(name, null, true))
return;
ByteBuf buf = Unpooled.buffer();
switch (pos) {
case INFO:
buf.writeByte(ComType.INFO.ordinal());
break;
case LIST:
buf.writeByte(ComType.LIST.ordinal());
break;
case LYRIC:
buf.writeByte(ComType.LYRIC.ordinal());
break;
}
writeString(buf, data);
send(player, buf);
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
e.printStackTrace();
}
}
@Override
public void sendHudList(String data) {
try {
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
if (!obj.list.enable)
continue;
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.LIST.ordinal());
writeString(buf, data);
send(player, buf);
}
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c歌曲列表发送出错");
e.printStackTrace();
}
}
@Override
public void sendHudUtilsAll() {
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
String Name = player.getName().getString();
try {
SaveObj obj = HudUtils.get(Name);
String data = new Gson().toJson(obj);
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.HUD.ordinal());
writeString(buf, data);
send(player, buf);
} catch (Exception e1) {
AllMusic.log.warning("§d[AllMusic]§c数据发送发生错误");
e1.printStackTrace();
}
}
}
@Override
public void sendBar(String data) {
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
try {
if (AllMusic.isOK(player.getName().getString(), null, true))
continue;
ForgeApi.sendBar(player, data);
} catch (Exception e1) {
AllMusic.log.warning("§d[AllMusic]§c数据发送发生错误");
e1.printStackTrace();
}
}
}
@Override
public void clearHud(String player) {
try {
ServerPlayer player1 = AllMusicForge.server.getPlayerList().getPlayerByName(player);
if (player1 == null)
return;
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.CLEAR.ordinal());
send(player1, buf);
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c清空Hud发生出错");
e.printStackTrace();
}
}
@Override
public void clearHud() {
try {
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
ByteBuf buf = Unpooled.buffer();
buf.writeByte(ComType.CLEAR.ordinal());
send(player, buf);
}
} catch (Exception e) {
AllMusic.log.warning("§d[AllMusic]§c清空Hud发生出错");
e.printStackTrace();
}
}
@Override
public void bq(String data) {
if (AllMusic.getConfig().messageLimit
&& data.length() > AllMusic.getConfig().messageLimitSize) {
data = data.substring(0, AllMusic.getConfig().messageLimitSize - 1) + "...";
}
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
if (!AllMusic.getConfig().mutePlayer.contains(player.getName().getString())) {
player.sendSystemMessage(Component.literal(data));
}
}
}
@Override
public void bqRun(String message, String end, String command) {
ForgeApi.sendMessageBqRun(message, end, command);
}
@Override
public void bqt(String data) {
if (AllMusic.getConfig().messageLimit
&& data.length() > AllMusic.getConfig().messageLimitSize) {
data = data.substring(0, AllMusic.getConfig().messageLimitSize - 1) + "...";
}
var finalData = Component.literal(data);
runTask(() -> {
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
if (!AllMusic.getConfig().mutePlayer.contains(player.getName().getString())) {
player.sendSystemMessage(finalData);
}
}
});
}
@Override
public void sendMessaget(Object obj, String message) {
runTask(() -> ((CommandSource) obj).sendSystemMessage(Component.literal(message)));
}
@Override
public void sendMessage(Object obj, String message) {
CommandSource sender = (CommandSource) obj;
sender.sendSystemMessage(Component.literal(message));
}
@Override
public void sendMessageRun(Object obj, String message, String end, String command) {
ForgeApi.sendMessageRun(obj, message, end, command);
}
@Override
public void sendMessageSuggest(Object obj, String message, String end, String command) {
ForgeApi.sendMessageSuggest(obj, message, end, command);
}
@Override
public boolean onMusicPlay(SongInfoObj obj) {
MusicPlayEvent event = new MusicPlayEvent(obj);
NeoForge.EVENT_BUS.post(event);
return event.isCancel();
}
@Override
public boolean onMusicAdd(Object obj, MusicObj music) {
MusicAddEvent event = new MusicAddEvent(music, (ServerPlayer) obj);
NeoForge.EVENT_BUS.post(event);
return event.isCancel();
}
@Override
public void updateInfo() {
}
@Override
public void updateLyric() {
}
@Override
public void ping() {
}
@Override
public List<String> getPlayerList() {
List<String> list = new ArrayList<>();
for (ServerPlayer player : AllMusicForge.server.getPlayerList().getPlayers()) {
list.add(player.getName().getString());
}
return list;
}
private void send(ServerPlayer players, ByteBuf data) {
if (players == null)
return;
try {
runTask(() -> PacketDistributor.sendToPlayer(players, new PackData(data)));
} catch (Exception e) {
AllMusic.log.warning("§c数据发送发生错误");
e.printStackTrace();
}
}
private void writeString(ByteBuf buf, String data) {
byte[] temp = data.getBytes(StandardCharsets.UTF_8);
buf.writeInt(temp.length)
.writeBytes(temp);
}
}
@@ -0,0 +1,39 @@
package com.coloryr.allmusic.server.side.forge.event;
import com.coloryr.allmusic.server.core.objs.music.MusicObj;
import net.minecraft.server.level.ServerPlayer;
import net.neoforged.bus.api.Event;
public class MusicAddEvent extends Event {
/**
* 添加的音乐
*/
private final MusicObj music;
/**
* 添加者
*/
private final ServerPlayer player;
private boolean cancel;
public MusicAddEvent(MusicObj id, ServerPlayer player) {
this.music = id;
this.player = player;
}
public boolean isCancel() {
return cancel;
}
public void setCancel(boolean cancel) {
this.cancel = cancel;
}
public ServerPlayer getPlayer() {
return player;
}
public MusicObj getMusic() {
return music;
}
}
@@ -0,0 +1,25 @@
package com.coloryr.allmusic.server.side.forge.event;
import com.coloryr.allmusic.server.core.objs.music.SongInfoObj;
import net.neoforged.bus.api.Event;
public class MusicPlayEvent extends Event {
private final SongInfoObj music;
private boolean cancel;
public MusicPlayEvent(SongInfoObj music) {
this.music = music;
}
public boolean isCancel() {
return cancel;
}
public void setCancel(boolean cancel) {
this.cancel = cancel;
}
public SongInfoObj getMusic() {
return music;
}
}
@@ -0,0 +1,94 @@
# This is an example mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here: https://github.com/toml-lang/toml
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
modLoader="javafml" #mandatory
# A version range to match for said mod loader - for regular FML @Mod it will be the the FML version. This is currently 47.
loaderVersion="${loader_version_range}" #mandatory
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="${mod_license}"
# A URL to refer people to when problems occur with this mod
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="${mod_id}" #mandatory
# The version number of the mod
version="${mod_version}" #mandatory
# A display name for the mod
displayName="${mod_name}" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://docs.neoforged.net/docs/misc/updatechecker/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
logoFile="icon.png" #optional
# A text field displayed in the mod UI
#credits="" #optional
# A text field displayed in the mod UI
authors="${mod_authors}" #optional
# Display Test controls the display for your mod in the server connection screen
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component.
# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value.
# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself.
#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional)
# The description text for the mod (multi line!) (#mandatory)
description='''${mod_description}'''
# The [[mixins]] block allows you to declare your mixin config to FML so that it gets loaded.
#[[mixins]]
#config="${mod_id}.mixins.json"
# The [[accessTransformers]] block allows you to declare where your AT file is.
# If this block is omitted, a fallback attempt will be made to load an AT from META-INF/accesstransformer.cfg
#[[accessTransformers]]
#file="META-INF/accesstransformer.cfg"
# The coremods config file path is not configurable and is always loaded from META-INF/coremods.json
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.${mod_id}]] #optional
# the modid of the dependency
modId="neoforge" #mandatory
# The type of the dependency. Can be one of "required", "optional", "incompatible" or "discouraged" (case insensitive).
# 'required' requires the mod to exist, 'optional' does not
# 'incompatible' will prevent the game from loading when the mod exists, and 'discouraged' will show a warning
type="required" #mandatory
# Optional field describing why the dependency is required or why it is incompatible
# reason="..."
# The version range of the dependency
versionRange="${neo_version_range}" #mandatory
# An ordering relationship for the dependency.
# BEFORE - This mod is loaded BEFORE the dependency
# AFTER - This mod is loaded AFTER the dependency
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
side="SERVER"
# Here's another dependency
[[dependencies.${mod_id}]]
modId="minecraft"
type="required"
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="${minecraft_version_range}"
ordering="NONE"
side="SERVER"
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

+1 -1
View File
@@ -8,7 +8,7 @@ setlocal enabledelayedexpansion
set array=folia server_top server forge_1_20 forge_1_19_3 ^
forge_1_19_2 forge_1_18_2 forge_1_16_5 forge_1_12_2 ^
fabric_1_20_2 fabric_1_20 fabric_1_19_3 fabric_1_19_2 fabric_1_18_2 ^
fabric_1_16_5 neoforge_1_20_4
fabric_1_16_5 neoforge_1_20_4 neoforge_1_20_5
for %%i in (%array%) do (
if exist "%%i\src\main\java\com\coloryr\allmusic\server\core" rmdir "%%i\src\main\java\com\coloryr\allmusic\server\core" "core"