// Path: src/main/java/net/frozenbit/plugin5zig/cubecraft/CubeCraftPlayer.java
// public class CubeCraftPlayer {
// 
//     private final Rank rank;
//     private List<String> tags;
//     private NetworkPlayerInfo info;
// 
//     public CubeCraftPlayer(Rank rank, List<String> tags, NetworkPlayerInfo info) {
//         if (rank == null || tags == null || info == null)
//             throw new IllegalArgumentException("rank, tags and info must not be null");
//         this.rank = rank;
//         this.tags = tags;
//         this.info = info;
//     }
// 
//     public boolean isStaff() {
//         return tags.contains("Mod")
//                || tags.contains("SrMod")
//                || tags.contains("Dev")
//                || tags.contains("Admin")
//                || tags.contains("Vanished");
//     }
// 
//     public Rank getRank() {
//         return rank;
//     }
// 
//     public String getName() {
//         return info.getGameProfile().getName();
//     }
// 
//     public UUID getId() {
//         return info.getGameProfile().getId();
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         CubeCraftPlayer that = (CubeCraftPlayer) o;
// 
//         return getName().equals(that.getName());
// 
//     }
// 
//     @Override
//     public String toString() {
//         return "CubeCraftPlayer{" +
//                 "rank=" + rank +
//                 ", tags=" + Arrays.toString(tags.toArray()) +
//                 ", name='" + getName() + '\'' +
//                 '}';
//     }
// 
//     @Override
//     public int hashCode() {
//         return getName().hashCode();
//     }
// }
// 
// Path: src/main/java/net/frozenbit/plugin5zig/cubecraft/Rank.java
// public enum Rank {
//     NONE, STONE, IRON, LAPIZ, GOLD, DIAMOND, EMERALD, OBSIDIAN
// }


import eu.the5zig.util.minecraft.ChatColor;
import net.frozenbit.plugin5zig.cubecraft.CubeCraftPlayer;
import net.frozenbit.plugin5zig.cubecraft.Rank;
import java.util.Map;
import static com.google.common.base.MoreObjects.firstNonNull;
package net.frozenbit.plugin5zig.cubecraft.gamemodes;




/**
 * Common superclass of gamemodes that support voting for time and loot
 */
public abstract class TimeLootVotableMode extends VotableCubeCraftGameMode {
    @Override
    protected String formatVoteString(CubeCraftPlayer player, Map<String, String> vote) {
        DaytimeType time = vote.containsKey("time") ?
                DaytimeType.fromString(vote.get("time")) : DaytimeType.NONE;
        return (player.getRank() == Rank.GOLD ? ChatColor.DARK_GRAY :
                LootType.fromString(firstNonNull(vote.get("loot"), "")).color)
               + player.getName() + ChatColor.RESET + " " + time.coloredSymbol();
    }

    @Override
    public String formatVoteResult(Map<String, String> draw) {
        LootType lootType = LootType.fromString(draw.get("loot"));
        return lootType + "/" + draw.get("time");
    }

    @Override
    protected boolean isShownInVoterList(CubeCraftPlayer player) {
// Path: src/main/java/net/frozenbit/plugin5zig/cubecraft/CubeCraftPlayer.java
// public class CubeCraftPlayer {
// 
//     private final Rank rank;
//     private List<String> tags;
//     private NetworkPlayerInfo info;
// 
//     public CubeCraftPlayer(Rank rank, List<String> tags, NetworkPlayerInfo info) {
//         if (rank == null || tags == null || info == null)
//             throw new IllegalArgumentException("rank, tags and info must not be null");
//         this.rank = rank;
//         this.tags = tags;
//         this.info = info;
//     }
// 
//     public boolean isStaff() {
//         return tags.contains("Mod")
//                || tags.contains("SrMod")
//                || tags.contains("Dev")
//                || tags.contains("Admin")
//                || tags.contains("Vanished");
//     }
// 
//     public Rank getRank() {
//         return rank;
//     }
// 
//     public String getName() {
//         return info.getGameProfile().getName();
//     }
// 
//     public UUID getId() {
//         return info.getGameProfile().getId();
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         CubeCraftPlayer that = (CubeCraftPlayer) o;
// 
//         return getName().equals(that.getName());
// 
//     }
// 
//     @Override
//     public String toString() {
//         return "CubeCraftPlayer{" +
//                 "rank=" + rank +
//                 ", tags=" + Arrays.toString(tags.toArray()) +
//                 ", name='" + getName() + '\'' +
//                 '}';
//     }
// 
//     @Override
//     public int hashCode() {
//         return getName().hashCode();
//     }
// }
// 
// Path: src/main/java/net/frozenbit/plugin5zig/cubecraft/Rank.java
// public enum Rank {
//     NONE, STONE, IRON, LAPIZ, GOLD, DIAMOND, EMERALD, OBSIDIAN
// }


// Path: src/main/java/net/frozenbit/plugin5zig/cubecraft/gamemodes/TimeLootVotableMode.java
import eu.the5zig.util.minecraft.ChatColor;
import net.frozenbit.plugin5zig.cubecraft.CubeCraftPlayer;
import net.frozenbit.plugin5zig.cubecraft.Rank;
import java.util.Map;
import static com.google.common.base.MoreObjects.firstNonNull;

package net.frozenbit.plugin5zig.cubecraft.gamemodes;




/**
 * Common superclass of gamemodes that support voting for time and loot
 */
public abstract class TimeLootVotableMode extends VotableCubeCraftGameMode {
    @Override
    protected String formatVoteString(CubeCraftPlayer player, Map<String, String> vote) {
        DaytimeType time = vote.containsKey("time") ?
                DaytimeType.fromString(vote.get("time")) : DaytimeType.NONE;
        return (player.getRank() == Rank.GOLD ? ChatColor.DARK_GRAY :
                LootType.fromString(firstNonNull(vote.get("loot"), "")).color)
               + player.getName() + ChatColor.RESET + " " + time.coloredSymbol();
    }

    @Override
    public String formatVoteResult(Map<String, String> draw) {
        LootType lootType = LootType.fromString(draw.get("loot"));
        return lootType + "/" + draw.get("time");
    }

    @Override
    protected boolean isShownInVoterList(CubeCraftPlayer player) {
        return player.isStaff() || Rank.GOLD.compareTo(player.getRank()) <= 0;