mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-26 16:30:52 +01:00
Refactoring to Permissions new System and some command names
This commit is contained in:
parent
8cb172c605
commit
3c9cc149f8
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.campaign;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.messages.outgoing.events.calendar.CampaignCalendarDoorOpenedMessageComposer;
|
||||
import com.eu.habbo.plugin.events.users.calendar.UserClaimRewardEvent;
|
||||
@ -121,7 +122,7 @@ public class CalendarManager {
|
||||
|
||||
if (object == null) return;
|
||||
long daysBetween = ChronoUnit.DAYS.between(new Timestamp(campaign.getStartTimestamp() * 1000L).toInstant(), new Date().toInstant());
|
||||
if (((daysBetween >= 0 && daysBetween <= campaign.getTotalDays()) && (((daysBetween - day <= 2 || !campaign.getLockExpired()) && daysBetween - day >= 0)) || (force && habbo.hasRight("acc_calendar_force")))) {
|
||||
if (((daysBetween >= 0 && daysBetween <= campaign.getTotalDays()) && (((daysBetween - day <= 2 || !campaign.getLockExpired()) && daysBetween - day >= 0)) || (force && habbo.hasRight(Permission.ACC_CALENDAR_FORCE)))) {
|
||||
if (Emulator.getPluginManager().fireEvent(new UserClaimRewardEvent(habbo, campaign, day, object, force)).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
|
||||
public class BlockAlertCommand extends Command {
|
||||
public BlockAlertCommand() {
|
||||
super("cmd_blockalert");
|
||||
super("cmd_block_alert");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,7 +32,7 @@ public class MimicCommand extends Command {
|
||||
} else if (habbo.hasRight(Permission.ACC_NOT_MIMICED) && !gameClient.getHabbo().hasRight(Permission.ACC_NOT_MIMICED)) {
|
||||
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_mimic.blocked"), params[1]).replace("%gender_name%", getGenderName(habbo)), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
} else if (!habbo.hasRight("acc_mimic_unredeemed") && FigureUtil.hasBlacklistedClothing(habbo.getHabboInfo().getLook(), gameClient.getHabbo().getForbiddenClothing())) {
|
||||
} else if (!habbo.hasRight(Permission.ACC_MIMIC_UNREDEEMED) && FigureUtil.hasBlacklistedClothing(habbo.getHabboInfo().getLook(), gameClient.getHabbo().getForbiddenClothing())) {
|
||||
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_mimic.forbidden_clothing"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
} else {
|
||||
|
@ -6,7 +6,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
|
||||
|
||||
public class PickallCommand extends Command {
|
||||
public PickallCommand() {
|
||||
super("cmd_pickall");
|
||||
super("cmd_pick_all");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,8 +49,10 @@ public class Permission {
|
||||
public static final String ACC_HELPER_JUDGE_CHAT_REVIEWS = "acc_helper_judge_chat_reviews";
|
||||
public static final String ACC_FLOORPLAN_EDITOR = "acc_floorplan_editor";
|
||||
public static final String ACC_CAMERA = "acc_camera";
|
||||
|
||||
private final String key;
|
||||
private final PermissionSetting setting;
|
||||
|
||||
public static final String ACC_INFINITE_FRIENDS = "acc_infinite_friends";
|
||||
public static final String ACC_ADS_BACKGROUND = "acc_ads_background";
|
||||
public static final String ACC_NO_MUTE = "acc_no_mute";
|
||||
public static final String ACC_CAN_STALK = "acc_can_stalk";
|
||||
public static final String ACC_MIMIC_UNREDEEMED = "acc_mimic_unredeemed";
|
||||
public static final String ACC_CALENDAR_FORCE = "acc_calendar_force";
|
||||
}
|
||||
|
@ -7,12 +7,20 @@ import java.sql.SQLException;
|
||||
|
||||
public class PermissionRight {
|
||||
@Getter
|
||||
private String name;
|
||||
@Getter
|
||||
private String description;
|
||||
private final String name;
|
||||
|
||||
private final String description;
|
||||
|
||||
public PermissionRight(ResultSet set) throws SQLException {
|
||||
this.name = set.getString("name");
|
||||
this.description = set.getString("description");
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
if(this.description == null || this.description.length() == 0) {
|
||||
return this.name + " - No description provided.";
|
||||
}
|
||||
|
||||
return this.description;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.eu.habbo.habbohotel.bots.Bot;
|
||||
import com.eu.habbo.habbohotel.catalog.ClothItem;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.messenger.Messenger;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.pets.Pet;
|
||||
import com.eu.habbo.habbohotel.rooms.*;
|
||||
import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
|
||||
@ -405,7 +406,7 @@ public class Habbo implements Runnable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.hasRight("acc_no_mute")) {
|
||||
if (!this.hasRight(Permission.ACC_NO_MUTE)) {
|
||||
int remaining = this.habboStats.addMuteTime(seconds);
|
||||
this.client.sendResponse(new FloodControlMessageComposer(remaining));
|
||||
this.client.sendResponse(new RemainingMutePeriodComposer(remaining));
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.messages.incoming.camera;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.networking.camera.CameraClient;
|
||||
import com.eu.habbo.networking.camera.messages.outgoing.CameraRenderImageComposer;
|
||||
@ -9,7 +10,7 @@ import com.eu.habbo.util.crypto.ZIP;
|
||||
public class RenderRoomEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() {
|
||||
if (!this.client.getHabbo().hasRight("acc_camera")) {
|
||||
if (!this.client.getHabbo().hasRight(Permission.ACC_CAMERA)) {
|
||||
this.client.getHabbo().alert(Emulator.getTexts().getValue("camera.permission"));
|
||||
return;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.messages.incoming.camera;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.camera.ThumbnailStatusMessageComposer;
|
||||
import com.eu.habbo.networking.camera.CameraClient;
|
||||
@ -10,7 +11,7 @@ import com.eu.habbo.util.crypto.ZIP;
|
||||
public class RenderRoomThumbnailEvent extends MessageHandler {
|
||||
@Override
|
||||
public void handle() {
|
||||
if (!this.client.getHabbo().hasRight("acc_camera")) {
|
||||
if (!this.client.getHabbo().hasRight(Permission.ACC_CAMERA)) {
|
||||
this.client.getHabbo().alert(Emulator.getTexts().getValue("camera.permission"));
|
||||
return;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.friends;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.messenger.Messenger;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboInfo;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
@ -64,12 +65,12 @@ public class AcceptFriendEvent extends MessageHandler {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(this.client.getHabbo().getMessenger().getFriends().size() >= this.client.getHabbo().getHabboStats().getMaxFriends() && !this.client.getHabbo().hasRight("acc_infinite_friends")) {
|
||||
if(this.client.getHabbo().getMessenger().getFriends().size() >= this.client.getHabbo().getHabboStats().getMaxFriends() && !this.client.getHabbo().hasRight(Permission.ACC_INFINITE_FRIENDS)) {
|
||||
this.client.sendResponse(new MessengerErrorComposer(MessengerErrorComposer.FRIEND_LIST_OWN_FULL));
|
||||
break;
|
||||
}
|
||||
|
||||
if(target.getMessenger().getFriends().size() >= target.getHabboStats().getMaxFriends() && !target.hasRight("acc_infinite_friends")) {
|
||||
if(target.getMessenger().getFriends().size() >= target.getHabboStats().getMaxFriends() && !target.hasRight(Permission.ACC_INFINITE_FRIENDS)) {
|
||||
this.client.sendResponse(new MessengerErrorComposer(MessengerErrorComposer.FRIEND_LIST_TARGET_FULL));
|
||||
continue;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.friends;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.messenger.Messenger;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
import com.eu.habbo.messages.outgoing.friends.MessengerErrorComposer;
|
||||
@ -63,13 +64,13 @@ public class RequestFriendEvent extends MessageHandler {
|
||||
}
|
||||
|
||||
// You can only have x friends
|
||||
if (this.client.getHabbo().getMessenger().getFriends().values().size() >= this.client.getHabbo().getHabboStats().getMaxFriends() && !this.client.getHabbo().hasRight("acc_infinite_friends")) {
|
||||
if (this.client.getHabbo().getMessenger().getFriends().values().size() >= this.client.getHabbo().getHabboStats().getMaxFriends() && !this.client.getHabbo().hasRight(Permission.ACC_INFINITE_FRIENDS)) {
|
||||
this.client.sendResponse(new MessengerErrorComposer(MessengerErrorComposer.FRIEND_LIST_OWN_FULL));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if targets friendlist is full
|
||||
if (targetHabbo.getMessenger().getFriends().values().size() >= targetHabbo.getHabboStats().getMaxFriends() && !targetHabbo.hasRight("acc_infinite_friends")) {
|
||||
if (targetHabbo.getMessenger().getFriends().values().size() >= targetHabbo.getHabboStats().getMaxFriends() && !targetHabbo.hasRight(Permission.ACC_INFINITE_FRIENDS)) {
|
||||
this.client.sendResponse(new MessengerErrorComposer(MessengerErrorComposer.FRIEND_LIST_TARGET_FULL));
|
||||
return;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.messages.incoming.friends;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.messenger.MessengerBuddy;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessage;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -29,7 +30,7 @@ public class VisitUserEvent extends MessageHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (habbo.getHabboStats().isBlockFollowing() && !this.client.getHabbo().hasRight("acc_can_stalk")) {
|
||||
if (habbo.getHabboStats().isBlockFollowing() && !this.client.getHabbo().hasRight(Permission.ACC_CAN_STALK)) {
|
||||
this.client.sendResponse(new FollowFriendFailedComposer(FollowFriendFailedComposer.FRIEND_BLOCKED_STALKING));
|
||||
return;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.eu.habbo.messages.incoming.rooms.items;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionCustomValues;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionRoomAds;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.incoming.MessageHandler;
|
||||
@ -22,7 +23,7 @@ public class SetObjectDataEvent extends MessageHandler {
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
if (item instanceof InteractionRoomAds && !this.client.getHabbo().hasRight("acc_ads_background")) {
|
||||
if (item instanceof InteractionRoomAds && !this.client.getHabbo().hasRight(Permission.ACC_ADS_BACKGROUND)) {
|
||||
this.client.getHabbo().alert(Emulator.getTexts().getValue("hotel.error.roomads.nopermission"));
|
||||
return;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.eu.habbo.messages.outgoing.friends;
|
||||
|
||||
import com.eu.habbo.habbohotel.messenger.Messenger;
|
||||
import com.eu.habbo.habbohotel.messenger.MessengerCategory;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||
@ -18,7 +19,7 @@ public class MessengerInitComposer extends MessageComposer {
|
||||
protected ServerMessage composeInternal() {
|
||||
|
||||
this.response.init(Outgoing.messengerInitComposer);
|
||||
if (this.habbo.hasRight("acc_infinite_friends")) {
|
||||
if (this.habbo.hasRight(Permission.ACC_INFINITE_FRIENDS)) {
|
||||
this.response.appendInt(Integer.MAX_VALUE);
|
||||
this.response.appendInt(1337);
|
||||
this.response.appendInt(Integer.MAX_VALUE);
|
||||
|
Loading…
Reference in New Issue
Block a user