Refactor guild rank names and fix #327

This commit is contained in:
Alejandro 2020-01-27 19:17:11 +02:00
parent 9a161e1184
commit b439774c11
9 changed files with 16 additions and 16 deletions

View File

@ -118,13 +118,13 @@ public final class Emulator {
Emulator.texts = new TextsManager(); Emulator.texts = new TextsManager();
new CleanerThread(); new CleanerThread();
Emulator.gameServer = new GameServer(getConfig().getValue("game.host", "127.0.0.1"), getConfig().getInt("game.port", 30000)); 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 = new GameEnvironment();
Emulator.gameEnvironment.load(); Emulator.gameEnvironment.load();
Emulator.gameServer.initializePipeline(); Emulator.gameServer.initializePipeline();
Emulator.gameServer.connect(); Emulator.gameServer.connect();
Emulator.rconServer.initializePipeline(); //Emulator.rconServer.initializePipeline();
Emulator.rconServer.connect(); //Emulator.rconServer.connect();
Emulator.badgeImager = new BadgeImager(); Emulator.badgeImager = new BadgeImager();
Emulator.getLogging().logStart("Arcturus Morningstar has succesfully loaded. You're running: " + Emulator.version); 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!"); Emulator.getLogging().logStart("System launched in: " + (System.nanoTime() - startTime) / 1e6 + "ms. Using: " + (Runtime.getRuntime().availableProcessors() * 2) + " threads!");

View File

@ -1,8 +1,8 @@
package com.eu.habbo.habbohotel.guilds; package com.eu.habbo.habbohotel.guilds;
public enum GuildRank { public enum GuildRank {
ADMIN(0), OWNER(0),
MOD(1), ADMIN(1),
MEMBER(2), MEMBER(2),
REQUESTED(3), REQUESTED(3),
DELETED(4); DELETED(4);

View File

@ -79,8 +79,8 @@ public class ModToolIssue implements ISerialize {
message.appendString(this.senderUsername); //Reporter user name. message.appendString(this.senderUsername); //Reporter user name.
message.appendInt(this.reportedId); //Reported user ID. message.appendInt(this.reportedId); //Reported user ID.
message.appendString(this.reportedUsername); //Reported user name. message.appendString(this.reportedUsername); //Reported user name.
message.appendInt(this.modId); //MOD User ID? message.appendInt(this.modId); //ADMIN User ID?
message.appendString(this.modName); //MOD User name? message.appendString(this.modName); //ADMIN User name?
message.appendString(this.message); message.appendString(this.message);
message.appendInt(0); message.appendInt(0);

View File

@ -18,7 +18,7 @@ public class GuildConfirmRemoveMemberEvent extends MessageHandler {
if (guild != null) { if (guild != null) {
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo()); 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()); Room room = Emulator.getGameEnvironment().getRoomManager().loadRoom(guild.getRoomId());
int count = 0; int count = 0;
if (room != null) { if (room != null) {

View File

@ -22,7 +22,7 @@ public class GuildDeclineMembershipEvent extends MessageHandler {
if (guild != null) { if (guild != null) {
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo()); 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(); guild.decreaseRequestCount();
Emulator.getGameEnvironment().getGuildManager().removeMember(guild, userId); 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, ""))); 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, "")));

View File

@ -22,7 +22,7 @@ public class GuildRemoveMemberEvent extends MessageHandler {
if (guild != null) { if (guild != null) {
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo()); 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); Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
GuildRemovedMemberEvent removedMemberEvent = new GuildRemovedMemberEvent(guild, userId, habbo); GuildRemovedMemberEvent removedMemberEvent = new GuildRemovedMemberEvent(guild, userId, habbo);
Emulator.getPluginManager().fireEvent(removedMemberEvent); Emulator.getPluginManager().fireEvent(removedMemberEvent);

View File

@ -21,7 +21,7 @@ public class RequestGuildMembersEvent extends MessageHandler {
boolean isAdmin = this.client.getHabbo().hasPermission("acc_guild_admin"); boolean isAdmin = this.client.getHabbo().hasPermission("acc_guild_admin");
if (!isAdmin && this.client.getHabbo().getHabboStats().hasGuild(g.getId())) { if (!isAdmin && this.client.getHabbo().getHabboStats().hasGuild(g.getId())) {
GuildMember member = Emulator.getGameEnvironment().getGuildManager().getGuildMember(g, this.client.getHabbo()); 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))); 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)));

View File

@ -36,13 +36,13 @@ public class GuildInfoComposer extends MessageComposer {
this.response.appendString(this.guild.getBadge()); this.response.appendString(this.guild.getBadge());
this.response.appendInt(this.guild.getRoomId()); this.response.appendInt(this.guild.getRoomId());
this.response.appendString(this.guild.getRoomName()); 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(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.MOD) ? 3 : (this.member.getRank().equals(GuildRank.ADMIN) ? 4 : 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.appendInt(this.guild.getMemberCount()); //Member count.
this.response.appendBoolean(this.client.getHabbo().getHabboStats().guild == this.guild.getId()); //favorite group 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.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.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()); //Habbo owner = Emulator.getGameEnvironment().getHabboManager().getHabbo(this.guild.getOwnerId());
this.response.appendString(this.guild.getOwnerName()); this.response.appendString(this.guild.getOwnerName());

View File

@ -42,8 +42,8 @@ public class ThreadUpdatedMessageComposer extends MessageComposer {
} }
if (this.habbo.getHabboInfo().getId() != guild.getOwnerId() || if (this.habbo.getHabboInfo().getId() != guild.getOwnerId() ||
guild.canModForum().state == 2 && (Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo).getRank() == GuildRank.ADMIN guild.canModForum().state == 2 && (Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo).getRank() == GuildRank.OWNER
|| Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo).getRank() == GuildRank.MOD) || Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, habbo).getRank() == GuildRank.ADMIN)
|| this.habbo.hasPermission("acc_modtool_ticket_q")) { || this.habbo.hasPermission("acc_modtool_ticket_q")) {
this.thread.setPinned(isPinned); this.thread.setPinned(isPinned);
this.thread.setLocked(isLocked); this.thread.setLocked(isLocked);