1package com.runehive.content.clanchannel.channel;
3import com.runehive.Config;
4import com.runehive.content.clanchannel.*;
5import com.runehive.game.world.entity.mob.player.Player;
6import com.runehive.game.world.entity.mob.player.PlayerRight;
7import com.runehive.game.world.entity.mob.player.profile.ProfileRepository;
8import com.runehive.net.packet.out.*;
9import com.runehive.util.Utility;
12import java.nio.file.Path;
13import java.nio.file.Paths;
16import static com.runehive.content.clanchannel.channel.ClanManagement.*;
45 player.clanChannel =
null;
57 boolean loaded =
true;
58 Path path = Paths.get(
"./data/content/clan/");
59 File[] files = path.toFile().listFiles();
62 System.out.println(
"No clan files were found!");
63 player.
message(
"Clan does not exist!");
65 if (owner.equalsIgnoreCase(player.
getName())) {
71 for (File file : files) {
72 if (file.getName().toLowerCase().contains(player.
getUsername().toLowerCase().trim()) && file.length() > 0) {
78 if (owner.equalsIgnoreCase(player.
getName())) {
80 player.
send(
new SendMessage(
"Your clan didn't load into the server properly!"));
81 player.
send(
new SendMessage(
"If you see this message, your clan was not reset."));
82 player.
message(
"Try to join your clan again. If you still see this message, contact a staff member.");
89 player.
send(
new SendMessage(
"This clan didn't load into the server properly!"));
90 player.
message(
"Try to join your clan again. If you still see this message, contact a staff member.");
94 player.
send(
new SendMessage(
"Connection was refused: No channel exists!"));
98 if (!
channel.getOwner().equals(
"osroyale") &&
channel.activeSize() >= 80) {
99 player.
send(
new SendMessage(
"Connection was refused: Channel currently full!"));
103 player.
send(
new SendMessage(
"Connection was refused: Currently banned from channel!"));
107 player.
message(
"Only Iron-man accounts can join this clan!");
126 Optional<ClanMember> member =
channel.getMember(player.
getName());
127 member.ifPresent(m -> {
129 player.
send(
new SendMessage(
"You do not have sufficient privileges to manage this clan!"));
157 if (!
channel.canEnter(member)) {
158 player.
send(
new SendMessage(
"Connection was refused: No required permission!"));
163 player.
send(
new SendMessage(
"Connection was refused: Clan is currently locked!"));
180 if (!
channel.isPassword(input)) {
181 player.
send(
new SendMessage(
"You have entered an invalid clan password."));
186 channel.establish(player, member);
197 member.
player.ifPresent(player -> {
199 player.send(
new SendMessage(
"To talk, start each line of chat with the / symbol."));
208 "-<col=FF0000>WARNING</col>-",
209 "Contributing to this clan or gaining a rank will remove",
210 "all of your progress from your current clan <col=FF4444>" + player.
lastClan +
"</col>.",
211 "Are you sure you want to join?")
214 () ->
channel.add(player, member),
215 "No, I don't want to risk it.",
224 if (!
channel.canManage(member))
227 List<ClanMember> sorted =
new ArrayList<>(
channel.getActiveMembers());
231 if (ordinal >= sorted.size())
256 List<ClanMember> members =
new LinkedList<>();
257 members.addAll(
channel.getMembers());
260 Iterator<ClanMember> iterator = members.iterator();
261 boolean tooltip =
channel.canManage(member);
264 for (
int index = 0; index < size * 3; index++) {
266 if (iterator.hasNext()) {
267 nextMember = iterator.next();
269 if (nextMember ==
null || (!nextMember.
player.isPresent() && index / 3 >= members.size())) {
275 }
else if (nextMember.
player.isPresent()) {
289 player.
send(
new SendString(
"Talking in: <col=F7DC6F>None", 33502));
290 for (
int i = 0; i < 99; i += 4) {
The class that contains setting-related constants for the server.
static final int CLAN_TAB
Handles the clan channel member.
ClanRank rank
The rank of the clan member.
Optional< Player > player
The player instance of the clan member .
final String name
The name of the clan member.
The repository containing all the clans and their corresponding data.
static ClanChannel getChannel(String channel)
Returns the channel.
This class holds all the util methods for the clan channel system.
static int getRankOrdinal(int button)
Gets the ordinal of a member based on the button.
static void manageMember(Player player, int button)
static void clean(Player player)
Handles cleaning the clan tab itemcontainer.
final ClanChannel channel
The clan channel instance.
boolean testPassword(Player player, ClanMember member)
Handles entering a clan channel password.
static void manage(Player player)
void sendConnectionWarning(Player player, ClanMember member)
The sends the connection warning for hopping clans.
static boolean disconnect(Player player, boolean logout)
Handles player joining a clan channel.
static void connect(Player player, String owner)
Handles player joining a clan channel.
ClanChannelHandler(ClanChannel channel)
Constructs a new ClanChannelHandler.
void connected(ClanMember member)
Handles connecting to the clan channel.
static void onLogin(Player player)
Handles logging into the server.
void updateMemberList(ClanMember member)
Handles updating the clan channel member list.
boolean attemptConnection(Player player, ClanMember member)
Attempts a connection to the clan channel.
Handles the clan chat channel.
static ClanChannel create(Player player)
static void load(String owner)
final DialogueFactory execute()
Retrieves the next dialogue in the chain and executes it.
void clear()
Clears the current dialogue chain.
final DialogueFactory onAction(Runnable action)
Sets an action so this action can be executed after dialogues are done.
final DialogueFactory sendStatement(String... lines)
Appends a StatementDialogue to the current dialogue chain.
final DialogueFactory sendOption(String option1, Runnable action1, String option2, Runnable action2)
Appends the OptionDialogue onto the current dialogue chain.
final GenericAttributes attributes
void open(int identification)
Opens an interface for the player.
void setSidebar(int tab, int id)
This class represents a character controlled by a player.
void message(String message)
String getName()
Gets the name of this entity.
DialogueFactory dialogueFactory
final InterfaceManager interfaceManager
void send(OutgoingPacket encoder)
ClanMemberComporator clanMemberComporator
The clan sort type.
Handles the profile repository, used for gathering important information for all created profiles.
static boolean isFriend(Player player, String other)
Checks if the other player is a friend.
The OutgoingPacket responsible for changing settings on a client.
The OutgoingPacket that sends a message to a Players chatbox in the client.
The OutgoingPacket that sends a string to a Players itemcontainer in the client.
Handles miscellaneous methods.
static String formatName(final String input)
public< K, E > void set(K key, E attribute)
Sets a generic attribute.
The enum containing all the rank's data within a clan channel.
boolean lessThan(ClanRank other)
The different clan types.
IRON_MAN
Clans that are focused on iron man accounts.
Holds all the player right data.
static boolean isDeveloper(Player player)
Checks if the player has developer status.
static boolean isIronman(Player player)
Checks if the player is an ironman.