mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-30 01:50:50 +01:00
Fixed Guilds so group admins can accept and remove group members.
This commit is contained in:
parent
60ecf6226f
commit
375f6a0e42
@ -20,12 +20,11 @@ public class GuildAcceptMembershipEvent extends MessageHandler {
|
|||||||
int userId = this.packet.readInt();
|
int userId = this.packet.readInt();
|
||||||
|
|
||||||
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
Guild guild = Emulator.getGameEnvironment().getGuildManager().getGuild(guildId);
|
||||||
|
|
||||||
if (guild == null || (guild.getOwnerId() != this.client.getHabbo().getHabboInfo().getId() && !Emulator.getGameEnvironment().getGuildManager().getOnlyAdmins(guild).containsKey(this.client.getHabbo().getHabboInfo().getId()) && !this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(userId);
|
||||||
|
|
||||||
|
if (guild != null) {
|
||||||
|
GuildMember groupMember = Emulator.getGameEnvironment().getGuildManager().getGuildMember(guild, this.client.getHabbo());
|
||||||
|
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || groupMember.getRank().equals(GuildRank.ADMIN) || groupMember.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
if (habbo.getHabboStats().hasGuild(guild.getId())) {
|
if (habbo.getHabboStats().hasGuild(guild.getId())) {
|
||||||
this.client.sendResponse(new GuildAcceptMemberErrorComposer(guild.getId(), GuildAcceptMemberErrorComposer.ALREADY_ACCEPTED));
|
this.client.sendResponse(new GuildAcceptMemberErrorComposer(guild.getId(), GuildAcceptMemberErrorComposer.ALREADY_ACCEPTED));
|
||||||
@ -59,4 +58,6 @@ public class GuildAcceptMembershipEvent extends MessageHandler {
|
|||||||
Emulator.getGameEnvironment().getGuildManager().joinGuild(guild, this.client, userId, true);
|
Emulator.getGameEnvironment().getGuildManager().joinGuild(guild, this.client, userId, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,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.OWNER)) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || (member != null && member.getRank().equals(GuildRank.OWNER) || member.getRank().equals(GuildRank.ADMIN)) || this.client.getHabbo().hasPermission(Permission.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) {
|
||||||
|
@ -23,7 +23,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.OWNER) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.ADMIN)|| member.getRank().equals(GuildRank.OWNER) || this.client.getHabbo().hasPermission(Permission.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, "")));
|
||||||
|
@ -24,7 +24,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.OWNER) || this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN)) {
|
if (userId == this.client.getHabbo().getHabboInfo().getId() || guild.getOwnerId() == this.client.getHabbo().getHabboInfo().getId() || member.getRank().equals(GuildRank.OWNER) || member.getRank().equals(GuildRank.ADMIN) || this.client.getHabbo().hasPermission(Permission.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);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.eu.habbo.messages.outgoing.guilds;
|
package com.eu.habbo.messages.outgoing.guilds;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.guilds.Guild;
|
import com.eu.habbo.habbohotel.guilds.Guild;
|
||||||
import com.eu.habbo.habbohotel.guilds.GuildMember;
|
import com.eu.habbo.habbohotel.guilds.GuildMember;
|
||||||
@ -28,7 +29,7 @@ public class GuildInfoComposer extends MessageComposer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ServerMessage composeInternal() {
|
protected ServerMessage composeInternal() {
|
||||||
boolean adminPermissions = this.client.getHabbo().getHabboStats().hasGuild(this.guild.getId()) && this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN);
|
boolean adminPermissions = this.client.getHabbo().getHabboStats().hasGuild(this.guild.getId()) && this.client.getHabbo().hasPermission(Permission.ACC_GUILD_ADMIN) || Emulator.getGameEnvironment().getGuildManager().getOnlyAdmins(guild).get(this.client.getHabbo().getHabboInfo().getId()) != null;
|
||||||
this.response.init(Outgoing.GuildInfoComposer);
|
this.response.init(Outgoing.GuildInfoComposer);
|
||||||
this.response.appendInt(this.guild.getId());
|
this.response.appendInt(this.guild.getId());
|
||||||
this.response.appendBoolean(true);
|
this.response.appendBoolean(true);
|
||||||
@ -52,4 +53,4 @@ public class GuildInfoComposer extends MessageComposer {
|
|||||||
this.response.appendBoolean(this.guild.hasForum());
|
this.response.appendBoolean(this.guild.hasForum());
|
||||||
return this.response;
|
return this.response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user