geforkt von SteamWar/BungeeCore
Implement broadcasting
Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Ursprung
1e38e9a0e2
Commit
c3faa9163f
@ -17,6 +17,7 @@ import net.md_5.bungee.config.Configuration;
|
|||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class CheckCommand extends BasicCommand {
|
public class CheckCommand extends BasicCommand {
|
||||||
@ -37,6 +38,12 @@ public class CheckCommand extends BasicCommand {
|
|||||||
|
|
||||||
public CheckCommand() {
|
public CheckCommand() {
|
||||||
super("check", ConnectionListener.CHECK_PERMISSION);
|
super("check", ConnectionListener.CHECK_PERMISSION);
|
||||||
|
|
||||||
|
ProxyServer.getInstance().getScheduler().schedule(BungeeCore.get(), () -> {
|
||||||
|
List<Schematic> schematics = getSchemsToCheck();
|
||||||
|
if(schematics.size() > 0)
|
||||||
|
ServerTeamchatCommand.sendToTeam("§7Es sind §e" + schematics.size() + " §7Schematics zu prüfen§8!");
|
||||||
|
}, 10, 10, TimeUnit.MINUTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -72,13 +79,18 @@ public class CheckCommand extends BasicCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void list(ProxiedPlayer player) {
|
private static List<Schematic> getSchemsToCheck(){
|
||||||
List<Schematic> schematicList = new LinkedList<>();
|
List<Schematic> schematicList = new LinkedList<>();
|
||||||
|
|
||||||
for (SchematicType type : SchematicType.values()) {
|
for (SchematicType type : SchematicType.values()) {
|
||||||
if (type.check())
|
if (type.check())
|
||||||
schematicList.addAll(Schematic.getAllSchemsOfType(type));
|
schematicList.addAll(Schematic.getAllSchemsOfType(type));
|
||||||
}
|
}
|
||||||
|
return schematicList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void list(ProxiedPlayer player) {
|
||||||
|
List<Schematic> schematicList = getSchemsToCheck();
|
||||||
|
|
||||||
BungeeCore.send(player, "§e§lZu prüfen sind " + schematicList.size() + " Schematics");
|
BungeeCore.send(player, "§e§lZu prüfen sind " + schematicList.size() + " Schematics");
|
||||||
|
|
||||||
@ -223,7 +235,7 @@ public class CheckCommand extends BasicCommand {
|
|||||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(SteamwarUser.get(schematic.getSchemOwner()).getUuid());
|
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(SteamwarUser.get(schematic.getSchemOwner()).getUuid());
|
||||||
if(player != null)
|
if(player != null)
|
||||||
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aDein §e" + schematic.getSchemType().name() + " " + schematic.getSchemName() + " §ewurde freigegeben§8!");
|
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§aDein §e" + schematic.getSchemType().name() + " " + schematic.getSchemName() + " §ewurde freigegeben§8!");
|
||||||
BungeeCore.send(checker, "§aDie Schematic §e" + schematic.getSchemName() + " §avon §e" + SteamwarUser.get(schematic.getSchemOwner()).getUserName() + " §aist nun freigegeben!");
|
ServerTeamchatCommand.sendToTeam("§aDie Schematic §e" + schematic.getSchemName() + " §avon §e" + SteamwarUser.get(schematic.getSchemOwner()).getUserName() + " §aist nun freigegeben!");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +245,7 @@ public class CheckCommand extends BasicCommand {
|
|||||||
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(SteamwarUser.get(schematic.getSchemOwner()).getUuid());
|
ProxiedPlayer player = ProxyServer.getInstance().getPlayer(SteamwarUser.get(schematic.getSchemOwner()).getUuid());
|
||||||
if(player != null)
|
if(player != null)
|
||||||
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDein §e" + schematic.getSchemType().name() + " " + schematic.getSchemName() + " §cwurde abgelehnt§8: §c" + reason);
|
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cDein §e" + schematic.getSchemType().name() + " " + schematic.getSchemName() + " §cwurde abgelehnt§8: §c" + reason);
|
||||||
BungeeCore.send(checker, "§aDie Schematic §e" + schematic.getSchemName() + " §avon §e" + SteamwarUser.get(schematic.getSchemOwner()).getUserName() + " §awurde aufgrund von §e" + reason + " §aabgelehnt!");
|
ServerTeamchatCommand.sendToTeam("§aDie Schematic §e" + schematic.getSchemName() + " §avon §e" + SteamwarUser.get(schematic.getSchemOwner()).getUserName() + " §awurde aufgrund von §e" + reason + " §aabgelehnt!");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,11 +30,15 @@ public class ServerTeamchatCommand extends BasicCommand {
|
|||||||
String msg = msgBuilder.toString();
|
String msg = msgBuilder.toString();
|
||||||
msg = ChatColor.translateAlternateColorCodes('&', msg);
|
msg = ChatColor.translateAlternateColorCodes('&', msg);
|
||||||
|
|
||||||
for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){
|
sendToTeam(msg);
|
||||||
if ((target.hasPermission("bungeecore.teamchat"))
|
}
|
||||||
&& target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN){
|
}
|
||||||
target.sendMessage(msg);
|
|
||||||
}
|
public static void sendToTeam(String message){
|
||||||
|
for (ProxiedPlayer target : ProxyServer.getInstance().getPlayers()){
|
||||||
|
if ((target.hasPermission("bungeecore.teamchat"))
|
||||||
|
&& target.getChatMode() == ProxiedPlayer.ChatMode.SHOWN){
|
||||||
|
BungeeCore.send(target, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren