Skip to content

Commit

Permalink
up 修改检查
Browse files Browse the repository at this point in the history
  • Loading branch information
Coloryr committed Jul 3, 2024
1 parent 9002459 commit 29f95fe
Show file tree
Hide file tree
Showing 25 changed files with 315 additions and 379 deletions.
12 changes: 7 additions & 5 deletions core/command/CommandEX.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public static List<String> getTabList(String name, String[] arg) {
List<String> arguments = new ArrayList<>();
if (arg.length == 0) {
arguments.addAll(normal);
if (AllMusic.getConfig().adminList.contains(name)) {
if (AllMusic.side.checkPermission(name)) {
arguments.addAll(admin);
}
if (AllMusic.getSearch(name) != null) {
Expand All @@ -263,7 +263,7 @@ public static List<String> getTabList(String name, String[] arg) {
} else {
if (arg[0] == null || arg[0].isEmpty() || arg.length == 1) {
arguments.addAll(normal);
if (AllMusic.getConfig().adminList.contains(name)) {
if (AllMusic.side.checkPermission(name)) {
arguments.addAll(admin);
}
if (arg[0] == null || arg[0].isEmpty()) {
Expand All @@ -276,9 +276,11 @@ public static List<String> getTabList(String name, String[] arg) {
if (command != null) {
arguments.addAll(command.tab(name, arg, 1));
}
command = CommandEX.commandAdminList.get(arg[0]);
if (command != null) {
arguments.addAll(command.tab(name, arg, 1));
if (AllMusic.side.checkPermission(name)) {
command = CommandEX.commandAdminList.get(arg[0]);
if (command != null) {
arguments.addAll(command.tab(name, arg, 1));
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/command/CommandHelp.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void ex(Object sender, String name, String[] args) {
AllMusic.getMessage().click.clickCheck, "/music hud pic rotate ");
AllMusic.side.sendMessageSuggest(sender, AllMusic.getMessage().help.normal.hud5,
AllMusic.getMessage().click.clickCheck, "/music hud pic speed ");
if (AllMusic.getConfig().adminList.contains(name)) {
if (AllMusic.side.checkPermission(name)) {
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.admin.reload,
AllMusic.getMessage().click.clickRun, "/music reload");
AllMusic.side.sendMessageRun(sender, AllMusic.getMessage().help.admin.next,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,12 @@ public boolean checkPermission(String player, String permission) {

@Override
public boolean needPlay() {
int online = getPlayerSize();
for (ServerPlayerEntity player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.getConfig().mutePlayer.contains(player.getName().getString())) {
online--;
if (!AllMusic.isSkip(player.getName().getString(), null, false)) {
return true;
}
}
return online > 0;
return false;
}

@Override
Expand Down Expand Up @@ -112,7 +111,7 @@ protected void topSendStop(String name) {
public void sendMusic(String data) {
try {
for (ServerPlayerEntity player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, false))
if (AllMusic.isSkip(player.getName().getString(), null, false))
continue;
send(player, PacketCodec.pack(ComType.PLAY, data, 0));
AllMusic.addNowPlayPlayer(player.getName().getString());
Expand All @@ -129,7 +128,7 @@ protected void topSendMusic(String player, String data) {
ServerPlayerEntity player1 = AllMusicFabric.server.getPlayerManager().getPlayer(player);
if (player1 == null)
return;
if (AllMusic.isOK(player, null, false))
if (AllMusic.isSkip(player, null, false))
return;
send(player1, PacketCodec.pack(ComType.PLAY, data, 0));
} catch (Exception e) {
Expand All @@ -142,7 +141,7 @@ protected void topSendMusic(String player, String data) {
public void sendPic(String data) {
try {
for (ServerPlayerEntity player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
Expand All @@ -162,7 +161,7 @@ public void sendPic(String player, String data) {
ServerPlayerEntity player1 = AllMusicFabric.server.getPlayerManager().getPlayer(player);
if (player1 == null)
return;
if (AllMusic.isOK(player1.getName().getString(), null, true))
if (AllMusic.isSkip(player1.getName().getString(), null, true))
return;
send(player1, PacketCodec.pack(ComType.IMG, data, 0));
} catch (Exception e) {
Expand All @@ -177,7 +176,7 @@ public void sendPos(String player, int pos) {
ServerPlayerEntity player1 = AllMusicFabric.server.getPlayerManager().getPlayer(player);
if (player1 == null)
return;
if (AllMusic.isOK(player1.getName().getString(), null, true))
if (AllMusic.isSkip(player1.getName().getString(), null, true))
return;
send(player1, PacketCodec.pack(ComType.POS, null, pos));
} catch (Exception e) {
Expand All @@ -190,7 +189,7 @@ public void sendPos(String player, int pos) {
public void sendHudLyric(String data) {
try {
for (ServerPlayerEntity player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
Expand All @@ -208,7 +207,7 @@ public void sendHudLyric(String data) {
public void sendHudInfo(String data) {
try {
for (ServerPlayerEntity player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
Expand Down Expand Up @@ -247,7 +246,7 @@ public void sendHud(String name, HudType pos, String data) {
if (player == null)
return;

if (AllMusic.isOK(name, null, true))
if (AllMusic.isSkip(name, null, true))
return;

switch (pos) {
Expand All @@ -271,7 +270,7 @@ public void sendHud(String name, HudType pos, String data) {
public void sendHudList(String data) {
try {
for (ServerPlayerEntity player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
Expand Down Expand Up @@ -304,7 +303,7 @@ public void sendHudUtilsAll() {
public void sendBar(String data) {
for (ServerPlayerEntity player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
try {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
FabricApi.sendBar(player, data);
} catch (Exception e1) {
Expand Down Expand Up @@ -342,7 +341,7 @@ public void clearHud() {
@Override
public void topBq(String data) {
for (ServerPlayerEntity player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (!AllMusic.getConfig().mutePlayer.contains(player.getName().getString())) {
if (!AllMusic.isSkip(player.getName().getString(), null, false)) {
player.sendMessage(Text.of(data), false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,12 @@ public boolean checkPermission(String player, String permission) {

@Override
public boolean needPlay() {
int online = getPlayerSize();
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.getConfig().mutePlayer.contains(player.getName().getString())) {
online--;
if (!AllMusic.isSkip(player.getName().getString(), null, false)) {
return true;
}
}
return online > 0;
return false;
}

@Override
Expand Down Expand Up @@ -112,7 +111,7 @@ protected void topSendStop(String name) {
public void sendMusic(String data) {
try {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, false))
if (AllMusic.isSkip(player.getName().getString(), null, false))
continue;
send(player, PacketCodec.pack(ComType.PLAY, data, 0));
AllMusic.addNowPlayPlayer(player.getName().getString());
Expand All @@ -129,7 +128,7 @@ protected void topSendMusic(String player, String data) {
var player1 = AllMusicFabric.server.getPlayerManager().getPlayer(player);
if (player1 == null)
return;
if (AllMusic.isOK(player, null, false))
if (AllMusic.isSkip(player, null, false))
return;
send(player1, PacketCodec.pack(ComType.PLAY, data, 0));
} catch (Exception e) {
Expand All @@ -142,7 +141,7 @@ protected void topSendMusic(String player, String data) {
public void sendPic(String data) {
try {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
Expand All @@ -162,7 +161,7 @@ public void sendPic(String player, String data) {
var player1 = AllMusicFabric.server.getPlayerManager().getPlayer(player);
if (player1 == null)
return;
if (AllMusic.isOK(player1.getName().getString(), null, true))
if (AllMusic.isSkip(player1.getName().getString(), null, true))
return;
send(player1, PacketCodec.pack(ComType.IMG, data, 0));
} catch (Exception e) {
Expand All @@ -177,7 +176,7 @@ public void sendPos(String player, int pos) {
var player1 = AllMusicFabric.server.getPlayerManager().getPlayer(player);
if (player1 == null)
return;
if (AllMusic.isOK(player1.getName().getString(), null, true))
if (AllMusic.isSkip(player1.getName().getString(), null, true))
return;
send(player1, PacketCodec.pack(ComType.POS, null, pos));
} catch (Exception e) {
Expand All @@ -190,7 +189,7 @@ public void sendPos(String player, int pos) {
public void sendHudLyric(String data) {
try {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
Expand All @@ -208,7 +207,7 @@ public void sendHudLyric(String data) {
public void sendHudInfo(String data) {
try {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
Expand Down Expand Up @@ -247,7 +246,7 @@ public void sendHud(String name, HudType pos, String data) {
if (player == null)
return;

if (AllMusic.isOK(name, null, true))
if (AllMusic.isSkip(name, null, true))
return;

switch (pos) {
Expand All @@ -271,7 +270,7 @@ public void sendHud(String name, HudType pos, String data) {
public void sendHudList(String data) {
try {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
Expand Down Expand Up @@ -304,7 +303,7 @@ public void sendHudUtilsAll() {
public void sendBar(String data) {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
try {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
FabricApi.sendBar(player, data);
} catch (Exception e1) {
Expand Down Expand Up @@ -342,7 +341,7 @@ public void clearHud() {
@Override
public void topBq(String data) {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (!AllMusic.getConfig().mutePlayer.contains(player.getName().getString())) {
if (!AllMusic.isSkip(player.getName().getString(), null, false)) {
player.sendMessage(Text.of(data), false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public boolean checkPermission(String player, String permission) {
public boolean needPlay() {
int online = getPlayerSize();
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.getConfig().mutePlayer.contains(player.getName().getString())) {
if (AllMusic.isSkip(player.getName().getString(), null, false)) {
online--;
}
}
Expand Down Expand Up @@ -113,7 +113,7 @@ protected void topSendStop(String name) {
public void sendMusic(String data) {
try {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, false))
if (AllMusic.isSkip(player.getName().getString(), null, false))
continue;
send(player, PacketCodec.pack(ComType.PLAY, data, 0));
AllMusic.addNowPlayPlayer(player.getName().getString());
Expand All @@ -130,7 +130,7 @@ protected void topSendMusic(String player, String data) {
var player1 = AllMusicFabric.server.getPlayerManager().getPlayer(player);
if (player1 == null)
return;
if (AllMusic.isOK(player, null, false))
if (AllMusic.isSkip(player, null, false))
return;
send(player1, PacketCodec.pack(ComType.PLAY, data, 0));
} catch (Exception e) {
Expand All @@ -143,7 +143,7 @@ protected void topSendMusic(String player, String data) {
public void sendPic(String data) {
try {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
Expand All @@ -163,7 +163,7 @@ public void sendPic(String player, String data) {
var player1 = AllMusicFabric.server.getPlayerManager().getPlayer(player);
if (player1 == null)
return;
if (AllMusic.isOK(player1.getName().getString(), null, true))
if (AllMusic.isSkip(player1.getName().getString(), null, true))
return;
send(player1, PacketCodec.pack(ComType.IMG, data, 0));
} catch (Exception e) {
Expand All @@ -178,7 +178,7 @@ public void sendPos(String player, int pos) {
var player1 = AllMusicFabric.server.getPlayerManager().getPlayer(player);
if (player1 == null)
return;
if (AllMusic.isOK(player1.getName().getString(), null, true))
if (AllMusic.isSkip(player1.getName().getString(), null, true))
return;
send(player1, PacketCodec.pack(ComType.POS, null, pos));
} catch (Exception e) {
Expand All @@ -191,7 +191,7 @@ public void sendPos(String player, int pos) {
public void sendHudLyric(String data) {
try {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
Expand All @@ -209,7 +209,7 @@ public void sendHudLyric(String data) {
public void sendHudInfo(String data) {
try {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
Expand Down Expand Up @@ -248,7 +248,7 @@ public void sendHud(String name, HudType pos, String data) {
if (player == null)
return;

if (AllMusic.isOK(name, null, true))
if (AllMusic.isSkip(name, null, true))
return;

switch (pos) {
Expand All @@ -272,7 +272,7 @@ public void sendHud(String name, HudType pos, String data) {
public void sendHudList(String data) {
try {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
String name = player.getName().getString();
SaveObj obj = HudUtils.get(name);
Expand Down Expand Up @@ -305,7 +305,7 @@ public void sendHudUtilsAll() {
public void sendBar(String data) {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
try {
if (AllMusic.isOK(player.getName().getString(), null, true))
if (AllMusic.isSkip(player.getName().getString(), null, true))
continue;
FabricApi.sendBar(player, data);
} catch (Exception e1) {
Expand Down Expand Up @@ -343,7 +343,7 @@ public void clearHud() {
@Override
public void topBq(String data) {
for (var player : AllMusicFabric.server.getPlayerManager().getPlayerList()) {
if (!AllMusic.getConfig().mutePlayer.contains(player.getName().getString())) {
if (!AllMusic.isSkip(player.getName().getString(), null, false)) {
player.sendMessage(Text.of(data), false);
}
}
Expand Down
Loading

0 comments on commit 29f95fe

Please sign in to comment.