Merge remote-tracking branch 'origin/master'

This commit is contained in:
Nicholas Rees 2021-03-17 17:34:49 -05:00
commit 9bb1265111
7 changed files with 92 additions and 33 deletions

@ -0,0 +1,19 @@
package zone.themcgamer.core.badSportSystem.command;
import lombok.AllArgsConstructor;
import org.bukkit.entity.Player;
import zone.themcgamer.core.account.AccountManager;
import zone.themcgamer.core.command.Command;
import zone.themcgamer.core.command.CommandProvider;
import zone.themcgamer.data.Rank;
@AllArgsConstructor
public class MuteCommand {
private final AccountManager accountManager;
@Command(name = "mute", aliases = { "bssmute" }, description = "Mute a player", ranks = { Rank.HELPER }, playersOnly = true)
public void onCommand(CommandProvider command) {
Player player = command.getPlayer();
}
}

@ -69,11 +69,18 @@ public class HelpCommand {
player.sendMessage("§cPage out of bounds. There " + (maxPage == 1 ? "is" : "are") + " only §l" + maxPage + " §cpage" + (maxPage == 1 ? "" : "s") + ".");
return;
}
String spacers = " ";
player.sendMessage("");
player.sendMessage("§2§lMc§6§lGamer§c§lZone §7(Page " + page + " / " + maxPage + ")");
player.sendMessage("§6<>§7 = required, §6[]§7 = optional");
player.sendMessage("");
pageBuilder.send(player, page);
player.sendMessage("");
player.sendMessage(new ComponentBuilder(" ")
.append(new ComponentBuilder(page <= 1 ? spacers : Style.color("&c&l« Previous Page")).event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help " + Math.decrementExact(page)))
.append(spacers)
.append(new ComponentBuilder(page == maxPage ? spacers : Style.color("&a&lNext Page »")).event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/help " + Math.incrementExact(page)))
.create()).create()).create());
player.sendMessage("");
}
}

