From b439774c1132dec00414426d16fc573af9522126 Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Mon, 27 Jan 2020 19:17:11 +0200 Subject: [PATCH] Refactor guild rank names and fix #327 --- src/main/java/com/eu/habbo/Emulator.java | 6 +++--- src/main/java/com/eu/habbo/habbohotel/guilds/GuildRank.java | 4 ++-- .../java/com/eu/habbo/habbohotel/modtool/ModToolIssue.java | 4 ++-- .../incoming/guilds/GuildConfirmRemoveMemberEvent.java | 2 +- .../incoming/guilds/GuildDeclineMembershipEvent.java | 2 +- .../messages/incoming/guilds/GuildRemoveMemberEvent.java | 2 +- .../messages/incoming/guilds/RequestGuildMembersEvent.java | 2 +- .../habbo/messages/outgoing/guilds/GuildInfoComposer.java | 6 +++--- .../guilds/forums/ThreadUpdatedMessageComposer.java | 4 ++-- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/eu/habbo/Emulator.java b/src/main/java/com/eu/habbo/Emulator.java index 6999051a..b73fb65f 100644 --- a/src/main/java/com/eu/habbo/Emulator.java +++ b/src/main/java/com/eu/habbo/Emulator.java @@ -118,13 +118,13 @@ public final class Emulator { Emulator.texts = new TextsManager(); new CleanerThread(); Emulator.gameServer = new GameServer(getConfig().getValue("game.host", "127.0.0.1"), getConfig().getInt("game.port", 30000)); - Emulator.rconServer = new RCONServer(getConfig().getValue("rcon.host", "127.0.0.1"), getConfig().getInt("rcon.port", 30001)); + //Emulator.rconServer = new RCONServer(getConfig().getValue("rcon.host", "127.0.0.1"), getConfig().getInt("rcon.port", 30001)); Emulator.gameEnvironment = new GameEnvironment(); Emulator.gameEnvironment.load(); Emulator.gameServer.initializePipeline(); Emulator.gameServer.connect(); - Emulator.rconServer.initializePipeline(); - Emulator.rconServer.connect(); + //Emulator.rconServer.initializePipeline(); + //Emulator.rconServer.connect(); Emulator.badgeImager = new BadgeImager(); Emulator.getLogging().logStart("Arcturus Morningstar has succesfully loaded. You're running: " + Emulator.version); Emulator.getLogging().logStart("System launched in: " + (System.nanoTime() - startTime) / 1e6 + "ms. Using: " + (Runtime.getRuntime().availableProcessors() * 2) + " threads!"); diff --git a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildRank.java b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildRank.java index e0c5c833..a7afa1b1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/guilds/GuildRank.java +++ b/src/main/java/com/eu/habbo/habbohotel/guilds/GuildRank.java @@ -1,8 +1,8 @@ package com.eu.habbo.habbohotel.guilds; public enum GuildRank { - ADMIN(0), - MOD(1), + OWNER(0), + ADMIN(1), MEMBER(2), REQUESTED(3), DELETED(4); diff --git a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolIssue.java b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolIssue.java index 172e29e2..3d2437e0 100644 --- a/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolIssue.java +++ b/src/main/java/com/eu/habbo/habbohotel/modtool/ModToolIssue.java @@ -79,8 +79,8 @@ public class ModToolIssue implements ISerialize { message.appendString(this.senderUsername); //Reporter user name. message.appendInt(this.reportedId); //Reported user ID. message.appendString(this.reportedUsername); //Reported user name. - message.appendInt(this.modId); //MOD User ID? - message.appendString(this.modName); //MOD User name? + message.appendInt(this.modId); //ADMIN User ID? + message.appendString(this.modName); //ADMIN User name? message.appendString(this.message); message.appendInt(0); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildConfirmRemoveMemberEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildConfirmRemoveMemberEvent.java index 5d12d01d..9e04a545 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildConfirmRemoveMemberEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildConfirmRemoveMemberEvent.java @@ -18,7 +18,7 @@ public class GuildConfirmRemoveMemberEvent extends MessageHandler { if (guild != null) { GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo()); - if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && member.getRank().equals(GuildRank.ADMIN)) || this.client.getHabbo().hasPermission("acc_guild_admin")) { + if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && member.getRank().equals(GuildRank.OWNER)) || this.client.getHabbo().hasPermission("acc_guild_admin")) { Room room = Emulator.getGameEnvironment().getRoomManager().loadRoom(guild.getRoomId()); int count = 0; if (room != null) { diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildDeclineMembershipEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildDeclineMembershipEvent.java index e2aede92..e67945d6 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildDeclineMembershipEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildDeclineMembershipEvent.java @@ -22,7 +22,7 @@ public class GuildDeclineMembershipEvent extends MessageHandler { if (guild != null) { GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo()); - if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN) || this.client.getHabbo().hasPermission("acc_guild_admin")) { + if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission("acc_guild_admin")) { guild.decreaseRequestCount(); Emulator.getGameEnvironment().getGuildManager().removeMember(guild, userId); this.client.sendResponse(new GuildMembersComposer(guild, Emulator.getGameEnvironment().getGuildManager().getGuildMembers(guild, 0, 0, ""), this.client.getHabbo(), 0, 0, "", true, Emulator.getGameEnvironment().getGuildManager().getGuildMembersCount(guild, 0, 0, ""))); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveMemberEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveMemberEvent.java index cfcada6c..beb69560 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveMemberEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/GuildRemoveMemberEvent.java @@ -22,7 +22,7 @@ public class GuildRemoveMemberEvent extends MessageHandler { if (guild != null) { GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo()); - if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN) || this.client.getHabbo().hasPermission("acc_guild_admin")) { + if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission("acc_guild_admin")) { Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId); GuildRemovedMemberEvent removedMemberEvent = new GuildRemovedMemberEvent(guild, userId, habbo); Emulator.getPluginManager().fireEvent(removedMemberEvent); diff --git a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildMembersEvent.java b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildMembersEvent.java index b1c1e873..f8ec7693 100644 --- a/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildMembersEvent.java +++ b/src/main/java/com/eu/habbo/messages/incoming/guilds/RequestGuildMembersEvent.java @@ -21,7 +21,7 @@ public class RequestGuildMembersEvent extends MessageHandler { boolean isAdmin = this.client.getHabbo().hasPermission("acc_guild_admin"); if (!isAdmin && this.client.getHabbo().getHabboStats().hasGuild(g.getId())) { GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(g, this.client.getHabbo()); - isAdmin = member != null && (member.getRank().equals(GuildRank.ADMIN) || member.getRank().equals(GuildRank.MOD)); + isAdmin = member != null && (member.getRank().equals(GuildRank.OWNER) || member.getRank().equals(GuildRank.ADMIN)); } this.client.sendResponse(new GuildMembersComposer(g, Emulator.getGameEnvironment().getGuildManager().getGuildMembers(g, pageId, levelId, query), this.client.getHabbo(), pageId, levelId, query, isAdmin, Emulator.getGameEnvironment().getGuildManager().getGuildMembersCount(g, pageId, levelId, query))); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildInfoComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildInfoComposer.java index 5cf963a9..9a106a08 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildInfoComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/GuildInfoComposer.java @@ -36,13 +36,13 @@ public class GuildInfoComposer extends MessageComposer { this.response.appendString(this.guild.getBadge()); this.response.appendInt(this.guild.getRoomId()); this.response.appendString(this.guild.getRoomName()); - //this.response.appendInt(this.guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() ? 3 : (this.member == null ? 0 : (this.member.getRank().equals(GuildRank.MEMBER) || this.member.getRank().equals(GuildRank.MOD) ? 1 : (this.member.getRank().equals(GuildRank.REQUESTED) ? 2 : 0)))); - this.response.appendInt(adminPermissions ? 4 : (this.member == null ? 0 : (this.member.getRank().equals(GuildRank.MEMBER) ? 1 : (this.member.getRank().equals(GuildRank.REQUESTED) ? 2 : (this.member.getRank().equals(GuildRank.MOD) ? 3 : (this.member.getRank().equals(GuildRank.ADMIN) ? 4 : 0)))))); + //this.response.appendInt(this.guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() ? 3 : (this.member == null ? 0 : (this.member.getRank().equals(GuildRank.MEMBER) || this.member.getRank().equals(GuildRank.ADMIN) ? 1 : (this.member.getRank().equals(GuildRank.REQUESTED) ? 2 : 0)))); + this.response.appendInt(adminPermissions ? 4 : (this.member == null ? 0 : (this.member.getRank().equals(GuildRank.MEMBER) ? 1 : (this.member.getRank().equals(GuildRank.REQUESTED) ? 2 : (this.member.getRank().equals(GuildRank.ADMIN) ? 3 : (this.member.getRank().equals(GuildRank.OWNER) ? 4 : 0)))))); this.response.appendInt(this.guild.getMemberCount()); //Member count. this.response.appendBoolean(this.client.getHabbo().getHabboStats().guild == this.guild.getId()); //favorite group this.response.appendString(new SimpleDateFormat("dd-MM-yyyy").format(new Date(this.guild.getDateCreated() * 1000L))); this.response.appendBoolean(adminPermissions || (this.guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId())); - this.response.appendBoolean(adminPermissions || (this.member != null && (this.member.getRank().equals(GuildRank.ADMIN)))); //Is admin. //this.member.getRank().equals(GuildRank.MOD) || + this.response.appendBoolean(adminPermissions || (this.member != null && (this.member.getRank().equals(GuildRank.ADMIN)))); //Is admin. //this.member.getRank().equals(GuildRank.ADMIN) || //Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.guild.getOwnerId()); this.response.appendString(this.guild.getOwnerName()); diff --git a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/ThreadUpdatedMessageComposer.java b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/ThreadUpdatedMessageComposer.java index c7138ef8..4d2453ef 100644 --- a/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/ThreadUpdatedMessageComposer.java +++ b/src/main/java/com/eu/habbo/messages/outgoing/guilds/forums/ThreadUpdatedMessageComposer.java @@ -42,8 +42,8 @@ public class ThreadUpdatedMessageComposer extends MessageComposer { } if (this.habbo.getHabboInfo().getId() != guild.getOwnerId() || - guild.canModForum().state == 2 && (Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo).getRank() == GuildRank.ADMIN - || Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo).getRank() == GuildRank.MOD) + guild.canModForum().state == 2 && (Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo).getRank() == GuildRank.OWNER + || Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo).getRank() == GuildRank.ADMIN) || this.habbo.hasPermission("acc_modtool_ticket_q")) { this.thread.setPinned(isPinned); this.thread.setLocked(isLocked);