Merge branch '297-userinfosanction' into 'dev'

feat(ModToolUserInfoComposer): display last sanction + small improv.

See merge request morningstar/Arcturus-Community!79
This commit is contained in:
Harmonic 2020-01-22 10:20:31 -05:00
commit b0446cebc4
7 changed files with 93 additions and 67 deletions

View File

@ -142,10 +142,11 @@ public class SecureLoginEvent extends MessageHandler {
this.client.sendResponse(new AchievementListComposer(this.client.getHabbo())); this.client.sendResponse(new AchievementListComposer(this.client.getHabbo()));
ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions(); ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions();
if (Emulator.getConfig().getBoolean("hotel.sanctions.enabled")) {
THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(habbo.getHabboInfo().getId()); THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(habbo.getHabboInfo().getId());
ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(habbo.getHabboInfo().getId()); ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(habbo.getHabboInfo().getId());
if (modToolSanctionItems != null && modToolSanctionItems.size() > 0) { if (modToolSanctionItems != null && modToolSanctionItems.size() > 0) {
ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1); ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1);
@ -171,6 +172,7 @@ public class SecureLoginEvent extends MessageHandler {
habbo.mute(Math.toIntExact(diff)); habbo.mute(Math.toIntExact(diff));
} }
} }
}
Emulator.getPluginManager().fireEvent(new UserLoginEvent(habbo, this.client.getChannel().localAddress())); Emulator.getPluginManager().fireEvent(new UserLoginEvent(habbo, this.client.getChannel().localAddress()));

View File

