mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 07:20:50 +01:00
Refactor commands
This commit is contained in:
parent
a224028df3
commit
00c3ae28fe
@ -35,16 +35,14 @@ public final class Emulator {
|
|||||||
|
|
||||||
public static final int MAJOR = 4;
|
public static final int MAJOR = 4;
|
||||||
public static final int MINOR = 0;
|
public static final int MINOR = 0;
|
||||||
public static final int BUILD = 0;
|
public static final int REVISION = 0;
|
||||||
public static final String PREVIEW = "Developer Preview";
|
public static final String PREVIEW = "Developer Preview";
|
||||||
public static final String version = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + BUILD + " " + PREVIEW;
|
public static final String VERSION = "Arcturus Morningstar" + " " + MAJOR + "." + MINOR + "." + REVISION + " " + PREVIEW;
|
||||||
public static String build = "";
|
public static String build = "";
|
||||||
public static boolean isReady = false;
|
public static boolean isReady = false;
|
||||||
public static boolean isShuttingDown = false;
|
public static boolean isShuttingDown = false;
|
||||||
public static boolean stopped = false;
|
public static boolean stopped = false;
|
||||||
public static boolean debugging = false;
|
public static boolean debugging = false;
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(Emulator.class);
|
|
||||||
private static final String OS_NAME = (System.getProperty("os.name") != null ? System.getProperty("os.name") : "Unknown");
|
private static final String OS_NAME = (System.getProperty("os.name") != null ? System.getProperty("os.name") : "Unknown");
|
||||||
private static final String CLASS_PATH = (System.getProperty("java.class.path") != null ? System.getProperty("java.class.path") : "Unknown");
|
private static final String CLASS_PATH = (System.getProperty("java.class.path") != null ? System.getProperty("java.class.path") : "Unknown");
|
||||||
|
|
||||||
@ -87,9 +85,9 @@ public final class Emulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void promptEnterKey(){
|
public static void promptEnterKey(){
|
||||||
System.out.println("\n");
|
log.info("\n");
|
||||||
System.out.println("This is a developer preview build. Your plugins for Arcturus Morningstar 3.x will NOT work on this build.");
|
log.info("This is a developer preview build. Your plugins for Arcturus Morningstar 3.x will NOT work on this build.");
|
||||||
System.out.println("Press \"ENTER\" if you agree to the terms stated above...");
|
log.info("Press \"ENTER\" if you agree to the terms stated above...");
|
||||||
Scanner scanner = new Scanner(System.in);
|
Scanner scanner = new Scanner(System.in);
|
||||||
scanner.nextLine();
|
scanner.nextLine();
|
||||||
}
|
}
|
||||||
@ -121,7 +119,7 @@ public final class Emulator {
|
|||||||
}
|
}
|
||||||
log.info("eek. Has it really been a year?");
|
log.info("eek. Has it really been a year?");
|
||||||
log.info("This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral.");
|
log.info("This project is for educational purposes only. This Emulator is an open-source fork of Arcturus created by TheGeneral.");
|
||||||
log.info("Version: {}", version);
|
log.info("Version: {}", VERSION);
|
||||||
log.info("Build: {}", build);
|
log.info("Build: {}", build);
|
||||||
log.info("Follow our development at https://git.krews.org/morningstar/Arcturus-Community");
|
log.info("Follow our development at https://git.krews.org/morningstar/Arcturus-Community");
|
||||||
|
|
||||||
@ -238,7 +236,7 @@ public final class Emulator {
|
|||||||
Emulator.isShuttingDown = true;
|
Emulator.isShuttingDown = true;
|
||||||
Emulator.isReady = false;
|
Emulator.isReady = false;
|
||||||
|
|
||||||
log.info("Stopping Arcturus Morningstar {}", version);
|
log.info("Stopping Arcturus Morningstar {}", VERSION);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Emulator.getPluginManager() != null)
|
if (Emulator.getPluginManager() != null)
|
||||||
@ -289,7 +287,7 @@ public final class Emulator {
|
|||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Stopped Arcturus Morningstar {}", version);
|
log.info("Stopped Arcturus Morningstar {}", VERSION);
|
||||||
|
|
||||||
if (Emulator.database != null) {
|
if (Emulator.database != null) {
|
||||||
Emulator.getDatabase().dispose();
|
Emulator.getDatabase().dispose();
|
||||||
|
@ -22,8 +22,8 @@ public class ErrorLog implements DatabaseLoggable {
|
|||||||
public final String stackTrace;
|
public final String stackTrace;
|
||||||
|
|
||||||
public ErrorLog(String type, Throwable e) {
|
public ErrorLog(String type, Throwable e) {
|
||||||
this.version = Emulator.version;
|
this.version = Emulator.VERSION;
|
||||||
this.buildHash = Emulator.version;
|
this.buildHash = Emulator.VERSION;
|
||||||
|
|
||||||
this.timeStamp = Emulator.getIntUnixTimestamp();
|
this.timeStamp = Emulator.getIntUnixTimestamp();
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@ -42,7 +42,7 @@ public class ErrorLog implements DatabaseLoggable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ErrorLog(String type, String message) {
|
public ErrorLog(String type, String message) {
|
||||||
this.version = Emulator.version;
|
this.version = Emulator.VERSION;
|
||||||
this.buildHash = Emulator.build;
|
this.buildHash = Emulator.build;
|
||||||
|
|
||||||
this.timeStamp = Emulator.getIntUnixTimestamp();
|
this.timeStamp = Emulator.getIntUnixTimestamp();
|
||||||
|
@ -21,7 +21,7 @@ public class ConsoleInfoCommand extends ConsoleCommand {
|
|||||||
long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
|
long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
|
||||||
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);
|
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);
|
||||||
|
|
||||||
log.info("Emulator version: " + Emulator.version);
|
log.info("Emulator version: " + Emulator.VERSION);
|
||||||
log.info("Emulator build: " + Emulator.build);
|
log.info("Emulator build: " + Emulator.build);
|
||||||
|
|
||||||
log.info("");
|
log.info("");
|
||||||
|
@ -42,11 +42,9 @@ public class Achievement {
|
|||||||
if (progress > 0) {
|
if (progress > 0) {
|
||||||
for (AchievementLevel level : this.levels.values()) {
|
for (AchievementLevel level : this.levels.values()) {
|
||||||
if (progress >= level.getProgress()) {
|
if (progress >= level.getProgress()) {
|
||||||
if (l != null) {
|
if (l != null && l.getLevel() > level.getLevel()) {
|
||||||
if (l.getLevel() > level.getLevel()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
l = level;
|
l = level;
|
||||||
}
|
}
|
||||||
@ -57,7 +55,6 @@ public class Achievement {
|
|||||||
|
|
||||||
|
|
||||||
public AchievementLevel getNextLevel(int currentLevel) {
|
public AchievementLevel getNextLevel(int currentLevel) {
|
||||||
AchievementLevel l = null;
|
|
||||||
|
|
||||||
for (AchievementLevel level : this.levels.values()) {
|
for (AchievementLevel level : this.levels.values()) {
|
||||||
if (level.getLevel() == (currentLevel + 1))
|
if (level.getLevel() == (currentLevel + 1))
|
||||||
|
@ -21,12 +21,15 @@ import gnu.trove.procedure.TObjectIntProcedure;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static com.eu.habbo.database.DatabaseConstants.CAUGHT_SQL_EXCEPTION;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AchievementManager {
|
public class AchievementManager {
|
||||||
public static boolean TALENTTRACK_ENABLED = false;
|
public static boolean TALENT_TRACK_ENABLED = false;
|
||||||
|
|
||||||
private final THashMap<String, Achievement> achievements;
|
private final THashMap<String, Achievement> achievements;
|
||||||
private final THashMap<TalentTrackType, LinkedHashMap<Integer, TalentTrackLevel>> talentTrackLevels;
|
private final THashMap<TalentTrackType, LinkedHashMap<Integer, TalentTrackLevel>> talentTrackLevels;
|
||||||
@ -57,7 +60,7 @@ public class AchievementManager {
|
|||||||
statement.setInt(4, amount);
|
statement.setInt(4, amount);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,13 +71,7 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void progressAchievement(Habbo habbo, Achievement achievement, int amount) {
|
public static void progressAchievement(Habbo habbo, Achievement achievement, int amount) {
|
||||||
if (achievement == null)
|
if (achievement == null || habbo == null || !habbo.isOnline())
|
||||||
return;
|
|
||||||
|
|
||||||
if (habbo == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!habbo.isOnline())
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int currentProgress = habbo.getHabboStats().getAchievementProgress(achievement);
|
int currentProgress = habbo.getHabboStats().getAchievementProgress(achievement);
|
||||||
@ -102,17 +99,12 @@ public class AchievementManager {
|
|||||||
|
|
||||||
AchievementLevel newLevel = achievement.getLevelForProgress(currentProgress + amount);
|
AchievementLevel newLevel = achievement.getLevelForProgress(currentProgress + amount);
|
||||||
|
|
||||||
if (AchievementManager.TALENTTRACK_ENABLED) {
|
if (AchievementManager.TALENT_TRACK_ENABLED) {
|
||||||
for (TalentTrackType type : TalentTrackType.values()) {
|
Arrays.stream(TalentTrackType.values())
|
||||||
if (Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.containsKey(type)) {
|
.filter(type -> Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.containsKey(type))
|
||||||
for (Map.Entry<Integer, TalentTrackLevel> entry : Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.get(type).entrySet()) {
|
.filter(type -> Emulator.getGameEnvironment().getAchievementManager().talentTrackLevels.get(type).entrySet().stream()
|
||||||
if (entry.getValue().achievements.containsKey(achievement)) {
|
.anyMatch(entry -> entry.getValue().achievements.containsKey(achievement)))
|
||||||
Emulator.getGameEnvironment().getAchievementManager().handleTalentTrackAchievement(habbo, type);
|
.forEach(type -> Emulator.getGameEnvironment().getAchievementManager().handleTalentTrackAchievement(habbo, type));
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newLevel == null ||
|
if (newLevel == null ||
|
||||||
@ -163,11 +155,9 @@ public class AchievementManager {
|
|||||||
|
|
||||||
Emulator.getThreading().run(badge);
|
Emulator.getThreading().run(badge);
|
||||||
|
|
||||||
if (badge.getSlot() > 0) {
|
if (badge.getSlot() > 0 && habbo.getHabboInfo().getCurrentRoom() != null) {
|
||||||
if (habbo.getHabboInfo().getCurrentRoom() != null) {
|
|
||||||
habbo.getHabboInfo().getCurrentRoom().sendComposer(new UserBadgesComposer(habbo.getInventory().getBadgesComponent().getWearingBadges(), habbo.getHabboInfo().getId()).compose());
|
habbo.getHabboInfo().getCurrentRoom().sendComposer(new UserBadgesComposer(habbo.getInventory().getBadgesComponent().getWearingBadges(), habbo.getHabboInfo().getId()).compose());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
habbo.getClient().sendResponse(new UnseenItemsComposer(badge.getId(), UnseenItemsComposer.AddHabboItemCategory.BADGE));
|
habbo.getClient().sendResponse(new UnseenItemsComposer(badge.getId(), UnseenItemsComposer.AddHabboItemCategory.BADGE));
|
||||||
|
|
||||||
@ -207,7 +197,7 @@ public class AchievementManager {
|
|||||||
statement.setInt(3, 1);
|
statement.setInt(3, 1);
|
||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +211,7 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
statement.executeBatch();
|
statement.executeBatch();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +225,7 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -258,7 +248,7 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
@ -280,7 +270,7 @@ public class AchievementManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
log.error(CAUGHT_SQL_EXCEPTION, e);
|
||||||
log.error("Achievement Manager -> Failed to load!");
|
log.error("Achievement Manager -> Failed to load!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -309,7 +299,7 @@ public class AchievementManager {
|
|||||||
return this.achievements;
|
return this.achievements;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedHashMap<Integer, TalentTrackLevel> getTalenTrackLevels(TalentTrackType type) {
|
public Map<Integer, TalentTrackLevel> getTalenTrackLevels(TalentTrackType type) {
|
||||||
return this.talentTrackLevels.get(type);
|
return this.talentTrackLevels.get(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,15 +308,12 @@ public class AchievementManager {
|
|||||||
|
|
||||||
for (Map.Entry<Integer, TalentTrackLevel> entry : this.talentTrackLevels.get(type).entrySet()) {
|
for (Map.Entry<Integer, TalentTrackLevel> entry : this.talentTrackLevels.get(type).entrySet()) {
|
||||||
final boolean[] allCompleted = {true};
|
final boolean[] allCompleted = {true};
|
||||||
entry.getValue().achievements.forEachEntry(new TObjectIntProcedure<Achievement>() {
|
entry.getValue().achievements.forEachEntry((a, b) -> {
|
||||||
@Override
|
|
||||||
public boolean execute(Achievement a, int b) {
|
|
||||||
if (habbo.getHabboStats().getAchievementProgress(a) < b) {
|
if (habbo.getHabboStats().getAchievementProgress(a) < b) {
|
||||||
allCompleted[0] = false;
|
allCompleted[0] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return allCompleted[0];
|
return allCompleted[0];
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (allCompleted[0]) {
|
if (allCompleted[0]) {
|
||||||
|
@ -13,7 +13,7 @@ public class AboutCommand extends Command {
|
|||||||
public AboutCommand() {
|
public AboutCommand() {
|
||||||
super(null, new String[]{"about", "info", "online", "server"});
|
super(null, new String[]{"about", "info", "online", "server"});
|
||||||
}
|
}
|
||||||
public static final String credits = """
|
public static final String CREDITS = """
|
||||||
Arcturus Morningstar is an opensource project based on Arcturus By TheGeneral\s
|
Arcturus Morningstar is an opensource project based on Arcturus By TheGeneral\s
|
||||||
The Following people have all contributed to this emulator:
|
The Following people have all contributed to this emulator:
|
||||||
TheGeneral
|
TheGeneral
|
||||||
@ -58,7 +58,7 @@ public class AboutCommand extends Command {
|
|||||||
long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
|
long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
|
||||||
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);
|
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);
|
||||||
|
|
||||||
String message = "<b>" + Emulator.version + "</b>\r\n";
|
String message = "<b>" + Emulator.VERSION + "</b>\r\n";
|
||||||
|
|
||||||
if (Emulator.getConfig().getBoolean("info.shown", true)) {
|
if (Emulator.getConfig().getBoolean("info.shown", true)) {
|
||||||
message += "<b>Hotel Statistics</b>\r" +
|
message += "<b>Hotel Statistics</b>\r" +
|
||||||
@ -79,7 +79,7 @@ public class AboutCommand extends Command {
|
|||||||
"<b>Thanks for using Arcturus. Report issues on the forums. http://arcturus.wf \r\r" +
|
"<b>Thanks for using Arcturus. Report issues on the forums. http://arcturus.wf \r\r" +
|
||||||
" - The General";
|
" - The General";
|
||||||
gameClient.getHabbo().alert(message);
|
gameClient.getHabbo().alert(message);
|
||||||
gameClient.sendResponse(new MOTDNotificationComposer(Collections.singletonList(credits)));
|
gameClient.sendResponse(new MOTDNotificationComposer(Collections.singletonList(CREDITS)));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public class AddYoutubePlaylistCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||||
if (params.length < 3) {
|
if (params.length < 3) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_add_youtube_playlist.usage"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_add_youtube_playlist.usage"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,19 +28,19 @@ public class AddYoutubePlaylistCommand extends Command {
|
|||||||
try {
|
try {
|
||||||
itemId = Integer.parseInt(params[1]);
|
itemId = Integer.parseInt(params[1]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_add_youtube_playlist.no_base_item"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_add_youtube_playlist.no_base_item"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Emulator.getGameEnvironment().getItemManager().getItem(itemId) == null) {
|
if (Emulator.getGameEnvironment().getItemManager().getItem(itemId) == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_add_youtube_playlist.no_base_item"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_add_youtube_playlist.no_base_item"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
YoutubeManager.YoutubePlaylist playlist = Emulator.getGameEnvironment().getItemManager().getYoutubeManager().getPlaylistDataById(params[2]);
|
YoutubeManager.YoutubePlaylist playlist = Emulator.getGameEnvironment().getItemManager().getYoutubeManager().getPlaylistDataById(params[2]);
|
||||||
|
|
||||||
if (playlist == null) {
|
if (playlist == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_add_youtube_playlist.failed_playlist"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_add_youtube_playlist.failed_playlist"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ public class AddYoutubePlaylistCommand extends Command {
|
|||||||
log.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_add_youtube_playlist"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_add_youtube_playlist"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,9 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class AlertCommand extends Command {
|
public class AlertCommand extends Command {
|
||||||
|
|
||||||
public AlertCommand() {
|
public AlertCommand() {
|
||||||
@ -14,28 +17,24 @@ public class AlertCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length < 2) {
|
if (params.length < 2) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_alert.forgot_username"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_alert.forgot_username"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (params.length < 3) {
|
if (params.length < 3) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_alert.forgot_message"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_alert.forgot_message"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String targetUsername = params[1];
|
String targetUsername = params[1];
|
||||||
StringBuilder message = new StringBuilder();
|
String message = IntStream.range(2, params.length).mapToObj(i -> params[i] + " ").collect(Collectors.joining());
|
||||||
|
|
||||||
for (int i = 2; i < params.length; i++) {
|
Habbo habbo = getHabbo(targetUsername);
|
||||||
message.append(params[i]).append(" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(targetUsername);
|
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
habbo.alert(message + "\r\n -" + gameClient.getHabbo().getHabboInfo().getUsername());
|
habbo.alert(message + "\r\n -" + gameClient.getHabbo().getHabboInfo().getUsername());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_alert.message_send").replace("%user%", targetUsername), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_alert.message_send"), targetUsername), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_alert.user_offline").replace("%user%", targetUsername), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_alert.user_offline"), targetUsername), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -16,21 +16,21 @@ public class AllowTradingCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||||
if (params.length == 1) {
|
if (params.length == 1) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_allow_trading.forgot_username"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_allow_trading.forgot_username"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.length == 2) {
|
if (params.length == 2) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_allow_trading.forgot_trade").replace("%username%", params[1]));
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_allow_trading.forgot_trade"), params[1]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String username = params[1];
|
final String username = params[1];
|
||||||
final String option = params[2];
|
final String option = params[2];
|
||||||
|
|
||||||
if (option.equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes")) || option.equalsIgnoreCase(Emulator.getTexts().getValue("generic.no"))) {
|
if (option.equalsIgnoreCase(getTextsValue("generic.yes")) || option.equalsIgnoreCase(getTextsValue("generic.no"))) {
|
||||||
final boolean enabled = option.equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"));
|
final boolean enabled = option.equalsIgnoreCase(getTextsValue("generic.yes"));
|
||||||
final Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(username);
|
final Habbo habbo = getHabbo(username);
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
@ -41,28 +41,28 @@ public class AllowTradingCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
habbo.getHabboStats().setAllowTrade(enabled);
|
habbo.getHabboStats().setAllowTrade(enabled);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")).replace("%username%", params[1]));
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")), params[1]));
|
||||||
habbo.getClient().sendResponse(new UserPerksComposer(habbo));
|
habbo.getClient().sendResponse(new UserPerksComposer(habbo));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
boolean found;
|
boolean found;
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
|
||||||
PreparedStatement statement = connection.prepareStatement("UPDATE users_settings INNER JOIN users ON users.id = users_settings.user_id SET can_trade = ?, tradelock_amount = tradelock_amount + ? WHERE users.username LIKE ?")) {
|
PreparedStatement statement = connection.prepareStatement("UPDATE users_settings INNER JOIN users ON users.id = users_settings.user_id SET can_trade = ?, tradelock_amount = tradelock_amount + ? WHERE users.username LIKE ?")) {
|
||||||
statement.setString(1, enabled ? "1" : "0");
|
statement.setString(1, booleanToIntString(enabled));
|
||||||
statement.setInt(2, enabled ? 0 : 1);
|
statement.setInt(2, booleanToInt(enabled));
|
||||||
statement.setString(3, username);
|
statement.setString(3, username);
|
||||||
found = statement.executeUpdate() > 0;
|
found = statement.executeUpdate() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_allow_trading.user_not_found").replace("%username%", params[1]));
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_allow_trading.user_not_found"), params[1]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")).replace("%username%", params[1]));
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")), params[1]));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_allow_trading.incorrect_setting").replace("%enabled%", Emulator.getTexts().getValue("generic.yes")).replace("%disabled%", Emulator.getTexts().getValue("generic.no")));
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_allow_trading.incorrect_setting").replace("%enabled%", getTextsValue("generic.yes")).replace("%disabled%", getTextsValue("generic.no")));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public class BlockAlertCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
||||||
gameClient.getHabbo().getHabboStats().setBlockStaffAlerts(!gameClient.getHabbo().getHabboStats().isBlockStaffAlerts());
|
gameClient.getHabbo().getHabboStats().setBlockStaffAlerts(!gameClient.getHabbo().getHabboStats().isBlockStaffAlerts());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_blockalert").replace("%state%", (gameClient.getHabbo().getHabboStats().isBlockStaffAlerts() ? Emulator.getTexts().getValue("generic.on") : Emulator.getTexts().getValue("generic.off"))), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_blockalert").replace("%state%", (gameClient.getHabbo().getHabboStats().isBlockStaffAlerts() ? getTextsValue("generic.on") : getTextsValue("generic.off"))), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -14,13 +14,18 @@ public class BotsCommand extends Command {
|
|||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == null || !gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo()))
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == null || !gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
StringBuilder data = new StringBuilder(Emulator.getTexts().getValue("total") + ": " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentBots().values().length);
|
StringBuilder data = new StringBuilder(getTextsValue("total") + ": " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentBots().values().length);
|
||||||
|
|
||||||
for (Object bot : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentBots().values()) {
|
for (Bot bot : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentBots().valueCollection()) {
|
||||||
if (bot instanceof Bot) {
|
|
||||||
data.append("\r");
|
data.append("\r");
|
||||||
data.append("<b>").append(Emulator.getTexts().getValue("generic.bot.name")).append("</b>: ").append(((Bot) bot).getName()).append(" <b>").append(Emulator.getTexts().getValue("generic.bot.id")).append("</b>: ").append(((Bot) bot).getId());
|
data.append("<b>");
|
||||||
}
|
data.append(Emulator.getTexts().getValue("generic.bot.name"));
|
||||||
|
data.append("</b>: ");
|
||||||
|
data.append(bot.getName());
|
||||||
|
data.append(" <b>");
|
||||||
|
data.append(Emulator.getTexts().getValue("generic.bot.id"));
|
||||||
|
data.append("</b>: ");
|
||||||
|
data.append(bot.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().alert(data.toString());
|
gameClient.getHabbo().alert(data.toString());
|
||||||
|
@ -21,16 +21,16 @@ public class ChangeNameCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if the habbo exists or is online
|
// check if the habbo exists or is online
|
||||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
Habbo habbo = getHabbo(params[1]);
|
||||||
|
|
||||||
if ( habbo == null) {
|
if (habbo == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_changename.user_not_found").replace("%user%", params[1]));
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_changename.user_not_found"), params[1]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this runs if params[1] is a valid habbo
|
// this runs if params[1] is a valid habbo
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_changename.done").replace("%user%", params[1]));
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_changename.done"), params[1]));
|
||||||
habbo.alert(Emulator.getTexts().getValue("commands.succes.cmd_changename.received"));
|
habbo.alert(getTextsValue("commands.succes.cmd_changename.received"));
|
||||||
habbo.getHabboStats().setAllowNameChange(!habbo.getHabboStats().isAllowNameChange());
|
habbo.getHabboStats().setAllowNameChange(!habbo.getHabboStats().isAllowNameChange());
|
||||||
habbo.getClient().sendResponse(new UserObjectComposer(habbo));
|
habbo.getClient().sendResponse(new UserObjectComposer(habbo));
|
||||||
return true;
|
return true;
|
||||||
|
@ -19,7 +19,7 @@ public class ChatTypeCommand extends Command {
|
|||||||
try {
|
try {
|
||||||
chatColor = Integer.parseInt(params[1]);
|
chatColor = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_chatcolor.numbers"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_chatcolor.numbers"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,14 +28,14 @@ public class ChatTypeCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (chatColor < 0) {
|
if (chatColor < 0) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_chatcolor.numbers"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_chatcolor.numbers"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gameClient.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) {
|
if (!gameClient.getHabbo().hasPermission(Permission.ACC_ANYCHATCOLOR)) {
|
||||||
for (String s : Emulator.getConfig().getValue("commands.cmd_chatcolor.banned_numbers").split(";")) {
|
for (String s : Emulator.getConfig().getValue("commands.cmd_chatcolor.banned_numbers").split(";")) {
|
||||||
if (Integer.parseInt(s) == chatColor) {
|
if (Integer.parseInt(s) == chatColor) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_chatcolor.banned"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_chatcolor.banned"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,10 +43,10 @@ public class ChatTypeCommand extends Command {
|
|||||||
|
|
||||||
gameClient.getHabbo().getHabboStats().setChatColor(RoomChatMessageBubbles.getBubble(chatColor));
|
gameClient.getHabbo().getHabboStats().setChatColor(RoomChatMessageBubbles.getBubble(chatColor));
|
||||||
gameClient.sendResponse(new AccountPreferencesComposer(gameClient.getHabbo()));
|
gameClient.sendResponse(new AccountPreferencesComposer(gameClient.getHabbo()));
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_chatcolor.set").replace("%chat%", RoomChatMessageBubbles.values()[chatColor].name().replace("_", " ").toLowerCase()), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_chatcolor.set").replace("%chat%", RoomChatMessageBubbles.values()[chatColor].name().replace("_", " ").toLowerCase()), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().getHabboStats().setChatColor(RoomChatMessageBubbles.NORMAL);
|
gameClient.getHabbo().getHabboStats().setChatColor(RoomChatMessageBubbles.NORMAL);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_chatcolor.reset"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_chatcolor.reset"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.eu.habbo.habbohotel.commands;
|
package com.eu.habbo.habbohotel.commands;
|
||||||
|
|
||||||
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@ -11,4 +13,33 @@ public abstract class Command {
|
|||||||
|
|
||||||
|
|
||||||
public abstract boolean handle(GameClient gameClient, String[] params) throws Exception;
|
public abstract boolean handle(GameClient gameClient, String[] params) throws Exception;
|
||||||
|
|
||||||
|
|
||||||
|
protected Habbo getHabbo(String username) {
|
||||||
|
return Emulator.getGameEnvironment().getHabboManager().getHabbo(username);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getTextsValue(String key) {
|
||||||
|
return Emulator.getTexts().getValue(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getTextsValue(String key, String defaultValue) {
|
||||||
|
return Emulator.getTexts().getValue(key, defaultValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String replaceUser(String input, String user) {
|
||||||
|
return input.replace("%user%", user);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String replaceUsername(String input, String user) {
|
||||||
|
return input.replace("%username%", user);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int booleanToInt(boolean value) {
|
||||||
|
return value ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String booleanToIntString(boolean value) {
|
||||||
|
return value ? "1" : "0";
|
||||||
|
}
|
||||||
}
|
}
|
@ -5,11 +5,19 @@ import com.eu.habbo.core.CommandLog;
|
|||||||
import com.eu.habbo.habbohotel.commands.badge.BadgeCommand;
|
import com.eu.habbo.habbohotel.commands.badge.BadgeCommand;
|
||||||
import com.eu.habbo.habbohotel.commands.badge.MassBadgeCommand;
|
import com.eu.habbo.habbohotel.commands.badge.MassBadgeCommand;
|
||||||
import com.eu.habbo.habbohotel.commands.badge.RoomBadgeCommand;
|
import com.eu.habbo.habbohotel.commands.badge.RoomBadgeCommand;
|
||||||
|
import com.eu.habbo.habbohotel.commands.badge.TakeBadgeCommand;
|
||||||
import com.eu.habbo.habbohotel.commands.bans.BanCommand;
|
import com.eu.habbo.habbohotel.commands.bans.BanCommand;
|
||||||
|
import com.eu.habbo.habbohotel.commands.bans.IPBanCommand;
|
||||||
import com.eu.habbo.habbohotel.commands.bans.MachineBanCommand;
|
import com.eu.habbo.habbohotel.commands.bans.MachineBanCommand;
|
||||||
import com.eu.habbo.habbohotel.commands.bans.SuperbanCommand;
|
import com.eu.habbo.habbohotel.commands.bans.SuperbanCommand;
|
||||||
|
import com.eu.habbo.habbohotel.commands.credits.CreditsCommand;
|
||||||
|
import com.eu.habbo.habbohotel.commands.credits.MassCreditsCommand;
|
||||||
|
import com.eu.habbo.habbohotel.commands.credits.RoomCreditsCommand;
|
||||||
import com.eu.habbo.habbohotel.commands.gift.GiftCommand;
|
import com.eu.habbo.habbohotel.commands.gift.GiftCommand;
|
||||||
import com.eu.habbo.habbohotel.commands.gift.MassGiftCommand;
|
import com.eu.habbo.habbohotel.commands.gift.MassGiftCommand;
|
||||||
|
import com.eu.habbo.habbohotel.commands.pixels.MassPixelsCommand;
|
||||||
|
import com.eu.habbo.habbohotel.commands.pixels.PixelCommand;
|
||||||
|
import com.eu.habbo.habbohotel.commands.pixels.RoomPixelsCommand;
|
||||||
import com.eu.habbo.habbohotel.commands.points.MassPointsCommand;
|
import com.eu.habbo.habbohotel.commands.points.MassPointsCommand;
|
||||||
import com.eu.habbo.habbohotel.commands.points.PointsCommand;
|
import com.eu.habbo.habbohotel.commands.points.PointsCommand;
|
||||||
import com.eu.habbo.habbohotel.commands.points.RoomPointsCommand;
|
import com.eu.habbo.habbohotel.commands.points.RoomPointsCommand;
|
||||||
@ -36,7 +44,7 @@ import java.util.NoSuchElementException;
|
|||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class CommandHandler {
|
public class CommandHandler {
|
||||||
private final static THashMap<String, Command> commands = new THashMap<>(5);
|
private static final THashMap<String, Command> commands = new THashMap<>(5);
|
||||||
private static final Comparator<Command> ALPHABETICAL_ORDER = (c1, c2) -> {
|
private static final Comparator<Command> ALPHABETICAL_ORDER = (c1, c2) -> {
|
||||||
int res = String.CASE_INSENSITIVE_ORDER.compare(c1.permission, c2.permission);
|
int res = String.CASE_INSENSITIVE_ORDER.compare(c1.permission, c2.permission);
|
||||||
return (res != 0) ? res : c1.permission.compareTo(c2.permission);
|
return (res != 0) ? res : c1.permission.compareTo(c2.permission);
|
||||||
@ -59,7 +67,7 @@ public class CommandHandler {
|
|||||||
public static void addCommand(Class<? extends Command> command) {
|
public static void addCommand(Class<? extends Command> command) {
|
||||||
try {
|
try {
|
||||||
//command.getConstructor().setAccessible(true);
|
//command.getConstructor().setAccessible(true);
|
||||||
addCommand(command.newInstance());
|
addCommand(command.getDeclaredConstructor().newInstance());
|
||||||
log.debug("Added command: {}", command.getName());
|
log.debug("Added command: {}", command.getName());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
@ -132,8 +140,7 @@ public class CommandHandler {
|
|||||||
|
|
||||||
Pet pet = petIterator.value();
|
Pet pet = petIterator.value();
|
||||||
|
|
||||||
if (pet != null) {
|
if (pet != null && pet.getName().equalsIgnoreCase(args[0])) {
|
||||||
if (pet.getName().equalsIgnoreCase(args[0])) {
|
|
||||||
StringBuilder s = new StringBuilder();
|
StringBuilder s = new StringBuilder();
|
||||||
|
|
||||||
for (int i = 1; i < args.length; i++) {
|
for (int i = 1; i < args.length; i++) {
|
||||||
@ -144,9 +151,9 @@ public class CommandHandler {
|
|||||||
|
|
||||||
for (PetCommand command : pet.getPetData().getPetCommands()) {
|
for (PetCommand command : pet.getPetData().getPetCommands()) {
|
||||||
if (command.getKey().equalsIgnoreCase(s.toString())) {
|
if (command.getKey().equalsIgnoreCase(s.toString())) {
|
||||||
if (pet instanceof RideablePet && ((RideablePet) pet).getRider() != null) {
|
if (pet instanceof RideablePet rideablePet && ((RideablePet) pet).getRider() != null) {
|
||||||
if (((RideablePet) pet).getRider().getHabboInfo().getId() == gameClient.getHabbo().getHabboInfo().getId()) {
|
if (rideablePet.getRider().getHabboInfo().getId() == gameClient.getHabbo().getHabboInfo().getId()) {
|
||||||
((RideablePet) pet).getRider().getHabboInfo().dismountPet();
|
rideablePet.getRider().getHabboInfo().dismountPet();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -164,7 +171,6 @@ public class CommandHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,12 +12,12 @@ public class CommandsCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
StringBuilder message = new StringBuilder(Emulator.getTexts().getValue("commands.generic.cmd_commands.text"));
|
StringBuilder message = new StringBuilder(getTextsValue("commands.generic.cmd_commands.text"));
|
||||||
List<Command> commands = Emulator.getGameEnvironment().getCommandHandler().getCommandsForRank(gameClient.getHabbo().getHabboInfo().getRank().getId());
|
List<Command> commands = Emulator.getGameEnvironment().getCommandHandler().getCommandsForRank(gameClient.getHabbo().getHabboInfo().getRank().getId());
|
||||||
message.append("(").append(commands.size()).append("):\r\n");
|
message.append("(").append(commands.size()).append("):\r\n");
|
||||||
|
|
||||||
for (Command c : commands) {
|
for (Command c : commands) {
|
||||||
message.append(Emulator.getTexts().getValue("commands.description." + c.permission, "commands.description." + c.permission)).append("\r");
|
message.append(getTextsValue("commands.description." + c.permission, "commands.description." + c.permission)).append("\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().alert(new String[]{message.toString()});
|
gameClient.getHabbo().alert(new String[]{message.toString()});
|
||||||
|
@ -14,15 +14,15 @@ public class ControlCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
||||||
if (params.length == 2) {
|
if (params.length == 2) {
|
||||||
Habbo target = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
|
Habbo target = getHabbo(params[1]);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_control.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_control.not_found"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target == gameClient.getHabbo()) {
|
if (target == gameClient.getHabbo()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_control.not_self"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_control.not_self"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,18 +30,18 @@ public class ControlCommand extends Command {
|
|||||||
|
|
||||||
if (oldHabbo != null) {
|
if (oldHabbo != null) {
|
||||||
oldHabbo.getRoomUnit().getCacheable().remove("controller");
|
oldHabbo.getRoomUnit().getCacheable().remove("controller");
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_control.stopped").replace("%user%", oldHabbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_control.stopped"), oldHabbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
gameClient.getHabbo().getRoomUnit().getCacheable().put("control", target);
|
gameClient.getHabbo().getRoomUnit().getCacheable().put("control", target);
|
||||||
target.getRoomUnit().getCacheable().put("controller", gameClient.getHabbo());
|
target.getRoomUnit().getCacheable().put("controller", gameClient.getHabbo());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_control.controlling").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_control.controlling"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
Object habbo = gameClient.getHabbo().getRoomUnit().getCacheable().get("control");
|
Object habbo = gameClient.getHabbo().getRoomUnit().getCacheable().get("control");
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
gameClient.getHabbo().getRoomUnit().getCacheable().remove("control");
|
gameClient.getHabbo().getRoomUnit().getCacheable().remove("control");
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_control.stopped").replace("%user%", ((Habbo) habbo).getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_control.stopped"), ((Habbo) habbo).getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -17,13 +17,13 @@ public class CoordsCommand extends Command {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (params.length == 1) {
|
if (params.length == 1) {
|
||||||
gameClient.getHabbo().alert(Emulator.getTexts().getValue("commands.generic.cmd_coords.title") + "\r\n" +
|
gameClient.getHabbo().alert(getTextsValue("commands.generic.cmd_coords.title") + "\r\n" +
|
||||||
"x: " + gameClient.getHabbo().getRoomUnit().getX() + "\r" +
|
"x: " + gameClient.getHabbo().getRoomUnit().getX() + "\r" +
|
||||||
"y: " + gameClient.getHabbo().getRoomUnit().getY() + "\r" +
|
"y: " + gameClient.getHabbo().getRoomUnit().getY() + "\r" +
|
||||||
"z: " + (gameClient.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.SIT) ? gameClient.getHabbo().getRoomUnit().getStatus(RoomUnitStatus.SIT) : gameClient.getHabbo().getRoomUnit().getZ()) + "\r" +
|
"z: " + (gameClient.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.SIT) ? gameClient.getHabbo().getRoomUnit().getStatus(RoomUnitStatus.SIT) : gameClient.getHabbo().getRoomUnit().getZ()) + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.rotation.head") + ": " + gameClient.getHabbo().getRoomUnit().getHeadRotation() + "-" + gameClient.getHabbo().getRoomUnit().getHeadRotation().getValue() + "\r" +
|
getTextsValue("generic.rotation.head") + ": " + gameClient.getHabbo().getRoomUnit().getHeadRotation() + "-" + gameClient.getHabbo().getRoomUnit().getHeadRotation().getValue() + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.rotation.body") + ": " + gameClient.getHabbo().getRoomUnit().getBodyRotation() + "-" + gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue() + "\r" +
|
getTextsValue("generic.rotation.body") + ": " + gameClient.getHabbo().getRoomUnit().getBodyRotation() + "-" + gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue() + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.sitting") + ": " + (gameClient.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.SIT) ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + "\r" +
|
getTextsValue("generic.sitting") + ": " + (gameClient.getHabbo().getRoomUnit().hasStatus(RoomUnitStatus.SIT) ? getTextsValue("generic.yes") : getTextsValue("generic.no")) + "\r" +
|
||||||
"Tile State: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).getState().name() + "\r" +
|
"Tile State: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).getState().name() + "\r" +
|
||||||
"Tile Walkable: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).isWalkable() + "\r" +
|
"Tile Walkable: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).isWalkable() + "\r" +
|
||||||
"Tile relative height: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).relativeHeight() + "\r" +
|
"Tile relative height: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(gameClient.getHabbo().getRoomUnit().getX(), gameClient.getHabbo().getRoomUnit().getY()).relativeHeight() + "\r" +
|
||||||
@ -33,7 +33,7 @@ public class CoordsCommand extends Command {
|
|||||||
RoomTile tile = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(Short.parseShort(params[1]), Short.parseShort(params[2]));
|
RoomTile tile = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTile(Short.parseShort(params[1]), Short.parseShort(params[2]));
|
||||||
|
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
gameClient.getHabbo().alert(Emulator.getTexts().getValue("commands.generic.cmd_coords.title") + "\r\n" +
|
gameClient.getHabbo().alert(getTextsValue("commands.generic.cmd_coords.title") + "\r\n" +
|
||||||
"x: " + tile.getX() + "\r" +
|
"x: " + tile.getX() + "\r" +
|
||||||
"y: " + tile.getY() + "\r" +
|
"y: " + tile.getY() + "\r" +
|
||||||
"z: " + tile.getZ() + "\r" +
|
"z: " + tile.getZ() + "\r" +
|
||||||
@ -42,7 +42,7 @@ public class CoordsCommand extends Command {
|
|||||||
"Tile Stack Height: " + tile.getStackHeight() + "\r" +
|
"Tile Stack Height: " + tile.getStackHeight() + "\r" +
|
||||||
"Tile Walkable: " + (tile.isWalkable() ? "Yes" : "No") + "\r");
|
"Tile Walkable: " + (tile.isWalkable() ? "Yes" : "No") + "\r");
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("generic.tile.not.exists"));
|
gameClient.getHabbo().whisper(getTextsValue("generic.tile.not.exists"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
package com.eu.habbo.habbohotel.commands;
|
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
|
||||||
import com.eu.habbo.habbohotel.users.HabboInfo;
|
|
||||||
import com.eu.habbo.habbohotel.users.HabboManager;
|
|
||||||
|
|
||||||
public class CreditsCommand extends Command {
|
|
||||||
public CreditsCommand() {
|
|
||||||
super("cmd_credits", Emulator.getTexts().getValue("commands.keys.cmd_credits").split(";"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
|
||||||
if (params.length == 3) {
|
|
||||||
HabboInfo info = HabboManager.getOfflineHabboInfo(params[1]);
|
|
||||||
|
|
||||||
if (info != null) {
|
|
||||||
Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(params[1]);
|
|
||||||
|
|
||||||
int credits;
|
|
||||||
try {
|
|
||||||
credits = Integer.parseInt(params[2]);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_credits.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (habbo != null) {
|
|
||||||
if (credits != 0) {
|
|
||||||
habbo.giveCredits(credits);
|
|
||||||
if (habbo.getHabboInfo().getCurrentRoom() != null)
|
|
||||||
habbo.whisper(Emulator.getTexts().getValue("commands.generic.cmd_credits.received").replace("%amount%", Integer.parseInt(params[2]) + ""), RoomChatMessageBubbles.ALERT);
|
|
||||||
else
|
|
||||||
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_credits.received").replace("%amount%", Integer.parseInt(params[2]) + ""));
|
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_credits.send").replace("%amount%", Integer.parseInt(params[2]) + "").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_credits.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Emulator.getGameEnvironment().getHabboManager().giveCredits(info.getId(), credits);
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_credits.send").replace("%amount%", Integer.parseInt(params[2]) + "").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_credits.user_not_found").replace("%amount%", Integer.parseInt(params[2]) + "").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_credits.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -11,19 +11,17 @@ public class DiagonalCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo())) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo())) {
|
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().moveDiagonally(!gameClient.getHabbo().getHabboInfo().getCurrentRoom().moveDiagonally());
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().moveDiagonally(!gameClient.getHabbo().getHabboInfo().getCurrentRoom().moveDiagonally());
|
||||||
|
|
||||||
if (!gameClient.getHabbo().getHabboInfo().getCurrentRoom().moveDiagonally()) {
|
if (!gameClient.getHabbo().getHabboInfo().getCurrentRoom().moveDiagonally()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_diagonal.disabled"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_diagonal.disabled"), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_diagonal.enabled"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_diagonal.enabled"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -13,30 +13,30 @@ public class DisconnectCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length < 2) {
|
if (params.length < 2) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_disconnect.forgot_username"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_disconnect.forgot_username"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params[1].equalsIgnoreCase(gameClient.getHabbo().getHabboInfo().getUsername())) {
|
if (params[1].equalsIgnoreCase(gameClient.getHabbo().getHabboInfo().getUsername())) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_disconnect.disconnect_self"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_disconnect.disconnect_self"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
Habbo target = getHabbo(params[1]);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_disconnect.user_offline"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_disconnect.user_offline"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.getHabboInfo().getRank().getId() > gameClient.getHabbo().getHabboInfo().getRank().getId()) {
|
if (target.getHabboInfo().getRank().getId() > gameClient.getHabbo().getHabboInfo().getRank().getId()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_disconnect.higher_rank"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_disconnect.higher_rank"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
target.getClient().getChannel().close();
|
target.getClient().getChannel().close();
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_disconnect.disconnected").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_disconnect.disconnected"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,10 @@ public class EjectAllCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
||||||
|
|
||||||
if (room != null) {
|
if (room != null && (room.isOwner(gameClient.getHabbo())
|
||||||
if (room.isOwner(gameClient.getHabbo()) || (room.hasGuild() && room.getGuildRightLevel(gameClient.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN))) {
|
|| (room.hasGuild() && room.getGuildRightLevel(gameClient.getHabbo()).equals(RoomRightLevels.GUILD_ADMIN)))) {
|
||||||
room.ejectAll(gameClient.getHabbo());
|
room.ejectAll(gameClient.getHabbo());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -17,19 +17,19 @@ public class EmptyBotsInventoryCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length == 1 || (params.length >= 2 && !params[1].equals(Emulator.getTexts().getValue("generic.yes")))) {
|
if (params.length == 1 || (params.length >= 2 && !params[1].equals(getTextsValue("generic.yes")))) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getUserCount() > 10) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getUserCount() > 10) {
|
||||||
gameClient.getHabbo().alert(Emulator.getTexts().getValue("commands.succes.cmd_empty_bots.verify").replace("%generic.yes%", Emulator.getTexts().getValue("generic.yes")));
|
gameClient.getHabbo().alert(getTextsValue("commands.succes.cmd_empty_bots.verify").replace("%generic.yes%", getTextsValue("generic.yes")));
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty_bots.verify").replace("%generic.yes%", Emulator.getTexts().getValue("generic.yes")), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_empty_bots.verify").replace("%generic.yes%", getTextsValue("generic.yes")), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.length >= 2 && params[1].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"))) {
|
if (params.length >= 2 && params[1].equalsIgnoreCase(getTextsValue("generic.yes"))) {
|
||||||
|
|
||||||
Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
|
Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
|
||||||
|
|
||||||
@ -45,9 +45,9 @@ public class EmptyBotsInventoryCommand extends Command {
|
|||||||
habbo.getClient().sendResponse(new FurniListInvalidateComposer());
|
habbo.getClient().sendResponse(new FurniListInvalidateComposer());
|
||||||
habbo.getClient().sendResponse(new BotInventoryComposer(habbo));
|
habbo.getClient().sendResponse(new BotInventoryComposer(habbo));
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty_bots.cleared").replace("%username%", habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.succes.cmd_empty_bots.cleared"), habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_empty_bots"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_empty_bots"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,19 +19,19 @@ public class EmptyInventoryCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length == 1 || (params.length == 2 && !params[1].equals(Emulator.getTexts().getValue("generic.yes")))) {
|
if (params.length == 1 || (params.length == 2 && !params[1].equals(getTextsValue("generic.yes")))) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getUserCount() > 10) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getUserCount() > 10) {
|
||||||
gameClient.getHabbo().alert(Emulator.getTexts().getValue("commands.succes.cmd_empty.verify").replace("%generic.yes%", Emulator.getTexts().getValue("generic.yes")));
|
gameClient.getHabbo().alert(getTextsValue("commands.succes.cmd_empty.verify").replace("%generic.yes%", getTextsValue("generic.yes")));
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty.verify").replace("%generic.yes%", Emulator.getTexts().getValue("generic.yes")), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_empty.verify").replace("%generic.yes%", getTextsValue("generic.yes")), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.length >= 2 && params[1].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"))) {
|
if (params.length >= 2 && params[1].equalsIgnoreCase(getTextsValue("generic.yes"))) {
|
||||||
|
|
||||||
Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
|
Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
|
||||||
|
|
||||||
@ -45,9 +45,9 @@ public class EmptyInventoryCommand extends Command {
|
|||||||
habbo.getClient().sendResponse(new FurniListComposer(0, 1, gameClient.getHabbo().getInventory().getItemsComponent().getItems()));
|
habbo.getClient().sendResponse(new FurniListComposer(0, 1, gameClient.getHabbo().getInventory().getItemsComponent().getItems()));
|
||||||
|
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty.cleared").replace("%username%", habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.succes.cmd_empty.cleared"), habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_empty"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_empty"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,25 +17,24 @@ public class EmptyPetsInventoryCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length == 1 || (params.length >= 2 && !params[1].equals(Emulator.getTexts().getValue("generic.yes")))) {
|
if (params.length == 1 || (params.length >= 2 && !params[1].equals(getTextsValue("generic.yes")))) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getUserCount() > 10) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getUserCount() > 10) {
|
||||||
gameClient.getHabbo().alert(Emulator.getTexts().getValue("commands.succes.cmd_empty_pets.verify").replace("%generic.yes%", Emulator.getTexts().getValue("generic.yes")));
|
gameClient.getHabbo().alert(getTextsValue("commands.succes.cmd_empty_pets.verify").replace("%generic.yes%", getTextsValue("generic.yes")));
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty_pets.verify").replace("%generic.yes%", Emulator.getTexts().getValue("generic.yes")), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_empty_pets.verify").replace("%generic.yes%", getTextsValue("generic.yes")), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.length >= 2 && params[1].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"))) {
|
if (params.length >= 2 && params[1].equalsIgnoreCase(getTextsValue("generic.yes"))) {
|
||||||
|
|
||||||
Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
|
Habbo habbo = (params.length == 3 && gameClient.getHabbo().hasPermission(Permission.ACC_EMPTY_OTHERS)) ? Emulator.getGameEnvironment().getHabboManager().getHabbo(params[2]) : gameClient.getHabbo();
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
TIntObjectHashMap<Pet> pets = new TIntObjectHashMap<>();
|
TIntObjectHashMap<Pet> pets = new TIntObjectHashMap<>(habbo.getInventory().getPetsComponent().getPets());
|
||||||
pets.putAll(habbo.getInventory().getPetsComponent().getPets());
|
|
||||||
habbo.getInventory().getPetsComponent().getPets().clear();
|
habbo.getInventory().getPetsComponent().getPets().clear();
|
||||||
pets.forEachValue(object -> {
|
pets.forEachValue(object -> {
|
||||||
Emulator.getGameEnvironment().getPetManager().deletePet(object);
|
Emulator.getGameEnvironment().getPetManager().deletePet(object);
|
||||||
@ -45,9 +44,9 @@ public class EmptyPetsInventoryCommand extends Command {
|
|||||||
habbo.getClient().sendResponse(new FurniListInvalidateComposer());
|
habbo.getClient().sendResponse(new FurniListInvalidateComposer());
|
||||||
habbo.getClient().sendResponse(new PetInventoryComposer(habbo));
|
habbo.getClient().sendResponse(new PetInventoryComposer(habbo));
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_empty_pets.cleared").replace("%username%", habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.succes.cmd_empty_pets.cleared"), habbo.getHabboInfo().getUsername()), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_empty_pets"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_empty_pets"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,28 +24,27 @@ public class EnableCommand extends Command {
|
|||||||
}
|
}
|
||||||
Habbo target = gameClient.getHabbo();
|
Habbo target = gameClient.getHabbo();
|
||||||
if (params.length == 3) {
|
if (params.length == 3) {
|
||||||
target = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[2]);
|
target = getHabbo(params[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target != null) {
|
if (target == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (target == gameClient.getHabbo() || gameClient.getHabbo().hasPermission(Permission.ACC_ENABLE_OTHERS)) {
|
if (target == gameClient.getHabbo() || gameClient.getHabbo().hasPermission(Permission.ACC_ENABLE_OTHERS)) {
|
||||||
try {
|
try {
|
||||||
if (target.getHabboInfo().getCurrentRoom() != null) {
|
if (target.getHabboInfo().getCurrentRoom() != null && target.getHabboInfo().getRiding() == null) {
|
||||||
if (target.getHabboInfo().getRiding() == null) {
|
|
||||||
if (Emulator.getGameEnvironment().getPermissionsManager().isEffectBlocked(effectId, target.getHabboInfo().getRank().getId())) {
|
if (Emulator.getGameEnvironment().getPermissionsManager().isEffectBlocked(effectId, target.getHabboInfo().getRank().getId())) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_enable.not_allowed"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_enable.not_allowed"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
target.getHabboInfo().getCurrentRoom().giveEffect(target, effectId, -1);
|
target.getHabboInfo().getCurrentRoom().giveEffect(target, effectId, -1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Caught exception", e);
|
log.error("Caught exception", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,8 @@ import com.eu.habbo.messages.ServerMessage;
|
|||||||
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
||||||
import gnu.trove.map.hash.THashMap;
|
import gnu.trove.map.hash.THashMap;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class EventCommand extends Command {
|
public class EventCommand extends Command {
|
||||||
public EventCommand() {
|
public EventCommand() {
|
||||||
@ -16,14 +17,10 @@ public class EventCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == null || params.length < 2) {
|
||||||
if (params.length >= 2) {
|
return false;
|
||||||
StringBuilder message = new StringBuilder();
|
|
||||||
|
|
||||||
for (int i = 1; i < params.length; i++) {
|
|
||||||
message.append(params[i]);
|
|
||||||
message.append(" ");
|
|
||||||
}
|
}
|
||||||
|
String message = IntStream.range(1, params.length).mapToObj(i -> params[i] + " ").collect(Collectors.joining());
|
||||||
|
|
||||||
THashMap<String, String> codes = new THashMap<>();
|
THashMap<String, String> codes = new THashMap<>();
|
||||||
codes.put("ROOMNAME", gameClient.getHabbo().getHabboInfo().getCurrentRoom().getName());
|
codes.put("ROOMNAME", gameClient.getHabbo().getHabboInfo().getCurrentRoom().getName());
|
||||||
@ -31,12 +28,11 @@ public class EventCommand extends Command {
|
|||||||
codes.put("USERNAME", gameClient.getHabbo().getHabboInfo().getUsername());
|
codes.put("USERNAME", gameClient.getHabbo().getHabboInfo().getUsername());
|
||||||
codes.put("LOOK", gameClient.getHabbo().getHabboInfo().getLook());
|
codes.put("LOOK", gameClient.getHabbo().getHabboInfo().getLook());
|
||||||
codes.put("TIME", Emulator.getDate().toString());
|
codes.put("TIME", Emulator.getDate().toString());
|
||||||
codes.put("MESSAGE", message.toString());
|
codes.put("MESSAGE", message);
|
||||||
|
|
||||||
ServerMessage msg = new NotificationDialogMessageComposer("hotel.event", codes).compose();
|
ServerMessage msg = new NotificationDialogMessageComposer("hotel.event", codes).compose();
|
||||||
|
|
||||||
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) {
|
||||||
Habbo habbo = set.getValue();
|
|
||||||
if (habbo.getHabboStats().isBlockStaffAlerts()) {
|
if (habbo.getHabboStats().isBlockStaffAlerts()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -45,9 +41,6 @@ public class EventCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,10 @@ public class FacelessCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String[] figureParts = gameClient.getHabbo().getHabboInfo().getLook().split("\\.");
|
String[] figureParts = gameClient.getHabbo().getHabboInfo().getLook().split("\\.");
|
||||||
@ -39,7 +42,6 @@ public class FacelessCommand extends Command {
|
|||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -12,17 +12,16 @@ public class FastwalkCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
//TODO Make this an event plugin which fires that can be cancelled
|
||||||
if (gameClient.getHabbo().getHabboInfo().getRiding() != null) //TODO Make this an event plugin which fires that can be cancelled
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && gameClient.getHabbo().getHabboInfo().getRiding() != null)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
Habbo habbo = gameClient.getHabbo();
|
Habbo habbo = gameClient.getHabbo();
|
||||||
|
|
||||||
if (params.length >= 2) {
|
if (params.length >= 2) {
|
||||||
String username = params[1];
|
String username = params[1];
|
||||||
|
|
||||||
habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(username);
|
habbo = getHabbo(username);
|
||||||
|
|
||||||
if (habbo == null)
|
if (habbo == null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -20,7 +20,7 @@ public class FilterWordCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length < 2) {
|
if (params.length < 2) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_filterword.missing_word"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_filterword.missing_word"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,11 +39,11 @@ public class FilterWordCommand extends Command {
|
|||||||
statement.execute();
|
statement.execute();
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_filterword.error"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_filterword.error"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_filterword.added").replace("%word%", word).replace("%replacement%", replacement));
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_filterword.added").replace("%word%", word).replace("%replacement%", replacement));
|
||||||
Emulator.getGameEnvironment().getWordFilter().addWord(wordFilterWord);
|
Emulator.getGameEnvironment().getWordFilter().addWord(wordFilterWord);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -12,17 +12,19 @@ public class FreezeBotsCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == null) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getId() == gameClient.getHabbo().getHabboInfo().getCurrentRoom().getOwnerId() || gameClient.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) {
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gameClient.getHabbo().getHabboInfo().getId() == gameClient.getHabbo().getHabboInfo().getCurrentRoom().getOwnerId()
|
||||||
|
|| gameClient.getHabbo().hasPermission(Permission.ACC_ANYROOMOWNER)) {
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().setAllowBotsWalk(!gameClient.getHabbo().getHabboInfo().getCurrentRoom().isAllowBotsWalk());
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().setAllowBotsWalk(!gameClient.getHabbo().getHabboInfo().getCurrentRoom().isAllowBotsWalk());
|
||||||
gameClient.getHabbo().whisper(gameClient.getHabbo().getHabboInfo().getCurrentRoom().isAllowBotsWalk() ? Emulator.getTexts().getValue("commands.succes.cmd_freeze_bots.unfrozen") : Emulator.getTexts().getValue("commands.succes.cmd_freeze_bots.frozen"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(gameClient.getHabbo().getHabboInfo().getCurrentRoom().isAllowBotsWalk() ? getTextsValue("commands.succes.cmd_freeze_bots.unfrozen") : getTextsValue("commands.succes.cmd_freeze_bots.frozen"), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("generic.cannot_do_that"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("generic.cannot_do_that"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,24 +13,24 @@ public class FreezeCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length == 2) {
|
if (params.length == 2) {
|
||||||
Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
|
Habbo habbo = getHabbo(params[1]);
|
||||||
|
|
||||||
if (habbo == null) {
|
if (habbo == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_freeze.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_freeze.not_found"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
if (habbo.getRoomUnit().canWalk()) {
|
if (habbo.getRoomUnit().canWalk()) {
|
||||||
habbo.getRoomUnit().setCanWalk(false);
|
habbo.getRoomUnit().setCanWalk(false);
|
||||||
habbo.whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.frozen"), RoomChatMessageBubbles.ALERT);
|
habbo.whisper(getTextsValue("commands.succes.cmd_freeze.frozen"), RoomChatMessageBubbles.ALERT);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.user_frozen").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_freeze.user_frozen"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
habbo.getRoomUnit().setCanWalk(true);
|
habbo.getRoomUnit().setCanWalk(true);
|
||||||
habbo.whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.unfrozen"), RoomChatMessageBubbles.ALERT);
|
habbo.whisper(getTextsValue("commands.succes.cmd_freeze.unfrozen"), RoomChatMessageBubbles.ALERT);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_freeze.user_unfrozen").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_freeze.user_unfrozen"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_freeze.not_found").replace("%user%", ""), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_freeze.not_found"), ""), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,17 +16,16 @@ public class GiveRankCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||||
Rank rank = null;
|
Rank rank = null;
|
||||||
if (params.length == 1) {
|
switch (params.length) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_give_rank.missing_username") + Emulator.getTexts().getValue("commands.description.cmd_give_rank"), RoomChatMessageBubbles.ALERT);
|
case 1 -> {
|
||||||
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_give_rank.missing_username") + getTextsValue("commands.description.cmd_give_rank"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
case 2 -> {
|
||||||
if (params.length == 2) {
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_give_rank.missing_rank") + getTextsValue("commands.description.cmd_give_rank"), RoomChatMessageBubbles.ALERT);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_give_rank.missing_rank") + Emulator.getTexts().getValue("commands.description.cmd_give_rank"), RoomChatMessageBubbles.ALERT);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
case 3 -> {
|
||||||
if (params.length == 3) {
|
|
||||||
if (StringUtils.isNumeric(params[2])) {
|
if (StringUtils.isNumeric(params[2])) {
|
||||||
int rankId = Integer.parseInt(params[2]);
|
int rankId = Integer.parseInt(params[2]);
|
||||||
if (Emulator.getGameEnvironment().getPermissionsManager().rankExists(rankId))
|
if (Emulator.getGameEnvironment().getPermissionsManager().rankExists(rankId))
|
||||||
@ -34,10 +33,9 @@ public class GiveRankCommand extends Command {
|
|||||||
} else {
|
} else {
|
||||||
rank = Emulator.getGameEnvironment().getPermissionsManager().getRankByName(params[2]);
|
rank = Emulator.getGameEnvironment().getPermissionsManager().getRankByName(params[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rank != null) {
|
if (rank != null) {
|
||||||
if (rank.getId() > gameClient.getHabbo().getHabboInfo().getRank().getId()) {
|
if (rank.getId() > gameClient.getHabbo().getHabboInfo().getRank().getId()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_give_rank.higher").replace("%username%", params[1]).replace("%id%", rank.getName()), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_give_rank.higher"), params[1]).replace("%id%", rank.getName()), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,21 +43,22 @@ public class GiveRankCommand extends Command {
|
|||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
if (habbo.getRank().getId() > gameClient.getHabbo().getHabboInfo().getRank().getId()) {
|
if (habbo.getRank().getId() > gameClient.getHabbo().getHabboInfo().getRank().getId()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_give_rank.higher.other").replace("%username%", params[1]).replace("%id%", rank.getName()), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_give_rank.higher.other"), params[1]).replace("%id%", rank.getName()), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Emulator.getGameEnvironment().getHabboManager().setRank(habbo.getId(), rank.getId());
|
Emulator.getGameEnvironment().getHabboManager().setRank(habbo.getId(), rank.getId());
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_give_rank.updated").replace("%id%", rank.getName()).replace("%username%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.succes.cmd_give_rank.updated"), params[1]).replace("%id%", rank.getName()), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_give_rank.user_offline").replace("%id%", rank.getName()).replace("%username%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_give_rank.user_offline"), params[1]).replace("%id%", rank.getName()), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.errors.cmd_give_rank.not_found").replace("%id%", params[2]).replace("%username%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.errors.cmd_give_rank.not_found"), params[1]).replace("%id%", params[2]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,12 +9,10 @@ public class HabnamCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (gameClient.getHabbo().getHabboStats().hasActiveClub()) {
|
if (gameClient.getHabbo().getHabboStats().hasActiveClub() && gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gameClient.getHabbo(), 140, 30);
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().giveEffect(gameClient.getHabbo(), 140, 30);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -17,9 +17,8 @@ public class HappyHourCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new HabboBroadcastMessageComposer("Happy Hour!"));
|
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new HabboBroadcastMessageComposer("Happy Hour!"));
|
||||||
|
|
||||||
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()
|
||||||
AchievementManager.progressAchievement(set.getValue(), Emulator.getGameEnvironment().getAchievementManager().getAchievement("HappyHour"));
|
.forEach(habbo -> AchievementManager.progressAchievement(habbo, Emulator.getGameEnvironment().getAchievementManager().getAchievement("HappyHour")));
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,15 @@ public class HideWiredCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
||||||
|
if (room == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (room != null) {
|
|
||||||
if (room.isOwner(gameClient.getHabbo())) {
|
if (room.isOwner(gameClient.getHabbo())) {
|
||||||
room.setHideWired(!room.isHideWired());
|
room.setHideWired(!room.isHideWired());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_hidewired." + (room.isHideWired() ? "hidden" : "shown")));
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_hidewired." + (room.isHideWired() ? "hidden" : "shown")));
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.errors.cmd_hidewired.permission"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.errors.cmd_hidewired.permission"));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -8,6 +8,8 @@ import com.eu.habbo.messages.ServerMessage;
|
|||||||
import com.eu.habbo.messages.outgoing.generic.alerts.ModeratorMessageComposer;
|
import com.eu.habbo.messages.outgoing.generic.alerts.ModeratorMessageComposer;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class HotelAlertCommand extends Command {
|
public class HotelAlertCommand extends Command {
|
||||||
|
|
||||||
@ -18,22 +20,15 @@ public class HotelAlertCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length > 1) {
|
if (params.length > 1) {
|
||||||
StringBuilder message = new StringBuilder();
|
String message = IntStream.range(1, params.length).mapToObj(i -> params[i] + " ").collect(Collectors.joining());
|
||||||
for (int i = 1; i < params.length; i++) {
|
|
||||||
message.append(params[i]).append(" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
ServerMessage msg = new ModeratorMessageComposer(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername(), "").compose();
|
ServerMessage msg = new ModeratorMessageComposer(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername(), "").compose();
|
||||||
|
|
||||||
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values().stream()
|
||||||
Habbo habbo = set.getValue();
|
.filter(habbo -> !habbo.getHabboStats().isBlockStaffAlerts())
|
||||||
if (habbo.getHabboStats().isBlockStaffAlerts())
|
.forEach(habbo -> habbo.getClient().sendResponse(msg));
|
||||||
continue;
|
|
||||||
|
|
||||||
habbo.getClient().sendResponse(msg);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ha.forgot_message"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_ha.forgot_message"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
package com.eu.habbo.habbohotel.commands;
|
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|
||||||
import com.eu.habbo.habbohotel.modtool.ModToolBanType;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
|
||||||
import com.eu.habbo.habbohotel.users.HabboInfo;
|
|
||||||
import com.eu.habbo.habbohotel.users.HabboManager;
|
|
||||||
|
|
||||||
public class IPBanCommand extends Command {
|
|
||||||
public final static int TEN_YEARS = 315569260;
|
|
||||||
|
|
||||||
public IPBanCommand() {
|
|
||||||
super("cmd_ip_ban", Emulator.getTexts().getValue("commands.keys.cmd_ip_ban").split(";"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
|
||||||
HabboInfo habbo;
|
|
||||||
StringBuilder reason = new StringBuilder();
|
|
||||||
if (params.length >= 2) {
|
|
||||||
Habbo h = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
|
||||||
|
|
||||||
if (h != null) {
|
|
||||||
habbo = h.getHabboInfo();
|
|
||||||
} else {
|
|
||||||
habbo = HabboManager.getOfflineHabboInfo(params[1]);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (params.length > 2) {
|
|
||||||
for (int i = 2; i < params.length; i++) {
|
|
||||||
reason.append(params[i]);
|
|
||||||
reason.append(" ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
if (habbo != null) {
|
|
||||||
if (habbo == gameClient.getHabbo().getHabboInfo()) {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ip_ban.ban_self"), RoomChatMessageBubbles.ALERT);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (habbo.getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ban.target_rank_higher"), RoomChatMessageBubbles.ALERT);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Emulator.getGameEnvironment().getModToolManager().ban(habbo.getId(), gameClient.getHabbo(), reason.toString(), TEN_YEARS, ModToolBanType.IP, -1);
|
|
||||||
count++;
|
|
||||||
for (Habbo h : Emulator.getGameServer().getGameClientManager().getHabbosWithIP(habbo.getIpLogin())) {
|
|
||||||
if (h != null) {
|
|
||||||
count++;
|
|
||||||
Emulator.getGameEnvironment().getModToolManager().ban(h.getHabboInfo().getId(), gameClient.getHabbo(), reason.toString(), TEN_YEARS, ModToolBanType.IP, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ban.user_offline"), RoomChatMessageBubbles.ALERT);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_ip_ban").replace("%count%", count + ""), RoomChatMessageBubbles.ALERT);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -25,8 +25,8 @@ public class InvisibleCommand extends Command {
|
|||||||
|
|
||||||
new RoomUnitTeleport(roomUnit, roomUnit.getRoom(), roomLayout.getDoorTile().getX(), roomLayout.getDoorTile().getY(), roomLayout.getDoorTile().getZ(), 0).run();
|
new RoomUnitTeleport(roomUnit, roomUnit.getRoom(), roomLayout.getDoorTile().getX(), roomLayout.getDoorTile().getY(), roomLayout.getDoorTile().getZ(), 0).run();
|
||||||
|
|
||||||
roomUnit.setInvisible(false);
|
roomUnit.setInvisible(false)
|
||||||
roomUnit.setInRoom(true);
|
.setInRoom(true);
|
||||||
|
|
||||||
roomUnit.getRoom().sendComposer(new RoomUsersComposer(gameClient.getHabbo()).compose());
|
roomUnit.getRoom().sendComposer(new RoomUsersComposer(gameClient.getHabbo()).compose());
|
||||||
roomUnit.getRoom().sendComposer(new UserUpdateComposer(roomUnit).compose());
|
roomUnit.getRoom().sendComposer(new UserUpdateComposer(roomUnit).compose());
|
||||||
@ -34,13 +34,13 @@ public class InvisibleCommand extends Command {
|
|||||||
WiredHandler.handle(WiredTriggerType.ENTER_ROOM, roomUnit, roomUnit.getRoom(), null);
|
WiredHandler.handle(WiredTriggerType.ENTER_ROOM, roomUnit, roomUnit.getRoom(), null);
|
||||||
roomUnit.getRoom().habboEntered(gameClient.getHabbo());
|
roomUnit.getRoom().habboEntered(gameClient.getHabbo());
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_invisible.updated.back"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_invisible.updated.back"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
roomUnit.setInvisible(true);
|
roomUnit.setInvisible(true);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_invisible.updated"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_invisible.updated"));
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UserRemoveMessageComposer(roomUnit).compose());
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UserRemoveMessageComposer(roomUnit).compose());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -7,6 +7,8 @@ import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
|||||||
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
|
import com.eu.habbo.habbohotel.rooms.RoomUserRotation;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.UserUpdateComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.UserUpdateComposer;
|
||||||
|
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class LayCommand extends Command {
|
public class LayCommand extends Command {
|
||||||
public LayCommand() {
|
public LayCommand() {
|
||||||
super(null, Emulator.getTexts().getValue("commands.keys.cmd_lay").split(";"));
|
super(null, Emulator.getTexts().getValue("commands.keys.cmd_lay").split(";"));
|
||||||
@ -27,12 +29,11 @@ public class LayCommand extends Command {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
if (IntStream.range(0, 3)
|
||||||
RoomTile t = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(tile, gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue(), i);
|
.mapToObj(i -> gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(tile, gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue(), i))
|
||||||
if (t == null || !t.isWalkable()) {
|
.anyMatch(t -> t == null || !t.isWalkable())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
gameClient.getHabbo().getRoomUnit().setStatus(RoomUnitStatus.LAY, 0.5 + "");
|
gameClient.getHabbo().getRoomUnit().setStatus(RoomUnitStatus.LAY, 0.5 + "");
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UserUpdateComposer(gameClient.getHabbo().getRoomUnit()).compose());
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UserUpdateComposer(gameClient.getHabbo().getRoomUnit()).compose());
|
||||||
|
@ -22,30 +22,34 @@ public class MimicCommand extends Command {
|
|||||||
Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
|
Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
|
||||||
|
|
||||||
if (habbo == null) {
|
if (habbo == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_mimic.not_found").replace("%user%", ""), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_mimic.not_found"), ""), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (habbo == gameClient.getHabbo()) {
|
if (habbo == gameClient.getHabbo()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_mimic.not_self"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_mimic.not_self"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
} else if (habbo.hasPermission(Permission.ACC_NOT_MIMICED) && !gameClient.getHabbo().hasPermission(Permission.ACC_NOT_MIMICED)) {
|
} else if (habbo.hasPermission(Permission.ACC_NOT_MIMICED) && !gameClient.getHabbo().hasPermission(Permission.ACC_NOT_MIMICED)) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_mimic.blocked").replace("%user%", params[1]).replace("%gender_name%", (habbo.getHabboInfo().getGender().equals(HabboGender.M) ? Emulator.getTexts().getValue("gender.him") : Emulator.getTexts().getValue("gender.her"))), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_mimic.blocked"), params[1]).replace("%gender_name%", getGenderName(habbo)), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
} else if (!habbo.hasPermission("acc_mimic_unredeemed") && FigureUtil.hasBlacklistedClothing(habbo.getHabboInfo().getLook(), gameClient.getHabbo().getForbiddenClothing())) {
|
} else if (!habbo.hasPermission("acc_mimic_unredeemed") && FigureUtil.hasBlacklistedClothing(habbo.getHabboInfo().getLook(), gameClient.getHabbo().getForbiddenClothing())) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_mimic.forbidden_clothing"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_mimic.forbidden_clothing"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().getHabboInfo().setLook(ClothingValidationManager.VALIDATE_ON_MIMIC ? ClothingValidationManager.validateLook(gameClient.getHabbo(), habbo.getHabboInfo().getLook(), habbo.getHabboInfo().getGender().name()) : habbo.getHabboInfo().getLook());
|
gameClient.getHabbo().getHabboInfo().setLook(ClothingValidationManager.VALIDATE_ON_MIMIC ? ClothingValidationManager.validateLook(gameClient.getHabbo(), habbo.getHabboInfo().getLook(), habbo.getHabboInfo().getGender().name()) : habbo.getHabboInfo().getLook());
|
||||||
gameClient.getHabbo().getHabboInfo().setGender(habbo.getHabboInfo().getGender());
|
gameClient.getHabbo().getHabboInfo().setGender(habbo.getHabboInfo().getGender());
|
||||||
gameClient.sendResponse(new UserObjectComposer(gameClient.getHabbo()));
|
gameClient.sendResponse(new UserObjectComposer(gameClient.getHabbo()));
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UserChangeMessageComposer(gameClient.getHabbo()).compose());
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new UserChangeMessageComposer(gameClient.getHabbo()).compose());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mimic.copied").replace("%user%", params[1]).replace("%gender_name%", (habbo.getHabboInfo().getGender().equals(HabboGender.M) ? Emulator.getTexts().getValue("gender.him") : Emulator.getTexts().getValue("gender.her"))), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_mimic.copied"), params[1]).replace("%gender_name%", getGenderName(habbo)), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_mimic.not_found").replace("%user%", ""), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_mimic.not_found"), ""), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getGenderName(Habbo habbo) {
|
||||||
|
return habbo.getHabboInfo().getGender().equals(HabboGender.M) ? getTextsValue("gender.him") : getTextsValue("gender.her");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ public class MuteBotsCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
gameClient.getHabbo().getHabboStats().setIgnoreBots(!gameClient.getHabbo().getHabboStats().isIgnoreBots());
|
gameClient.getHabbo().getHabboStats().setIgnoreBots(!gameClient.getHabbo().getHabboStats().isIgnoreBots());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mute_bots." + (gameClient.getHabbo().getHabboStats().isIgnoreBots() ? "ignored" : "unignored")), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_mute_bots." + (gameClient.getHabbo().getHabboStats().isIgnoreBots() ? "ignored" : "unignored")), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,18 +14,18 @@ public class MuteCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length == 1) {
|
if (params.length == 1) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_mute.not_specified"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_mute.not_specified"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
||||||
|
|
||||||
if (habbo == null) {
|
if (habbo == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_mute.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_mute.not_found"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (habbo == gameClient.getHabbo()) {
|
if (habbo == gameClient.getHabbo()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_mute.self"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_mute.self"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ public class MuteCommand extends Command {
|
|||||||
if (duration <= 0)
|
if (duration <= 0)
|
||||||
throw new Exception("");
|
throw new Exception("");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_mute.time"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_mute.time"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ public class MuteCommand extends Command {
|
|||||||
habbo.getHabboInfo().getCurrentRoom().sendComposer(new IgnoreResultMessageComposer(habbo, IgnoreResultMessageComposer.MUTED).compose()); //: RoomUserIgnoredComposer.UNIGNORED
|
habbo.getHabboInfo().getCurrentRoom().sendComposer(new IgnoreResultMessageComposer(habbo, IgnoreResultMessageComposer.MUTED).compose()); //: RoomUserIgnoredComposer.UNIGNORED
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mute.muted").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_mute.muted"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -12,7 +12,7 @@ public class MutePetsCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
gameClient.getHabbo().getHabboStats().setIgnorePets(!gameClient.getHabbo().getHabboStats().isIgnorePets());
|
gameClient.getHabbo().getHabboStats().setIgnorePets(!gameClient.getHabbo().getHabboStats().isIgnorePets());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_mute_pets." + (gameClient.getHabbo().getHabboStats().isIgnorePets() ? "ignored" : "unignored")), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_mute_pets." + (gameClient.getHabbo().getHabboStats().isIgnorePets() ? "ignored" : "unignored")), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,7 +12,10 @@ public class PetInfoCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length > 1) {
|
if (params.length <= 1) {
|
||||||
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_pet_info.pet_not_found"), RoomChatMessageBubbles.ALERT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == null)
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -21,28 +24,25 @@ public class PetInfoCommand extends Command {
|
|||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().forEachEntry((a, pet) -> {
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().getCurrentPets().forEachEntry((a, pet) -> {
|
||||||
if (pet.getName().equalsIgnoreCase(name)) {
|
if (pet.getName().equalsIgnoreCase(name)) {
|
||||||
gameClient.getHabbo().alert("" +
|
gameClient.getHabbo().alert("" +
|
||||||
Emulator.getTexts().getValue("commands.generic.cmd_pet_info.title") + ": " + pet.getName() + "\r\n" +
|
getTextsValue("commands.generic.cmd_pet_info.title") + ": " + pet.getName() + "\r\n" +
|
||||||
Emulator.getTexts().getValue("generic.pet.id") + ": " + pet.getId() + "\r" +
|
getTextsValue("generic.pet.id") + ": " + pet.getId() + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.name") + ": " + pet.getName() + "\r" +
|
getTextsValue("generic.pet.name") + ": " + pet.getName() + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.age") + ": " + pet.daysAlive() + " " + Emulator.getTexts().getValue("generic.pet.days.alive") + "\r" +
|
getTextsValue("generic.pet.age") + ": " + pet.daysAlive() + " " + getTextsValue("generic.pet.days.alive") + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.level") + ": " + pet.getLevel() + "\r" +
|
getTextsValue("generic.pet.level") + ": " + pet.getLevel() + "\r" +
|
||||||
"\r" +
|
"\r" +
|
||||||
Emulator.getTexts().getValue("commands.generic.cmd_pet_info.stats") + "\r\n" +
|
getTextsValue("commands.generic.cmd_pet_info.stats") + "\r\n" +
|
||||||
Emulator.getTexts().getValue("generic.pet.scratches") + ": " + pet.getRespect() + "\r" +
|
getTextsValue("generic.pet.scratches") + ": " + pet.getRespect() + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.energy") + ": " + pet.getEnergy() + "/" + PetManager.maxEnergy(pet.getLevel()) + "\r" +
|
getTextsValue("generic.pet.energy") + ": " + pet.getEnergy() + "/" + PetManager.maxEnergy(pet.getLevel()) + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.happiness") + ": " + pet.getHappiness() + "\r" +
|
getTextsValue("generic.pet.happiness") + ": " + pet.getHappiness() + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.level.thirst") + ": " + pet.levelThirst + "\r" +
|
getTextsValue("generic.pet.level.thirst") + ": " + pet.levelThirst + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.level.hunger") + ": " + pet.levelHunger + "\r" +
|
getTextsValue("generic.pet.level.hunger") + ": " + pet.levelHunger + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.pet.current_action") + ": " + (pet.getTask() == null ? Emulator.getTexts().getValue("generic.nothing") : pet.getTask().name()) + "\r" +
|
getTextsValue("generic.pet.current_action") + ": " + (pet.getTask() == null ? getTextsValue("generic.nothing") : pet.getTask().name()) + "\r" +
|
||||||
Emulator.getTexts().getValue("generic.can.walk") + ": " + (pet.getRoomUnit().canWalk() ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + ""
|
getTextsValue("generic.can.walk") + ": " + (pet.getRoomUnit().canWalk() ? getTextsValue("generic.yes") : getTextsValue("generic.no")) + ""
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_pet_info.pet_not_found"), RoomChatMessageBubbles.ALERT);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,14 +13,16 @@ public class PickallCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
||||||
|
|
||||||
if (room != null) {
|
if (room == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (room.isOwner(gameClient.getHabbo())) {
|
if (room.isOwner(gameClient.getHabbo())) {
|
||||||
room.ejectAll();
|
room.ejectAll();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
room.ejectUserFurni(gameClient.getHabbo().getHabboInfo().getId());
|
room.ejectUserFurni(gameClient.getHabbo().getHabboInfo().getId());
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
package com.eu.habbo.habbohotel.commands;
|
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
|
||||||
|
|
||||||
public class PixelCommand extends Command {
|
|
||||||
public PixelCommand() {
|
|
||||||
super("cmd_duckets", Emulator.getTexts().getValue("commands.keys.cmd_duckets").split(";"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
|
||||||
if (params.length == 3) {
|
|
||||||
Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(params[1]);
|
|
||||||
|
|
||||||
if (habbo != null) {
|
|
||||||
try {
|
|
||||||
if (Integer.parseInt(params[2]) != 0) {
|
|
||||||
habbo.givePixels(Integer.parseInt(params[2]));
|
|
||||||
if (habbo.getHabboInfo().getCurrentRoom() != null)
|
|
||||||
habbo.whisper(Emulator.getTexts().getValue("commands.generic.cmd_duckets.received").replace("%amount%", Integer.parseInt(params[2]) + ""), RoomChatMessageBubbles.ALERT);
|
|
||||||
else
|
|
||||||
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_duckets.received").replace("%amount%", Integer.parseInt(params[2]) + ""));
|
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_duckets.send").replace("%amount%", Integer.parseInt(params[2]) + "").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_duckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
|
||||||
}
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_duckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_duckets.user_offline").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_duckets.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -20,17 +20,17 @@ public class PromoteTargetOfferCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length <= 1) {
|
if (params.length <= 1) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_promote_offer.not_found"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_promote_offer.not_found"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String offerKey = params[1];
|
String offerKey = params[1];
|
||||||
|
|
||||||
if (offerKey.equalsIgnoreCase(Emulator.getTexts().getValue("commands.cmd_promote_offer.info"))) {
|
if (offerKey.equalsIgnoreCase(getTextsValue("commands.cmd_promote_offer.info"))) {
|
||||||
THashMap<Integer, TargetOffer> targetOffers = Emulator.getGameEnvironment().getCatalogManager().targetOffers;
|
THashMap<Integer, TargetOffer> targetOffers = Emulator.getGameEnvironment().getCatalogManager().targetOffers;
|
||||||
String[] textConfig = Emulator.getTexts().getValue("commands.cmd_promote_offer.list").replace("%amount%", targetOffers.size() + "").split("<br>");
|
String[] textConfig = getTextsValue("commands.cmd_promote_offer.list").replace("%amount%", targetOffers.size() + "").split("<br>");
|
||||||
|
|
||||||
String entryConfig = Emulator.getTexts().getValue("commands.cmd_promote_offer.list.entry");
|
String entryConfig = getTextsValue("commands.cmd_promote_offer.list.entry");
|
||||||
List<String> message = new ArrayList<>();
|
List<String> message = new ArrayList<>();
|
||||||
|
|
||||||
for (String pair : textConfig) {
|
for (String pair : textConfig) {
|
||||||
@ -56,14 +56,13 @@ public class PromoteTargetOfferCommand extends Command {
|
|||||||
|
|
||||||
if (offer != null) {
|
if (offer != null) {
|
||||||
TargetOffer.ACTIVE_TARGET_OFFER_ID = offer.getId();
|
TargetOffer.ACTIVE_TARGET_OFFER_ID = offer.getId();
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_promote_offer").replace("%id%", offerKey).replace("%title%", offer.getTitle()));
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_promote_offer").replace("%id%", offerKey).replace("%title%", offer.getTitle()));
|
||||||
|
|
||||||
for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) {
|
Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()
|
||||||
habbo.getClient().sendResponse(new TargetedOfferComposer(habbo, offer));
|
.forEach(habbo -> habbo.getClient().sendResponse(new TargetedOfferComposer(habbo, offer)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_promote_offer.not_found"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_promote_offer.not_found"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,29 +20,29 @@ public class PullCommand extends Command {
|
|||||||
Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
|
Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
|
||||||
|
|
||||||
if (habbo == null) {
|
if (habbo == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_pull.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_pull.not_found"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (habbo == gameClient.getHabbo()) {
|
if (habbo == gameClient.getHabbo()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_pull.pull_self"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_pull.pull_self"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
int distanceX = habbo.getRoomUnit().getX() - gameClient.getHabbo().getRoomUnit().getX();
|
int distanceX = habbo.getRoomUnit().getX() - gameClient.getHabbo().getRoomUnit().getX();
|
||||||
int distanceY = habbo.getRoomUnit().getY() - gameClient.getHabbo().getRoomUnit().getY();
|
int distanceY = habbo.getRoomUnit().getY() - gameClient.getHabbo().getRoomUnit().getY();
|
||||||
|
|
||||||
if (distanceX < -2 || distanceX > 2 || distanceY < -2 || distanceY > 2) {
|
if (distanceX < -2 || distanceX > 2 || distanceY < -2 || distanceY > 2) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_pull.cant_reach").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_pull.cant_reach"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
RoomTile tile = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(gameClient.getHabbo().getRoomUnit().getCurrentLocation(), gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue());
|
RoomTile tile = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(gameClient.getHabbo().getRoomUnit().getCurrentLocation(), gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue());
|
||||||
|
|
||||||
if (tile != null && tile.isWalkable()) {
|
if (tile != null && tile.isWalkable()) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getDoorTile() == tile) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getDoorTile() == tile) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_pull.invalid").replace("%username%", params[1]));
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_pull.invalid"), params[1]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
habbo.getRoomUnit().setGoalLocation(tile);
|
habbo.getRoomUnit().setGoalLocation(tile);
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new ChatMessageComposer(new RoomChatMessage(Emulator.getTexts().getValue("commands.succes.cmd_pull.pull").replace("%user%", params[1]).replace("%gender_name%", (gameClient.getHabbo().getHabboInfo().getGender().equals(HabboGender.M) ? Emulator.getTexts().getValue("gender.him") : Emulator.getTexts().getValue("gender.her"))), gameClient.getHabbo(), gameClient.getHabbo(), RoomChatMessageBubbles.NORMAL)).compose());
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new ChatMessageComposer(new RoomChatMessage(replaceUser(getTextsValue("commands.succes.cmd_pull.pull"), params[1]).replace("%gender_name%", (gameClient.getHabbo().getHabboInfo().getGender().equals(HabboGender.M) ? getTextsValue("gender.him") : getTextsValue("gender.her"))), gameClient.getHabbo(), gameClient.getHabbo(), RoomChatMessageBubbles.NORMAL)).compose());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@ public class PushCommand extends Command {
|
|||||||
Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
|
Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
|
||||||
|
|
||||||
if (habbo == null) {
|
if (habbo == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_push.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_push.not_found"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (habbo == gameClient.getHabbo()) {
|
if (habbo == gameClient.getHabbo()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_push.push_self"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_push.push_self"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
RoomTile tFront = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(gameClient.getHabbo().getRoomUnit().getCurrentLocation(), gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue());
|
RoomTile tFront = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(gameClient.getHabbo().getRoomUnit().getCurrentLocation(), gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue());
|
||||||
@ -37,14 +37,19 @@ public class PushCommand extends Command {
|
|||||||
|
|
||||||
if (tFrontTarget != null && tFrontTarget.isWalkable()) {
|
if (tFrontTarget != null && tFrontTarget.isWalkable()) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getDoorTile() == tFrontTarget) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getDoorTile() == tFrontTarget) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_push.invalid").replace("%username%", params[1]));
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_push.invalid"), params[1]));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
habbo.getRoomUnit().setGoalLocation(tFrontTarget);
|
habbo.getRoomUnit().setGoalLocation(tFrontTarget);
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new ChatMessageComposer(new RoomChatMessage(Emulator.getTexts().getValue("commands.succes.cmd_push.push").replace("%user%", params[1]).replace("%gender_name%", (gameClient.getHabbo().getHabboInfo().getGender().equals(HabboGender.M) ? Emulator.getTexts().getValue("gender.him") : Emulator.getTexts().getValue("gender.her"))), gameClient.getHabbo(), gameClient.getHabbo(), RoomChatMessageBubbles.NORMAL)).compose());
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(
|
||||||
|
new ChatMessageComposer(
|
||||||
|
new RoomChatMessage(
|
||||||
|
replaceUser(getTextsValue("commands.succes.cmd_push.push"), params[1])
|
||||||
|
.replace("%gender_name%", (gameClient.getHabbo().getHabboInfo().getGender().equals(HabboGender.M) ? getTextsValue("gender.him") : getTextsValue("gender.her"))), gameClient.getHabbo(), gameClient.getHabbo(), RoomChatMessageBubbles.NORMAL)).compose()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_push.cant_reach").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_push.cant_reach"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,7 @@ public class RedeemCommand extends Command {
|
|||||||
TIntIntMap points = new TIntIntHashMap();
|
TIntIntMap points = new TIntIntHashMap();
|
||||||
|
|
||||||
for (HabboItem item : gameClient.getHabbo().getInventory().getItemsComponent().getItemsAsValueCollection()) {
|
for (HabboItem item : gameClient.getHabbo().getInventory().getItemsComponent().getItemsAsValueCollection()) {
|
||||||
if (item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_") || item.getBaseItem().getName().startsWith("DF_") || item.getBaseItem().getName().startsWith("PF_")) {
|
if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_") || item.getBaseItem().getName().startsWith("DF_") || item.getBaseItem().getName().startsWith("PF_")) && item.getUserId() == gameClient.getHabbo().getHabboInfo().getId()) {
|
||||||
if (item.getUserId() == gameClient.getHabbo().getHabboInfo().getId()) {
|
|
||||||
items.add(item);
|
items.add(item);
|
||||||
if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_")) && !item.getBaseItem().getName().contains("_diamond_")) {
|
if ((item.getBaseItem().getName().startsWith("CF_") || item.getBaseItem().getName().startsWith("CFC_")) && !item.getBaseItem().getName().contains("_diamond_")) {
|
||||||
try {
|
try {
|
||||||
@ -51,8 +50,7 @@ public class RedeemCommand extends Command {
|
|||||||
pointsAmount = Integer.parseInt(item.getBaseItem().getName().split("_")[2]);
|
pointsAmount = Integer.parseInt(item.getBaseItem().getName().split("_")[2]);
|
||||||
|
|
||||||
points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount);
|
points.adjustOrPutValue(pointsType, pointsAmount, pointsAmount);
|
||||||
}
|
} else if (item.getBaseItem().getName().startsWith("CF_diamond_")) {
|
||||||
else if (item.getBaseItem().getName().startsWith("CF_diamond_")) {
|
|
||||||
int pointsType;
|
int pointsType;
|
||||||
int pointsAmount;
|
int pointsAmount;
|
||||||
|
|
||||||
@ -63,13 +61,12 @@ public class RedeemCommand extends Command {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TIntObjectHashMap<HabboItem> deleted = new TIntObjectHashMap<>();
|
TIntObjectHashMap<HabboItem> deleted = new TIntObjectHashMap<>();
|
||||||
for (HabboItem item : items) {
|
items.forEach(item -> {
|
||||||
gameClient.getHabbo().getInventory().getItemsComponent().removeHabboItem(item);
|
gameClient.getHabbo().getInventory().getItemsComponent().removeHabboItem(item);
|
||||||
deleted.put(item.getId(), item);
|
deleted.put(item.getId(), item);
|
||||||
}
|
});
|
||||||
|
|
||||||
Emulator.getThreading().run(new QueryDeleteHabboItems(deleted));
|
Emulator.getThreading().run(new QueryDeleteHabboItems(deleted));
|
||||||
|
|
||||||
@ -77,20 +74,20 @@ public class RedeemCommand extends Command {
|
|||||||
gameClient.getHabbo().giveCredits(credits);
|
gameClient.getHabbo().giveCredits(credits);
|
||||||
gameClient.getHabbo().givePixels(pixels);
|
gameClient.getHabbo().givePixels(pixels);
|
||||||
|
|
||||||
final String[] message = {Emulator.getTexts().getValue("generic.redeemed")};
|
final String[] message = {getTextsValue("generic.redeemed")};
|
||||||
|
|
||||||
message[0] += Emulator.getTexts().getValue("generic.credits");
|
message[0] += getTextsValue("generic.credits");
|
||||||
message[0] += ": " + credits;
|
message[0] += ": " + credits;
|
||||||
|
|
||||||
if (pixels > 0) {
|
if (pixels > 0) {
|
||||||
message[0] += ", " + Emulator.getTexts().getValue("generic.pixels");
|
message[0] += ", " + getTextsValue("generic.pixels");
|
||||||
message[0] += ": " + pixels + "";
|
message[0] += ": " + pixels;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!points.isEmpty()) {
|
if (!points.isEmpty()) {
|
||||||
points.forEachEntry((a, b) -> {
|
points.forEachEntry((a, b) -> {
|
||||||
gameClient.getHabbo().givePoints(a, b);
|
gameClient.getHabbo().givePoints(a, b);
|
||||||
message[0] += " ," + Emulator.getTexts().getValue("seasonal.name." + a) + ": " + b;
|
message[0] += " ," + getTextsValue("seasonal.name." + a) + ": " + b;
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,7 @@ public class ReloadRoomCommand extends Command {
|
|||||||
Emulator.getGameEnvironment().getRoomManager().unloadRoom(room);
|
Emulator.getGameEnvironment().getRoomManager().unloadRoom(room);
|
||||||
room = Emulator.getGameEnvironment().getRoomManager().loadRoom(room.getId());
|
room = Emulator.getGameEnvironment().getRoomManager().loadRoom(room.getId());
|
||||||
ServerMessage message = new RoomForwardMessageComposer(room.getId()).compose();
|
ServerMessage message = new RoomForwardMessageComposer(room.getId()).compose();
|
||||||
for (Habbo habbo : habbos) {
|
habbos.forEach(habbo -> habbo.getClient().sendResponse(message));
|
||||||
habbo.getClient().sendResponse(message);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
|
@ -6,6 +6,9 @@ import com.eu.habbo.habbohotel.rooms.Room;
|
|||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.messages.outgoing.modtool.IssueCloseNotificationMessageComposer;
|
import com.eu.habbo.messages.outgoing.modtool.IssueCloseNotificationMessageComposer;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class RoomAlertCommand extends Command {
|
public class RoomAlertCommand extends Command {
|
||||||
public RoomAlertCommand() {
|
public RoomAlertCommand() {
|
||||||
super("cmd_roomalert", Emulator.getTexts().getValue("commands.keys.cmd_roomalert").split(";"));
|
super("cmd_roomalert", Emulator.getTexts().getValue("commands.keys.cmd_roomalert").split(";"));
|
||||||
@ -13,25 +16,23 @@ public class RoomAlertCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
StringBuilder message = new StringBuilder();
|
String message;
|
||||||
|
|
||||||
if (params.length >= 2) {
|
if (params.length < 2) {
|
||||||
for (int i = 1; i < params.length; i++) {
|
return false;
|
||||||
message.append(params[i]).append(" ");
|
|
||||||
}
|
}
|
||||||
|
message = IntStream.range(1, params.length).mapToObj(i -> params[i] + " ").collect(Collectors.joining());
|
||||||
|
|
||||||
if (message.length() == 0) {
|
if (message.length() == 0) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomalert.empty"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_roomalert.empty"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
||||||
|
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
room.sendComposer(new IssueCloseNotificationMessageComposer(message.toString()).compose());
|
room.sendComposer(new IssueCloseNotificationMessageComposer(message).compose());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -26,12 +26,12 @@ public class RoomBundleCommand extends Command {
|
|||||||
int pointsType;
|
int pointsType;
|
||||||
|
|
||||||
if (params.length < 5) {
|
if (params.length < 5) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_bundle.missing_params"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_bundle.missing_params"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Emulator.getGameEnvironment().getCatalogManager().getCatalogPage("room_bundle_" + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId()) != null) {
|
if (Emulator.getGameEnvironment().getCatalogManager().getCatalogPage("room_bundle_" + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId()) != null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_bundle.duplicate"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_bundle.duplicate"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,9 +42,9 @@ public class RoomBundleCommand extends Command {
|
|||||||
|
|
||||||
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().createCatalogPage("Room Bundle: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getName(), "room_bundle_" + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), 0, CatalogPageLayouts.room_bundle, gameClient.getHabbo().getHabboInfo().getRank().getId(), parentId);
|
CatalogPage page = Emulator.getGameEnvironment().getCatalogManager().createCatalogPage("Room Bundle: " + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getName(), "room_bundle_" + gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), 0, CatalogPageLayouts.room_bundle, gameClient.getHabbo().getHabboInfo().getRank().getId(), parentId);
|
||||||
|
|
||||||
if (page instanceof RoomBundleLayout) {
|
if (page instanceof RoomBundleLayout roomBundleLayout) {
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO catalog_items (page_id, item_ids, catalog_name, cost_credits, cost_points, points_type ) VALUES (?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO catalog_items (page_id, item_ids, catalog_name, cost_credits, cost_points, points_type ) VALUES (?, ?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS)) {
|
||||||
statement.setInt(1, page.getId());
|
statement.setInt(1, roomBundleLayout.getId());
|
||||||
statement.setString(2, "");
|
statement.setString(2, "");
|
||||||
statement.setString(3, "room_bundle");
|
statement.setString(3, "room_bundle");
|
||||||
statement.setInt(4, credits);
|
statement.setInt(4, credits);
|
||||||
@ -67,9 +67,9 @@ public class RoomBundleCommand extends Command {
|
|||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Caught SQL exception", e);
|
log.error("Caught SQL exception", e);
|
||||||
}
|
}
|
||||||
((RoomBundleLayout) page).loadItems(gameClient.getHabbo().getHabboInfo().getCurrentRoom());
|
roomBundleLayout.loadItems(gameClient.getHabbo().getHabboInfo().getCurrentRoom());
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_bundle").replace("%id%", page.getId() + ""), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_bundle").replace("%id%", roomBundleLayout.getId() + ""), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -20,21 +20,21 @@ public class RoomDanceCommand extends Command {
|
|||||||
try {
|
try {
|
||||||
danceId = Integer.parseInt(params[1]);
|
danceId = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_danceall.invalid_dance"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_danceall.invalid_dance"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (danceId < 0 || danceId > 4) {
|
if (danceId < 0 || danceId > 4) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_danceall.outside_bounds"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_danceall.outside_bounds"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos()) {
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos().forEach(habbo -> {
|
||||||
habbo.getRoomUnit().setDanceType(DanceType.values()[danceId]);
|
habbo.getRoomUnit().setDanceType(DanceType.values()[danceId]);
|
||||||
habbo.getHabboInfo().getCurrentRoom().sendComposer(new DanceMessageComposer(habbo.getRoomUnit()).compose());
|
habbo.getHabboInfo().getCurrentRoom().sendComposer(new DanceMessageComposer(habbo.getRoomUnit()).compose());
|
||||||
}
|
});
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_danceall.no_dance"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_danceall.no_dance"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -14,7 +14,7 @@ public class RoomEffectCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length < 2) {
|
if (params.length < 2) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomeffect.no_effect"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_roomeffect.no_effect"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,16 +23,14 @@ public class RoomEffectCommand extends Command {
|
|||||||
|
|
||||||
if (effectId >= 0) {
|
if (effectId >= 0) {
|
||||||
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
||||||
for (Habbo habbo : room.getHabbos()) {
|
room.getHabbos().forEach(habbo -> room.giveEffect(habbo, effectId, -1));
|
||||||
room.giveEffect(habbo, effectId, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomeffect.positive"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_roomeffect.positive"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomeffect.numbers_only"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_roomeffect.numbers_only"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,11 +20,11 @@ public class RoomItemCommand extends Command {
|
|||||||
itemId = Integer.parseInt(params[1]);
|
itemId = Integer.parseInt(params[1]);
|
||||||
|
|
||||||
if (itemId < 0) {
|
if (itemId < 0) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomitem.positive"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_roomitem.positive"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roomitem.no_item"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_roomitem.no_item"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -35,9 +35,9 @@ public class RoomItemCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (itemId > 0) {
|
if (itemId > 0) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_roomitem.given").replace("%item%", itemId + ""), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_roomitem.given").replace("%item%", itemId + ""), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_roomitem.removed"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_roomitem.removed"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,9 @@ import com.eu.habbo.habbohotel.rooms.Room;
|
|||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.HabboBroadcastMessageComposer;
|
import com.eu.habbo.messages.outgoing.generic.alerts.HabboBroadcastMessageComposer;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class RoomKickCommand extends Command {
|
public class RoomKickCommand extends Command {
|
||||||
public RoomKickCommand() {
|
public RoomKickCommand() {
|
||||||
super("cmd_kickall", Emulator.getTexts().getValue("commands.keys.cmd_kickall").split(";"));
|
super("cmd_kickall", Emulator.getTexts().getValue("commands.keys.cmd_kickall").split(";"));
|
||||||
@ -17,10 +20,7 @@ public class RoomKickCommand extends Command {
|
|||||||
final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
final Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
if (params.length > 1) {
|
if (params.length > 1) {
|
||||||
StringBuilder message = new StringBuilder();
|
String message = IntStream.range(1, params.length).mapToObj(i -> params[i] + " ").collect(Collectors.joining());
|
||||||
for (int i = 1; i < params.length; i++) {
|
|
||||||
message.append(params[i]).append(" ");
|
|
||||||
}
|
|
||||||
room.sendComposer(new HabboBroadcastMessageComposer(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername()).compose());
|
room.sendComposer(new HabboBroadcastMessageComposer(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername()).compose());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,9 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class SayAllCommand extends Command {
|
public class SayAllCommand extends Command {
|
||||||
public SayAllCommand() {
|
public SayAllCommand() {
|
||||||
super("cmd_say_all", Emulator.getTexts().getValue("commands.keys.cmd_say_all").split(";"));
|
super("cmd_say_all", Emulator.getTexts().getValue("commands.keys.cmd_say_all").split(";"));
|
||||||
@ -13,18 +16,13 @@ public class SayAllCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length < 2) {
|
if (params.length < 2) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_say_all.forgot_message"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_say_all.forgot_message"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder message = new StringBuilder();
|
String message = IntStream.range(1, params.length).mapToObj(i -> params[i] + " ").collect(Collectors.joining());
|
||||||
for (int i = 1; i < params.length; i++) {
|
|
||||||
message.append(params[i]).append(" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos()) {
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos().forEach(habbo -> habbo.talk(message));
|
||||||
habbo.talk(message.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,9 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
|||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.ChatMessageComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.ChatMessageComposer;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class SayCommand extends Command {
|
public class SayCommand extends Command {
|
||||||
public SayCommand() {
|
public SayCommand() {
|
||||||
super("cmd_say", Emulator.getTexts().getValue("commands.keys.cmd_say").split(";"));
|
super("cmd_say", Emulator.getTexts().getValue("commands.keys.cmd_say").split(";"));
|
||||||
@ -15,31 +18,29 @@ public class SayCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length < 2) {
|
if (params.length < 2) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_say.forgot_username"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_say.forgot_username"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
Habbo target = getHabbo(params[1]);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_say.user_not_found"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_say.user_not_found"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (target.getHabboInfo().getCurrentRoom() == null) {
|
if (target.getHabboInfo().getCurrentRoom() == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_say.hotel_view").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_say.hotel_view"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder message = new StringBuilder();
|
String message = "";
|
||||||
if (params.length > 2) {
|
if (params.length > 2) {
|
||||||
for (int i = 2; i < params.length; i++) {
|
message = IntStream.range(2, params.length).mapToObj(i -> params[i] + " ").collect(Collectors.joining());
|
||||||
message.append(params[i]).append(" ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target.getHabboInfo().getCurrentRoom().sendComposer(new ChatMessageComposer(new RoomChatMessage(message.toString(), target, RoomChatMessageBubbles.NORMAL)).compose());
|
target.getHabboInfo().getCurrentRoom().sendComposer(new ChatMessageComposer(new RoomChatMessage(message, target, RoomChatMessageBubbles.NORMAL)).compose());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_say").replace("%user%", params[1]).replace("%message%", message.toString()), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_say"), params[1]).replace("%message%", message), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,12 @@ public class SetMaxCommand extends Command {
|
|||||||
|
|
||||||
if (max > 0 && max < 9999) {
|
if (max > 0 && max < 9999) {
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().setUsersMax(max);
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().setUsersMax(max);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.success.cmd_setmax").replace("%value%", max + ""), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.success.cmd_setmax").replace("%value%", max + ""), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setmax.invalid_number"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_setmax.invalid_number"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setmax.forgot_number"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_setmax.forgot_number"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -11,29 +11,28 @@ public class SetPollCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length >= 2) {
|
if (params.length < 2) {
|
||||||
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_set_poll.missing_arg"), RoomChatMessageBubbles.ALERT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
||||||
int pollId = -1;
|
int pollId = -1;
|
||||||
try {
|
try {
|
||||||
pollId = Integer.parseInt(params[1]);
|
pollId = Integer.parseInt(params[1]);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pollId >= 0) {
|
if (pollId >= 0) {
|
||||||
if (Emulator.getGameEnvironment().getPollManager().getPoll(pollId) != null) {
|
if (Emulator.getGameEnvironment().getPollManager().getPoll(pollId) != null) {
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().setPollId(pollId);
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().setPollId(pollId);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_set_poll"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_set_poll"), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_set_poll.not_found"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_set_poll.not_found"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_set_poll.invalid_number"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_set_poll.invalid_number"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_set_poll.missing_arg"), RoomChatMessageBubbles.ALERT);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,7 @@ public class SetSpeedCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() != null && gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo())) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasRights(gameClient.getHabbo())) {
|
|
||||||
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
Room room = gameClient.getHabbo().getHabboInfo().getCurrentRoom();
|
||||||
|
|
||||||
int oldSpeed = room.getRollerSpeed();
|
int oldSpeed = room.getRollerSpeed();
|
||||||
@ -22,21 +21,20 @@ public class SetSpeedCommand extends Command {
|
|||||||
try {
|
try {
|
||||||
newSpeed = Integer.parseInt(params[1]);
|
newSpeed = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setspeed.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_setspeed.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newSpeed < -1 || newSpeed > Emulator.getConfig().getInt("hotel.rollers.speed.maximum")) {
|
if (newSpeed < -1 || newSpeed > Emulator.getConfig().getInt("hotel.rollers.speed.maximum")) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setspeed.bounds"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_setspeed.bounds"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
room.setRollerSpeed(newSpeed);
|
room.setRollerSpeed(newSpeed);
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_setspeed").replace("%oldspeed%", oldSpeed + "").replace("%newspeed%", newSpeed + ""), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_setspeed").replace("%oldspeed%", oldSpeed + "").replace("%newspeed%", newSpeed + ""), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,9 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
|
|||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class ShoutAllCommand extends Command {
|
public class ShoutAllCommand extends Command {
|
||||||
public ShoutAllCommand() {
|
public ShoutAllCommand() {
|
||||||
super("cmd_shout_all", Emulator.getTexts().getValue("commands.keys.cmd_shout_all").split(";"));
|
super("cmd_shout_all", Emulator.getTexts().getValue("commands.keys.cmd_shout_all").split(";"));
|
||||||
@ -13,17 +16,14 @@ public class ShoutAllCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length < 2) {
|
if (params.length < 2) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_shout_all.forgot_message"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_shout_all.forgot_message"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder message = new StringBuilder();
|
String message = IntStream.range(1, params.length).mapToObj(i -> params[i] + " ").collect(Collectors.joining());
|
||||||
for (int i = 1; i < params.length; i++) {
|
|
||||||
message.append(params[i]).append(" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos()) {
|
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos()) {
|
||||||
habbo.shout(message.toString());
|
habbo.shout(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -7,6 +7,9 @@ import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
|||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.messages.outgoing.rooms.users.ShoutMessageComposer;
|
import com.eu.habbo.messages.outgoing.rooms.users.ShoutMessageComposer;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class ShoutCommand extends Command {
|
public class ShoutCommand extends Command {
|
||||||
|
|
||||||
public ShoutCommand() {
|
public ShoutCommand() {
|
||||||
@ -16,31 +19,29 @@ public class ShoutCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length < 2) {
|
if (params.length < 2) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_shout.forgot_username"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_shout.forgot_username"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
Habbo target = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_shout.user_not_found"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_shout.user_not_found"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (target.getHabboInfo().getCurrentRoom() == null) {
|
if (target.getHabboInfo().getCurrentRoom() == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_shout.hotel_view").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_shout.hotel_view"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder message = new StringBuilder();
|
String message = "";
|
||||||
if (params.length > 2) {
|
if (params.length > 2) {
|
||||||
for (int i = 2; i < params.length; i++) {
|
message = IntStream.range(2, params.length).mapToObj(i -> params[i] + " ").collect(Collectors.joining());
|
||||||
message.append(params[i]).append(" ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
target.getHabboInfo().getCurrentRoom().sendComposer(new ShoutMessageComposer(new RoomChatMessage(message.toString(), target, RoomChatMessageBubbles.NORMAL)).compose());
|
target.getHabboInfo().getCurrentRoom().sendComposer(new ShoutMessageComposer(new RoomChatMessage(message, target, RoomChatMessageBubbles.NORMAL)).compose());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_shout").replace("%user%", params[1]).replace("%message%", message.toString()), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_shout"), params[1]).replace("%message%", message), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,9 @@ public class ShutdownCommand extends Command {
|
|||||||
|
|
||||||
ServerMessage message;
|
ServerMessage message;
|
||||||
if (!reason.toString().equals("-")) {
|
if (!reason.toString().equals("-")) {
|
||||||
message = new HabboBroadcastMessageComposer("<b>" + Emulator.getTexts().getValue("generic.warning") + "</b> \r\n" +
|
message = new HabboBroadcastMessageComposer("<b>" + getTextsValue("generic.warning") + "</b> \r\n" +
|
||||||
Emulator.getTexts().getValue("generic.shutdown").replace("%minutes%", minutes + "") + "\r\n" +
|
getTextsValue("generic.shutdown").replace("%minutes%", minutes + "") + "\r\n" +
|
||||||
Emulator.getTexts().getValue("generic.reason.specified") + ": <b>" + reason + "</b>\r" +
|
getTextsValue("generic.reason.specified") + ": <b>" + reason + "</b>\r" +
|
||||||
"\r" +
|
"\r" +
|
||||||
"- " + gameClient.getHabbo().getHabboInfo().getUsername()).compose();
|
"- " + gameClient.getHabbo().getHabboInfo().getUsername()).compose();
|
||||||
} else {
|
} else {
|
||||||
|
@ -12,15 +12,14 @@ public class SitDownCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos()) {
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos().forEach(habbo -> {
|
||||||
if (habbo.getRoomUnit().isWalking()) {
|
if (habbo.getRoomUnit().isWalking()) {
|
||||||
habbo.getRoomUnit().stopWalking();
|
habbo.getRoomUnit().stopWalking();
|
||||||
} else if (habbo.getRoomUnit().hasStatus(RoomUnitStatus.SIT)) {
|
} else if (habbo.getRoomUnit().hasStatus(RoomUnitStatus.SIT)) {
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().makeSit(habbo);
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().makeSit(habbo);
|
||||||
}
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,12 @@ public class SoftKickCommand extends Command {
|
|||||||
final Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
|
final Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
|
||||||
|
|
||||||
if (habbo == null) {
|
if (habbo == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.keys.cmd_softkick_error").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.keys.cmd_softkick_error"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (habbo == gameClient.getHabbo()) {
|
if (habbo == gameClient.getHabbo()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.keys.cmd_softkick_error_self"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.keys.cmd_softkick_error_self"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,9 @@ import com.eu.habbo.habbohotel.messenger.Message;
|
|||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.messages.outgoing.friends.NewConsoleMessageComposer;
|
import com.eu.habbo.messages.outgoing.friends.NewConsoleMessageComposer;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
public class StaffAlertCommand extends Command {
|
public class StaffAlertCommand extends Command {
|
||||||
public StaffAlertCommand() {
|
public StaffAlertCommand() {
|
||||||
super("cmd_staffalert", Emulator.getTexts().getValue("commands.keys.cmd_staffalert").split(";"));
|
super("cmd_staffalert", Emulator.getTexts().getValue("commands.keys.cmd_staffalert").split(";"));
|
||||||
@ -14,15 +17,12 @@ public class StaffAlertCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length > 1) {
|
if (params.length > 1) {
|
||||||
StringBuilder message = new StringBuilder();
|
String message = IntStream.range(1, params.length).mapToObj(i -> params[i] + " ").collect(Collectors.joining());
|
||||||
for (int i = 1; i < params.length; i++) {
|
|
||||||
message.append(params[i]).append(" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
Emulator.getGameEnvironment().getHabboManager().staffAlert(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername());
|
Emulator.getGameEnvironment().getHabboManager().staffAlert(message + "\r\n-" + gameClient.getHabbo().getHabboInfo().getUsername());
|
||||||
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new NewConsoleMessageComposer(new Message(gameClient.getHabbo().getHabboInfo().getId(), -1, message.toString())).compose(), "acc_staff_chat", gameClient);
|
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new NewConsoleMessageComposer(new Message(gameClient.getHabbo().getHabboInfo().getId(), -1, message)).compose(), "acc_staff_chat", gameClient);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_staffalert.forgot_message"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_staffalert.forgot_message"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -7,7 +7,9 @@ import com.eu.habbo.habbohotel.users.Habbo;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class StaffOnlineCommand extends Command {
|
public class StaffOnlineCommand extends Command {
|
||||||
public StaffOnlineCommand() {
|
public StaffOnlineCommand() {
|
||||||
@ -23,39 +25,29 @@ public class StaffOnlineCommand extends Command {
|
|||||||
int i = Integer.parseInt(params[1]);
|
int i = Integer.parseInt(params[1]);
|
||||||
|
|
||||||
if (i < 1) {
|
if (i < 1) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_staffonline.positive_only"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_staffonline.positive_only"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
minRank = i;
|
minRank = i;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_staffonline.numbers_only"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_staffonline.numbers_only"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos()) {
|
synchronized (Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos()) {
|
||||||
ArrayList<Habbo> staffs = new ArrayList<>();
|
int finalMinRank = minRank;
|
||||||
|
List<Habbo> staffs = Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values().stream()
|
||||||
|
.filter(habbo -> habbo.getHabboInfo().getRank().getId() >= finalMinRank)
|
||||||
|
.sorted(Comparator.comparingInt(o->o.getHabboInfo().getId()))
|
||||||
|
.toList();
|
||||||
|
|
||||||
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
String message = staffs.stream()
|
||||||
if (set.getValue().getHabboInfo().getRank().getId() >= minRank) {
|
.map(habbo -> habbo.getHabboInfo().getUsername() + ": " + habbo.getHabboInfo().getRank().getName() + "\r")
|
||||||
staffs.add(set.getValue());
|
.collect(Collectors.joining("", getTextsValue("commands.generic.cmd_staffonline.staffs") + "\r\n", ""));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
staffs.sort(Comparator.comparingInt(o -> o.getHabboInfo().getId()));
|
gameClient.getHabbo().alert(message);
|
||||||
|
|
||||||
StringBuilder message = new StringBuilder(Emulator.getTexts().getValue("commands.generic.cmd_staffonline.staffs"));
|
|
||||||
message.append("\r\n");
|
|
||||||
|
|
||||||
for (Habbo habbo : staffs) {
|
|
||||||
message.append(habbo.getHabboInfo().getUsername());
|
|
||||||
message.append(": ");
|
|
||||||
message.append(habbo.getHabboInfo().getRank().getName());
|
|
||||||
message.append("\r");
|
|
||||||
}
|
|
||||||
|
|
||||||
gameClient.getHabbo().alert(message.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -17,32 +17,31 @@ public class StalkCommand extends Command {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (params.length >= 2) {
|
if (params.length >= 2) {
|
||||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
Habbo habbo = getHabbo(params[1]);
|
||||||
|
|
||||||
if (habbo == null) {
|
if (habbo == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_stalk.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_stalk.not_found"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (habbo.getHabboInfo().getCurrentRoom() == null) {
|
if (habbo.getHabboInfo().getCurrentRoom() == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_stalk.not_room").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_stalk.not_room"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gameClient.getHabbo().getHabboInfo().getUsername().equals(habbo.getHabboInfo().getUsername())) {
|
if (gameClient.getHabbo().getHabboInfo().getUsername().equals(habbo.getHabboInfo().getUsername())) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.generic.cmd_stalk.self").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.generic.cmd_stalk.self"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == habbo.getHabboInfo().getCurrentRoom()) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == habbo.getHabboInfo().getCurrentRoom()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.generic.cmd_stalk.same_room").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.generic.cmd_stalk.same_room"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.sendResponse(new GetGuestRoomResultComposer(habbo.getHabboInfo().getCurrentRoom(), gameClient.getHabbo(), true, false));
|
gameClient.sendResponse(new GetGuestRoomResultComposer(habbo.getHabboInfo().getCurrentRoom(), gameClient.getHabbo(), true, false));
|
||||||
//gameClient.sendResponse(new ForwardToRoomComposer(habbo.getHabboInfo().getCurrentRoom().getId()));
|
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_stalk.forgot_username"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_stalk.forgot_username"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,9 @@ import com.eu.habbo.habbohotel.users.HabboManager;
|
|||||||
import com.eu.habbo.habbohotel.users.HabboStats;
|
import com.eu.habbo.habbohotel.users.HabboStats;
|
||||||
import com.eu.habbo.habbohotel.users.subscriptions.Subscription;
|
import com.eu.habbo.habbohotel.users.subscriptions.Subscription;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Beny
|
* @author Beny
|
||||||
*/
|
*/
|
||||||
@ -18,13 +21,13 @@ public class SubscriptionCommand extends Command {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows you to give/extend/remove subscription on a given user.
|
* Allows you to give/extend/remove subscription on a given user.
|
||||||
*
|
* <p>
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* [username] = Username of user to execute command on
|
* [username] = Username of user to execute command on
|
||||||
* [type] = Subscription type (e.g. HABBO_CLUB)
|
* [type] = Subscription type (e.g. HABBO_CLUB)
|
||||||
* [add|remove] = Use add or remove to increase/decrease sub duration
|
* [add|remove] = Use add or remove to increase/decrease sub duration
|
||||||
* [time] = Time string e.g. "1 week", "18 days", "4 minutes". Can be complex e.g. "1 month 5 days 2 minutes"
|
* [time] = Time string e.g. "1 week", "18 days", "4 minutes". Can be complex e.g. "1 month 5 days 2 minutes"
|
||||||
*
|
* <p>
|
||||||
* Examples:
|
* Examples:
|
||||||
* :sub Beny habbo_club add 1 month - adds 1 month of HABBO_CLUB subscription duration on the user Beny
|
* :sub Beny habbo_club add 1 month - adds 1 month of HABBO_CLUB subscription duration on the user Beny
|
||||||
* :sub Beny builders_club add 1 month - adds 1 month of BUILDERS_CLUB subscription duration on the user Beny
|
* :sub Beny builders_club add 1 month - adds 1 month of BUILDERS_CLUB subscription duration on the user Beny
|
||||||
@ -37,71 +40,67 @@ public class SubscriptionCommand extends Command {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length >= 4) {
|
if (params.length < 4) {
|
||||||
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_subscription.invalid_params", "Invalid command format"), RoomChatMessageBubbles.ALERT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
HabboInfo info = HabboManager.getOfflineHabboInfo(params[1]);
|
HabboInfo info = HabboManager.getOfflineHabboInfo(params[1]);
|
||||||
|
|
||||||
if (info != null) {
|
if (info == null) {
|
||||||
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_subscription.user_not_found", "%user% was not found"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
HabboStats stats = info.getHabboStats();
|
HabboStats stats = info.getHabboStats();
|
||||||
String subscription = params[2].toUpperCase();
|
String subscription = params[2].toUpperCase();
|
||||||
String action = params[3];
|
String action = params[3];
|
||||||
|
|
||||||
StringBuilder message = new StringBuilder();
|
String message = "";
|
||||||
if (params.length > 4) {
|
if (params.length > 4) {
|
||||||
for (int i = 4; i < params.length; i++) {
|
message = IntStream.range(4, params.length).mapToObj(i -> params[i] + " ").collect(Collectors.joining());
|
||||||
message.append(params[i]).append(" ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!Emulator.getGameEnvironment().getSubscriptionManager().getTypes().containsKey(subscription)) {
|
if (!Emulator.getGameEnvironment().getSubscriptionManager().getTypes().containsKey(subscription)) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_subscription.type_not_found", "%subscription% is not a valid subscription type").replace("%subscription%", subscription), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_subscription.type_not_found", "%subscription% is not a valid subscription type").replace("%subscription%", subscription), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(action.equalsIgnoreCase("add") || action.equalsIgnoreCase("+") || action.equalsIgnoreCase("a")) {
|
if (action.equalsIgnoreCase("add") || action.equalsIgnoreCase("+") || action.equalsIgnoreCase("a")) {
|
||||||
int timeToAdd = Emulator.timeStringToSeconds(message.toString());
|
int timeToAdd = Emulator.timeStringToSeconds(message);
|
||||||
|
|
||||||
if(timeToAdd < 1) {
|
if (timeToAdd < 1) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_subscription.invalid_params_time", "Invalid time span, try: x minutes/days/weeks/months"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_subscription.invalid_params_time", "Invalid time span, try: x minutes/days/weeks/months"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
stats.createSubscription(subscription, timeToAdd);
|
stats.createSubscription(subscription, timeToAdd);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_subscription.success_add_time", "Successfully added %time% seconds to %subscription% on %user%").replace("%time%", timeToAdd + "").replace("%user%", params[1]).replace("%subscription%", subscription), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_subscription.success_add_time", "Successfully added %time% seconds to %subscription% on %user%"), params[1]).replace("%time%", timeToAdd + "").replace("%subscription%", subscription), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
} else if (action.equalsIgnoreCase("remove") || action.equalsIgnoreCase("-") || action.equalsIgnoreCase("r")) {
|
||||||
else if(action.equalsIgnoreCase("remove") || action.equalsIgnoreCase("-") || action.equalsIgnoreCase("r")) {
|
|
||||||
Subscription s = stats.getSubscription(subscription);
|
Subscription s = stats.getSubscription(subscription);
|
||||||
|
|
||||||
if (s == null) {
|
if (s == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_subscription.user_not_have", "%user% does not have the %subscription% subscription").replace("%user%", params[1]).replace("%subscription%", subscription), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_subscription.user_not_have", "%user% does not have the %subscription% subscription"), params[1]).replace("%subscription%", subscription), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(message.length() != 0) {
|
if (message.length() != 0) {
|
||||||
int timeToRemove = Emulator.timeStringToSeconds(message.toString());
|
int timeToRemove = Emulator.timeStringToSeconds(message);
|
||||||
|
|
||||||
if (timeToRemove < 1) {
|
if (timeToRemove < 1) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_subscription.invalid_params_time", "Invalid time span, try: x minutes/days/weeks/months"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_subscription.invalid_params_time", "Invalid time span, try: x minutes/days/weeks/months"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
s.addDuration(-timeToRemove);
|
s.addDuration(-timeToRemove);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_subscription.success_remove_time", "Successfully removed %time% seconds from %subscription% on %user%").replace("%time%", timeToRemove + "").replace("%user%", params[1]).replace("%subscription%", subscription), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_subscription.success_remove_time", "Successfully removed %time% seconds from %subscription% on %user%"), params[1]).replace("%time%", timeToRemove + "").replace("%subscription%", subscription), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
s.addDuration(-s.getRemaining());
|
s.addDuration(-s.getRemaining());
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_subscription.success_remove_sub", "Successfully removed %subscription% sub from %user%").replace("%user%", params[1]).replace("%subscription%", subscription), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_subscription.success_remove_sub", "Successfully removed %subscription% sub from %user%"), params[1]).replace("%subscription%", subscription), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_subscription.invalid_action", "Invalid action specified. Must be add, +, remove or -"), RoomChatMessageBubbles.ALERT);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_subscription.invalid_action", "Invalid action specified. Must be add, +, remove or -"), RoomChatMessageBubbles.ALERT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_subscription.user_not_found", "%user% was not found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_subscription.invalid_params", "Invalid command format"), RoomChatMessageBubbles.ALERT);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,21 +17,25 @@ public class SummonCommand extends Command {
|
|||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == null)
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (params.length >= 2) {
|
if (params.length < 2) {
|
||||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_summon.forgot_username"), RoomChatMessageBubbles.ALERT);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Habbo habbo = getHabbo(params[1]);
|
||||||
|
|
||||||
if (habbo == null) {
|
if (habbo == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_summon.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_summon.not_found"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gameClient.getHabbo().getHabboInfo().getUsername().equals(habbo.getHabboInfo().getUsername())) {
|
if (gameClient.getHabbo().getHabboInfo().getUsername().equals(habbo.getHabboInfo().getUsername())) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.generic.cmd_summon.self").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.generic.cmd_summon.self"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == habbo.getHabboInfo().getCurrentRoom()) {
|
if (gameClient.getHabbo().getHabboInfo().getCurrentRoom() == habbo.getHabboInfo().getCurrentRoom()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.generic.cmd_summon.same_room").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.generic.cmd_summon.same_room"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,13 +52,10 @@ public class SummonCommand extends Command {
|
|||||||
|
|
||||||
habbo.getClient().sendResponse(new RoomForwardMessageComposer(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId()));
|
habbo.getClient().sendResponse(new RoomForwardMessageComposer(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId()));
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_summon.summoned").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_summon.summoned"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_summon.been_summoned").replace("%user%", gameClient.getHabbo().getHabboInfo().getUsername()));
|
habbo.alert(replaceUser(getTextsValue("commands.generic.cmd_summon.been_summoned"), gameClient.getHabbo().getHabboInfo().getUsername()));
|
||||||
|
|
||||||
} else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_summon.forgot_username"), RoomChatMessageBubbles.ALERT);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,30 +22,30 @@ public class SummonRankCommand extends Command {
|
|||||||
try {
|
try {
|
||||||
minRank = Integer.parseInt(params[1]);
|
minRank = Integer.parseInt(params[1]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.generic.cmd_summonrank.error"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.generic.cmd_summonrank.error"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
for (Habbo habbo : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().values()) {
|
||||||
if (set.getValue().getHabboInfo().getRank().getId() >= minRank) {
|
if (habbo.getHabboInfo().getRank().getId() >= minRank) {
|
||||||
if (set.getValue() == gameClient.getHabbo())
|
if (habbo == gameClient.getHabbo())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (set.getValue().getHabboInfo().getCurrentRoom() == gameClient.getHabbo().getHabboInfo().getCurrentRoom())
|
if (habbo.getHabboInfo().getCurrentRoom() == gameClient.getHabbo().getHabboInfo().getCurrentRoom())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Room room = set.getValue().getHabboInfo().getCurrentRoom();
|
Room room = habbo.getHabboInfo().getCurrentRoom();
|
||||||
if (room != null) {
|
if (room != null) {
|
||||||
Emulator.getGameEnvironment().getRoomManager().logExit(set.getValue());
|
Emulator.getGameEnvironment().getRoomManager().logExit(habbo);
|
||||||
|
|
||||||
room.removeHabbo(set.getValue(), true);
|
room.removeHabbo(habbo, true);
|
||||||
|
|
||||||
set.getValue().getHabboInfo().setCurrentRoom(null);
|
habbo.getHabboInfo().setCurrentRoom(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
Emulator.getGameEnvironment().getRoomManager().enterRoom(set.getValue(), gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), "", true);
|
Emulator.getGameEnvironment().getRoomManager().enterRoom(habbo, gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId(), "", true);
|
||||||
|
|
||||||
set.getValue().getClient().sendResponse(new RoomForwardMessageComposer(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId()));
|
habbo.getClient().sendResponse(new RoomForwardMessageComposer(gameClient.getHabbo().getHabboInfo().getCurrentRoom().getId()));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,30 +16,31 @@ public class SuperPullCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length == 2) {
|
if (params.length != 2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
|
Habbo habbo = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbo(params[1]);
|
||||||
|
|
||||||
if (habbo == null) {
|
if (habbo == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_pull.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_pull.not_found"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
} else if (habbo == gameClient.getHabbo()) {
|
} else if (habbo == gameClient.getHabbo()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_pull.pull_self"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_pull.pull_self"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
RoomTile tile = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(gameClient.getHabbo().getRoomUnit().getCurrentLocation(), gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue());
|
RoomTile tile = gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getTileInFront(gameClient.getHabbo().getRoomUnit().getCurrentLocation(), gameClient.getHabbo().getRoomUnit().getBodyRotation().getValue());
|
||||||
|
|
||||||
if (tile != null && tile.isWalkable()) {
|
if (tile != null && tile.isWalkable()) {
|
||||||
if (tile == gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getDoorTile()) {
|
if (tile == gameClient.getHabbo().getHabboInfo().getCurrentRoom().getLayout().getDoorTile()) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_pull.invalid").replace("%username%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_pull.invalid"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
habbo.getRoomUnit().setGoalLocation(tile);
|
habbo.getRoomUnit().setGoalLocation(tile);
|
||||||
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new ChatMessageComposer(new RoomChatMessage(Emulator.getTexts().getValue("commands.succes.cmd_pull.pull").replace("%user%", params[1]).replace("%gender_name%", (gameClient.getHabbo().getHabboInfo().getGender().equals(HabboGender.M) ? Emulator.getTexts().getValue("gender.him") : Emulator.getTexts().getValue("gender.her"))), gameClient.getHabbo(), gameClient.getHabbo(), RoomChatMessageBubbles.NORMAL)).compose());
|
gameClient.getHabbo().getHabboInfo().getCurrentRoom().sendComposer(new ChatMessageComposer(new RoomChatMessage(replaceUser(getTextsValue("commands.succes.cmd_pull.pull"), params[1]).replace("%gender_name%", (gameClient.getHabbo().getHabboInfo().getGender().equals(HabboGender.M) ? getTextsValue("gender.him") : getTextsValue("gender.her"))), gameClient.getHabbo(), gameClient.getHabbo(), RoomChatMessageBubbles.NORMAL)).compose());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,10 @@ public class TeleportCommand extends Command {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (gameClient.getHabbo().getHabboInfo().getRiding() == null) //TODO Make this an event plugin which fires that can be cancelled
|
if (gameClient.getHabbo().getHabboInfo().getRiding() != null){ //TODO Make this an event plugin which fires that can be cancelled
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (gameClient.getHabbo().getRoomUnit().isCmdTeleport()) {
|
if (gameClient.getHabbo().getRoomUnit().isCmdTeleport()) {
|
||||||
gameClient.getHabbo().getRoomUnit().setCmdTeleport(false);
|
gameClient.getHabbo().getRoomUnit().setCmdTeleport(false);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_teleport.disabled"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_teleport.disabled"), RoomChatMessageBubbles.ALERT);
|
||||||
@ -21,6 +24,5 @@ public class TeleportCommand extends Command {
|
|||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_teleport.enabled"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_teleport.enabled"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,11 +21,11 @@ public class TransformCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length == 1) {
|
if (params.length == 1) {
|
||||||
StringBuilder petNames = new StringBuilder();
|
StringBuilder petNames = new StringBuilder();
|
||||||
petNames.append(Emulator.getTexts().getValue("commands.generic.cmd_transform.title"));
|
petNames.append(getTextsValue("commands.generic.cmd_transform.title"));
|
||||||
petNames.append("\r------------------------------------------------------------------------------\r");
|
petNames.append("\r------------------------------------------------------------------------------\r");
|
||||||
ArrayList<PetData> petData = new ArrayList<>(Emulator.getGameEnvironment().getPetManager().getPetData());
|
ArrayList<PetData> petData = new ArrayList<>(Emulator.getGameEnvironment().getPetManager().getPetData());
|
||||||
Collections.sort(petData);
|
Collections.sort(petData);
|
||||||
String line = Emulator.getTexts().getValue("commands.generic.cmd_transform.line");
|
String line = getTextsValue("commands.generic.cmd_transform.line");
|
||||||
for (PetData p : petData) {
|
for (PetData p : petData) {
|
||||||
petNames.append(line.replace("%id%", p.getType() + "").replace("%name%", p.getName())).append("\r");
|
petNames.append(line.replace("%id%", p.getType() + "").replace("%name%", p.getName())).append("\r");
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,12 @@ public class UnbanCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length == 1) {
|
if (params.length == 1) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_unban.not_specified"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_unban.not_specified"), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
if (Emulator.getGameEnvironment().getModToolManager().unban(params[1])) {
|
if (Emulator.getGameEnvironment().getModToolManager().unban(params[1])) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_unban.success").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_unban.success"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_unban.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_unban.not_found"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,16 +13,17 @@ public class UnmuteCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length == 1) {
|
if (params.length == 1) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_unmute.not_specified"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_unmute.not_specified"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
||||||
|
|
||||||
if (habbo == null) {
|
if (habbo == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_unmute.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_unmute.not_found"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
|
|
||||||
if (!habbo.getHabboStats().allowTalk() || (habbo.getHabboInfo().getCurrentRoom() != null && habbo.getHabboInfo().getCurrentRoom().isMuted(habbo))) {
|
if (!habbo.getHabboStats().allowTalk() || (habbo.getHabboInfo().getCurrentRoom() != null && habbo.getHabboInfo().getCurrentRoom().isMuted(habbo))) {
|
||||||
if (!habbo.getHabboStats().allowTalk()) {
|
if (!habbo.getHabboStats().allowTalk()) {
|
||||||
habbo.unMute();
|
habbo.unMute();
|
||||||
@ -32,12 +33,11 @@ public class UnmuteCommand extends Command {
|
|||||||
habbo.getHabboInfo().getCurrentRoom().muteHabbo(habbo, 1);
|
habbo.getHabboInfo().getCurrentRoom().muteHabbo(habbo, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_unmute").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.succes.cmd_unmute"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_unmute.not_muted").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_unmute.not_muted"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ public class UpdateAchievements extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
Emulator.getGameEnvironment().getAchievementManager().reload();
|
Emulator.getGameEnvironment().getAchievementManager().reload();
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_achievements.updated"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_achievements.updated"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ public class UpdateCalendarCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
Emulator.getGameEnvironment().getCalendarManager().reload();
|
Emulator.getGameEnvironment().getCalendarManager().reload();
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.success.cmd_update_calendar"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.success.cmd_update_calendar"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ public class UpdateCatalogCommand extends Command {
|
|||||||
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new GiftWrappingConfigurationComposer());
|
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new GiftWrappingConfigurationComposer());
|
||||||
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new RecyclerPrizesComposer());
|
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new RecyclerPrizesComposer());
|
||||||
Emulator.getGameEnvironment().getCraftingManager().reload();
|
Emulator.getGameEnvironment().getCraftingManager().reload();
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_catalog"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_catalog"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public class UpdateConfigCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
Emulator.getConfig().reload();
|
Emulator.getConfig().reload();
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_config"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_config"), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public class UpdateHotelViewCommand extends Command {
|
|||||||
Emulator.getGameEnvironment().getHotelViewManager().getNewsList().reload();
|
Emulator.getGameEnvironment().getHotelViewManager().getNewsList().reload();
|
||||||
Emulator.getGameEnvironment().getHotelViewManager().getHallOfFame().reload();
|
Emulator.getGameEnvironment().getHotelViewManager().getHallOfFame().reload();
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_hotel_view"));
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_hotel_view"));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,12 @@ public class UpdateItemsCommand extends Command {
|
|||||||
Emulator.getGameEnvironment().getItemManager().loadSoundTracks();
|
Emulator.getGameEnvironment().getItemManager().loadSoundTracks();
|
||||||
|
|
||||||
synchronized (Emulator.getGameEnvironment().getRoomManager().getActiveRooms()) {
|
synchronized (Emulator.getGameEnvironment().getRoomManager().getActiveRooms()) {
|
||||||
for (Room room : Emulator.getGameEnvironment().getRoomManager().getActiveRooms()) {
|
Emulator.getGameEnvironment().getRoomManager().getActiveRooms().stream()
|
||||||
if (room.isLoaded() && room.getUserCount() > 0 && room.getLayout() != null) {
|
.filter(room -> room.isLoaded() && room.getUserCount() > 0 && room.getLayout() != null)
|
||||||
room.sendComposer(new HeightMapComposer(room).compose());
|
.forEach(room -> room.sendComposer(new HeightMapComposer(room).compose()));
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_items"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_items"), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ public class UpdateNavigatorCommand extends Command {
|
|||||||
Emulator.getGameEnvironment().getNavigatorManager().loadNavigator();
|
Emulator.getGameEnvironment().getNavigatorManager().loadNavigator();
|
||||||
Emulator.getGameEnvironment().getRoomManager().loadRoomModels();
|
Emulator.getGameEnvironment().getRoomManager().loadRoomModels();
|
||||||
Emulator.getGameEnvironment().getRoomManager().loadPublicRooms();
|
Emulator.getGameEnvironment().getRoomManager().loadPublicRooms();
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_navigator"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_navigator"), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public class UpdatePermissionsCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
Emulator.getGameEnvironment().getPermissionsManager().reload();
|
Emulator.getGameEnvironment().getPermissionsManager().reload();
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_permissions"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_permissions"), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public class UpdatePetDataCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
Emulator.getGameEnvironment().getPetManager().reloadPetData();
|
Emulator.getGameEnvironment().getPetManager().reloadPetData();
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_pet_data"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_pet_data"), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ public class UpdatePluginsCommand extends Command {
|
|||||||
Emulator.getPluginManager().reload();
|
Emulator.getPluginManager().reload();
|
||||||
|
|
||||||
gameClient.getHabbo().whisper("This is an unsafe command and could possibly lead to memory leaks.\rIt is recommended to restart the emulator in order to reload plugins.");
|
gameClient.getHabbo().whisper("This is an unsafe command and could possibly lead to memory leaks.\rIt is recommended to restart the emulator in order to reload plugins.");
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_plugins").replace("%count%", Emulator.getPluginManager().getPlugins().size() + ""), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_plugins").replace("%count%", Emulator.getPluginManager().getPlugins().size() + ""), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ public class UpdatePollsCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
Emulator.getGameEnvironment().getPollManager().loadPolls();
|
Emulator.getGameEnvironment().getPollManager().loadPolls();
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_polls"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_polls"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,9 +14,9 @@ public class UpdateTextsCommand extends Command {
|
|||||||
try {
|
try {
|
||||||
Emulator.getTexts().reload();
|
Emulator.getTexts().reload();
|
||||||
Emulator.getGameEnvironment().getCommandHandler().reloadCommands();
|
Emulator.getGameEnvironment().getCommandHandler().reloadCommands();
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_texts"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_texts"), RoomChatMessageBubbles.ALERT);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_update_texts.failed"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_update_texts.failed"), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -13,7 +13,7 @@ public class UpdateWordFilterCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
Emulator.getGameEnvironment().getWordFilter().reload();
|
Emulator.getGameEnvironment().getWordFilter().reload();
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_wordfilter"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_wordfilter"), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public class UpdateYoutubePlaylistsCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
Emulator.getGameEnvironment().getItemManager().getYoutubeManager().load();
|
Emulator.getGameEnvironment().getItemManager().getYoutubeManager().load();
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_update_youtube_playlists"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_update_youtube_playlists"), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public class UserInfoCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length < 2) {
|
if (params.length < 2) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_userinfo.forgot_username"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_userinfo.forgot_username"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,32 +33,32 @@ public class UserInfoCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (habbo == null) {
|
if (habbo == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_userinfo.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUser(getTextsValue("commands.error.cmd_userinfo.not_found"), params[1]), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder message = new StringBuilder(Emulator.getTexts().getValue("command.cmd_userinfo.userinfo") + ": " + " <b>" + habbo.getUsername() + "</b> (<b>" + habbo.getId() + "</b>)\r" +
|
StringBuilder message = new StringBuilder(getTextsValue("command.cmd_userinfo.userinfo") + ": " + " <b>" + habbo.getUsername() + "</b> (<b>" + habbo.getId() + "</b>)\r" +
|
||||||
Emulator.getTexts().getValue("command.cmd_userinfo.user_id") + ": " + habbo.getId() + "\r" +
|
getTextsValue("command.cmd_userinfo.user_id") + ": " + habbo.getId() + "\r" +
|
||||||
Emulator.getTexts().getValue("command.cmd_userinfo.user_name") + ": " + habbo.getUsername() + "\r" +
|
getTextsValue("command.cmd_userinfo.user_name") + ": " + habbo.getUsername() + "\r" +
|
||||||
Emulator.getTexts().getValue("command.cmd_userinfo.motto") + ": " + habbo.getMotto().replace("<", "[").replace(">", "]") + "\r" +
|
getTextsValue("command.cmd_userinfo.motto") + ": " + habbo.getMotto().replace("<", "[").replace(">", "]") + "\r" +
|
||||||
Emulator.getTexts().getValue("command.cmd_userinfo.rank") + ": " + habbo.getRank().getName() + " (" + habbo.getRank().getId() + ") \r" +
|
getTextsValue("command.cmd_userinfo.rank") + ": " + habbo.getRank().getName() + " (" + habbo.getRank().getId() + ") \r" +
|
||||||
Emulator.getTexts().getValue("command.cmd_userinfo.online") + ": " + (onlineHabbo == null ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" +
|
getTextsValue("command.cmd_userinfo.online") + ": " + (onlineHabbo == null ? getTextsValue("generic.no") : getTextsValue("generic.yes")) + "\r" +
|
||||||
((habbo.getRank().hasPermission(Permission.ACC_HIDE_MAIL, true)) ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.email") + ": " + habbo.getMail() + "\r") +
|
((habbo.getRank().hasPermission(Permission.ACC_HIDE_MAIL, true)) ? "" : getTextsValue("command.cmd_userinfo.email") + ": " + habbo.getMail() + "\r") +
|
||||||
((habbo.getRank().hasPermission(Permission.ACC_HIDE_IP, true)) ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_register") + ": " + habbo.getIpRegister() + "\r") +
|
((habbo.getRank().hasPermission(Permission.ACC_HIDE_IP, true)) ? "" : getTextsValue("command.cmd_userinfo.ip_register") + ": " + habbo.getIpRegister() + "\r") +
|
||||||
((habbo.getRank().hasPermission(Permission.ACC_HIDE_IP, true)) || onlineHabbo == null ? "" : Emulator.getTexts().getValue("command.cmd_userinfo.ip_current") + ": " + onlineHabbo.getHabboInfo().getIpLogin() + "\r") +
|
((habbo.getRank().hasPermission(Permission.ACC_HIDE_IP, true)) || onlineHabbo == null ? "" : getTextsValue("command.cmd_userinfo.ip_current") + ": " + onlineHabbo.getHabboInfo().getIpLogin() + "\r") +
|
||||||
(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.achievement_score") + ": " + onlineHabbo.getHabboStats().getAchievementScore() + "\r" : ""));
|
(onlineHabbo != null ? getTextsValue("command.cmd_userinfo.achievement_score") + ": " + onlineHabbo.getHabboStats().getAchievementScore() + "\r" : ""));
|
||||||
|
|
||||||
ModToolBan ban = Emulator.getGameEnvironment().getModToolManager().checkForBan(habbo.getId());
|
ModToolBan ban = Emulator.getGameEnvironment().getModToolManager().checkForBan(habbo.getId());
|
||||||
|
|
||||||
message.append(Emulator.getTexts().getValue("command.cmd_userinfo.total_bans")).append(": ").append(Emulator.getGameEnvironment().getModToolManager().totalBans(habbo.getId())).append("\r");
|
message.append(getTextsValue("command.cmd_userinfo.total_bans")).append(": ").append(Emulator.getGameEnvironment().getModToolManager().totalBans(habbo.getId())).append("\r");
|
||||||
message.append(Emulator.getTexts().getValue("command.cmd_userinfo.banned")).append(": ").append(Emulator.getTexts().getValue(ban != null ? "generic.yes" : "generic.no")).append("\r\r");
|
message.append(getTextsValue("command.cmd_userinfo.banned")).append(": ").append(getTextsValue(ban != null ? "generic.yes" : "generic.no")).append("\r\r");
|
||||||
if (ban != null) {
|
if (ban != null) {
|
||||||
message.append("<b>").append(Emulator.getTexts().getValue("command.cmd_userinfo.ban_info")).append("</b>\r");
|
message.append("<b>").append(getTextsValue("command.cmd_userinfo.ban_info")).append("</b>\r");
|
||||||
message.append(ban.listInfo()).append("\r");
|
message.append(ban.listInfo()).append("\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
message.append("<b>").append(Emulator.getTexts().getValue("command.cmd_userinfo.currencies")).append("</b>\r");
|
message.append("<b>").append(getTextsValue("command.cmd_userinfo.currencies")).append("</b>\r");
|
||||||
message.append(Emulator.getTexts().getValue("command.cmd_userinfo.credits")).append(": ").append(habbo.getCredits()).append("\r");
|
message.append(getTextsValue("command.cmd_userinfo.credits")).append(": ").append(habbo.getCredits()).append("\r");
|
||||||
TIntIntIterator iterator = habbo.getCurrencies().iterator();
|
TIntIntIterator iterator = habbo.getCurrencies().iterator();
|
||||||
|
|
||||||
for (int i = habbo.getCurrencies().size(); i-- > 0; ) {
|
for (int i = habbo.getCurrencies().size(); i-- > 0; ) {
|
||||||
@ -68,9 +68,9 @@ public class UserInfoCommand extends Command {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
message.append(Emulator.getTexts().getValue("seasonal.name." + iterator.key())).append(": ").append(iterator.value()).append("\r");
|
message.append(getTextsValue("seasonal.name." + iterator.key())).append(": ").append(iterator.value()).append("\r");
|
||||||
}
|
}
|
||||||
message.append("\r").append(onlineHabbo != null ? "<b>" + Emulator.getTexts().getValue("command.cmd_userinfo.current_activity") + "</b>\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.room") + ": " + (onlineHabbo.getHabboInfo().getCurrentRoom() != null ? onlineHabbo.getHabboInfo().getCurrentRoom().getName() + "(" + onlineHabbo.getHabboInfo().getCurrentRoom().getId() + ")\r" : "-") : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.respect_left") + ": " + onlineHabbo.getHabboStats().getRespectPointsToGive() + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.pet_respect_left") + ": " + onlineHabbo.getHabboStats().getPetRespectPointsToGive() + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_trade") + ": " + ((onlineHabbo.getHabboStats().allowTrade()) ? Emulator.getTexts().getValue("generic.yes") : Emulator.getTexts().getValue("generic.no")) + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_follow") + ": " + ((onlineHabbo.getHabboStats().isBlockFollowing()) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "").append(onlineHabbo != null ? Emulator.getTexts().getValue("command.cmd_userinfo.allow_friend_request") + ": " + ((onlineHabbo.getHabboStats().isBlockFriendRequests()) ? Emulator.getTexts().getValue("generic.no") : Emulator.getTexts().getValue("generic.yes")) + "\r" : "");
|
message.append("\r").append(onlineHabbo != null ? "<b>" + getTextsValue("command.cmd_userinfo.current_activity") + "</b>\r" : "").append(onlineHabbo != null ? getTextsValue("command.cmd_userinfo.room") + ": " + (onlineHabbo.getHabboInfo().getCurrentRoom() != null ? onlineHabbo.getHabboInfo().getCurrentRoom().getName() + "(" + onlineHabbo.getHabboInfo().getCurrentRoom().getId() + ")\r" : "-") : "").append(onlineHabbo != null ? getTextsValue("command.cmd_userinfo.respect_left") + ": " + onlineHabbo.getHabboStats().getRespectPointsToGive() + "\r" : "").append(onlineHabbo != null ? getTextsValue("command.cmd_userinfo.pet_respect_left") + ": " + onlineHabbo.getHabboStats().getPetRespectPointsToGive() + "\r" : "").append(onlineHabbo != null ? getTextsValue("command.cmd_userinfo.allow_trade") + ": " + ((onlineHabbo.getHabboStats().allowTrade()) ? getTextsValue("generic.yes") : getTextsValue("generic.no")) + "\r" : "").append(onlineHabbo != null ? getTextsValue("command.cmd_userinfo.allow_follow") + ": " + ((onlineHabbo.getHabboStats().isBlockFollowing()) ? getTextsValue("generic.no") : getTextsValue("generic.yes")) + "\r" : "").append(onlineHabbo != null ? getTextsValue("command.cmd_userinfo.allow_friend_request") + ": " + ((onlineHabbo.getHabboStats().isBlockFriendRequests()) ? getTextsValue("generic.no") : getTextsValue("generic.yes")) + "\r" : "");
|
||||||
|
|
||||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
List<Map.Entry<Integer, String>> nameChanges = Emulator.getGameEnvironment().getHabboManager().getNameChanges(habbo.getId(), 3);
|
List<Map.Entry<Integer, String>> nameChanges = Emulator.getGameEnvironment().getHabboManager().getNameChanges(habbo.getId(), 3);
|
||||||
@ -93,7 +93,7 @@ public class UserInfoCommand extends Command {
|
|||||||
message.append("<b>Username,\tID,\tDate register,\tDate last online</b>\r");
|
message.append("<b>Username,\tID,\tDate register,\tDate last online</b>\r");
|
||||||
|
|
||||||
for (HabboInfo info : users) {
|
for (HabboInfo info : users) {
|
||||||
message.append(info.getUsername()).append(",\t").append(info.getId()).append(",\t").append(format.format(new Date((long) info.getAccountCreated() * 1000L))).append(",\t").append(format.format(new Date((long) info.getLastOnline() * 1000L))).append("\r");
|
message.append(info.getUsername()).append(",\t").append(info.getId()).append(",\t").append(format.format(new Date(info.getAccountCreated() * 1000L))).append(",\t").append(format.format(new Date((long) info.getLastOnline() * 1000L))).append("\r");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gameClient.getHabbo().alert(message.toString());
|
gameClient.getHabbo().alert(message.toString());
|
||||||
|
@ -15,7 +15,7 @@ public class WordQuizCommand extends Command {
|
|||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (!gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasActiveWordQuiz()) {
|
if (!gameClient.getHabbo().getHabboInfo().getCurrentRoom().hasActiveWordQuiz()) {
|
||||||
if(params.length == 1) {
|
if(params.length == 1) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.description.cmd_word_quiz"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.description.cmd_word_quiz"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
StringBuilder question = new StringBuilder();
|
StringBuilder question = new StringBuilder();
|
||||||
|
@ -24,22 +24,22 @@ public class BadgeCommand extends BaseBadgeCommand {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length == 1) {
|
if (params.length == 1) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.forgot_username"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_badge.forgot_username"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (params.length == 2) {
|
if (params.length == 2) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.forgot_badge").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUserAndBadge(getTextsValue("commands.error.cmd_badge.forgot_badge"), params[1], ""), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.length == 3) {
|
if (params.length == 3) {
|
||||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
Habbo habbo = getHabbo(params[1]);
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
if (habbo.addBadge(params[2])) {
|
if (habbo.addBadge(params[2])) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_badge.given").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUserAndBadge(getTextsValue("commands.succes.cmd_badge.given"), params[1], params[2]), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.already_owned").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUserAndBadge(getTextsValue("commands.error.cmd_badge.already_owned"), params[1], params[2]), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -47,7 +47,7 @@ public class BadgeCommand extends BaseBadgeCommand {
|
|||||||
HabboInfo habboInfo = HabboManager.getOfflineHabboInfo(params[1]);
|
HabboInfo habboInfo = HabboManager.getOfflineHabboInfo(params[1]);
|
||||||
|
|
||||||
if (habboInfo == null) {
|
if (habboInfo == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.unknown_user"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_badge.unknown_user"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public class BadgeCommand extends BaseBadgeCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_badge.already_owns").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUserAndBadge(getTextsValue("commands.error.cmd_badge.already_owns"), params[1], params[2]), RoomChatMessageBubbles.ALERT);
|
||||||
} else {
|
} else {
|
||||||
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO users_badges (`id`, `user_id`, `slot_id`, `badge_code`) VALUES (null, ?, 0, ?)")) {
|
try (PreparedStatement statement = connection.prepareStatement("INSERT INTO users_badges (`id`, `user_id`, `slot_id`, `badge_code`) VALUES (null, ?, 0, ?)")) {
|
||||||
statement.setInt(1, habboInfo.getId());
|
statement.setInt(1, habboInfo.getId());
|
||||||
@ -71,7 +71,7 @@ public class BadgeCommand extends BaseBadgeCommand {
|
|||||||
statement.execute();
|
statement.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_badge.given").replace("%user%", params[1]).replace("%badge%", params[2]), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUserAndBadge(getTextsValue("commands.succes.cmd_badge.given"), params[1], params[2]), RoomChatMessageBubbles.ALERT);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
@ -20,18 +20,20 @@ public abstract class BaseBadgeCommand extends Command {
|
|||||||
THashMap<String, String> keys = new THashMap<>();
|
THashMap<String, String> keys = new THashMap<>();
|
||||||
keys.put("display", "BUBBLE");
|
keys.put("display", "BUBBLE");
|
||||||
keys.put("image", "${image.library.url}album1584/" + badge + ".gif");
|
keys.put("image", "${image.library.url}album1584/" + badge + ".gif");
|
||||||
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
|
keys.put("message", getTextsValue("commands.generic.cmd_badge.received"));
|
||||||
return new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.getKey(), keys).compose();
|
return new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.getKey(), keys).compose();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void sendBadgeToClient(String badge, ServerMessage message, Habbo habbo) {
|
protected void sendBadgeToClient(String badge, ServerMessage message, Habbo habbo) {
|
||||||
if (habbo.isOnline()) {
|
if (habbo.isOnline() && habbo.getInventory() != null && habbo.getInventory().getBadgesComponent() != null && !habbo.getInventory().getBadgesComponent().hasBadge(badge)) {
|
||||||
if (habbo.getInventory() != null && habbo.getInventory().getBadgesComponent() != null && !habbo.getInventory().getBadgesComponent().hasBadge(badge)) {
|
|
||||||
HabboBadge b = BadgesComponent.createBadge(badge, habbo);
|
HabboBadge b = BadgesComponent.createBadge(badge, habbo);
|
||||||
|
|
||||||
habbo.getClient().sendResponse(new BadgeReceivedComposer(b));
|
habbo.getClient().sendResponse(new BadgeReceivedComposer(b));
|
||||||
habbo.getClient().sendResponse(message);
|
habbo.getClient().sendResponse(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected String replaceUserAndBadge(String input, String name, String badge) {
|
||||||
|
return replaceUser(input, name).replace("%badge%", badge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ public class MassBadgeCommand extends BaseBadgeCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_massbadge.no_badge"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_massbadge.no_badge"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,17 +1,9 @@
|
|||||||
package com.eu.habbo.habbohotel.commands.badge;
|
package com.eu.habbo.habbohotel.commands.badge;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
import com.eu.habbo.habbohotel.commands.Command;
|
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
|
||||||
import com.eu.habbo.habbohotel.users.HabboBadge;
|
|
||||||
import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
|
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.BubbleAlertKeys;
|
|
||||||
import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageComposer;
|
|
||||||
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
|
|
||||||
import gnu.trove.map.hash.THashMap;
|
|
||||||
|
|
||||||
public class RoomBadgeCommand extends BaseBadgeCommand {
|
public class RoomBadgeCommand extends BaseBadgeCommand {
|
||||||
public RoomBadgeCommand() {
|
public RoomBadgeCommand() {
|
||||||
@ -24,21 +16,18 @@ public class RoomBadgeCommand extends BaseBadgeCommand {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (params.length == 2) {
|
if (params.length == 2) {
|
||||||
String badge;
|
String badge = params[1];
|
||||||
|
|
||||||
badge = params[1];
|
|
||||||
|
|
||||||
if (!badge.isEmpty()) {
|
if (!badge.isEmpty()) {
|
||||||
ServerMessage message = createServerMessage(badge);
|
ServerMessage message = createServerMessage(badge);
|
||||||
|
|
||||||
for (Habbo habbo : gameClient.getHabbo().getRoomUnit().getRoom().getHabbos()) {
|
gameClient.getHabbo().getRoomUnit().getRoom().getHabbos()
|
||||||
sendBadgeToClient(badge, message, habbo);
|
.forEach(habbo -> sendBadgeToClient(badge, message, habbo));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roombadge.no_badge"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_roombadge.no_badge"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.eu.habbo.habbohotel.commands;
|
package com.eu.habbo.habbohotel.commands.badge;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.commands.Command;
|
||||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||||
import com.eu.habbo.habbohotel.users.Habbo;
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
@ -11,7 +12,7 @@ import com.eu.habbo.habbohotel.users.inventory.BadgesComponent;
|
|||||||
import com.eu.habbo.messages.outgoing.inventory.BadgesComposer;
|
import com.eu.habbo.messages.outgoing.inventory.BadgesComposer;
|
||||||
import com.eu.habbo.messages.outgoing.users.UserBadgesComposer;
|
import com.eu.habbo.messages.outgoing.users.UserBadgesComposer;
|
||||||
|
|
||||||
public class TakeBadgeCommand extends Command {
|
public class TakeBadgeCommand extends BaseBadgeCommand {
|
||||||
public TakeBadgeCommand() {
|
public TakeBadgeCommand() {
|
||||||
super("cmd_take_badge", Emulator.getTexts().getValue("commands.keys.cmd_take_badge").split(";"));
|
super("cmd_take_badge", Emulator.getTexts().getValue("commands.keys.cmd_take_badge").split(";"));
|
||||||
}
|
}
|
||||||
@ -19,10 +20,10 @@ public class TakeBadgeCommand extends Command {
|
|||||||
@Override
|
@Override
|
||||||
public boolean handle(GameClient gameClient, String[] params) {
|
public boolean handle(GameClient gameClient, String[] params) {
|
||||||
if (params.length == 2) {
|
if (params.length == 2) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_take_badge.forgot_badge"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_take_badge.forgot_badge"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
} else if (params.length == 1) {
|
} else if (params.length == 1) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_take_badge.forgot_username"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.error.cmd_take_badge.forgot_username"), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +37,7 @@ public class TakeBadgeCommand extends Command {
|
|||||||
HabboBadge b = habbo.getInventory().getBadgesComponent().removeBadge(badge);
|
HabboBadge b = habbo.getInventory().getBadgesComponent().removeBadge(badge);
|
||||||
|
|
||||||
if (b == null) {
|
if (b == null) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_take_badge.no_badge").replace("%username%", username).replace("%badge%", badge), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(replaceUsername(getTextsValue("commands.error.cmd_take_badge.no_badge"), username).replace("%badge%", badge), RoomChatMessageBubbles.ALERT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ public class TakeBadgeCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (userId > 0) {
|
if (userId > 0) {
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_take_badge"), RoomChatMessageBubbles.ALERT);
|
gameClient.getHabbo().whisper(getTextsValue("commands.succes.cmd_take_badge"), RoomChatMessageBubbles.ALERT);
|
||||||
|
|
||||||
BadgesComponent.deleteBadge(userId, badge);
|
BadgesComponent.deleteBadge(userId, badge);
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user