diff --git a/src/main/java/net/momirealms/customfishing/competition/Ranking.java b/src/main/java/net/momirealms/customfishing/competition/Ranking.java deleted file mode 100644 index b0c84a25..00000000 --- a/src/main/java/net/momirealms/customfishing/competition/Ranking.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (C) <2022> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.momirealms.customfishing.competition; - -import java.util.TreeSet; - -public class Ranking { - - private final TreeSet competitionPlayers = new TreeSet<>(); - - public void addPlayer(String player, float score) { - CompetitionPlayer competitionPlayer = new CompetitionPlayer(player, score); - competitionPlayers.add(competitionPlayer); - } - - public void addPlayer(CompetitionPlayer competitionPlayer) { - competitionPlayers.add(competitionPlayer); - } - - public void removePlayer(CompetitionPlayer competitionPlayer) { - competitionPlayers.removeIf(e -> e == competitionPlayer); - } - - public void clear() { - competitionPlayers.clear(); - } - - public boolean contains(CompetitionPlayer competitionPlayer) { - return competitionPlayers.contains(competitionPlayer); - } - - public CompetitionPlayer getCompetitionPlayer(String player) { - for (CompetitionPlayer competitionPlayer : competitionPlayers) { - if (competitionPlayer.getPlayer().equals(player)) { - return competitionPlayer; - } - } - return null; - } - - public String getPlayerRank(String player) { - int index = 1; - for (CompetitionPlayer competitionPlayer : competitionPlayers) { - if (competitionPlayer.getPlayer().equals(player)) { - return String.valueOf(index); - }else { - index++; - } - } - return null; - } - - public CompetitionPlayer getFirst() { - return competitionPlayers.first(); - } - - public String getPlayerAt(int i) { - int count = 1; - for (CompetitionPlayer competitionPlayer : competitionPlayers) { - if (count == i) { - return competitionPlayer.getPlayer(); - } - count++; - } - return null; - } - - public float getScoreAt(int i) { - int count = 1; - for (CompetitionPlayer competitionPlayer : competitionPlayers) { - if (count == i) { - return competitionPlayer.getScore(); - } - count++; - } - return -1.0f; - } -} diff --git a/src/main/java/net/momirealms/customfishing/competition/reward/Command.java b/src/main/java/net/momirealms/customfishing/competition/reward/Command.java deleted file mode 100644 index dd2a9c40..00000000 --- a/src/main/java/net/momirealms/customfishing/competition/reward/Command.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) <2022> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.momirealms.customfishing.competition.reward; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.List; - -public class Command implements Reward{ - - private final List commands; - - public Command(List commands){ - this.commands = commands; - } - - @Override - public void giveReward(Player player) { - commands.forEach(command -> { - Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), command.replace("{player}", player.getName())); - }); - } -} diff --git a/src/main/java/net/momirealms/customfishing/competition/reward/Message.java b/src/main/java/net/momirealms/customfishing/competition/reward/Message.java deleted file mode 100644 index d771ad0b..00000000 --- a/src/main/java/net/momirealms/customfishing/competition/reward/Message.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) <2022> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package net.momirealms.customfishing.competition.reward; - -import net.momirealms.customfishing.utils.AdventureManager; -import org.bukkit.entity.Player; - -import java.util.List; - -public class Message implements Reward{ - - private final List messages; - - public Message(List messages){ - this.messages = messages; - } - - @Override - public void giveReward(Player player) { - if (!player.isOnline()) return; - messages.forEach(message -> { - AdventureManager.playerMessage(player, message); - }); - } -}