getWorld(String worldName) {
}
/**
- * Logs a player's join event to the database.
- *
- * @param uuid The unique identifier of the player.
- * @param ip The IP address of the player.
- *
- * This method uses a worker thread to execute the database operation.
- * It prepares a SQL statement to insert a new record into the 'cytonic_player_joins' table.
- * The 'joined' column is set to the current timestamp, the 'uuid' column is set to the provided UUID,
- * and the 'ip' column is set to the provided IP address.
- * If an error occurs during the database operation, it is logged using the Logger.
- */
-public void logPlayerJoin(UUID uuid, SocketAddress ip) {
- worker.submit(() -> {
- try (PreparedStatement ps = connection.prepareStatement("INSERT INTO cytonic_player_joins (joined, uuid, ip) VALUES (CURRENT_TIMESTAMP,?,?)")) {
- ps.setString(1, uuid.toString());
- ps.setString(2, ip.toString());
- ps.executeUpdate();
- } catch (SQLException e) {
- Logger.error("Failed to add a player to the database!", e);
- }
- });
-}
+ * Logs a player's join event to the database.
+ *
+ * @param uuid The unique identifier of the player.
+ * @param ip The IP address of the player.
+ *
+ * This method uses a worker thread to execute the database operation.
+ * It prepares a SQL statement to insert a new record into the 'cytonic_player_joins' table.
+ * The 'joined' column is set to the current timestamp, the 'uuid' column is set to the provided UUID,
+ * and the 'ip' column is set to the provided IP address.
+ * If an error occurs during the database operation, it is logged using the Logger.
+ */
+ public void logPlayerJoin(UUID uuid, SocketAddress ip) {
+ worker.submit(() -> {
+ try (PreparedStatement ps = connection.prepareStatement("INSERT INTO cytonic_player_joins (joined, uuid, ip) VALUES (CURRENT_TIMESTAMP,?,?)")) {
+ ps.setString(1, uuid.toString());
+ ps.setString(2, ip.toString());
+ ps.executeUpdate();
+ } catch (SQLException e) {
+ Logger.error("Failed to add a player to the database!", e);
+ }
+ });
+ }
}
\ No newline at end of file
diff --git a/src/main/java/net/cytonic/cytosis/data/objects/Request.java b/src/main/java/net/cytonic/cytosis/data/objects/Request.java
deleted file mode 100644
index 0278e3e8..00000000
--- a/src/main/java/net/cytonic/cytosis/data/objects/Request.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package net.cytonic.cytosis.data.objects;
-
-import java.time.Instant;
-import java.util.UUID;
-
-public class Request {
- private final Instant expiry;
- private final UUID author;
- private final UUID target;
- private final RequestType type;
- private final Instant issuedAt;
- private boolean accepted;
- private boolean declined;
-
- public Request(Instant expiry, UUID author, UUID target, RequestType type) {
- this.expiry = expiry;
- this.author = author;
- this.target = target;
- this.type = type;
- issuedAt = Instant.now();
- accepted = false;
- declined = false;
- }
-
- public Instant getExpiry() {
- return expiry;
- }
-
- public RequestType getType() {
- return type;
- }
-
- public Instant getIssuedAt() {
- return issuedAt;
- }
-
- public UUID getAuthor() {
- return author;
- }
-
- public UUID getTarget() {
- return target;
- }
-
- public boolean isAccepted() {
- return accepted;
- }
-
- public boolean isDeclined() {
- return declined;
- }
-
- public void setAccepted(boolean accepted) {
- this.accepted = accepted;
- }
-
- public void setDeclined(boolean declined) {
- this.declined = declined;
- }
-
- public enum RequestType {
- FRIEND,
- LEAGUE,
- PARTY
- }
-}
diff --git a/src/main/java/net/cytonic/cytosis/events/EventHandler.java b/src/main/java/net/cytonic/cytosis/events/EventHandler.java
index 021f3c54..cb4b75dc 100644
--- a/src/main/java/net/cytonic/cytosis/events/EventHandler.java
+++ b/src/main/java/net/cytonic/cytosis/events/EventHandler.java
@@ -79,8 +79,7 @@ public boolean registerListener(EventListener extends Event> listener) {
public void handleEvent(T event) {
List> matchingListeners = new ArrayList<>();
for (EventListener extends Event> listener : NAMESPACED_HANDLERS.values()) {
- if (listener.getEventClass() == event.getClass() &&
- !(event instanceof CancellableEvent && ((CancellableEvent) event).isCancelled())) {
+ if (listener.getEventClass() == event.getClass() && !(event instanceof CancellableEvent && ((CancellableEvent) event).isCancelled())) {
matchingListeners.add(listener);
}
}
@@ -184,7 +183,6 @@ private void setupInternalListeners() {
GLOBAL_HANDLER.addListener(ClientPingServerEvent.class, (this::handleEvent));
GLOBAL_HANDLER.addListener(ServerListPingEvent.class, (this::handleEvent));
GLOBAL_HANDLER.addListener(ServerTickMonitorEvent.class, (this::handleEvent));
-
// Cytosis Events
GLOBAL_HANDLER.addListener(RankSetupEvent.class, (this::handleEvent));
GLOBAL_HANDLER.addListener(RankChangeEvent.class, (this::handleEvent));
diff --git a/src/main/java/net/cytonic/cytosis/events/ServerEventListeners.java b/src/main/java/net/cytonic/cytosis/events/ServerEventListeners.java
index 60f541a4..6c9fa00a 100644
--- a/src/main/java/net/cytonic/cytosis/events/ServerEventListeners.java
+++ b/src/main/java/net/cytonic/cytosis/events/ServerEventListeners.java
@@ -5,12 +5,12 @@
import net.cytonic.cytosis.data.enums.ChatChannel;
import net.cytonic.cytosis.logging.Logger;
import net.kyori.adventure.text.Component;
-import net.kyori.adventure.text.format.NamedTextColor;
import net.minestom.server.entity.Player;
import net.minestom.server.event.player.AsyncPlayerConfigurationEvent;
import net.minestom.server.event.player.PlayerChatEvent;
import net.minestom.server.event.player.PlayerDisconnectEvent;
import net.minestom.server.event.player.PlayerSpawnEvent;
+import static net.cytonic.cytosis.utils.MiniMessageTemplate.MM;
public class ServerEventListeners {
@@ -28,6 +28,11 @@ public static void initServerEvents() {
Logger.info(STR."\{player.getUsername()} (\{player.getUuid()}) joined with the ip: \{player.getPlayerConnection().getServerAddress()}");
Cytosis.getDatabaseManager().getDatabase().logPlayerJoin(player.getUuid(), player.getPlayerConnection().getRemoteAddress());
Cytosis.getRankManager().addPlayer(player);
+ Cytosis.getDatabaseManager().getDatabase().getChatChannel(player.getUuid()).whenComplete(((chatChannel, throwable) -> {
+ if (throwable != null) {
+ Logger.error("An error occurred whilst getting a player's chat channel!", throwable);
+ } else Cytosis.getChatManager().setChannel(player.getUuid(), chatChannel);
+ }));
})));
Logger.info("Registering player chat event.");
@@ -37,23 +42,29 @@ public static void initServerEvents() {
Cytosis.getDatabaseManager().getDatabase().addChat(player.getUuid(), event.getMessage());
event.setCancelled(true);
String originalMessage = event.getMessage();
- if(Cytosis.getChatManager().getChannel(player.getUuid()) != ChatChannel.ALL) {
- ChatChannel channel = Cytosis.getChatManager().getChannel(player.getUuid());
- Component message = Component.text("")
- .append(channel.getPrefix())
- .append(Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getPrefix())
- .append(Component.text(player.getUsername(), (Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getChatColor())))
- .appendSpace()
- .append(Component.text(originalMessage, NamedTextColor.WHITE));
+ if (!originalMessage.contains("|")) {
+ if (Cytosis.getChatManager().getChannel(player.getUuid()) != ChatChannel.ALL) {
+ ChatChannel channel = Cytosis.getChatManager().getChannel(player.getUuid());
+ Component message = Component.text("")
+ .append(channel.getPrefix())
+ .append(Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getPrefix())
+ .appendSpace()
+ .append(Component.text(player.getUsername(), (Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getTeamColor())))
+ .append(Component.text(":", Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getChatColor()))
+ .appendSpace()
+ .append(Component.text(originalMessage, Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getChatColor()));
Cytosis.getChatManager().sendMessageToChannel(message, Cytosis.getChatManager().getChannel(player.getUuid()));
} else {
Component message = Component.text("")
- .append(Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getPrefix())
- .append(Component.text(player.getUsername(), (Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getChatColor())))
- .appendSpace()
- .append(Component.text(originalMessage, NamedTextColor.WHITE));
- Cytosis.getOnlinePlayers().forEach((p) -> {p.sendMessage(message);});
+ .append(Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getPrefix())
+ .appendSpace()
+ .append(Component.text(player.getUsername(), (Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getTeamColor())))
+ .append(Component.text(":", Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getChatColor()))
+ .appendSpace()
+ .append(Component.text(originalMessage, Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getChatColor()));
+ Cytosis.getOnlinePlayers().forEach((p) -> p.sendMessage(message));
}
+ } else player.sendMessage(MM."Hey you cannot do that!");
}));
Logger.info("Registering player disconnect event.");
@@ -62,22 +73,4 @@ public static void initServerEvents() {
Cytosis.getRankManager().removePlayer(player);
}));
}
-
- public static void chatEvent(PlayerChatEvent event) {
- Player player = event.getPlayer();
- if(Cytosis.getChatManager().getChannel(player.getUuid()) != ChatChannel.ALL) {
- ChatChannel channel = Cytosis.getChatManager().getChannel(player.getUuid());
- event.setCancelled(true);
- String originalMessage = event.getMessage();
- Component message = Component.text("")
- .append(channel.getPrefix())
- .append(Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getPrefix())
- .append(Component.text(player.getUsername(), (Cytosis.getRankManager().getPlayerRank(player.getUuid()).orElseThrow().getChatColor())))
- .appendSpace()
- .append(Component.text(originalMessage, NamedTextColor.WHITE));
- Cytosis.getChatManager().sendMessageToChannel(message, Cytosis.getChatManager().getChannel(player.getUuid()));
- } else {
- event.setCancelled(false);
- }
- }
}
\ No newline at end of file
diff --git a/src/main/java/net/cytonic/cytosis/events/ranks/RankChangeEvent.java b/src/main/java/net/cytonic/cytosis/events/ranks/RankChangeEvent.java
index 325788c1..364f0bb5 100644
--- a/src/main/java/net/cytonic/cytosis/events/ranks/RankChangeEvent.java
+++ b/src/main/java/net/cytonic/cytosis/events/ranks/RankChangeEvent.java
@@ -28,4 +28,4 @@ public boolean isCancelled() {
public void setCancelled(boolean cancel) {
this.canceled = cancel;
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/net/cytonic/cytosis/events/ranks/RankSetupEvent.java b/src/main/java/net/cytonic/cytosis/events/ranks/RankSetupEvent.java
index fd06ecf1..a85f4df4 100644
--- a/src/main/java/net/cytonic/cytosis/events/ranks/RankSetupEvent.java
+++ b/src/main/java/net/cytonic/cytosis/events/ranks/RankSetupEvent.java
@@ -27,4 +27,4 @@ public boolean isCancelled() {
public void setCancelled(boolean canceled) {
this.canceled = canceled;
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/net/cytonic/cytosis/files/FileManager.java b/src/main/java/net/cytonic/cytosis/files/FileManager.java
index 2514c57c..ec35fd4f 100644
--- a/src/main/java/net/cytonic/cytosis/files/FileManager.java
+++ b/src/main/java/net/cytonic/cytosis/files/FileManager.java
@@ -41,7 +41,6 @@ public CompletableFuture init() {
*/
public CompletableFuture createConfigFile() {
CompletableFuture future = new CompletableFuture<>();
-
worker.submit(() -> {
if (!CONFIG_PATH.toFile().exists()) {
Logger.info("No config file found, creating...");
@@ -131,14 +130,12 @@ private Map recursiveParse(Map map, String paren
// If it's a list, check for nested tables within the list
else if (value instanceof Iterable> iterable) {
for (Object item : iterable) {
- if (item instanceof TomlTable toml)
- resultMap.putAll(recursiveParse(toml.toMap(), key));
+ if (item instanceof TomlTable toml) resultMap.putAll(recursiveParse(toml.toMap(), key));
}
} else {
resultMap.put(key, value);
}
}
-
return resultMap;
}
}
\ No newline at end of file
diff --git a/src/main/java/net/cytonic/cytosis/managers/ChatManager.java b/src/main/java/net/cytonic/cytosis/managers/ChatManager.java
index dca764c9..35af4364 100644
--- a/src/main/java/net/cytonic/cytosis/managers/ChatManager.java
+++ b/src/main/java/net/cytonic/cytosis/managers/ChatManager.java
@@ -3,7 +3,6 @@
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-
import net.cytonic.cytosis.Cytosis;
import net.cytonic.cytosis.data.enums.ChatChannel;
import net.kyori.adventure.text.Component;
@@ -11,11 +10,14 @@
public class ChatManager {
private final Map channels = new HashMap<>();
+
public void removeChannel(UUID uuid) {
channels.remove(uuid);
}
+
public void setChannel(UUID uuid, ChatChannel channel) {
channels.put(uuid, channel);
+ Cytosis.getDatabaseManager().getDatabase().setChatChannel(uuid,channel);
}
public ChatChannel getChannel(UUID uuid) {
@@ -24,7 +26,7 @@ public ChatChannel getChannel(UUID uuid) {
public void sendMessageToChannel(Component component, ChatChannel chatChannel) {
switch (chatChannel) {
- case ADMIN,MOD,STAFF -> // send a message to all servers
+ case ADMIN, MOD, STAFF -> // send a message to all servers
Cytosis.getMessagingManager().getRabbitMQ().sendChatMessage(component, chatChannel);
case PARTY -> {
// parties..
@@ -35,8 +37,8 @@ public void sendMessageToChannel(Component component, ChatChannel chatChannel) {
case PRIVATE_MESSAGE -> {
// private messages
}
- case ALL -> throw new UnsupportedOperationException("Unimplemented case: " + chatChannel);
- default -> throw new IllegalArgumentException("Unexpected value: " + chatChannel);
+ case ALL -> throw new UnsupportedOperationException(STR."Unimplemented case: \{chatChannel}");
+ default -> throw new IllegalArgumentException(STR."Unexpected value: \{chatChannel}");
}
}
}
\ No newline at end of file
diff --git a/src/main/java/net/cytonic/cytosis/messaging/MessagingManager.java b/src/main/java/net/cytonic/cytosis/messaging/MessagingManager.java
index ba7a331b..44fe832d 100644
--- a/src/main/java/net/cytonic/cytosis/messaging/MessagingManager.java
+++ b/src/main/java/net/cytonic/cytosis/messaging/MessagingManager.java
@@ -3,11 +3,8 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-
import lombok.Getter;
import net.cytonic.cytosis.config.CytosisSettings;
-import net.cytonic.cytosis.data.enums.ChatChannel;
-import net.kyori.adventure.text.Component;
public class MessagingManager {
@@ -27,9 +24,8 @@ public CompletableFuture initialize() {
if (rabbitMQ != null) {
rabbitMQ.initializeConnection();
rabbitMQ.initializeQueues();
- rabbitMQ.sendServerDeclarationMessage();
+ rabbitMQ.sendServerDeclarationMessage();
rabbitMQ.receiveChatMessages();
- rabbitMQ.sendChatMessage(Component.text("hello world!"), ChatChannel.ADMIN);
}
future.complete(null);
});
diff --git a/src/main/java/net/cytonic/cytosis/messaging/RabbitMQ.java b/src/main/java/net/cytonic/cytosis/messaging/RabbitMQ.java
index 85e5fdd7..03fbd002 100644
--- a/src/main/java/net/cytonic/cytosis/messaging/RabbitMQ.java
+++ b/src/main/java/net/cytonic/cytosis/messaging/RabbitMQ.java
@@ -1,15 +1,10 @@
package net.cytonic.cytosis.messaging;
import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
+import java.net.*;
+import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeoutException;
-
-import com.rabbitmq.client.Channel;
-import com.rabbitmq.client.Connection;
-import com.rabbitmq.client.ConnectionFactory;
-import com.rabbitmq.client.DeliverCallback;
-
+import com.rabbitmq.client.*;
import net.cytonic.cytosis.Cytosis;
import net.cytonic.cytosis.config.CytosisSettings;
import net.cytonic.cytosis.data.enums.ChatChannel;
@@ -21,7 +16,7 @@ public class RabbitMQ {
public static final String SERVER_DECLARE_QUEUE = "server-declaration";
public static final String SHUTDOWN_QUEUE = "server-shutdown";
- public static final String CHAT_CHANNEL_QUEUE = "chat-channel";
+ public static final String CHAT_CHANNEL_QUEUE = STR."chat-channel-\{CytosisSettings.SERVER_HOSTNAME}";
private Connection connection;
private Channel channel;
@@ -39,8 +34,7 @@ public void initializeConnection() {
Logger.info("Connected to RabbitMQ!");
try {
channel = connection.createChannel();
- connection = factory.newConnection();
- } catch (IOException | TimeoutException e) {
+ } catch (IOException e) {
Logger.error("An error occurred whilst connecting to RabbitMQ!", e);
}
}
@@ -58,9 +52,9 @@ public void initializeQueues() {
Logger.error("An error occurred whilst initializing the 'SHUTDOWN_QUEUE'.", e);
}
try {
+ channel.exchangeDeclare("chat-testing", BuiltinExchangeType.FANOUT);
channel.queueDeclare(CHAT_CHANNEL_QUEUE, false, false, false, null);
- channel.exchangeDeclare("chat-messages", "fanout");
- channel.queueBind(CHAT_CHANNEL_QUEUE, "chat-messages", "");
+ channel.queueBind(CHAT_CHANNEL_QUEUE,"chat-testing","");
} catch (IOException e) {
Logger.error("An error occurred whilst initializing the 'CHAT_CHANNEL_QUEUE'.", e);
}
@@ -68,7 +62,6 @@ public void initializeQueues() {
public void sendServerDeclarationMessage() {
//formatting: {server-name}|:|{server-ip}|:|{server-port}
- String serverName = System.getenv("HOSTNAME");
String serverIP;
try {
serverIP = InetAddress.getLocalHost().getHostAddress();
@@ -76,7 +69,7 @@ public void sendServerDeclarationMessage() {
Logger.error("An error occurred whilst fetching this server's IP address! Bailing out!", e);
return;
}
- String message = STR."\{serverName}|:|\{serverIP}|:|\{CytosisSettings.SERVER_PORT}";
+ String message = STR."\{CytosisSettings.SERVER_HOSTNAME}|:|\{serverIP}|:|\{CytosisSettings.SERVER_PORT}";
try {
channel.basicPublish("", SERVER_DECLARE_QUEUE, null, message.getBytes());
} catch (IOException e) {
@@ -85,54 +78,59 @@ public void sendServerDeclarationMessage() {
Logger.info(STR."Server Declaration message sent! '\{message}'.");
}
- public void sendChatMessage(Component chatMessage, ChatChannel chatChannel) {
- //formatting: {chat-message}|{chat-channel}
- String message = STR."\{JSONComponentSerializer.json().serialize(chatMessage)}|\{chatChannel.name()}";
- try {
- channel.basicPublish("chat-messages", CHAT_CHANNEL_QUEUE, null, message.getBytes());
- } catch (IOException e) {
- Logger.error("An error occurred whilst attempting to send a chat message!", e);
- }
+ /**
+ * Sends a chat message to all the servers.
+ *
+ * @param chatMessage The chat message to be sent. This should be a {@link Component}.
+ * @param chatChannel The channel to which the chat message should be sent.
+ *
+ */
+public void sendChatMessage(Component chatMessage, ChatChannel chatChannel) {
+ // Formatting: {chat-message}|:|{chat-channel}
+ String message = STR."\{JSONComponentSerializer.json().serialize(chatMessage)}|\{chatChannel.name()}";
+ try {
+ channel.basicPublish("chat-testing","", null, message.getBytes());
+ } catch (IOException e) {
+ Logger.error("An error occurred whilst attempting to send a chat message!", e);
}
+}
public void receiveChatMessages() {
try {
- DeliverCallback deliverCallback = (consumerTag, delivery) -> {
- String[] thing = new String(delivery.getBody(), "UTF-8").split("\\|");
- Component chatMessage = JSONComponentSerializer.json().deserialize(thing[0]);
- ChatChannel chatChannel = ChatChannel.valueOf(thing[1]);
- switch (chatChannel) {
- case MOD -> // send a message to all players with cytonic.chat.mod permission
- Cytosis.getOnlinePlayers().forEach(player -> {
- if (player.hasPermission("cytonic.chat.mod")) {
- player.sendMessage(chatMessage);
- }
- });
+ DeliverCallback deliverCallback = (_, delivery) -> {
+ String[] thing = new String(delivery.getBody(), StandardCharsets.UTF_8).split("\\|");
+ Component chatMessage = JSONComponentSerializer.json().deserialize(thing[0]);
+ ChatChannel chatChannel = ChatChannel.valueOf(thing[1]);
+ switch (chatChannel) {
+ case MOD -> // send a message to all players with cytonic.chat.mod permission
+ Cytosis.getOnlinePlayers().forEach(player -> {
+ if (player.hasPermission("cytonic.chat.mod")) {
+ player.sendMessage(chatMessage);
+ }
+ });
- case STAFF -> // send a message to all players with cytonic.chat.staff permission
- Cytosis.getOnlinePlayers().forEach(player -> {
- if (player.hasPermission("cytonic.chat.staff")) {
- player.sendMessage(chatMessage);
- }
- });
- case ADMIN -> // send a message to all players with cytonic.chat.admin permission
- Cytosis.getOnlinePlayers().forEach(player -> {
- if (player.hasPermission("cytonic.chat.admin")) {
- player.sendMessage(chatMessage);
- }
- });
- case LEAGUE -> {
- // leagues..
- }
+ case STAFF -> // send a message to all players with cytonic.chat.staff permission
+ Cytosis.getOnlinePlayers().forEach(player -> {
+ if (player.hasPermission("cytonic.chat.staff")) {
+ player.sendMessage(chatMessage);
+ }
+ });
+ case ADMIN -> // send a message to all players with cytonic.chat.admin permission
+ Cytosis.getOnlinePlayers().forEach(player -> {
+ if (player.hasPermission("cytonic.chat.admin")) {
+ player.sendMessage(chatMessage);
+ }
+ });
+ case LEAGUE -> {// leagues..
+ }
- case PARTY -> {
- // parties..
- }
+ case PARTY -> {// parties..
+ }
+ }
+ };
+ channel.basicConsume(CHAT_CHANNEL_QUEUE, true, deliverCallback, _ -> {});
+ } catch (IOException e) {
+ Logger.error("error", e);
}
- };
- channel.basicConsume(CHAT_CHANNEL_QUEUE, true, deliverCallback, consumerTag -> { });
-} catch (IOException e) {
- Logger.error("error", e);
-}
-}
+ }
}
\ No newline at end of file
diff --git a/src/main/java/net/cytonic/cytosis/ranks/PlayerRank.java b/src/main/java/net/cytonic/cytosis/ranks/PlayerRank.java
index 606cf646..f63d0a38 100644
--- a/src/main/java/net/cytonic/cytosis/ranks/PlayerRank.java
+++ b/src/main/java/net/cytonic/cytosis/ranks/PlayerRank.java
@@ -57,13 +57,11 @@ public static boolean canChangeRank(PlayerRank currentUserRole, PlayerRank targe
if (isDemotion(targetOriginalRole, targetNewRole)) {
return currentUserRole.ordinal() <= targetOriginalRole.ordinal();
}
-
if (isPromotion(targetOriginalRole, targetNewRole)) {
return currentUserRole.ordinal() <= targetOriginalRole.ordinal();
}
-
// If it's neither promotion nor demotion, it's an invalid operation
return false;
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/net/cytonic/cytosis/ranks/RankManager.java b/src/main/java/net/cytonic/cytosis/ranks/RankManager.java
index 6028c580..9a63d0c7 100644
--- a/src/main/java/net/cytonic/cytosis/ranks/RankManager.java
+++ b/src/main/java/net/cytonic/cytosis/ranks/RankManager.java
@@ -12,7 +12,6 @@
import net.minestom.server.scoreboard.Team;
import net.minestom.server.scoreboard.TeamBuilder;
import org.jetbrains.annotations.NotNull;
-
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@@ -28,7 +27,6 @@ public void init() {
.teamColor(value.getTeamColor())
.prefix(value.getPrefix().appendSpace())
.build();
-
teamMap.put(value, team);
}
}
@@ -83,4 +81,4 @@ public final void removePermissions(@NotNull final Player player, @NotNull final
public Optional getPlayerRank(UUID uuid) {
return Optional.ofNullable(rankMap.get(uuid));
}
-}
+}
\ No newline at end of file
diff --git a/src/main/resources/config.toml b/src/main/resources/config.toml
index 684c6fb0..c885f7c0 100644
--- a/src/main/resources/config.toml
+++ b/src/main/resources/config.toml
@@ -15,6 +15,7 @@ secret = "hi i am the secret" # this can NOT be empty
port = 25565
world_name = ""
spawn_point = ""
+hostname = "UNKNOWN"
# Logging Configuration
# Enable/disable logging for various player activities