mirror of
https://github.com/Coloryr/AllMusic.git
synced 2026-11-22 16:39:44 +00:00
Merge remote-tracking branch 'origin1/main'
This commit is contained in:
commit
62fd85cffe
50 files changed
+398
-189
No files matched your search
@@ -38,6 +38,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd onejar && cd fabric_1_16_5 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_onejar_fabric_1_16_5"
|
||||
@@ -63,6 +64,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd onejar && cd fabric_1_20_1 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_onejar_fabric_1_20_1"
|
||||
@@ -88,6 +90,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd onejar && cd fabric_1_21 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_onejar_fabric_1_21"
|
||||
@@ -113,6 +116,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd onejar && cd fabric_1_21_6 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_onejar_fabric_1_21_6"
|
||||
@@ -138,6 +142,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd onejar && cd fabric_1_21_11 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_onejar_fabric_1_21_11"
|
||||
@@ -163,6 +168,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd onejar && cd neoforge_1_21 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_onejar_neoforge_1_21"
|
||||
@@ -188,6 +194,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd onejar && cd neoforge_1_21_6 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_onejar_neoforge_1_21_6"
|
||||
@@ -213,6 +220,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd onejar && cd neoforge_1_21_11 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_onejar_neoforge_1_21_11"
|
||||
|
||||
@@ -38,6 +38,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd folia && gradlew shadowJar
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_folia"
|
||||
@@ -63,6 +64,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd paper && gradlew shadowJar
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_paper"
|
||||
@@ -88,6 +90,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd velocity && gradlew shadowJar
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_velocity"
|
||||
@@ -113,6 +116,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd fabric_1_16_5 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_fabric_1_16_5"
|
||||
@@ -138,6 +142,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd fabric_1_20_1 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_fabric_1_20_1"
|
||||
@@ -163,6 +168,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd fabric_1_21 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_fabric_1_21"
|
||||
@@ -213,6 +219,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd fabric_1_21_11 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_fabric_1_21_11"
|
||||
@@ -263,6 +270,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd forge_1_7_10 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_forge_1_7_10"
|
||||
@@ -288,6 +296,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd forge_1_12_2 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_forge_1_12_2"
|
||||
@@ -313,6 +322,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd forge_1_16_5 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_forge_1_16_5"
|
||||
@@ -338,6 +348,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd forge_1_20_1 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_forge_1_20_1"
|
||||
@@ -363,6 +374,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd neoforge_1_21 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_neoforge_1_21"
|
||||
@@ -388,6 +400,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd neoforge_1_21_6 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_neoforge_1_21_6"
|
||||
@@ -413,6 +426,7 @@ jobs:
|
||||
run: |
|
||||
link.cmd && cd neoforge_1_21_11 && gradlew build
|
||||
- name: update
|
||||
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref_name, 'debug')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: "allmusic_server_neoforge_1_21_11"
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
# This is an example neoforge.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 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="examplemod.png" #optional
|
||||
|
||||
# A text field displayed in the mod UI
|
||||
#credits="" #optional
|
||||
|
||||
# A text field displayed in the mod UI
|
||||
authors="${mod_authors}" #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="BOTH"
|
||||
|
||||
# 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="BOTH"
|
||||
|
||||
# Features are specific properties of the game environment, that you may want to declare you require. This example declares
|
||||
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
|
||||
# stop your mod loading on the server for example.
|
||||
#[features.${mod_id}]
|
||||
#openGLVersion="[3.2,)"
|
||||
@@ -12,6 +12,7 @@ import com.coloryr.allmusic.server.core.side.BaseSide;
|
||||
import com.coloryr.allmusic.server.core.side.IAllMusicLogger;
|
||||
import com.coloryr.allmusic.server.core.sql.DataSql;
|
||||
import com.coloryr.allmusic.server.core.sql.IEconomy;
|
||||
import com.coloryr.allmusic.server.core.utils.StringReplacer;
|
||||
import com.coloryr.allmusic.server.netapi.NetiApiMain;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@@ -50,11 +51,11 @@ public class AllMusic {
|
||||
/**
|
||||
* 配置文件版本号
|
||||
*/
|
||||
public static final String configVersion = "206";
|
||||
public static final String configVersion = "207";
|
||||
/**
|
||||
* 语言文件配置版本号
|
||||
*/
|
||||
public static final String messageVersion = "210";
|
||||
public static final String messageVersion = "212";
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
@@ -95,6 +96,14 @@ public class AllMusic {
|
||||
* 语言文件
|
||||
*/
|
||||
private static File messageFile;
|
||||
/**
|
||||
* 正则替换器
|
||||
*/
|
||||
private static StringReplacer replacer;
|
||||
|
||||
public static StringReplacer getReplacer() {
|
||||
return replacer;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查配置文件完整性
|
||||
@@ -320,6 +329,13 @@ public class AllMusic {
|
||||
if (!AllMusic.configVersion.equalsIgnoreCase(config.version)) {
|
||||
log.data("<light_purple>[AllMusic3]<red>请及时更新配置文件");
|
||||
}
|
||||
|
||||
replacer = new StringReplacer();
|
||||
if (!config.lyricReplace.isEmpty()) {
|
||||
for (Map.Entry<String, String> item : config.lyricReplace.entrySet()) {
|
||||
replacer.put(item.getKey(), item.getValue());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.data("<light_purple>[AllMusic3]<red>读取配置文件错误");
|
||||
e.printStackTrace();
|
||||
@@ -332,34 +348,17 @@ public class AllMusic {
|
||||
* @param player 用户名
|
||||
*/
|
||||
public static void joinPlay(String player) {
|
||||
DataSql.task(() -> {
|
||||
String player1 = player.toLowerCase();
|
||||
if (DataSql.checkMutePlayer(player1) || PlayMusic.containNowPlay(player1)) {
|
||||
return;
|
||||
}
|
||||
if (DataSql.checkMuteListPlayer(player1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
AllMusic.side.runTask(() -> {
|
||||
SongInfoObj music = PlayMusic.nowPlayMusic;
|
||||
if (music != null && PlayMusic.url != null) {
|
||||
AllMusic.side.sendHudPos(player1);
|
||||
AllMusic.side.sendMusic(player1, PlayMusic.url);
|
||||
AllMusic.side.sendPic(player1, music.getPicUrl());
|
||||
AllMusic.side.sendPos(player1, (int) PlayMusic.musicNowTime);
|
||||
}
|
||||
}, 20);
|
||||
});
|
||||
AllMusic.side.runTask(() -> joinPlayNow(player), AllMusic.config.joinDelay);
|
||||
}
|
||||
|
||||
public static void joinPlay(String player, String server) {
|
||||
public static void joinPlayNow(String player) {
|
||||
DataSql.task(() -> {
|
||||
String player1 = player.toLowerCase();
|
||||
Object player2 = AllMusic.side.getPlayer(player1);
|
||||
String server = AllMusic.side.getPlayerServer(player2);
|
||||
if (server != null && AllMusic.getConfig().muteServer.contains(server)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String player1 = player.toLowerCase();
|
||||
if (DataSql.checkMutePlayer(player1)) {
|
||||
return;
|
||||
}
|
||||
@@ -373,7 +372,7 @@ public class AllMusic {
|
||||
AllMusic.side.sendHudPos(player1);
|
||||
AllMusic.side.sendMusic(player1, PlayMusic.url);
|
||||
AllMusic.side.sendPic(player1, music.getPicUrl());
|
||||
AllMusic.side.runTask(() -> AllMusic.side.sendPos(player1, (int) PlayMusic.musicNowTime), 50);
|
||||
AllMusic.side.runTask(() -> AllMusic.side.sendPos(player1, (int) PlayMusic.musicNowTime), 20);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -41,6 +41,7 @@ public class CommandEX {
|
||||
commandList.put("lastpage", new CommandLastPage());
|
||||
commandList.put("hud", new CommandHud());
|
||||
commandList.put("push", new CommandPush());
|
||||
commandList.put("join", new CommandJoin());
|
||||
commandList.put("cancel", new CommandCancel());
|
||||
|
||||
commandAdminList.put("reload", new CommandReload());
|
||||
|
||||
+2
@@ -56,6 +56,8 @@ public class CommandHelp extends ACommand {
|
||||
.append(AllMusic.miniMessageSuggest(AllMusic.getMessage().click.clickCheck, "/music hud pic rotate ")));
|
||||
AllMusic.side.sendMessage(sender, AllMusic.miniMessage(AllMusic.getMessage().help.normal.hud5)
|
||||
.append(AllMusic.miniMessageSuggest(AllMusic.getMessage().click.clickCheck, "/music hud pic speed ")));
|
||||
AllMusic.side.sendMessage(sender, AllMusic.miniMessage(AllMusic.getMessage().help.normal.join)
|
||||
.append(AllMusic.miniMessageRun(AllMusic.getMessage().click.clickRun, "/music join")));
|
||||
if (AllMusic.side.checkPermission(sender)) {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.miniMessage(AllMusic.getMessage().help.admin.reload)
|
||||
.append(AllMusic.miniMessageRun(AllMusic.getMessage().click.clickRun, "/music reload")));
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.coloryr.allmusic.server.core.command.sub;
|
||||
|
||||
import com.coloryr.allmusic.server.core.AllMusic;
|
||||
import com.coloryr.allmusic.server.core.command.ACommand;
|
||||
|
||||
public class CommandJoin extends ACommand {
|
||||
@Override
|
||||
public void execute(Object sender, String name, String[] args) {
|
||||
AllMusic.joinPlayNow(name);
|
||||
}
|
||||
}
|
||||
+7
-4
@@ -4,6 +4,7 @@ import com.coloryr.allmusic.server.core.AllMusic;
|
||||
import com.coloryr.allmusic.server.core.command.ACommand;
|
||||
import com.coloryr.allmusic.server.core.command.PermissionList;
|
||||
import com.coloryr.allmusic.server.core.music.PlayMusic;
|
||||
import com.coloryr.allmusic.server.core.music.PlayRuntime;
|
||||
import com.coloryr.allmusic.server.core.objs.message.ARG;
|
||||
import com.coloryr.allmusic.server.core.objs.music.SongInfoObj;
|
||||
import com.coloryr.allmusic.server.core.sql.DataSql;
|
||||
@@ -72,11 +73,12 @@ public class CommandPush extends ACommand {
|
||||
PlayMusic.startPush(name, music);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.doVote);
|
||||
String data = AllMusic.getMessage().push.bq;
|
||||
AllMusic.side.broadcast(data
|
||||
.replace(ARG.player, name)
|
||||
data = data.replace(ARG.player, name)
|
||||
.replace(ARG.time, String.valueOf(AllMusic.getConfig().voteTime))
|
||||
.replace(ARG.musicName, music.getName())
|
||||
.replace(ARG.musicAuthor, music.getAuthor()));
|
||||
.replace(ARG.musicAuthor, music.getAuthor())
|
||||
.replace(ARG.countAll, String.valueOf(PlayRuntime.getMiniVote()));
|
||||
AllMusic.side.broadcast(data);
|
||||
AllMusic.side.broadcast(AllMusic.miniMessage(AllMusic.getMessage().push.bq1)
|
||||
.append(AllMusic.miniMessageRun(AllMusic.getMessage().push.bq2, "/music push")));
|
||||
} else {
|
||||
@@ -89,7 +91,8 @@ public class CommandPush extends ACommand {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.agree);
|
||||
String data = AllMusic.getMessage().push.bqAgree;
|
||||
data = data.replace(ARG.player, name)
|
||||
.replace(ARG.count, String.valueOf(PlayMusic.getVoteCount()));
|
||||
.replace(ARG.count, String.valueOf(PlayMusic.getVoteCount()))
|
||||
.replace(ARG.countAll, String.valueOf(PlayRuntime.getMiniVote()));
|
||||
AllMusic.side.broadcast(data);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().push.arAgree);
|
||||
|
||||
+7
-3
@@ -4,6 +4,7 @@ import com.coloryr.allmusic.server.core.AllMusic;
|
||||
import com.coloryr.allmusic.server.core.command.ACommand;
|
||||
import com.coloryr.allmusic.server.core.command.PermissionList;
|
||||
import com.coloryr.allmusic.server.core.music.PlayMusic;
|
||||
import com.coloryr.allmusic.server.core.music.PlayRuntime;
|
||||
import com.coloryr.allmusic.server.core.objs.message.ARG;
|
||||
import com.coloryr.allmusic.server.core.sql.DataSql;
|
||||
|
||||
@@ -40,8 +41,10 @@ public class CommandVote extends ACommand {
|
||||
PlayMusic.startVote(name);
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().vote.doVote);
|
||||
String data = AllMusic.getMessage().vote.bq;
|
||||
AllMusic.side.broadcast(data.replace(ARG.player, name)
|
||||
.replace(ARG.time, String.valueOf(AllMusic.getConfig().voteTime)));
|
||||
data = data.replace(ARG.player, name)
|
||||
.replace(ARG.time, String.valueOf(AllMusic.getConfig().voteTime))
|
||||
.replace(ARG.countAll, String.valueOf(PlayRuntime.getMiniVote()));
|
||||
AllMusic.side.broadcast(data);
|
||||
AllMusic.side.broadcast(AllMusic.miniMessage(AllMusic.getMessage().vote.bq1)
|
||||
.append(AllMusic.miniMessageRun(AllMusic.getMessage().vote.bq2, "/music vote")));
|
||||
} else {
|
||||
@@ -50,7 +53,8 @@ public class CommandVote extends ACommand {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().vote.agree);
|
||||
String data = AllMusic.getMessage().vote.bqAgree;
|
||||
data = data.replace(ARG.player, name)
|
||||
.replace(ARG.count, String.valueOf(PlayMusic.getVoteCount()));
|
||||
.replace(ARG.count, String.valueOf(PlayMusic.getVoteCount()))
|
||||
.replace(ARG.countAll, String.valueOf(PlayRuntime.getMiniVote()));
|
||||
AllMusic.side.broadcast(data);
|
||||
} else {
|
||||
AllMusic.side.sendMessage(sender, AllMusic.getMessage().vote.arAgree);
|
||||
|
||||
@@ -137,6 +137,10 @@ public class PlayRuntime {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int getMiniVote() {
|
||||
return Math.min(AllMusic.getConfig().minVote, AllMusic.side.getPlayers().size());
|
||||
}
|
||||
|
||||
/**
|
||||
* 事务定时器
|
||||
*/
|
||||
@@ -156,10 +160,7 @@ public class PlayRuntime {
|
||||
PlayMusic.clearPush();
|
||||
AllMusic.side.broadcastInTask(AllMusic.getMessage().push.timeOut);
|
||||
} else {
|
||||
int players = AllMusic.side.getPlayers().size();
|
||||
if (PlayMusic.getPushCount() >= AllMusic.getConfig().minVote
|
||||
|| (players <= AllMusic.getConfig().minVote
|
||||
&& players <= PlayMusic.getPushCount())) {
|
||||
if (PlayMusic.getPushCount() >= getMiniVote()) {
|
||||
PlayMusic.pushMusic();
|
||||
PlayMusic.clearPush();
|
||||
AllMusic.side.broadcastInTask(AllMusic.getMessage().push.doPush);
|
||||
@@ -174,10 +175,7 @@ public class PlayRuntime {
|
||||
PlayMusic.clearVote();
|
||||
AllMusic.side.broadcastInTask(AllMusic.getMessage().vote.timeOut);
|
||||
} else {
|
||||
int players = AllMusic.side.getPlayers().size();
|
||||
if (PlayMusic.getVoteCount() >= AllMusic.getConfig().minVote
|
||||
|| (players <= AllMusic.getConfig().minVote
|
||||
&& players <= PlayMusic.getVoteCount())) {
|
||||
if (PlayMusic.getVoteCount() >= getMiniVote()) {
|
||||
PlayMusic.musicLessTime = 0;
|
||||
PlayMusic.clearVote();
|
||||
AllMusic.side.broadcastInTask(AllMusic.getMessage().vote.voteDone);
|
||||
|
||||
+16
-2
@@ -3,8 +3,7 @@ package com.coloryr.allmusic.server.core.objs.config;
|
||||
import com.coloryr.allmusic.codec.HudPosObj;
|
||||
import com.coloryr.allmusic.server.core.AllMusic;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 配置文件对象
|
||||
@@ -122,6 +121,14 @@ public class ConfigObj {
|
||||
* 信息更新延迟
|
||||
*/
|
||||
public int sendDelay;
|
||||
/**
|
||||
* 中途加入延迟
|
||||
*/
|
||||
public int joinDelay;
|
||||
/**
|
||||
* 歌词正则替换
|
||||
*/
|
||||
public Map<String, String> lyricReplace;
|
||||
|
||||
public static ConfigObj make() {
|
||||
ConfigObj config = new ConfigObj();
|
||||
@@ -160,6 +167,10 @@ public class ConfigObj {
|
||||
saveConfig = true;
|
||||
cost = CostObj.make();
|
||||
}
|
||||
if (lyricReplace == null) {
|
||||
saveConfig = true;
|
||||
lyricReplace = new HashMap<>();
|
||||
}
|
||||
|
||||
return saveConfig;
|
||||
}
|
||||
@@ -169,6 +180,7 @@ public class ConfigObj {
|
||||
maxPlayList = 10;
|
||||
minVote = 3;
|
||||
voteTime = 30;
|
||||
|
||||
adminList = new HashSet<>();
|
||||
adminList.add("color_yr");
|
||||
muteServer = new HashSet<>();
|
||||
@@ -192,6 +204,8 @@ public class ConfigObj {
|
||||
ktvLyricDelay = 0;
|
||||
lyricDelay = 0;
|
||||
sendDelay = 1000;
|
||||
joinDelay = 1000;
|
||||
lyricReplace = new HashMap<>();
|
||||
version = AllMusic.configVersion;
|
||||
}
|
||||
}
|
||||
@@ -24,5 +24,6 @@ public class ARG {
|
||||
public static String klyric = "%KLyric%";
|
||||
public static String list = "%List%";
|
||||
public static String count = "%Count%";
|
||||
public static String countAll = "%CountAll%";
|
||||
public static String time = "%Time%";
|
||||
}
|
||||
+5
@@ -26,6 +26,7 @@ public class HelpNormalObj {
|
||||
public String hud8;
|
||||
public String hud9;
|
||||
public String hud10;
|
||||
public String join;
|
||||
|
||||
public static HelpNormalObj make() {
|
||||
HelpNormalObj obj = new HelpNormalObj();
|
||||
@@ -83,6 +84,8 @@ public class HelpNormalObj {
|
||||
return true;
|
||||
if (lastpage == null)
|
||||
return true;
|
||||
if (join == null)
|
||||
return true;
|
||||
return hud5 == null;
|
||||
}
|
||||
|
||||
@@ -137,5 +140,7 @@ public class HelpNormalObj {
|
||||
hud4 = "<light_purple>[AllMusic3]<yellow>/music hud pic rotate [开关] 设置图片旋转模式";
|
||||
if (hud5 == null)
|
||||
hud5 = "<light_purple>[AllMusic3]<yellow>/music hud pic speed [数值] 设置图片旋转速度";
|
||||
if (join == null)
|
||||
join = "<light_purple>[AllMusic3]<yellow>/music join 重新播放当前歌曲";
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -71,7 +71,7 @@ public class PushObj {
|
||||
if (doVote == null)
|
||||
doVote = "<light_purple>[AllMusic3]<yellow>已发起插歌投票";
|
||||
if (bq == null)
|
||||
bq = "<light_purple>[AllMusic3]<yellow>" + ARG.player + "发起了插歌投票,将曲目" + ARG.musicName + "-" + ARG.musicAuthor + "调整到下一首播放," + ARG.time + "秒后结束,输入/music push 同意插歌。";
|
||||
bq = "<light_purple>[AllMusic3]<yellow>" + ARG.player + "发起了插歌投票,将曲目" + ARG.musicName + "-" + ARG.musicAuthor + "调整到下一首播放," + ARG.time + "秒后结束,输入/music push 同意插歌,需要至少" + ARG.countAll + "名玩家同意才会插歌。";
|
||||
if (bq1 == null)
|
||||
bq1 = "<light_purple>[AllMusic3]<yellow>或者点击 ";
|
||||
if (bq2 == null)
|
||||
@@ -79,7 +79,7 @@ public class PushObj {
|
||||
if (agree == null)
|
||||
agree = "<light_purple>[AllMusic3]<yellow>你同意插歌";
|
||||
if (bqAgree == null)
|
||||
bqAgree = "<light_purple>[AllMusic3]<yellow>" + ARG.player + "同意插歌,共有" + ARG.count + "名玩家同意插歌。";
|
||||
bqAgree = "<light_purple>[AllMusic3]<yellow>" + ARG.player + "同意插歌,共有" + ARG.count + "名玩家同意插歌,需要至少" + ARG.countAll + "名玩家同意才会插歌。";
|
||||
if (arAgree == null)
|
||||
arAgree = "<light_purple>[AllMusic3]<yellow>你已申请插歌";
|
||||
if (timeOut == null)
|
||||
|
||||
+2
-2
@@ -59,7 +59,7 @@ public class VoteObj {
|
||||
if (doVote == null)
|
||||
doVote = "<light_purple>[AllMusic3]<yellow>已发起切歌投票";
|
||||
if (bq == null)
|
||||
bq = "<light_purple>[AllMusic3]<yellow>" + ARG.player + "发起了切歌投票," + ARG.time + "秒后结束,输入/music vote 同意切歌。";
|
||||
bq = "<light_purple>[AllMusic3]<yellow>" + ARG.player + "发起了切歌投票," + ARG.time + "秒后结束,输入/music vote 同意切歌,需要至少" + ARG.countAll + "名玩家同意才会切歌。";
|
||||
if (bq1 == null)
|
||||
bq1 = "<light_purple>[AllMusic3]<yellow>或者点击 ";
|
||||
if (bq2 == null)
|
||||
@@ -67,7 +67,7 @@ public class VoteObj {
|
||||
if (agree == null)
|
||||
agree = "<light_purple>[AllMusic3]<yellow>你同意切歌";
|
||||
if (bqAgree == null)
|
||||
bqAgree = "<light_purple>[AllMusic3]<yellow>" + ARG.player + "同意切歌,共有" + ARG.count + "名玩家同意切歌。";
|
||||
bqAgree = "<light_purple>[AllMusic3]<yellow>" + ARG.player + "同意切歌,共有" + ARG.count + "名玩家同意切歌,需要至少" + ARG.countAll + "名玩家同意才会切歌。";
|
||||
if (arAgree == null)
|
||||
arAgree = "<light_purple>[AllMusic3]<yellow>你已申请切歌";
|
||||
if (timeOut == null)
|
||||
|
||||
@@ -154,7 +154,7 @@ public abstract class BaseSide {
|
||||
* 重载
|
||||
*/
|
||||
public final void reload() {
|
||||
new AllMusic().init(getFolder());
|
||||
AllMusic.init(getFolder());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.coloryr.allmusic.server.core.utils;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class StringReplacer {
|
||||
private Map<String, String> literalMap = new LinkedHashMap<>();
|
||||
private Map<Pattern, String> regexMap = new LinkedHashMap<>();
|
||||
|
||||
// 自动判断是否为正则表达式
|
||||
public void put(String search, String replacement) {
|
||||
if (isRegex(search)) {
|
||||
regexMap.put(Pattern.compile(search), replacement);
|
||||
} else {
|
||||
literalMap.put(search, replacement);
|
||||
}
|
||||
}
|
||||
|
||||
// 判断字符串是否包含正则表达式特征
|
||||
private boolean isRegex(String str) {
|
||||
return str.matches(".*[.\\[\\]{}(),*+?|^$\\\\].*");
|
||||
}
|
||||
|
||||
// 强制添加为正则表达式
|
||||
public void putRegex(String regex, String replacement) {
|
||||
regexMap.put(Pattern.compile(regex), replacement);
|
||||
}
|
||||
|
||||
// 强制添加为普通字符串
|
||||
public void putLiteral(String literal, String replacement) {
|
||||
literalMap.put(literal, replacement);
|
||||
}
|
||||
|
||||
// 执行替换
|
||||
public String replace(String input) {
|
||||
String result = input;
|
||||
|
||||
// 先替换普通字符串(更快)
|
||||
for (Map.Entry<String, String> entry : literalMap.entrySet()) {
|
||||
result = result.replace(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
// 再替换正则表达式
|
||||
for (Map.Entry<Pattern, String> entry : regexMap.entrySet()) {
|
||||
result = entry.getKey().matcher(result).replaceAll(entry.getValue());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -11,13 +11,13 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class LyricDecoder {
|
||||
private static final Pattern p = Pattern.compile("\\(([0-9]+),[0-9]+.[0-9]\\)");
|
||||
private final Map<Long, LyricItemObj> temp = new LinkedHashMap<>();
|
||||
private final Map<Long, LyricItemObj> lyrics = new LinkedHashMap<>();
|
||||
public boolean isHave = false;
|
||||
public boolean isHaveK = false;
|
||||
public Map<Long, String> kly = new LinkedHashMap<>();
|
||||
|
||||
public Map<Long, LyricItemObj> getTemp() {
|
||||
return temp;
|
||||
public Map<Long, LyricItemObj> getLyrics() {
|
||||
return lyrics;
|
||||
}
|
||||
|
||||
public Map<Long, String> getKLyric() {
|
||||
@@ -62,12 +62,18 @@ public class LyricDecoder {
|
||||
isHaveK = true;
|
||||
}
|
||||
|
||||
for (Map.Entry<Long, String> item : temp.entrySet()) {
|
||||
this.temp.put(item.getKey(), new LyricItemObj(item.getValue(),
|
||||
haveT ? temp1.get(item.getKey()) : null));
|
||||
if (isHaveK) {
|
||||
for (Map.Entry<Long, String> item : temp.entrySet()) {
|
||||
this.lyrics.put(item.getKey(), new LyricItemObj(item.getValue(), haveT ? temp1.get(item.getKey()) : null));
|
||||
}
|
||||
} else {
|
||||
for (Map.Entry<Long, String> item : temp.entrySet()) {
|
||||
String value = AllMusic.getReplacer().replace(item.getValue());
|
||||
String value1 = AllMusic.getReplacer().replace(temp1.get(item.getKey()));
|
||||
this.lyrics.put(item.getKey(), new LyricItemObj(value, haveT ? value1 : null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
isHave = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -205,16 +205,16 @@ public class NetiApiMain implements IMusicApi {
|
||||
if (res != null && res.ok) {
|
||||
try {
|
||||
WLyricObj obj = AllMusic.gson.fromJson(res.data, WLyricObj.class);
|
||||
LyricDecoder temp = new LyricDecoder();
|
||||
LyricDecoder docoder = new LyricDecoder();
|
||||
for (int times = 0; times < 3; times++) {
|
||||
if (temp.check(obj)) {
|
||||
if (docoder.check(obj)) {
|
||||
AllMusic.log.data("<light_purple>[AllMusic3]<red>歌词解析错误,正在进行第" + times + "重试");
|
||||
} else {
|
||||
if (temp.isHave) {
|
||||
if (docoder.isHave) {
|
||||
lyric.setHaveLyric(AllMusic.getConfig().sendLyric);
|
||||
lyric.setLyric(temp.getTemp());
|
||||
if (temp.isHaveK) {
|
||||
lyric.setKlyric(temp.getKLyric());
|
||||
lyric.setLyric(docoder.getLyrics());
|
||||
if (docoder.isHaveK) {
|
||||
lyric.setKlyric(docoder.getKLyric());
|
||||
}
|
||||
}
|
||||
return lyric;
|
||||
|
||||
@@ -8,8 +8,8 @@ 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.Commands;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -59,7 +59,7 @@ public class CommandFabric implements Command<CommandSourceStack>, Predicate<Com
|
||||
String remaining = builder.getRemaining().trim();
|
||||
|
||||
for (String s : results) {
|
||||
if (s.startsWith(remaining)) {
|
||||
if (s.startsWith(remaining)){
|
||||
builder.suggest(s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,9 @@ import com.coloryr.allmusic.server.event.MusicPlayEvent;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
@@ -35,14 +34,13 @@ public class SideFabric extends BaseSide {
|
||||
|
||||
@Override
|
||||
public boolean checkPermission(Object player) {
|
||||
CommandSourceStack source = (CommandSourceStack) player;
|
||||
return source.hasPermission(2);
|
||||
ServerPlayer source = (ServerPlayer) player;
|
||||
return source.hasPermissions(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlayer(Object player) {
|
||||
CommandSourceStack source = (CommandSourceStack) player;
|
||||
return source.isPlayer();
|
||||
return player instanceof ServerPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -94,7 +92,7 @@ public class SideFabric extends BaseSide {
|
||||
@Override
|
||||
public void sendBar(Object player, Component data) {
|
||||
if (player instanceof ServerPlayer player1) {
|
||||
player1.displayClientMessage(AllMusicServer.parse(data), true);
|
||||
player1.sendActionBar(data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,10 +103,9 @@ public class SideFabric extends BaseSide {
|
||||
|
||||
@Override
|
||||
public void broadcast(Component message) {
|
||||
var component = AllMusicServer.parse(message);
|
||||
for (var player : AllMusicServer.server.getPlayerList().getPlayers()) {
|
||||
if (!AllMusic.isSkip(player.getName().getString(), null, false)) {
|
||||
player.sendSystemMessage(component);
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,19 +113,19 @@ public class SideFabric extends BaseSide {
|
||||
@Override
|
||||
public void sendMessage(Object obj, Component message) {
|
||||
if (obj instanceof CommandSourceStack source) {
|
||||
source.sendSystemMessage(AllMusicServer.parse(message));
|
||||
source.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicPlay(SongInfoObj obj) {
|
||||
return MusicPlayEvent.EVENT.invoker().interact(obj) != InteractionResult.PASS;
|
||||
return !MusicPlayEvent.EVENT.invoker().interact(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicAdd(Object obj, PlayerAddMusicObj music) {
|
||||
CommandSourceStack source = (CommandSourceStack) obj;
|
||||
return MusicAddEvent.EVENT.invoker().interact(source.getPlayer(), music) != InteractionResult.PASS;
|
||||
return !MusicAddEvent.EVENT.invoker().interact(source.getPlayer(), music);
|
||||
}
|
||||
|
||||
private void send(ServerPlayer players, ByteBuf data) {
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ public class ServerPlayerMixin {
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "placeNewPlayer")
|
||||
private void add(Connection connection, ServerPlayer player, CallbackInfo info) {
|
||||
AllMusic.joinPlay(player.getName().getString());
|
||||
private void add(Connection connection, ServerPlayer serverPlayer, CallbackInfo ci) {
|
||||
AllMusic.joinPlay(serverPlayer.getName().getString());
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,8 @@ 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.Commands;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@@ -13,7 +13,6 @@ import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
@@ -114,20 +113,20 @@ public class SideFabric extends BaseSide {
|
||||
|
||||
@Override
|
||||
public void sendMessage(Object obj, Component message) {
|
||||
if (obj instanceof CommandSourceStack source) {
|
||||
if(obj instanceof CommandSourceStack source) {
|
||||
source.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicPlay(SongInfoObj obj) {
|
||||
return MusicPlayEvent.EVENT.invoker().interact(obj) != InteractionResult.PASS;
|
||||
return !MusicPlayEvent.EVENT.invoker().interact(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicAdd(Object obj, PlayerAddMusicObj music) {
|
||||
CommandSourceStack source = (CommandSourceStack) obj;
|
||||
return MusicAddEvent.EVENT.invoker().interact(source.getPlayer(), music) != InteractionResult.PASS;
|
||||
return !MusicAddEvent.EVENT.invoker().interact(source.getPlayer(), music);
|
||||
}
|
||||
|
||||
private void send(ServerPlayer players, MusicPack data) {
|
||||
|
||||
+5
-6
@@ -4,21 +4,20 @@ import com.coloryr.allmusic.server.core.objs.music.PlayerAddMusicObj;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
||||
public interface MusicAddEvent {
|
||||
Event<MusicAddEvent> EVENT = EventFactory.createArrayBacked(MusicAddEvent.class,
|
||||
(listeners) -> (player, music) -> {
|
||||
for (MusicAddEvent listener : listeners) {
|
||||
InteractionResult result = listener.interact(player, music);
|
||||
boolean result = listener.interact(player, music);
|
||||
|
||||
if (result != InteractionResult.PASS) {
|
||||
return result;
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return InteractionResult.PASS;
|
||||
return true;
|
||||
});
|
||||
|
||||
InteractionResult interact(ServerPlayer player, PlayerAddMusicObj music);
|
||||
boolean interact(ServerPlayer player, PlayerAddMusicObj music);
|
||||
}
|
||||
+2
-2
@@ -19,7 +19,7 @@ public class ServerPlayerMixin {
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "placeNewPlayer")
|
||||
private void add(Connection connection, ServerPlayer player, CommonListenerCookie clientData, CallbackInfo info) {
|
||||
AllMusic.joinPlay(player.getName().getString());
|
||||
private void add(Connection connection, ServerPlayer serverPlayer, CommonListenerCookie commonListenerCookie, CallbackInfo ci) {
|
||||
AllMusic.joinPlay(serverPlayer.getName().getString());
|
||||
}
|
||||
}
|
||||
+5
-6
@@ -4,21 +4,20 @@ import com.coloryr.allmusic.server.core.objs.music.PlayerAddMusicObj;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
||||
public interface MusicAddEvent {
|
||||
Event<MusicAddEvent> EVENT = EventFactory.createArrayBacked(MusicAddEvent.class,
|
||||
(listeners) -> (player, music) -> {
|
||||
for (MusicAddEvent listener : listeners) {
|
||||
InteractionResult result = listener.interact(player, music);
|
||||
boolean result = listener.interact(player, music);
|
||||
|
||||
if (result != InteractionResult.PASS) {
|
||||
return result;
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return InteractionResult.PASS;
|
||||
return true;
|
||||
});
|
||||
|
||||
InteractionResult interact(ServerPlayer player, PlayerAddMusicObj music);
|
||||
boolean interact(ServerPlayer player, PlayerAddMusicObj music);
|
||||
}
|
||||
+4
-5
@@ -3,21 +3,20 @@ 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.world.InteractionResult;
|
||||
|
||||
public interface MusicPlayEvent {
|
||||
Event<MusicPlayEvent> EVENT = EventFactory.createArrayBacked(MusicPlayEvent.class,
|
||||
(listeners) -> (music) -> {
|
||||
for (MusicPlayEvent listener : listeners) {
|
||||
InteractionResult result = listener.interact(music);
|
||||
boolean result = listener.interact(music);
|
||||
|
||||
if (result != InteractionResult.PASS) {
|
||||
if (!result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return InteractionResult.PASS;
|
||||
return true;
|
||||
});
|
||||
|
||||
InteractionResult interact(SongInfoObj music);
|
||||
boolean interact(SongInfoObj music);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.coloryr.allmusic.server.core.AllMusic;
|
||||
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
import java.io.File;
|
||||
@@ -11,6 +12,8 @@ import java.io.File;
|
||||
public class AllMusicServer implements DedicatedServerModInitializer {
|
||||
public static MinecraftServer server;
|
||||
|
||||
public static final ResourceLocation ID = new ResourceLocation("allmusic", "channel");
|
||||
|
||||
public static final String dir = "allmusic_server/";
|
||||
|
||||
@Override
|
||||
@@ -18,8 +21,7 @@ public class AllMusicServer implements DedicatedServerModInitializer {
|
||||
AllMusic.log = new LogFabric();
|
||||
AllMusic.side = new SideFabric();
|
||||
|
||||
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment)
|
||||
-> CommandFabric.instance.register(dispatcher));
|
||||
CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> CommandFabric.instance.register(dispatcher));
|
||||
|
||||
ServerLifecycleEvents.SERVER_STARTED.register((a) -> {
|
||||
server = a;
|
||||
|
||||
@@ -13,7 +13,6 @@ import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
@@ -114,20 +113,20 @@ public class SideFabric extends BaseSide {
|
||||
|
||||
@Override
|
||||
public void sendMessage(Object obj, Component message) {
|
||||
if (obj instanceof CommandSourceStack source) {
|
||||
if(obj instanceof CommandSourceStack source) {
|
||||
source.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicPlay(SongInfoObj obj) {
|
||||
return MusicPlayEvent.EVENT.invoker().interact(obj) != InteractionResult.PASS;
|
||||
return !MusicPlayEvent.EVENT.invoker().interact(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicAdd(Object obj, PlayerAddMusicObj music) {
|
||||
CommandSourceStack source = (CommandSourceStack) obj;
|
||||
return MusicAddEvent.EVENT.invoker().interact(source.getPlayer(), music) != InteractionResult.PASS;
|
||||
return !MusicAddEvent.EVENT.invoker().interact(source.getPlayer(), music);
|
||||
}
|
||||
|
||||
private void send(ServerPlayer players, MusicPack data) {
|
||||
|
||||
+5
-6
@@ -4,21 +4,20 @@ import com.coloryr.allmusic.server.core.objs.music.PlayerAddMusicObj;
|
||||
import net.fabricmc.fabric.api.event.Event;
|
||||
import net.fabricmc.fabric.api.event.EventFactory;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
||||
public interface MusicAddEvent {
|
||||
Event<MusicAddEvent> EVENT = EventFactory.createArrayBacked(MusicAddEvent.class,
|
||||
(listeners) -> (player, music) -> {
|
||||
for (MusicAddEvent listener : listeners) {
|
||||
InteractionResult result = listener.interact(player, music);
|
||||
boolean result = listener.interact(player, music);
|
||||
|
||||
if (result != InteractionResult.PASS) {
|
||||
return result;
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return InteractionResult.PASS;
|
||||
return true;
|
||||
});
|
||||
|
||||
InteractionResult interact(ServerPlayer player, PlayerAddMusicObj music);
|
||||
boolean interact(ServerPlayer player, PlayerAddMusicObj music);
|
||||
}
|
||||
+4
-5
@@ -3,21 +3,20 @@ 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.world.InteractionResult;
|
||||
|
||||
public interface MusicPlayEvent {
|
||||
Event<MusicPlayEvent> EVENT = EventFactory.createArrayBacked(MusicPlayEvent.class,
|
||||
(listeners) -> (music) -> {
|
||||
for (MusicPlayEvent listener : listeners) {
|
||||
InteractionResult result = listener.interact(music);
|
||||
boolean result = listener.interact(music);
|
||||
|
||||
if (result != InteractionResult.PASS) {
|
||||
if (!result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return InteractionResult.PASS;
|
||||
return true;
|
||||
});
|
||||
|
||||
InteractionResult interact(SongInfoObj music);
|
||||
boolean interact(SongInfoObj music);
|
||||
}
|
||||
+2
-2
@@ -19,7 +19,7 @@ public class ServerPlayerMixin {
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"), method = "placeNewPlayer")
|
||||
private void add(Connection connection, ServerPlayer player, CommonListenerCookie clientData, CallbackInfo info) {
|
||||
AllMusic.joinPlay(player.getName().getString());
|
||||
private void add(Connection connection, ServerPlayer serverPlayer, CommonListenerCookie commonListenerCookie, CallbackInfo ci) {
|
||||
AllMusic.joinPlay(serverPlayer.getName().getString());
|
||||
}
|
||||
}
|
||||
+4
-5
@@ -3,21 +3,20 @@ 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.world.InteractionResult;
|
||||
|
||||
public interface MusicPlayEvent {
|
||||
Event<MusicPlayEvent> EVENT = EventFactory.createArrayBacked(MusicPlayEvent.class,
|
||||
(listeners) -> (music) -> {
|
||||
for (MusicPlayEvent listener : listeners) {
|
||||
InteractionResult result = listener.interact(music);
|
||||
boolean result = listener.interact(music);
|
||||
|
||||
if (result != InteractionResult.PASS) {
|
||||
if (!result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return InteractionResult.PASS;
|
||||
return true;
|
||||
});
|
||||
|
||||
InteractionResult interact(SongInfoObj music);
|
||||
boolean interact(SongInfoObj music);
|
||||
}
|
||||
+22
-11
@@ -5,6 +5,7 @@ import com.coloryr.allmusic.server.core.music.PlayMusic;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.kyori.adventure.platform.modcommon.MinecraftServerAudiences;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
@@ -34,32 +35,42 @@ public class AllMusicServer {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRegisterCommands(RegisterCommandsEvent event) {
|
||||
LOGGER.info("注册指令");
|
||||
CommandDispatcher<CommandSourceStack> dispatcher = event.getDispatcher();
|
||||
CommandNeoForge.instance.register(dispatcher);
|
||||
if (event.getCommandSelection() != Commands.CommandSelection.INTEGRATED) {
|
||||
LOGGER.info("注册指令");
|
||||
CommandDispatcher<CommandSourceStack> dispatcher = event.getDispatcher();
|
||||
CommandNeoForge.instance.register(dispatcher);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onServerStarting(ServerStartedEvent event) {
|
||||
audiences = MinecraftServerAudiences.of(event.getServer());
|
||||
server = event.getServer();
|
||||
AllMusic.init(new File(dir));
|
||||
AllMusic.start();
|
||||
Tasks.init();
|
||||
if (event.getServer().isDedicatedServer()) {
|
||||
audiences = MinecraftServerAudiences.of(event.getServer());
|
||||
server = event.getServer();
|
||||
AllMusic.init(new File(dir));
|
||||
AllMusic.start();
|
||||
Tasks.init();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onServerStopping(ServerStoppingEvent event) {
|
||||
AllMusic.stop();
|
||||
if (event.getServer().isDedicatedServer()) {
|
||||
AllMusic.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent event) {
|
||||
PlayMusic.removeNowPlayPlayer(event.getEntity().getName().getString());
|
||||
if (server != null) {
|
||||
PlayMusic.removeNowPlayPlayer(event.getEntity().getName().getString());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
|
||||
AllMusic.joinPlay(event.getEntity().getName().getString());
|
||||
if (server != null) {
|
||||
AllMusic.joinPlay(event.getEntity().getName().getString());
|
||||
}
|
||||
}
|
||||
}
|
||||
+22
-11
@@ -5,6 +5,7 @@ import com.coloryr.allmusic.server.core.music.PlayMusic;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.kyori.adventure.platform.modcommon.MinecraftServerAudiences;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
@@ -36,32 +37,42 @@ public class AllMusicServer {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRegisterCommands(RegisterCommandsEvent event) {
|
||||
LOGGER.info("注册指令");
|
||||
CommandDispatcher<CommandSourceStack> dispatcher = event.getDispatcher();
|
||||
CommandNeoForge.instance.register(dispatcher);
|
||||
if (event.getCommandSelection() != Commands.CommandSelection.INTEGRATED) {
|
||||
LOGGER.info("注册指令");
|
||||
CommandDispatcher<CommandSourceStack> dispatcher = event.getDispatcher();
|
||||
CommandNeoForge.instance.register(dispatcher);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onServerStarting(ServerStartedEvent event) {
|
||||
server = event.getServer();
|
||||
audiences = MinecraftServerAudiences.of(server);
|
||||
AllMusic.init(new File(dir));
|
||||
AllMusic.start();
|
||||
Tasks.init();
|
||||
if (event.getServer().isDedicatedServer()) {
|
||||
audiences = MinecraftServerAudiences.of(event.getServer());
|
||||
server = event.getServer();
|
||||
AllMusic.init(new File(dir));
|
||||
AllMusic.start();
|
||||
Tasks.init();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onServerStopping(ServerStoppingEvent event) {
|
||||
AllMusic.stop();
|
||||
if (event.getServer().isDedicatedServer()) {
|
||||
AllMusic.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPlayerLoggedOut(PlayerEvent.PlayerLoggedOutEvent event) {
|
||||
PlayMusic.removeNowPlayPlayer(event.getEntity().getName().getString());
|
||||
if (server != null) {
|
||||
PlayMusic.removeNowPlayPlayer(event.getEntity().getName().getString());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onPlayerLoggedIn(PlayerEvent.PlayerLoggedInEvent event) {
|
||||
AllMusic.joinPlay(event.getEntity().getName().getString());
|
||||
if (server != null) {
|
||||
AllMusic.joinPlay(event.getEntity().getName().getString());
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-8
@@ -4,15 +4,14 @@ import com.coloryr.allmusic.server.core.AllMusic;
|
||||
import com.coloryr.allmusic.server.core.music.PlayMusic;
|
||||
import com.coloryr.allmusic.server.core.music.TopLyricSave;
|
||||
import com.coloryr.allmusic.server.core.objs.music.TopSongInfoObj;
|
||||
import com.coloryr.allmusic.server.side.bukkit.*;
|
||||
import com.coloryr.allmusic.server.side.bukkit.hooks.AllMusicPAPI;
|
||||
import com.coloryr.allmusic.server.side.bukkit.hooks.VaultHook;
|
||||
import com.coloryr.allmusic.server.hooks.AllMusicPAPI;
|
||||
import com.coloryr.allmusic.server.hooks.VaultHook;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class AllMusicBukkit extends JavaPlugin {
|
||||
public class AllMusicPaper extends JavaPlugin {
|
||||
public static Plugin plugin;
|
||||
public static AllMusicPAPI PAPI;
|
||||
private static PluginMessage pluginMessage;
|
||||
@@ -20,8 +19,8 @@ public class AllMusicBukkit extends JavaPlugin {
|
||||
@Override
|
||||
public void onEnable() {
|
||||
plugin = this;
|
||||
AllMusic.log = new LogBukkit();
|
||||
AllMusic.side = new SideBukkit();
|
||||
AllMusic.log = new LogPaper();
|
||||
AllMusic.side = new SidePaper();
|
||||
|
||||
AllMusic.init(plugin.getDataFolder());
|
||||
if (!AllMusic.isRun) {
|
||||
@@ -66,12 +65,12 @@ public class AllMusicBukkit extends JavaPlugin {
|
||||
getServer().getMessenger().registerIncomingPluginChannel(this, AllMusic.channelBC, pluginMessage);
|
||||
AllMusic.log.data("<light_purple>[AllMusic3]<yellow>设置为顶层模式");
|
||||
} else {
|
||||
CommandBukkit command = new CommandBukkit();
|
||||
CommandPaper command = new CommandPaper();
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this, AllMusic.channel);
|
||||
PluginCommand command1 = Bukkit.getPluginCommand("music");
|
||||
command1.setExecutor(command);
|
||||
command1.setTabCompleter(command);
|
||||
Bukkit.getPluginManager().registerEvents(new ListenerBukkit(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new ListenerPaper(), this);
|
||||
AllMusic.start();
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.coloryr.allmusic.server.side.bukkit;
|
||||
package com.coloryr.allmusic.server;
|
||||
|
||||
import com.coloryr.allmusic.server.core.command.CommandEX;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class CommandBukkit implements CommandExecutor, TabExecutor {
|
||||
public class CommandPaper implements CommandExecutor, TabExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, Command command, @NotNull String label, @NotNull String[] args) {
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.coloryr.allmusic.server.side.bukkit;
|
||||
package com.coloryr.allmusic.server;
|
||||
|
||||
import com.coloryr.allmusic.server.core.AllMusic;
|
||||
import org.bukkit.Bukkit;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package com.coloryr.allmusic.server.side.bukkit;
|
||||
package com.coloryr.allmusic.server;
|
||||
|
||||
import com.coloryr.allmusic.server.core.AllMusic;
|
||||
import com.coloryr.allmusic.server.core.music.PlayMusic;
|
||||
@@ -7,7 +7,7 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class ListenerBukkit implements Listener {
|
||||
public class ListenerPaper implements Listener {
|
||||
@EventHandler
|
||||
public void onPlayerQuitEvent(final PlayerQuitEvent e) {
|
||||
PlayMusic.removeNowPlayPlayer(e.getPlayer().getName());
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
package com.coloryr.allmusic.server.side.bukkit;
|
||||
package com.coloryr.allmusic.server;
|
||||
|
||||
import com.coloryr.allmusic.server.core.side.IAllMusicLogger;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class LogBukkit implements IAllMusicLogger {
|
||||
public class LogPaper implements IAllMusicLogger {
|
||||
@Override
|
||||
public void data(Component data) {
|
||||
Bukkit.getConsoleSender().sendMessage(data);
|
||||
+2
-3
@@ -1,6 +1,5 @@
|
||||
package com.coloryr.allmusic.server.side.bukkit;
|
||||
package com.coloryr.allmusic.server;
|
||||
|
||||
import com.coloryr.allmusic.server.AllMusicBukkit;
|
||||
import com.coloryr.allmusic.server.core.AllMusic;
|
||||
import com.coloryr.allmusic.server.core.music.PlayMusic;
|
||||
import com.coloryr.allmusic.server.core.music.TopLyricSave;
|
||||
@@ -42,7 +41,7 @@ public class PluginMessage implements PluginMessageListener {
|
||||
Player player = Iterables.getFirst(Bukkit.getOnlinePlayers(), null);
|
||||
if (player == null)
|
||||
return;
|
||||
player.sendPluginMessage(AllMusicBukkit.plugin, AllMusic.channelBC, out.toByteArray());
|
||||
player.sendPluginMessage(AllMusicPaper.plugin, AllMusic.channelBC, out.toByteArray());
|
||||
}
|
||||
|
||||
public static void startUpdate() {
|
||||
+11
-12
@@ -1,14 +1,13 @@
|
||||
package com.coloryr.allmusic.server.side.bukkit;
|
||||
package com.coloryr.allmusic.server;
|
||||
|
||||
import com.coloryr.allmusic.codec.CommandType;
|
||||
import com.coloryr.allmusic.server.AllMusicBukkit;
|
||||
import com.coloryr.allmusic.server.core.AllMusic;
|
||||
import com.coloryr.allmusic.server.core.objs.music.PlayerAddMusicObj;
|
||||
import com.coloryr.allmusic.server.core.objs.music.SongInfoObj;
|
||||
import com.coloryr.allmusic.server.core.side.BaseSide;
|
||||
import com.coloryr.allmusic.server.side.bukkit.event.MusicAddEvent;
|
||||
import com.coloryr.allmusic.server.side.bukkit.event.MusicPlayEvent;
|
||||
import com.coloryr.allmusic.server.side.bukkit.hooks.CitizensNPC;
|
||||
import com.coloryr.allmusic.server.event.MusicAddEvent;
|
||||
import com.coloryr.allmusic.server.event.MusicPlayEvent;
|
||||
import com.coloryr.allmusic.server.hooks.CitizensNPC;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -23,7 +22,7 @@ import java.lang.reflect.Method;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collection;
|
||||
|
||||
public class SideBukkit extends BaseSide {
|
||||
public class SidePaper extends BaseSide {
|
||||
private static Class ByteBufC;
|
||||
private static Class UnpooledC;
|
||||
private static Method bufferM;
|
||||
@@ -138,7 +137,7 @@ public class SideBukkit extends BaseSide {
|
||||
|
||||
@Override
|
||||
public File getFolder() {
|
||||
return AllMusicBukkit.plugin.getDataFolder();
|
||||
return AllMusicPaper.plugin.getDataFolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,7 +151,7 @@ public class SideBukkit extends BaseSide {
|
||||
|
||||
@Override
|
||||
public void runTask(Runnable run) {
|
||||
Bukkit.getScheduler().runTask(AllMusicBukkit.plugin, run);
|
||||
Bukkit.getScheduler().runTask(AllMusicPaper.plugin, run);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -186,13 +185,13 @@ public class SideBukkit extends BaseSide {
|
||||
|
||||
@Override
|
||||
public void runTask(Runnable run, int delay) {
|
||||
Bukkit.getScheduler().runTaskLater(AllMusicBukkit.plugin, run, delay);
|
||||
Bukkit.getScheduler().runTaskLater(AllMusicPaper.plugin, run, delay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicPlay(SongInfoObj obj) {
|
||||
MusicPlayEvent event = new MusicPlayEvent(obj);
|
||||
Bukkit.getScheduler().callSyncMethod(AllMusicBukkit.plugin, () -> {
|
||||
Bukkit.getScheduler().callSyncMethod(AllMusicPaper.plugin, () -> {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancel()) {
|
||||
FunCore.addMusic();
|
||||
@@ -205,7 +204,7 @@ public class SideBukkit extends BaseSide {
|
||||
@Override
|
||||
public boolean onMusicAdd(Object obj, PlayerAddMusicObj music) {
|
||||
MusicAddEvent event = new MusicAddEvent(music, (CommandSender) obj);
|
||||
Bukkit.getScheduler().callSyncMethod(AllMusicBukkit.plugin, () -> {
|
||||
Bukkit.getScheduler().callSyncMethod(AllMusicPaper.plugin, () -> {
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
return event;
|
||||
});
|
||||
@@ -217,7 +216,7 @@ public class SideBukkit extends BaseSide {
|
||||
return;
|
||||
|
||||
if (AllMusic.isRun) {
|
||||
runTask(() -> players.sendPluginMessage(AllMusicBukkit.plugin, AllMusic.channel, data));
|
||||
runTask(() -> players.sendPluginMessage(AllMusicPaper.plugin, AllMusic.channel, data));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.coloryr.allmusic.server.side.bukkit.event;
|
||||
package com.coloryr.allmusic.server.event;
|
||||
|
||||
import com.coloryr.allmusic.server.core.objs.music.PlayerAddMusicObj;
|
||||
import org.bukkit.command.CommandSender;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.coloryr.allmusic.server.side.bukkit.event;
|
||||
package com.coloryr.allmusic.server.event;
|
||||
|
||||
import com.coloryr.allmusic.server.core.objs.music.SongInfoObj;
|
||||
import org.bukkit.event.Event;
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package com.coloryr.allmusic.server.side.bukkit.hooks;
|
||||
package com.coloryr.allmusic.server.hooks;
|
||||
|
||||
import com.coloryr.allmusic.server.core.AllMusic;
|
||||
import com.coloryr.allmusic.server.core.music.PlayMusic;
|
||||
import com.coloryr.allmusic.server.side.bukkit.PluginMessage;
|
||||
import com.coloryr.allmusic.server.PluginMessage;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.coloryr.allmusic.server.side.bukkit.hooks;
|
||||
package com.coloryr.allmusic.server.hooks;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.coloryr.allmusic.server.side.bukkit.hooks;
|
||||
package com.coloryr.allmusic.server.hooks;
|
||||
|
||||
import com.coloryr.allmusic.server.core.sql.IEconomy;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
@@ -1,5 +1,5 @@
|
||||
name: AllMusic3
|
||||
main: com.coloryr.allmusic.server.AllMusicBukkit
|
||||
main: com.coloryr.allmusic.server.AllMusicPaper
|
||||
author: Color_yr
|
||||
version: ${version}
|
||||
softdepend: [PlaceholderAPI, Vault, Essentials, CMI]
|
||||
|
||||
+1
-6
@@ -21,12 +21,7 @@ public class ListenerVelocity {
|
||||
|
||||
@Subscribe
|
||||
public void onPostLoginEvent(PostLoginEvent event) {
|
||||
AllMusic.side.runTask(() -> {
|
||||
Player player = event.getPlayer();
|
||||
Optional<ServerConnection> serverConnection = player.getCurrentServer();
|
||||
serverConnection.ifPresent(connection ->
|
||||
AllMusic.joinPlay(event.getPlayer().getUsername(), connection.getServerInfo().getName()));
|
||||
}, 1000);
|
||||
AllMusic.joinPlay(event.getPlayer().getUsername());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
Reference in new issue
Block a user