1package com.runehive.content.clanchannel;
3import com.runehive.content.clanchannel.channel.ClanChannel;
4import com.runehive.content.clanchannel.content.ClanViewer;
5import com.runehive.util.GsonUtils;
8import java.io.FileWriter;
9import java.nio.file.Path;
10import java.nio.file.Paths;
21 private static Map<String, ClanChannel>
CHANNELS =
new HashMap<>();
33 public static Set<ClanChannel>
ALLTIME =
new TreeSet<>();
36 private static Set<ClanChannel>
TOP_PVP =
new TreeSet<>();
39 private static Set<ClanChannel>
TOP_PVM =
new TreeSet<>();
75 return ACTIVE_TAGS.contains(name.toLowerCase().trim());
80 if (
channel.getTag().equalsIgnoreCase(tag))
88 if (
channel.activeSize() <= 0) {
96 Thread.startVirtualThread(() -> {
97 final File dir = Paths.get(
"data",
"content",
"clan").toFile();
103 try (FileWriter fw =
new FileWriter(dir.toPath().resolve(
channel.getOwner() +
".json").toFile())) {
105 }
catch (
final Exception e) {
113 Path path = Paths.get(
"./data/content/clan/");
114 File[] files = path.toFile().listFiles();
117 System.out.println(
"No clan files were found.");
121 for (File file : files) {
122 String fileName = file.getName();
123 if (!fileName.toLowerCase().endsWith(
".json"))
continue;
151 return Optional.empty();
170 return Optional.empty();
The repository containing all the clans and their corresponding data.
static Set< ClanChannel > ALLTIME
Set of all active clan chat names.
static Set< ClanChannel > ACTIVE_CHANNELS
Set of all active clan chat channels.
static void saveClan(ClanChannel channel)
static Map< String, ClanChannel > CHANNELS
Map of all clan chat channels.
static void addChannel(ClanChannel channel)
Adds the channel.
static void setInactive(ClanChannel channel)
static void saveAllActiveClans()
static void setActive(ClanChannel channel)
static Optional< Set< ClanChannel > > getTopChanels(ClanType type)
static Optional< Set< ClanChannel > > getTopChanels(ClanViewer.Filter filter)
static void loadChannels()
Loads all clans and puts them into the map.
static Set< ClanChannel > TOP_IRON_MAN
Set of all active clan chat names.
static Set< String > ACTIVE_NAMES
Set of all active clan chat names.
static Set< ClanChannel > TOP_PVM
Set of all active clan chat names.
static Set< ClanChannel > TOP_PVP
Set of all active clan chat names.
static boolean tagExist(String tag)
static Set< ClanChannel > TOP_SKILLING
Set of all active clan chat names.
static boolean nameExist(String name)
static Set< String > ACTIVE_TAGS
Set of all active clan chat tags.
static ClanChannel getChannel(String channel)
Returns the channel.
static void removeChannel(ClanChannel channel)
Handles removing a channel from the clan lists.
Handles the clan chat channel.
static void load(String owner)
Handles viewing clan information.
The different clan types.
PVM
Clans that are focused on PVM.
IRON_MAN
Clans that are focused on iron man accounts.
PVP
Clans that are focused on PVP.
SKILLING
Clans that are focused on skilling.
static final ThreadLocal< Gson > JSON_PRETTY_NO_NULLS