mirror of
https://github.com/Coloryr/AllMusic.git
synced 2026-11-21 05:42:17 +00:00
1.7.0
This commit is contained in:
1 parent
e4d72cd53f
commit
dcb2e935a0
26 files changed
+410
-50
No files matched your search
@@ -1,15 +1,17 @@
|
||||
package Color_yr.ALLMusic;
|
||||
|
||||
import Color_yr.ALLMusic.Side.ISide;
|
||||
import Color_yr.ALLMusic.VV.VVGet;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class ALLMusic {
|
||||
public static final String channel = "allmusic:channel";
|
||||
public static final String Version = "1.6.0";
|
||||
public static final String Version = "1.7.0";
|
||||
public static ConfigOBJ Config;
|
||||
public static Logger log;
|
||||
public static File ConfigFile;
|
||||
public static ISide Side;
|
||||
public static VVGet VV;
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import Color_yr.ALLMusic.Side.SideBukkit1_12;
|
||||
import Color_yr.ALLMusic.Side.SideBukkit1_14;
|
||||
import Color_yr.ALLMusic.Side.SideBukkit1_15;
|
||||
import Color_yr.ALLMusic.Utils.logs;
|
||||
import Color_yr.ALLMusic.VV.VVGet;
|
||||
import com.google.gson.Gson;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -17,9 +18,9 @@ import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
|
||||
|
||||
public class ALLMusicBukkit extends JavaPlugin {
|
||||
public static Plugin ALLMusicP;
|
||||
public static boolean VVEnable = false;
|
||||
|
||||
public static void save() {
|
||||
try {
|
||||
@@ -89,7 +90,7 @@ public class ALLMusicBukkit extends JavaPlugin {
|
||||
ALLMusic.Side = new SideBukkit1_12();
|
||||
else if (Version.startsWith("1.14"))
|
||||
ALLMusic.Side = new SideBukkit1_14();
|
||||
else if(Version.startsWith("1.15"))
|
||||
else if (Version.startsWith("1.15"))
|
||||
ALLMusic.Side = new SideBukkit1_15();
|
||||
else
|
||||
ALLMusic.Side = new SideBukkit();
|
||||
@@ -97,6 +98,10 @@ public class ALLMusicBukkit extends JavaPlugin {
|
||||
Bukkit.getPluginCommand("music").setExecutor(new CommandBukkit());
|
||||
Bukkit.getPluginCommand("music").setTabCompleter(new CommandBukkit());
|
||||
Bukkit.getPluginManager().registerEvents(new EventBukkit(), this);
|
||||
if (ALLMusic.Config.isVexView() && Bukkit.getPluginManager().isPluginEnabled("VexView")) {
|
||||
ALLMusic.VV = new VVGet();
|
||||
VVEnable = true;
|
||||
}
|
||||
ALLMusic.log.info("§d[ALLMusic]§e已启动-" + ALLMusic.Version);
|
||||
}
|
||||
|
||||
@@ -105,6 +110,9 @@ public class ALLMusicBukkit extends JavaPlugin {
|
||||
PlayMusic.stop();
|
||||
PlayMusic.PlayList.clear();
|
||||
PlayMusic.Vote.clear();
|
||||
if (ALLMusic.VV != null) {
|
||||
ALLMusic.VV.clear();
|
||||
}
|
||||
ALLMusic.Side.Send("[Stop]", false);
|
||||
ALLMusic.log.info("§d[ALLMusic]§e已停止,感谢使用");
|
||||
}
|
||||
|
||||
@@ -16,6 +16,6 @@ public class CommandBC extends Command implements TabExecutor {
|
||||
}
|
||||
|
||||
public Iterable<String> onTabComplete(CommandSender sender, String[] args) {
|
||||
return TabCommand.GetTabList(sender.getName());
|
||||
return TabCommand.GetTabList(sender.getName(), args);
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class CommandBukkit 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());
|
||||
return TabCommand.GetTabList(sender.getName(), args);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ public class CommandEX {
|
||||
ALLMusic.Side.SendMessage(sender, "§d[ALLMusic]§2使用/music v [音量] 调节音量");
|
||||
ALLMusic.Side.SendMessage(sender, "§d[ALLMusic]§2使用/music search [歌名] 搜索歌曲");
|
||||
ALLMusic.Side.SendMessage(sender, "§d[ALLMusic]§2使用/music select [序列] 选择歌曲");
|
||||
ALLMusic.Side.SendMessage(sender, "§d[ALLMusic]§2使用/music vv [位置] [坐标] [数值] 设置VV位置");
|
||||
} else if (args[0].equalsIgnoreCase("stop")) {
|
||||
ALLMusic.Side.Send("[Stop]", Name, false);
|
||||
ALLMusic.Side.SendMessage(sender, "§d[ALLMusic]§2已停止" + Name + "的音乐播放");
|
||||
@@ -161,6 +162,23 @@ public class CommandEX {
|
||||
} else {
|
||||
ALLMusic.Side.SendMessage(sender, "§d[ALLMusic]§c请输入正确的序号");
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("vv")) {
|
||||
if (ALLMusic.VV == null) {
|
||||
ALLMusic.Side.SendMessage(sender, "§d[ALLMusic]§c服务器没有启用VV");
|
||||
} else if (args.length != 4) {
|
||||
ALLMusic.Side.SendMessage(sender, "§d[ALLMusic]§c参数错误,请输入/music help获取帮助");
|
||||
} else {
|
||||
ALLMusic.Side.RunTask(() -> {
|
||||
try {
|
||||
if (!ALLMusic.VV.SetPot(Name, args[1], args[2], args[3]))
|
||||
ALLMusic.Side.SendMessage(sender, "§d[ALLMusic]§c参数错误,请输入/music help获取帮助");
|
||||
else
|
||||
ALLMusic.Side.SendMessage(sender, "§d[ALLMusic]§2已设置");
|
||||
} catch (Exception e) {
|
||||
ALLMusic.Side.SendMessage(sender, "§d[ALLMusic]§c参数错误,请输入/music help获取帮助");
|
||||
}
|
||||
});
|
||||
}
|
||||
} else
|
||||
AddMusic(sender, Name, args);
|
||||
}
|
||||
|
||||
@@ -6,20 +6,31 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TabCommand {
|
||||
public static List<String> GetTabList(String name) {
|
||||
public static List<String> GetTabList(String name, String[] arg) {
|
||||
List<String> arguments = new ArrayList<>();
|
||||
arguments.add("stop");
|
||||
arguments.add("list");
|
||||
arguments.add("vote");
|
||||
arguments.add("nomusic");
|
||||
arguments.add("search");
|
||||
arguments.add("select");
|
||||
if (ALLMusic.Config.getAdmin().contains(name)) {
|
||||
arguments.add("reload");
|
||||
arguments.add("next");
|
||||
arguments.add("ban");
|
||||
arguments.add("delete");
|
||||
arguments.add("addlist");
|
||||
if (arg.length == 1) {
|
||||
arguments.add("stop");
|
||||
arguments.add("list");
|
||||
arguments.add("vote");
|
||||
arguments.add("nomusic");
|
||||
arguments.add("search");
|
||||
arguments.add("select");
|
||||
if (ALLMusic.Config.getAdmin().contains(name)) {
|
||||
arguments.add("reload");
|
||||
arguments.add("next");
|
||||
arguments.add("ban");
|
||||
arguments.add("delete");
|
||||
arguments.add("addlist");
|
||||
}
|
||||
} else if (arg[0].equalsIgnoreCase("vv")) {
|
||||
if (arg.length == 2) {
|
||||
arguments.add("info");
|
||||
arguments.add("list");
|
||||
arguments.add("lyric");
|
||||
} else if (arg.length == 3) {
|
||||
arguments.add("x");
|
||||
arguments.add("y");
|
||||
}
|
||||
}
|
||||
return arguments;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package Color_yr.ALLMusic;
|
||||
|
||||
import Color_yr.ALLMusic.VV.VVSaveOBJ;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ConfigOBJ {
|
||||
private String Music_Api1;
|
||||
@@ -23,6 +27,9 @@ public class ConfigOBJ {
|
||||
private boolean PlayListSwitch;
|
||||
private boolean PlayListRandom;
|
||||
|
||||
private boolean VexView;
|
||||
private Map<String, VVSaveOBJ> VVSave;
|
||||
|
||||
private String Version;
|
||||
|
||||
public ConfigOBJ() {
|
||||
@@ -41,10 +48,24 @@ public class ConfigOBJ {
|
||||
PlayList = new ArrayList<>();
|
||||
PlayListSwitch = true;
|
||||
PlayListRandom = true;
|
||||
VexView = false;
|
||||
VVSave = new HashMap<>();
|
||||
|
||||
Version = ALLMusic.Version;
|
||||
}
|
||||
|
||||
public VVSaveOBJ getVVSave(String player) {
|
||||
return VVSave.get(player);
|
||||
}
|
||||
|
||||
public void setVVSave(VVSaveOBJ obj, String player) {
|
||||
VVSave.put(player, obj);
|
||||
}
|
||||
|
||||
public boolean isVexView() {
|
||||
return VexView;
|
||||
}
|
||||
|
||||
public String getSearch_Api1() {
|
||||
return Search_Api1;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,18 @@ public class ShowOBJ {
|
||||
this.tlyric = tlyric;
|
||||
}
|
||||
|
||||
public boolean isHaveT() {
|
||||
return haveT;
|
||||
}
|
||||
|
||||
public String getTlyric() {
|
||||
return tlyric;
|
||||
}
|
||||
|
||||
public String getLyric() {
|
||||
return lyric;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (lyric == null || lyric.isEmpty())
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package Color_yr.ALLMusic.Play;
|
||||
|
||||
import Color_yr.ALLMusic.ALLMusic;
|
||||
import Color_yr.ALLMusic.ALLMusicBukkit;
|
||||
import Color_yr.ALLMusic.Http.Get;
|
||||
import Color_yr.ALLMusic.Lyric.LyricDo;
|
||||
import Color_yr.ALLMusic.Lyric.ShowOBJ;
|
||||
@@ -12,17 +13,20 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
class PlayGo extends Thread {
|
||||
|
||||
private int times = 0;
|
||||
//创建 run 方法
|
||||
Runnable runnable = () -> PlayMusic.MusicNowTime += 10;
|
||||
private int times = 0;
|
||||
Runnable runnable1 = () -> {
|
||||
ShowOBJ show = PlayMusic.Lyric.checkTime(PlayMusic.MusicNowTime);
|
||||
if (show != null) {
|
||||
String now = show.toString();
|
||||
PlayMusic.nowLyric = now != null ? now : PlayMusic.nowLyric;
|
||||
times = 0;
|
||||
ALLMusic.Side.SendLyric(PlayMusic.nowLyric);
|
||||
} else {
|
||||
if (ALLMusic.VV != null) {
|
||||
ALLMusic.VV.SendLyric(show);
|
||||
} else {
|
||||
String now = show.toString();
|
||||
PlayMusic.nowLyric = now != null ? now : PlayMusic.nowLyric;
|
||||
ALLMusic.Side.SendLyric(PlayMusic.nowLyric);
|
||||
}
|
||||
} else if (ALLMusic.VV == null) {
|
||||
times++;
|
||||
if (times == 200) {
|
||||
times = 0;
|
||||
@@ -97,6 +101,10 @@ class PlayGo extends Thread {
|
||||
ALLMusic.Side.Send("[Play]" + songURL, true);
|
||||
try {
|
||||
while (PlayMusic.MusicAllTime > 0) {
|
||||
if (ALLMusic.Config.isVexView() && ALLMusicBukkit.VVEnable) {
|
||||
ALLMusic.VV.SendList();
|
||||
ALLMusic.VV.SendInfo();
|
||||
}
|
||||
if (!ALLMusic.Side.NeedPlay()) {
|
||||
PlayMusic.MusicAllTime = 1;
|
||||
}
|
||||
|
||||
@@ -23,10 +23,8 @@ public class PlayMusic {
|
||||
public static LyricDo Lyric;
|
||||
public static boolean haveLyric;
|
||||
public static String nowLyric = "";
|
||||
|
||||
private static PlayGo PlayGo;
|
||||
|
||||
public static boolean isList = false;
|
||||
private static PlayGo PlayGo;
|
||||
|
||||
public static void stop() {
|
||||
if (PlayGo != null && PlayGo.isAlive()) {
|
||||
@@ -46,7 +44,7 @@ public class PlayMusic {
|
||||
ALLMusic.Side.bq("§d[ALLMusic]§2" + player +
|
||||
"点歌" + ID);
|
||||
logs.log_write("玩家:" + player + " 点歌:" + ID);
|
||||
SongInfo info = new SongInfo(null, null, ID, null, player);
|
||||
SongInfo info = new SongInfo(null, null, ID, null, player, null);
|
||||
try {
|
||||
info = GetInfo.Get(ID, player);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -9,13 +9,15 @@ public class DataOBJ {
|
||||
return result.getSongs();
|
||||
}
|
||||
}
|
||||
class result{
|
||||
|
||||
class result {
|
||||
private List<songs> songs;
|
||||
|
||||
public List<songs> getSongs() {
|
||||
return songs;
|
||||
}
|
||||
}
|
||||
|
||||
class songs {
|
||||
private int id;
|
||||
private String name;
|
||||
@@ -42,14 +44,16 @@ class songs {
|
||||
return a.substring(0, a.length() - 1);
|
||||
}
|
||||
}
|
||||
class artists{
|
||||
|
||||
class artists {
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
class album{
|
||||
|
||||
class album {
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
|
||||
@@ -18,7 +18,7 @@ public class Search {
|
||||
}
|
||||
String data = name1.toString();
|
||||
data = data.substring(0, data.length() - 1);
|
||||
data = Get.realData(ALLMusic.Config.getSearch_Api1() , data);
|
||||
data = Get.realData(ALLMusic.Config.getSearch_Api1(), data);
|
||||
if (data != null) {
|
||||
DataOBJ obj = new Gson().fromJson(data, DataOBJ.class);
|
||||
if (obj != null && obj.getResult() != null) {
|
||||
|
||||
@@ -6,7 +6,7 @@ public class SearchOBJ {
|
||||
private String Author;
|
||||
private String Aila;
|
||||
|
||||
public SearchOBJ(String ID, String Name, String Author, String Aila) {
|
||||
public SearchOBJ(String ID, String Name, String Author, String Aila) {
|
||||
this.ID = ID;
|
||||
this.Name = Name;
|
||||
this.Author = Author;
|
||||
|
||||
@@ -10,12 +10,9 @@ import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.connection.Server;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static Color_yr.ALLMusic.Play.PlayMusic.NowPlay;
|
||||
|
||||
@@ -85,7 +82,7 @@ public class SideBC implements ISide {
|
||||
if (ALLMusic.Config.getNoMusicPlayer().contains(player.getName())) {
|
||||
online--;
|
||||
} else {
|
||||
if(player.getServer()!=null) {
|
||||
if (player.getServer() != null) {
|
||||
ServerInfo server = player.getServer().getInfo();
|
||||
if (server != null && ALLMusic.Config.getNoMusicServer().contains(server.getName())) {
|
||||
online--;
|
||||
|
||||
@@ -12,8 +12,7 @@ import static Color_yr.ALLMusic.Play.PlayMusic.NowPlay;
|
||||
|
||||
public class SideBukkit1_12 extends SideBukkit {
|
||||
@Override
|
||||
public void SendLyric(String data)
|
||||
{
|
||||
public void SendLyric(String data) {
|
||||
Collection<Player> values = (Collection<Player>) Bukkit.getOnlinePlayers();
|
||||
for (Player players : values) {
|
||||
if (!ALLMusic.Config.getNoMusicPlayer().contains(players.getName())) {
|
||||
|
||||
@@ -12,8 +12,7 @@ import static Color_yr.ALLMusic.Play.PlayMusic.NowPlay;
|
||||
|
||||
public class SideBukkit1_14 extends SideBukkit {
|
||||
@Override
|
||||
public void SendLyric(String data)
|
||||
{
|
||||
public void SendLyric(String data) {
|
||||
Collection<Player> values = (Collection<Player>) Bukkit.getOnlinePlayers();
|
||||
for (Player players : values) {
|
||||
if (!ALLMusic.Config.getNoMusicPlayer().contains(players.getName())) {
|
||||
|
||||
@@ -10,10 +10,9 @@ import java.util.Collection;
|
||||
|
||||
import static Color_yr.ALLMusic.Play.PlayMusic.NowPlay;
|
||||
|
||||
public class SideBukkit1_15 extends SideBukkit{
|
||||
public class SideBukkit1_15 extends SideBukkit {
|
||||
@Override
|
||||
public void SendLyric(String data)
|
||||
{
|
||||
public void SendLyric(String data) {
|
||||
Collection<Player> values = (Collection<Player>) Bukkit.getOnlinePlayers();
|
||||
for (Player players : values) {
|
||||
if (!ALLMusic.Config.getNoMusicPlayer().contains(players.getName())) {
|
||||
|
||||
@@ -7,10 +7,10 @@ import com.google.gson.Gson;
|
||||
public class GetInfo {
|
||||
public static SongInfo Get(String ID, String player) {
|
||||
String data = Get.realData(ALLMusic.Config.getInfo_Api1(), ID);
|
||||
SongInfo info = new SongInfo(null, null, ID, null, player);
|
||||
SongInfo info = new SongInfo(null, null, ID, null, player, null);
|
||||
if (data != null) {
|
||||
InfoOBJ temp = new Gson().fromJson(data, InfoOBJ.class);
|
||||
info = new SongInfo(temp.getAuthor(), temp.getName(), ID, temp.getAlia(), player);
|
||||
info = new SongInfo(temp.getAuthor(), temp.getName(), ID, temp.getAlia(), player, temp.getAl());
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -31,12 +31,17 @@ public class InfoOBJ {
|
||||
}
|
||||
return Alia;
|
||||
}
|
||||
|
||||
public String getAl() {
|
||||
return songs.get(0).getAl();
|
||||
}
|
||||
}
|
||||
|
||||
class Songs {
|
||||
private String name;
|
||||
private List<ar> ar;
|
||||
private List<String> alia;
|
||||
private al al;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
@@ -49,11 +54,23 @@ class Songs {
|
||||
public List<String> getAlia() {
|
||||
return alia;
|
||||
}
|
||||
|
||||
public String getAl() {
|
||||
return al.getName();
|
||||
}
|
||||
}
|
||||
|
||||
class ar {
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
class al {
|
||||
private String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@@ -6,13 +6,35 @@ public class SongInfo {
|
||||
private String ID;
|
||||
private String Alia;
|
||||
private String Call;
|
||||
private String Al;
|
||||
|
||||
public SongInfo(String Author, String Name, String ID, String Alia, String Call) {
|
||||
public SongInfo(String Author, String Name, String ID, String Alia, String Call, String Al) {
|
||||
this.Author = Author;
|
||||
this.Name = Name;
|
||||
this.ID = ID;
|
||||
this.Alia = Alia;
|
||||
this.Call = Call;
|
||||
this.Al = Al;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return Author;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return Name;
|
||||
}
|
||||
|
||||
public String getCall() {
|
||||
return Call;
|
||||
}
|
||||
|
||||
public String getAlia() {
|
||||
return Alia;
|
||||
}
|
||||
|
||||
public String getAl() {
|
||||
return Al;
|
||||
}
|
||||
|
||||
public String getID() {
|
||||
@@ -29,6 +51,9 @@ public class SongInfo {
|
||||
if (Alia != null && !Alia.isEmpty()) {
|
||||
info += " | " + Alia;
|
||||
}
|
||||
if (Al != null && Al.isEmpty()) {
|
||||
info += " | " + Al;
|
||||
}
|
||||
} else
|
||||
info = ID;
|
||||
info += " by:" + Call;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package Color_yr.ALLMusic.VV;
|
||||
|
||||
public class PosOBJ {
|
||||
private int x;
|
||||
private int y;
|
||||
|
||||
public PosOBJ(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public int getY() {
|
||||
return y;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package Color_yr.ALLMusic.VV;
|
||||
|
||||
import Color_yr.ALLMusic.ALLMusic;
|
||||
import Color_yr.ALLMusic.Lyric.ShowOBJ;
|
||||
import Color_yr.ALLMusic.Play.PlayMusic;
|
||||
import Color_yr.ALLMusic.Song.SongInfo;
|
||||
import Color_yr.ALLMusic.Utils.Function;
|
||||
import lk.vexview.api.VexViewAPI;
|
||||
import lk.vexview.hud.VexTextShow;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class VVGet {
|
||||
public static String version;
|
||||
|
||||
public VVGet() {
|
||||
version = VexViewAPI.getVexView().getVersion();
|
||||
ALLMusic.log.info("§d[ALLMusic]§2VexView支持已启动");
|
||||
}
|
||||
|
||||
public boolean SetPot(String player, String pos, String local, String data) {
|
||||
VVSaveOBJ obj = ALLMusic.Config.getVVSave(player);
|
||||
if (obj == null)
|
||||
obj = new VVSaveOBJ();
|
||||
Pos pos1 = Pos.valueOf(pos);
|
||||
PosOBJ posOBJ = new PosOBJ(0, 0);
|
||||
int data1 = Integer.parseInt(data);
|
||||
Local local1 = Local.valueOf(local);
|
||||
if (!Function.isInteger(data))
|
||||
return false;
|
||||
switch (pos1) {
|
||||
case lyric:
|
||||
posOBJ = obj.getLyric();
|
||||
break;
|
||||
case list:
|
||||
posOBJ = obj.getList();
|
||||
break;
|
||||
case info:
|
||||
posOBJ = obj.getInfo();
|
||||
break;
|
||||
}
|
||||
switch (local1) {
|
||||
case x:
|
||||
posOBJ.setX(data1);
|
||||
break;
|
||||
case y:
|
||||
posOBJ.setY(data1);
|
||||
break;
|
||||
}
|
||||
switch (pos1) {
|
||||
case lyric:
|
||||
obj.setLyric(posOBJ);
|
||||
break;
|
||||
case list:
|
||||
obj.setList(posOBJ);
|
||||
break;
|
||||
case info:
|
||||
obj.setInfo(posOBJ);
|
||||
break;
|
||||
}
|
||||
|
||||
ALLMusic.Config.setVVSave(obj, player);
|
||||
ALLMusic.Side.save();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SendList() {
|
||||
VexTextShow show;
|
||||
List<String> list = new ArrayList<>();
|
||||
boolean save = false;
|
||||
if (PlayMusic.PlayList.size() == 0) {
|
||||
list.add("队列中无歌曲");
|
||||
} else {
|
||||
String now;
|
||||
for (SongInfo info : PlayMusic.PlayList) {
|
||||
now = info.getInfo();
|
||||
if (now.length() > 30)
|
||||
now = now.substring(0, 29) + "...";
|
||||
list.add(now);
|
||||
}
|
||||
}
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
VVSaveOBJ obj = ALLMusic.Config.getVVSave(player.getName());
|
||||
if (obj == null) {
|
||||
obj = new VVSaveOBJ();
|
||||
ALLMusic.Config.setVVSave(obj, player.getName());
|
||||
save = true;
|
||||
}
|
||||
|
||||
show = new VexTextShow("ALLMusicList", obj.getList().getX(), obj.getList().getY(), 0, list, 0);
|
||||
VexViewAPI.sendHUD(player, show);
|
||||
}
|
||||
if (save) {
|
||||
ALLMusic.Side.save();
|
||||
}
|
||||
}
|
||||
|
||||
public void SendInfo() {
|
||||
VexTextShow show;
|
||||
List<String> list = new ArrayList<>();
|
||||
boolean save = false;
|
||||
if (PlayMusic.NowPlayMusic == null) {
|
||||
list.add("没有播放的音乐");
|
||||
} else {
|
||||
list.add(PlayMusic.NowPlayMusic.getName());
|
||||
list.add(PlayMusic.NowPlayMusic.getAuthor());
|
||||
list.add(PlayMusic.NowPlayMusic.getAlia());
|
||||
list.add(PlayMusic.NowPlayMusic.getAl());
|
||||
list.add("by:" + PlayMusic.NowPlayMusic.getCall());
|
||||
}
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
VVSaveOBJ obj = ALLMusic.Config.getVVSave(player.getName());
|
||||
if (obj == null) {
|
||||
obj = new VVSaveOBJ();
|
||||
ALLMusic.Config.setVVSave(obj, player.getName());
|
||||
save = true;
|
||||
}
|
||||
|
||||
show = new VexTextShow("ALLMusicInfo", obj.getInfo().getX(), obj.getInfo().getY(), 0, list, 0);
|
||||
VexViewAPI.sendHUD(player, show);
|
||||
}
|
||||
if (save) {
|
||||
ALLMusic.Side.save();
|
||||
}
|
||||
}
|
||||
|
||||
public void SendLyric(ShowOBJ showobj) {
|
||||
VexTextShow show;
|
||||
List<String> list = new ArrayList<>();
|
||||
boolean save = false;
|
||||
if (showobj == null) {
|
||||
list.add("无歌词");
|
||||
} else {
|
||||
if (showobj.getLyric() != null)
|
||||
list.add(showobj.getLyric());
|
||||
if (showobj.isHaveT() && showobj.getTlyric() != null)
|
||||
list.add(showobj.getTlyric());
|
||||
}
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
VVSaveOBJ obj = ALLMusic.Config.getVVSave(player.getName());
|
||||
if (obj == null) {
|
||||
obj = new VVSaveOBJ();
|
||||
ALLMusic.Config.setVVSave(obj, player.getName());
|
||||
save = true;
|
||||
}
|
||||
|
||||
show = new VexTextShow("ALLMusicLyric", obj.getLyric().getX(), obj.getLyric().getY(), 0, list, 0);
|
||||
VexViewAPI.sendHUD(player, show);
|
||||
}
|
||||
if (save) {
|
||||
ALLMusic.Side.save();
|
||||
}
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
VexViewAPI.removeHUD(player, "ALLMusicInfo");
|
||||
VexViewAPI.removeHUD(player, "ALLMusicList");
|
||||
VexViewAPI.removeHUD(player, "ALLMusicLyric");
|
||||
}
|
||||
}
|
||||
|
||||
public enum Pos {
|
||||
info, list, lyric
|
||||
}
|
||||
|
||||
public enum Local {
|
||||
x, y
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package Color_yr.ALLMusic.VV;
|
||||
|
||||
public class VVSaveOBJ {
|
||||
private PosOBJ List;
|
||||
private PosOBJ Lyric;
|
||||
private PosOBJ Info;
|
||||
|
||||
public VVSaveOBJ() {
|
||||
List = new PosOBJ(2, 80);
|
||||
Lyric = new PosOBJ(2, 325);
|
||||
Info = new PosOBJ(2, 2);
|
||||
}
|
||||
|
||||
public PosOBJ getInfo() {
|
||||
return Info;
|
||||
}
|
||||
|
||||
public void setInfo(PosOBJ info) {
|
||||
Info = info;
|
||||
}
|
||||
|
||||
public PosOBJ getList() {
|
||||
return List;
|
||||
}
|
||||
|
||||
public void setList(PosOBJ list) {
|
||||
List = list;
|
||||
}
|
||||
|
||||
public PosOBJ getLyric() {
|
||||
return Lyric;
|
||||
}
|
||||
|
||||
public void setLyric(PosOBJ lyric) {
|
||||
Lyric = lyric;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
name: ALLMusic
|
||||
main: Color_yr.ALLMusic.ALLMusicBC
|
||||
author: Color_yr
|
||||
version: 1.6.0
|
||||
version: 1.7.0
|
||||
@@ -14,5 +14,6 @@
|
||||
"PlayList": [],
|
||||
"PlayListSwitch": true,
|
||||
"PlayListRandom": true,
|
||||
"Version": "1.6.0"
|
||||
"VexView": false,
|
||||
"Version": "1.7.0"
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
name: ALLMusic
|
||||
main: Color_yr.ALLMusic.ALLMusicBukkit
|
||||
author: Color_yr
|
||||
version: 1.6.0
|
||||
version: 1.7.0
|
||||
loadbefore:
|
||||
- vexview
|
||||
|
||||
commands:
|
||||
music:
|
||||
|
||||
Reference in new issue
Block a user