@ -1,6 +1,7 @@
package zone.themcgamer.discordbot;
import com.jagrosh.jdautilities.command.CommandClientBuilder;
import com.jagrosh.jdautilities.command.annotation.JDACommand;
import lombok.Getter;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
@ -39,6 +40,7 @@ public class MGZBot {
commandClientBuilder.addCommand(new MessageCommand());
commandClientBuilder.addCommand(new EditMessageCommand());
commandClientBuilder.addCommand(new AddReactionToMessageCommand());
commandClientBuilder.addCommand(new MemberCountCommand());
try {
jda = JDABuilder.createDefault(BotConstants.TOKEN)

@ -0,0 +1,39 @@
package zone.themcgamer.discordbot.command.impl;
import com.jagrosh.jdautilities.command.CommandEvent;
import com.jagrosh.jdautilities.command.annotation.JDACommand;
import net.dv8tion.jda.api.EmbedBuilder;
import zone.themcgamer.core.cooldown.Cooldown;
import zone.themcgamer.discordbot.command.BaseCommand;
import zone.themcgamer.discordbot.guild.Guild;
import zone.themcgamer.discordbot.utilities.EmbedUtils;
import java.util.Arrays;
import java.util.List;
public class MemberCountCommand extends BaseCommand {
public MemberCountCommand() {
name = "membercount";
aliases = new String[]{"members"};
help = "Shows the amount of members in the guild";
cooldown = 10;
arguments = "";
guildOnly = true;
guilds = Arrays.asList(Guild.MAIN, Guild.TEAM, Guild.TEST);
}
@Override
protected void execute(CommandEvent event, List<String> args) {
net.dv8tion.jda.api.entities.Guild guild = event.getGuild();
guild.loadMembers().onSuccess(members -> {
EmbedBuilder embedBuilder = EmbedUtils.defaultEmbed();
embedBuilder.setTitle("Member Count");
embedBuilder.addField("Humans", String.valueOf(members.stream().filter(member -> !member.getUser().isBot()).count()), true);
embedBuilder.addField("Bots", String.valueOf(members.stream().filter(member -> member.getUser().isBot()).count()), true);
event.getChannel().sendMessage(embedBuilder.build()).queue();
});
}
}

@ -140,7 +140,7 @@ public class GuildsListener extends ListenerAdapter {
embedBuilder.setDescription(event.getOldPosition() + " -> " + event.getNewPosition());
embedBuilder.addField("Role", role.getAsMention(), false);
embedBuilder.addField("Id", role.getId(), false);
embedBuilder.addField("Color", Objects.requireNonNull(role.getColor()).toString(), false);
embedBuilder.addField("Color", String.valueOf(role.getColor().getRGB()), false);
embedBuilder.addField("Guild", guild.getName(), true);
MessageUtils.sendLogMessage(embedBuilder);
}

@ -50,23 +50,6 @@ public class HubBalancer implements Runnable, Listener {
if (jedisCommand instanceof ServerRestartCommand) {
ServerRestartCommand serverRestartCommand = (ServerRestartCommand) jedisCommand;
removeServer(serverRestartCommand.getServerId());
ServerInfo serverInfo = proxy.getProxy().getServerInfo(serverRestartCommand.getServerId());
if (serverInfo == null) {
System.out.println("ServerInfo is null");
//We do this check due sometimes players stay in a server which is deleted. But were send to it before it was deleted.
for (ProxiedPlayer player : proxy.getProxy().getPlayers()) {
if (player.getServer() == null && (hubs.size() == 0))
kickPlayer(player, NO_AVAILABLE_HUB);
}
return;
} else {
for (ProxiedPlayer player : proxy.getProxy().getPlayers()) {
if (player.getServer().getInfo().equals(serverInfo)) {
if (hubs.isEmpty())
kickPlayer(player, NO_AVAILABLE_HUB);
}
}
}
}
if (jedisCommand instanceof ServerStateChangeCommand) {
ServerStateChangeCommand serverStateChangeCommand = (ServerStateChangeCommand) jedisCommand;
@ -233,6 +216,15 @@ public class HubBalancer implements Runnable, Listener {
if (entry.getValue().getMotd().equals("STATIC"))
return false;
hubs.remove(serverId);
if (hubs.size() <= 0) {
System.out.println(hubs.size());
System.out.println("Kicking players from server" + entry.getValue().getName());
entry.getValue().getPlayers().forEach(proxiedPlayer -> kickPlayer(proxiedPlayer, NO_AVAILABLE_HUB));
} else {
System.out.println(hubs.size());
System.out.println("Movings players from server " + entry.getValue().getName());
entry.getValue().getPlayers().forEach(this::sendToHub);
}
return true;
});
}

@ -1,6 +1,7 @@
package zone.themcgamer.skyblock.scoreboard;
import com.bgsoftware.superiorskyblock.api.SuperiorSkyblockAPI;
import com.bgsoftware.superiorskyblock.api.island.Island;
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer;
import me.clip.placeholderapi.PlaceholderAPI;
import org.bukkit.entity.Player;
@ -33,7 +34,6 @@ public class SkyblockScoreboard extends WritableScoreboard {
LocalDateTime dateTime = LocalDateTime.now();
write("§7" + dateTime.getMonth().getValue() + "/" + dateTime.getDayOfMonth() + "/" + dateTime.getYear());
writeBlank();
write("§e┋ Account");
write("§e┋ §fRank: &7" + account.getPrimaryRank().getColor() + account.getPrimaryRank().getDisplayName());
@ -42,21 +42,21 @@ public class SkyblockScoreboard extends WritableScoreboard {
write("§e┋ &fMcMMO: &60");
SuperiorPlayer superiorPlayer = SuperiorSkyblockAPI.getPlayer(player);
if (superiorPlayer == null)
return;
if (superiorPlayer.getIsland() == null) {
if (superiorPlayer != null) {
writeBlank();
write("&7You do not have");
write("&7an island!");
write("&e/start &7to get started!");
} else {
writeBlank();
write("§c┋ Island");
write("§c┋ §fRole: &c" + superiorPlayer.getPlayerRole().getName());
write("§c┋ §fLevel: &a" + superiorPlayer.getIsland().getIslandLevel());
write("§c┋ &fSize: &b" + superiorPlayer.getIsland().getIslandSize() + "x" + superiorPlayer.getIsland().getIslandSize());
write("§c┋ &fTeam: &3" + superiorPlayer.getIsland().getIslandMembers(true).size() + "/" + superiorPlayer.getIsland().getTeamLimit());
write("§c┋ &fBank: &e" + DoubleUtils.format(superiorPlayer.getIsland().getIslandBank().getBalance().doubleValue(), true));
Island island = superiorPlayer.getIsland();
if (island == null) {
write("&7You do not have");
write("&7an island!");
write("&e/start &7to get started!");
} else {
write("§c┋ Island");
write("§c┋ §fRole: &c" + superiorPlayer.getPlayerRole().getName());
write("§c┋ §fLevel: &a" + island.getIslandLevel());
write("§c┋ &fSize: &b" + island.getIslandSize() + "x" + island.getIslandSize());
write("§c┋ &fTeam: &3" + island.getIslandMembers(true).size() + "/" + island.getTeamLimit());
write("§c┋ &fBank: &e" + DoubleUtils.format(island.getIslandBank().getBalance().doubleValue(), true));
}
}
writeBlank();
write("§bthemcgamer.zone");