mirror of
https://github.com/Coloryr/AllMusic.git
synced 2026-11-26 23:13:13 +00:00
up
This commit is contained in:
1 parent
abd11eba3f
commit
4db9bfbca7
10 files changed
+220
-75
No files matched your search
+1
-3
@@ -38,7 +38,7 @@ dependencies {
|
||||
//implementation "org.apache.commons:commons-dbcp2:2.9.0"
|
||||
//implementation 'mysql:mysql-connector-java:8.0.31'
|
||||
|
||||
compileOnly 'dev.folia:folia-api:1.20.2-R0.1-SNAPSHOT'
|
||||
compileOnly 'dev.folia:folia-api:1.20.4-R0.1-SNAPSHOT'
|
||||
compileOnly "com.github.MilkBowl:VaultAPI:1.7.1"
|
||||
compileOnly 'me.clip:placeholderapi:2.10.10'
|
||||
//compileOnly 'net.citizensnpcs:citizens-main:2.0.30-SNAPSHOT'
|
||||
@@ -46,7 +46,6 @@ dependencies {
|
||||
|
||||
//implementation 'org.xerial:sqlite-jdbc:3.39.3.0'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
|
||||
implementation 'com.google.code.gson:gson:2.10.1'
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
@@ -55,7 +54,6 @@ shadowJar {
|
||||
relocate 'kotlin', 'coloryr.allmusic.lib.kotlin'
|
||||
relocate 'org.intellij', 'coloryr.allmusic.lib.org.intellij'
|
||||
relocate 'org.jetbrains', 'coloryr.allmusic.lib.org.jetbrains'
|
||||
relocate 'com.google.gson', 'coloryr.allmusic.lib.com.google.gson'
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class AllMusicFolia extends JavaPlugin {
|
||||
AllMusic.log.info("§2PAPI未挂钩");
|
||||
}
|
||||
|
||||
if (AllMusic.getConfig().TopPAPI) {
|
||||
if (AllMusic.getConfig().topPAPI) {
|
||||
PlayMusic.nowPlayMusic = new TopSongInfoObj();
|
||||
PlayMusic.lyric = new TopLyricSave();
|
||||
pluginMessage = new PluginMessage();
|
||||
@@ -58,7 +58,7 @@ public class AllMusicFolia extends JavaPlugin {
|
||||
AllMusic.log.info("§2设置为顶层模式");
|
||||
} else {
|
||||
if (Bukkit.getPluginManager().getPlugin("Vault") != null
|
||||
&& AllMusic.getConfig().Economy.Vault) {
|
||||
&& AllMusic.getConfig().economy.vault) {
|
||||
try {
|
||||
VaultHook vault = new VaultHook();
|
||||
AllMusic.economy = vault;
|
||||
@@ -92,7 +92,7 @@ public class AllMusicFolia extends JavaPlugin {
|
||||
@Override
|
||||
public void onDisable() {
|
||||
AllMusic.isRun = false;
|
||||
if (AllMusic.getConfig().TopPAPI)
|
||||
if (AllMusic.getConfig().topPAPI)
|
||||
pluginMessage.stop();
|
||||
else
|
||||
AllMusic.stop();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package coloryr.allmusic.side.folia;
|
||||
|
||||
import coloryr.allmusic.core.command.CommandEX;
|
||||
import coloryr.allmusic.core.command.TabCommand;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -23,7 +22,7 @@ public class CommandFolia implements CommandExecutor, TabExecutor {
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("music")) {
|
||||
return TabCommand.getTabList(sender.getName(), args);
|
||||
return CommandEX.getTabList(sender.getName(), args);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ public class FunCore {
|
||||
private static final Random random = new Random();
|
||||
|
||||
public static void addMusic() {
|
||||
if (AllMusic.getConfig().FunConfig.Rain) {
|
||||
int rate = AllMusic.getConfig().FunConfig.RainRate;
|
||||
if (AllMusic.getConfig().funConfig.rain) {
|
||||
int rate = AllMusic.getConfig().funConfig.rainRate;
|
||||
boolean rain;
|
||||
if (rate <= 1) {
|
||||
rain = true;
|
||||
@@ -22,7 +22,7 @@ public class FunCore {
|
||||
for (World item : Bukkit.getWorlds()) {
|
||||
item.setStorm(true);
|
||||
}
|
||||
AllMusic.side.bq(AllMusic.getMessage().Fun.Rain);
|
||||
AllMusic.side.bq(AllMusic.getMessage().fun.rain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,17 @@ package coloryr.allmusic.side.folia;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import coloryr.allmusic.AllMusicFolia;
|
||||
import coloryr.allmusic.core.hud.HudUtils;
|
||||
import coloryr.allmusic.core.objs.config.SaveObj;
|
||||
import coloryr.allmusic.core.objs.enums.ComType;
|
||||
import coloryr.allmusic.core.objs.enums.HudType;
|
||||
import coloryr.allmusic.core.objs.music.MusicObj;
|
||||
import coloryr.allmusic.core.objs.music.SongInfoObj;
|
||||
import coloryr.allmusic.core.side.ComType;
|
||||
import coloryr.allmusic.core.side.ISide;
|
||||
import coloryr.allmusic.core.utils.HudUtils;
|
||||
import coloryr.allmusic.side.folia.event.MusicAddEvent;
|
||||
import coloryr.allmusic.side.folia.event.MusicPlayEvent;
|
||||
import coloryr.allmusic.side.folia.hooks.CitizensNPC;
|
||||
import coloryr.allmusic.side.folia.hooks.SpigotApi;
|
||||
import com.google.gson.Gson;
|
||||
import io.papermc.paper.threadedregions.scheduler.ScheduledTask;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -21,12 +21,14 @@ import org.bukkit.entity.Player;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
|
||||
public class SideFolia extends ISide {
|
||||
private static Class ByteBufC;
|
||||
private static Class UnpooledC;
|
||||
private static Method bufferM;
|
||||
private static Method writeByteM;
|
||||
private static Method writeIntM;
|
||||
private static Method writeBytesM;
|
||||
private static Method arrayM;
|
||||
|
||||
@@ -44,6 +46,7 @@ public class SideFolia extends ISide {
|
||||
try {
|
||||
arrayM = ByteBufC.getMethod("array");
|
||||
writeByteM = ByteBufC.getMethod("writeByte", int.class);
|
||||
writeIntM = ByteBufC.getMethod("writeInt", int.class);
|
||||
writeBytesM = ByteBufC.getMethod("writeBytes", byte[].class);
|
||||
} catch (NoSuchMethodException e1) {
|
||||
e1.printStackTrace();
|
||||
@@ -60,19 +63,13 @@ public class SideFolia extends ISide {
|
||||
}
|
||||
if (UnpooledC != null) {
|
||||
try {
|
||||
bufferM = UnpooledC.getMethod("buffer", int.class);
|
||||
bufferM = UnpooledC.getMethod("buffer");
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void send(String data, String player) {
|
||||
send(Bukkit.getPlayer(player), data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAllPlayer() {
|
||||
return Bukkit.getOnlinePlayers().size();
|
||||
@@ -86,9 +83,14 @@ public class SideFolia extends ISide {
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
if (!obj.EnableLyric)
|
||||
if (!obj.lyric.enable)
|
||||
continue;
|
||||
send(player, ComType.lyric + data);
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.LYRIC.ordinal());
|
||||
writeString(buf, data);
|
||||
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌词发送出错");
|
||||
@@ -104,9 +106,14 @@ public class SideFolia extends ISide {
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
if (!obj.EnableInfo)
|
||||
if (!obj.info.enable)
|
||||
continue;
|
||||
send(player, ComType.info + data);
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.INFO.ordinal());
|
||||
writeString(buf, data);
|
||||
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌词信息发送出错");
|
||||
@@ -114,6 +121,62 @@ public class SideFolia extends ISide {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHudPos(String name) {
|
||||
try {
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null)
|
||||
return;
|
||||
if (AllMusic.isOK(name, null, false))
|
||||
return;
|
||||
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
String data = AllMusic.gson.toJson(obj);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, 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;
|
||||
}
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (AllMusic.isOK(name, null, true))
|
||||
return;
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
switch (pos) {
|
||||
case INFO:
|
||||
writeByteM.invoke(buf, ComType.INFO.ordinal());
|
||||
break;
|
||||
case LIST:
|
||||
writeByteM.invoke(buf, ComType.LIST.ordinal());
|
||||
break;
|
||||
case LYRIC:
|
||||
writeByteM.invoke(buf, 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 {
|
||||
@@ -122,9 +185,14 @@ public class SideFolia extends ISide {
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
if (!obj.EnableList)
|
||||
if (!obj.list.enable)
|
||||
continue;
|
||||
send(player, ComType.list + data);
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.LIST.ordinal());
|
||||
writeString(buf, data);
|
||||
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲列表发送出错");
|
||||
@@ -138,8 +206,13 @@ public class SideFolia extends ISide {
|
||||
String Name = player.getName();
|
||||
try {
|
||||
SaveObj obj = HudUtils.get(Name);
|
||||
String data = new Gson().toJson(obj);
|
||||
send(player, data);
|
||||
String data = AllMusic.gson.toJson(obj);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.HUD.ordinal());
|
||||
writeString(buf, data);
|
||||
|
||||
send(player, buf);
|
||||
|
||||
} catch (Exception e1) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c数据发送发生错误");
|
||||
e1.printStackTrace();
|
||||
@@ -171,7 +244,12 @@ public class SideFolia extends ISide {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (AllMusic.isOK(player.getName(), null, false))
|
||||
continue;
|
||||
send(player, ComType.play + url);
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.PLAY.ordinal());
|
||||
writeString(buf, url);
|
||||
|
||||
send(player, buf);
|
||||
AllMusic.addNowPlayPlayer(player.getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -188,7 +266,11 @@ public class SideFolia extends ISide {
|
||||
return;
|
||||
if (AllMusic.isOK(player, null, false))
|
||||
return;
|
||||
send(ComType.play + url, player);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.PLAY.ordinal());
|
||||
writeString(buf, url);
|
||||
|
||||
send(player1, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c歌曲指令发送出错");
|
||||
e.printStackTrace();
|
||||
@@ -203,9 +285,14 @@ public class SideFolia extends ISide {
|
||||
continue;
|
||||
String name = player.getName();
|
||||
SaveObj obj = HudUtils.get(name);
|
||||
if (!obj.EnablePic)
|
||||
if (!obj.pic.enable)
|
||||
continue;
|
||||
send(player, ComType.img + url);
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.IMG.ordinal());
|
||||
writeString(buf, url);
|
||||
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c图片指令发送出错");
|
||||
@@ -221,7 +308,11 @@ public class SideFolia extends ISide {
|
||||
return;
|
||||
if (AllMusic.isOK(player1.getName(), null, true))
|
||||
return;
|
||||
send(ComType.img + url, player);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.IMG.ordinal());
|
||||
writeString(buf, url);
|
||||
|
||||
send(player1, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c图片指令发送出错");
|
||||
e.printStackTrace();
|
||||
@@ -236,7 +327,11 @@ public class SideFolia extends ISide {
|
||||
return;
|
||||
if (AllMusic.isOK(player1.getName(), null, true))
|
||||
return;
|
||||
send(ComType.pos + pos, player);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.POS.ordinal());
|
||||
writeIntM.invoke(buf, pos);
|
||||
|
||||
send(player1, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c清空Hud发生出错");
|
||||
e.printStackTrace();
|
||||
@@ -247,7 +342,10 @@ public class SideFolia extends ISide {
|
||||
protected void topSendStop() {
|
||||
try {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
send(player, ComType.stop);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.STOP.ordinal());
|
||||
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
|
||||
@@ -261,7 +359,10 @@ public class SideFolia extends ISide {
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null)
|
||||
return;
|
||||
send(player, ComType.stop);
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.STOP.ordinal());
|
||||
send(player, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c停止指令发送出错");
|
||||
e.printStackTrace();
|
||||
@@ -269,9 +370,16 @@ public class SideFolia extends ISide {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearHud(String player) {
|
||||
public void clearHud(String name) {
|
||||
try {
|
||||
send(ComType.clear, player);
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.CLEAR.ordinal());
|
||||
|
||||
send(player, buf);
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c清空Hud发生出错");
|
||||
e.printStackTrace();
|
||||
@@ -282,7 +390,10 @@ public class SideFolia extends ISide {
|
||||
public void clearHud() {
|
||||
try {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
send(player, ComType.clear);
|
||||
Object buf = bufferM.invoke(null);
|
||||
writeByteM.invoke(buf, ComType.CLEAR.ordinal());
|
||||
|
||||
send(player, buf);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§d[AllMusic]§c清空Hud发生出错");
|
||||
@@ -292,27 +403,32 @@ public class SideFolia extends ISide {
|
||||
|
||||
@Override
|
||||
public void bq(String data) {
|
||||
if (AllMusic.getConfig().MessageLimit
|
||||
&& data.length() > AllMusic.getConfig().MessageLimitSize) {
|
||||
data = data.substring(0, AllMusic.getConfig().MessageLimitSize - 1) + "...";
|
||||
if (AllMusic.getConfig().messageLimit
|
||||
&& data.length() > AllMusic.getConfig().messageLimitSize) {
|
||||
data = data.substring(0, AllMusic.getConfig().messageLimitSize - 1) + "...";
|
||||
}
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!AllMusic.getConfig().NoMusicPlayer.contains(player.getName())) {
|
||||
if (!AllMusic.getConfig().mutePlayer.contains(player.getName())) {
|
||||
player.sendMessage(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bqRun(String message, String end, String command) {
|
||||
SpigotApi.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) + "...";
|
||||
if (AllMusic.getConfig().messageLimit
|
||||
&& data.length() > AllMusic.getConfig().messageLimitSize) {
|
||||
data = data.substring(0, AllMusic.getConfig().messageLimitSize - 1) + "...";
|
||||
}
|
||||
String finalData = data;
|
||||
Bukkit.getGlobalRegionScheduler().execute(AllMusicFolia.plugin, () -> {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!AllMusic.getConfig().NoMusicPlayer.contains(player.getName())) {
|
||||
if (!AllMusic.getConfig().mutePlayer.contains(player.getName())) {
|
||||
player.sendMessage(finalData);
|
||||
}
|
||||
}
|
||||
@@ -325,7 +441,7 @@ public class SideFolia extends ISide {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (CitizensNPC.isNPC(player))
|
||||
online--;
|
||||
else if (AllMusic.getConfig().NoMusicPlayer.contains(player.getName())) {
|
||||
else if (AllMusic.getConfig().mutePlayer.contains(player.getName())) {
|
||||
online--;
|
||||
}
|
||||
}
|
||||
@@ -375,7 +491,7 @@ public class SideFolia extends ISide {
|
||||
|
||||
@Override
|
||||
public boolean checkPermission(String player, String permission) {
|
||||
if (AllMusic.getConfig().Admin.contains(player))
|
||||
if (AllMusic.getConfig().adminList.contains(player))
|
||||
return false;
|
||||
Player player1 = Bukkit.getPlayer(player);
|
||||
if (player1 == null)
|
||||
@@ -404,6 +520,11 @@ public class SideFolia extends ISide {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getPlayerList() {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMusicPlay(SongInfoObj obj) {
|
||||
MusicPlayEvent event = new MusicPlayEvent(obj);
|
||||
@@ -442,29 +563,29 @@ public class SideFolia extends ISide {
|
||||
return event.isCancel();
|
||||
}
|
||||
|
||||
private void send(Player players, String data) {
|
||||
private void send(Player players, Object data) {
|
||||
if (players == null)
|
||||
return;
|
||||
try {
|
||||
byte[] bytes = data.getBytes(StandardCharsets.UTF_8);
|
||||
Object buf = bufferM.invoke(null, bytes.length + 1);
|
||||
writeByteM.invoke(buf, 666);
|
||||
writeBytesM.invoke(buf, bytes);
|
||||
|
||||
if (AllMusic.isRun)
|
||||
if (AllMusic.isRun) {
|
||||
runTask(() ->
|
||||
{
|
||||
try {
|
||||
players.sendPluginMessage(AllMusicFolia.plugin, AllMusic.channel, (byte[]) arrayM.invoke(buf));
|
||||
players.sendPluginMessage(AllMusicFolia.plugin, AllMusic.channel, (byte[]) arrayM.invoke(data));
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
else {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§c数据发送发生错误");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeString(Object buf, String data) throws InvocationTargetException, IllegalAccessException {
|
||||
byte[] temp = data.getBytes(StandardCharsets.UTF_8);
|
||||
writeIntM.invoke(buf, temp.length);
|
||||
writeBytesM.invoke(buf, temp);
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public class AllMusicPAPI extends PlaceholderExpansion {
|
||||
|
||||
@Override
|
||||
public String onRequest(OfflinePlayer player, @NotNull String identifier) {
|
||||
if (AllMusic.getConfig().TopPAPI) {
|
||||
if (AllMusic.getConfig().topPAPI) {
|
||||
if (!PluginMessage.update) {
|
||||
PluginMessage.startUpdate();
|
||||
return "";
|
||||
@@ -87,19 +87,19 @@ public class AllMusicPAPI extends PlaceholderExpansion {
|
||||
}
|
||||
case "lyric": {
|
||||
if (PlayMusic.lyric == null || PlayMusic.lyric.getLyric() == null) {
|
||||
return AllMusic.getMessage().Lyric.Empty1;
|
||||
return AllMusic.getMessage().lyric.empty1;
|
||||
}
|
||||
return PlayMusic.lyric.getLyric();
|
||||
}
|
||||
case "tlyric": {
|
||||
if (PlayMusic.lyric == null || PlayMusic.lyric.getTlyric() == null) {
|
||||
return AllMusic.getMessage().Lyric.Empty2;
|
||||
return AllMusic.getMessage().lyric.empty2;
|
||||
}
|
||||
return PlayMusic.lyric.getTlyric();
|
||||
}
|
||||
case "klyric": {
|
||||
if (PlayMusic.lyric == null || PlayMusic.lyric.getKly() == null) {
|
||||
return AllMusic.getMessage().Lyric.Empty3;
|
||||
return AllMusic.getMessage().lyric.empty3;
|
||||
}
|
||||
return PlayMusic.lyric.getKly();
|
||||
}
|
||||
@@ -108,10 +108,10 @@ public class AllMusicPAPI extends PlaceholderExpansion {
|
||||
switch (identifier) {
|
||||
case "now_music_name": {
|
||||
if (PlayMusic.nowPlayMusic == null)
|
||||
return AllMusic.getMessage().PAPI.NoMusic;
|
||||
if (AllMusic.getConfig().MessageLimit
|
||||
&& PlayMusic.nowPlayMusic.getName().length() > AllMusic.getConfig().MessageLimitSize) {
|
||||
return PlayMusic.nowPlayMusic.getName().substring(0, AllMusic.getConfig().MessageLimitSize);
|
||||
return AllMusic.getMessage().papi.emptyMusic;
|
||||
if (AllMusic.getConfig().messageLimit
|
||||
&& PlayMusic.nowPlayMusic.getName().length() > AllMusic.getConfig().messageLimitSize) {
|
||||
return PlayMusic.nowPlayMusic.getName().substring(0, AllMusic.getConfig().messageLimitSize);
|
||||
}
|
||||
return PlayMusic.nowPlayMusic.getName();
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class AllMusicPAPI extends PlaceholderExpansion {
|
||||
return PlayMusic.nowPlayMusic.getInfo();
|
||||
}
|
||||
case "list_size": {
|
||||
return "" + PlayMusic.getSize();
|
||||
return "" + PlayMusic.getListSize();
|
||||
}
|
||||
case "music_list": {
|
||||
return PlayMusic.getAllList();
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package coloryr.allmusic.side.folia.hooks;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -28,4 +30,16 @@ public class SpigotApi {
|
||||
public static void sendBar(Player player, String message) {
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(message));
|
||||
}
|
||||
|
||||
public static void sendMessageBqRun(String message, String end, String command) {
|
||||
TextComponent send = new TextComponent(message);
|
||||
TextComponent endtext = new TextComponent(end);
|
||||
endtext.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command));
|
||||
send.addExtra(endtext);
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!AllMusic.getConfig().mutePlayer.contains(player.getName())) {
|
||||
player.spigot().sendMessage(send);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
name: AllMusic
|
||||
name: AllMusic3
|
||||
main: coloryr.allmusic.AllMusicFolia
|
||||
author: Color_yr
|
||||
version: 2.19.4
|
||||
version: 3.0.0
|
||||
folia-supported: true
|
||||
softdepend: [PlaceholderAPI, Vault, Essentials, CMI]
|
||||
api-version: 1.19
|
||||
|
||||
commands:
|
||||
music:
|
||||
description: AllMusic
|
||||
usage: §4[AllMusic]§6/music help
|
||||
description: AllMusic3
|
||||
usage: §4[AllMusic3]§6/music help
|
||||
@@ -416,7 +416,7 @@ public class SideBukkit extends ISide {
|
||||
|
||||
@Override
|
||||
public void bqRun(String message, String end, String command) {
|
||||
|
||||
SpigotApi.sendMessageBqRun(message, end, command);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -551,7 +551,7 @@ public class SideBukkit extends ISide {
|
||||
if (players == null)
|
||||
return;
|
||||
try {
|
||||
if (AllMusic.isRun)
|
||||
if (AllMusic.isRun) {
|
||||
runTask(() ->
|
||||
{
|
||||
try {
|
||||
@@ -560,7 +560,6 @@ public class SideBukkit extends ISide {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
else {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AllMusic.log.warning("§c数据发送发生错误");
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package coloryr.allmusic.side.bukkit.hooks;
|
||||
|
||||
import coloryr.allmusic.core.AllMusic;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -28,4 +30,16 @@ public class SpigotApi {
|
||||
public static void sendBar(Player player, String message) {
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(message));
|
||||
}
|
||||
|
||||
public static void sendMessageBqRun(String message, String end, String command) {
|
||||
TextComponent send = new TextComponent(message);
|
||||
TextComponent endtext = new TextComponent(end);
|
||||
endtext.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, command));
|
||||
send.addExtra(endtext);
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (!AllMusic.getConfig().mutePlayer.contains(player.getName())) {
|
||||
player.spigot().sendMessage(send);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user