@ -26,10 +26,11 @@ public class ModToolSanctionAlertEvent extends MessageHandler {
if (habbo != null) { if (habbo != null) {
ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions(); ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions();
if (Emulator.getConfig().getBoolean("hotel.sanctions.enabled")) {
THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(habbo.getHabboInfo().getId()); THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(habbo.getHabboInfo().getId());
ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(habbo.getHabboInfo().getId()); ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(habbo.getHabboInfo().getId());
if (Emulator.getConfig().getBoolean("hotel.sanctions.enabled")) {
if (modToolSanctionItems != null && !modToolSanctionItems.isEmpty()) { if (modToolSanctionItems != null && !modToolSanctionItems.isEmpty()) {
ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1); ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1);

View File

@ -50,10 +50,11 @@ public class ModToolSanctionBanEvent extends MessageHandler {
} }
if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) { if (this.client.getHabbo().hasPermission(Permission.ACC_SUPPORTTOOL)) {
ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions(); ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions();
if (Emulator.getConfig().getBoolean("hotel.sanctions.enabled")) {
THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(userId); THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(userId);
ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(userId); ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(userId);
if (Emulator.getConfig().getBoolean("hotel.sanctions.enabled")) {
if (modToolSanctionItems != null && !modToolSanctionItemsHashMap.isEmpty()) { if (modToolSanctionItems != null && !modToolSanctionItemsHashMap.isEmpty()) {
ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1); ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1);

View File

@ -28,10 +28,11 @@ public class ModToolSanctionMuteEvent extends MessageHandler {
if (habbo != null) { if (habbo != null) {
ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions(); ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions();
if (Emulator.getConfig().getBoolean("hotel.sanctions.enabled")) {
THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(habbo.getHabboInfo().getId()); THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(habbo.getHabboInfo().getId());
ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(habbo.getHabboInfo().getId()); ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(habbo.getHabboInfo().getId());
if (Emulator.getConfig().getBoolean("hotel.sanctions.enabled")) {
if (modToolSanctionItems != null && !modToolSanctionItemsHashMap.isEmpty()) { if (modToolSanctionItems != null && !modToolSanctionItemsHashMap.isEmpty()) {
ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1); ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1);

View File

@ -26,10 +26,11 @@ public class ModToolSanctionTradeLockEvent extends MessageHandler {
if (habbo != null) { if (habbo != null) {
ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions(); ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions();
if (Emulator.getConfig().getBoolean("hotel.sanctions.enabled")) {
THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(userId); THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(userId);
ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(userId); ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(userId);
if (Emulator.getConfig().getBoolean("hotel.sanctions.enabled")) {
if (modToolSanctionItems != null && !modToolSanctionItems.isEmpty()) { if (modToolSanctionItems != null && !modToolSanctionItems.isEmpty()) {
ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1); ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1);

View File

@ -26,12 +26,14 @@ public class ModToolSanctionInfoComposer extends MessageComposer {
@Override @Override
public ServerMessage compose() { public ServerMessage compose() {
ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions(); ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions();
THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(habbo.getHabboInfo().getId());
ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(habbo.getHabboInfo().getId());
Date probationEndTime; Date probationEndTime;
Date probationStartTime = null; Date probationStartTime = null;
if (Emulator.getConfig().getBoolean("hotel.sanctions.enabled")) {
THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(habbo.getHabboInfo().getId());
ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(habbo.getHabboInfo().getId());
if (modToolSanctionItems != null && modToolSanctionItems.size() > 0) { if (modToolSanctionItems != null && modToolSanctionItems.size() > 0) {
ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1); ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1);
@ -69,6 +71,7 @@ public class ModToolSanctionInfoComposer extends MessageComposer {
this.response.appendBoolean(item.isMuted); // muted this.response.appendBoolean(item.isMuted); // muted
this.response.appendString(tradeLockedUntil == null ? "" : tradeLockedUntil.toString()); // trade locked until this.response.appendString(tradeLockedUntil == null ? "" : tradeLockedUntil.toString()); // trade locked until
}
} else { } else {
this.response.init(Outgoing.ModToolSanctionInfoComposer); this.response.init(Outgoing.ModToolSanctionInfoComposer);

View File

@ -1,12 +1,17 @@
package com.eu.habbo.messages.outgoing.modtool; package com.eu.habbo.messages.outgoing.modtool;
import com.eu.habbo.Emulator; import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.modtool.ModToolSanctionItem;
import com.eu.habbo.habbohotel.modtool.ModToolSanctionLevelItem;
import com.eu.habbo.habbohotel.modtool.ModToolSanctions;
import com.eu.habbo.messages.ServerMessage; import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.MessageComposer; import com.eu.habbo.messages.outgoing.MessageComposer;
import com.eu.habbo.messages.outgoing.Outgoing; import com.eu.habbo.messages.outgoing.Outgoing;
import gnu.trove.map.hash.THashMap;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
public class ModToolUserInfoComposer extends MessageComposer { public class ModToolUserInfoComposer extends MessageComposer {
private final ResultSet set; private final ResultSet set;
@ -37,11 +42,23 @@ public class ModToolUserInfoComposer extends MessageComposer {
this.response.appendString(this.set.getString("mail")); this.response.appendString(this.set.getString("mail"));
this.response.appendString("Rank (" + this.set.getInt("rank_id") + "): " + this.set.getString("rank_name")); //user_class_txt this.response.appendString("Rank (" + this.set.getInt("rank_id") + "): " + this.set.getString("rank_name")); //user_class_txt
if (false) //has sanction ModToolSanctions modToolSanctions = Emulator.getGameEnvironment().getModToolSanctions();
if (Emulator.getConfig().getBoolean("hotel.sanctions.enabled")) {
THashMap<Integer, ArrayList<ModToolSanctionItem>> modToolSanctionItemsHashMap = Emulator.getGameEnvironment().getModToolSanctions().getSanctions(this.set.getInt("user_id"));
ArrayList<ModToolSanctionItem> modToolSanctionItems = modToolSanctionItemsHashMap.get(this.set.getInt("user_id"));
if (modToolSanctionItems != null && modToolSanctionItems.size() > 0) //has sanction
{ {
this.response.appendString("SOME SANCTION"); ModToolSanctionItem item = modToolSanctionItems.get(modToolSanctionItems.size() - 1);
ModToolSanctionLevelItem modToolSanctionLevelItem = modToolSanctions.getSanctionLevelItem(item.sanctionLevel);
this.response.appendString(modToolSanctions.getSanctionType(modToolSanctionLevelItem));
this.response.appendInt(31); this.response.appendInt(31);
} }
}
return this.response; return this.response;
} catch (SQLException e) { } catch (SQLException e) {
Emulator.getLogging().logSQLException(e); Emulator.getLogging().logSQLException(e);