mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-18 23:46:28 +01:00
Feature/remove some code duplication2
This commit is contained in:
parent
b7794d239a
commit
1105b96a8f
1
pom.xml
1
pom.xml
@ -36,6 +36,7 @@
|
||||
<configuration>
|
||||
<source>18</source>
|
||||
<target>18</target>
|
||||
<compilerArgs>--enable-preview</compilerArgs>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
@ -217,13 +217,14 @@ public final class Emulator {
|
||||
try {
|
||||
String filepath = new File(Emulator.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getAbsolutePath();
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");// MD5
|
||||
FileInputStream fis = new FileInputStream(filepath);
|
||||
try(FileInputStream fis = new FileInputStream(filepath)) {
|
||||
byte[] dataBytes = new byte[1024];
|
||||
int nread;
|
||||
while ((nread = fis.read(dataBytes)) != -1)
|
||||
md.update(dataBytes, 0, nread);
|
||||
byte[] mdbytes = md.digest();
|
||||
for (byte mdbyte : mdbytes) sb.append(Integer.toString((mdbyte & 0xff) + 0x100, 16).substring(1));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
build = "4.0 Developer Preview Branch";
|
||||
return;
|
||||
|
@ -59,6 +59,6 @@ public abstract class ConsoleCommand {
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract void handle(String[] args) throws Exception;
|
||||
public abstract void handle(String[] args);
|
||||
|
||||
}
|
@ -17,7 +17,7 @@ public class ConsoleInfoCommand extends ConsoleCommand {
|
||||
public void handle(String[] args) {
|
||||
int seconds = Emulator.getIntUnixTimestamp() - Emulator.getTimeStarted();
|
||||
int day = (int) TimeUnit.SECONDS.toDays(seconds);
|
||||
long hours = TimeUnit.SECONDS.toHours(seconds) - (day * 24);
|
||||
long hours = TimeUnit.SECONDS.toHours(seconds) - (day * 24L);
|
||||
long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
|
||||
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);
|
||||
|
||||
|
@ -8,7 +8,7 @@ public class ConsoleShutdownCommand extends ConsoleCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(String[] args) throws Exception {
|
||||
public void handle(String[] args) {
|
||||
new ShutdownCommand().handle(null, args);
|
||||
}
|
||||
}
|
@ -88,11 +88,11 @@ public class HabboDiffieHellman {
|
||||
}
|
||||
|
||||
if (this.DHPrime.compareTo(BigInteger.valueOf(2)) < 1) {
|
||||
throw new HabboCryptoException("Prime cannot be <= 2!\nPrime: " + this.DHPrime.toString());
|
||||
throw new HabboCryptoException("Prime cannot be <= 2!\nPrime: " + this.DHPrime);
|
||||
}
|
||||
|
||||
if (this.DHGenerator.compareTo(this.DHPrime) > -1) {
|
||||
throw new HabboCryptoException("Generator cannot be >= Prime!\nPrime: " + this.DHPrime.toString() + "\nGenerator: " + this.DHGenerator.toString());
|
||||
throw new HabboCryptoException("Generator cannot be >= Prime!\nPrime: " + this.DHPrime + "\nGenerator: " + this.DHGenerator);
|
||||
}
|
||||
|
||||
generateDHKeys();
|
||||
|
@ -20,6 +20,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
public class Bot implements Runnable {
|
||||
@ -42,7 +43,7 @@ public class Bot implements Runnable {
|
||||
private int chatTimeOut;
|
||||
private int chatTimestamp;
|
||||
private short lastChatIndex;
|
||||
private int bubble;
|
||||
private final int bubble;
|
||||
|
||||
|
||||
private final String type;
|
||||
@ -108,7 +109,7 @@ public class Bot implements Runnable {
|
||||
this.chatRandom = false;
|
||||
this.chatDelay = 10;
|
||||
this.chatTimeOut = Emulator.getIntUnixTimestamp() + this.chatDelay;
|
||||
this.chatLines = new ArrayList<>(Arrays.asList("Default Message :D"));
|
||||
this.chatLines = new ArrayList<>(List.of("Default Message :D"));
|
||||
this.type = bot.getType();
|
||||
this.effect = bot.getEffect();
|
||||
this.bubble = bot.getBubbleId();
|
||||
|
@ -26,14 +26,14 @@ public class CatalogLimitedConfiguration implements Runnable {
|
||||
public CatalogLimitedConfiguration(int itemId, LinkedList<Integer> availableNumbers, int totalSet) {
|
||||
this.itemId = itemId;
|
||||
this.totalSet = totalSet;
|
||||
LinkedList<Integer> numbers = new LinkedList(availableNumbers);
|
||||
LinkedList<Integer> numbers = new LinkedList<>(availableNumbers);
|
||||
|
||||
if (Emulator.getConfig().getBoolean("catalog.ltd.random", true)) {
|
||||
Collections.shuffle(numbers);
|
||||
} else {
|
||||
Collections.reverse(numbers);
|
||||
}
|
||||
limitedNumbers = new LinkedBlockingQueue(numbers);
|
||||
limitedNumbers = new LinkedBlockingQueue<>(numbers);
|
||||
}
|
||||
|
||||
public int getNumber() {
|
||||
@ -70,7 +70,7 @@ public class CatalogLimitedConfiguration implements Runnable {
|
||||
|
||||
public void generateNumbers(int starting, int amount) {
|
||||
synchronized (lock) {
|
||||
LinkedList<Integer> numbers = new LinkedList();
|
||||
LinkedList<Integer> numbers = new LinkedList<>();
|
||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("INSERT INTO catalog_items_limited (catalog_item_id, number) VALUES (?, ?)")) {
|
||||
statement.setInt(1, this.itemId);
|
||||
|
||||
@ -93,7 +93,7 @@ public class CatalogLimitedConfiguration implements Runnable {
|
||||
Collections.reverse(numbers);
|
||||
}
|
||||
|
||||
limitedNumbers = new LinkedBlockingQueue(numbers);
|
||||
limitedNumbers = new LinkedBlockingQueue<>(numbers);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -125,6 +125,37 @@ public abstract class CatalogPage implements Comparable<CatalogPage>, ISerialize
|
||||
}
|
||||
}
|
||||
|
||||
protected void appendImagesAndText(ServerMessage message) {
|
||||
message.appendInt(3);
|
||||
message.appendString(getHeaderImage());
|
||||
message.appendString(getTeaserImage());
|
||||
message.appendString(getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(getTextOne());
|
||||
message.appendString(getTextDetails());
|
||||
message.appendString(getTextTeaser());
|
||||
}
|
||||
|
||||
protected void appendGuildImagesAndText(ServerMessage message) {
|
||||
message.appendInt(2);
|
||||
message.appendString(getHeaderImage());
|
||||
message.appendString(getTeaserImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(getTextOne());
|
||||
message.appendString(getTextDetails());
|
||||
message.appendString(getTextTeaser());
|
||||
}
|
||||
|
||||
protected void appendPetImagesAndText(ServerMessage message){
|
||||
message.appendInt(2);
|
||||
message.appendString(getHeaderImage());
|
||||
message.appendString(getTeaserImage());
|
||||
message.appendInt(4);
|
||||
message.appendString(getTextOne());
|
||||
message.appendString(getTextTwo());
|
||||
message.appendString(getTextDetails());
|
||||
message.appendString(getTextTeaser());
|
||||
}
|
||||
@Override
|
||||
public int compareTo(CatalogPage page) {
|
||||
return this.getOrderNum() - page.getOrderNum();
|
||||
|
@ -15,13 +15,6 @@ public class BadgeDisplayLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("badge_display");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,8 @@ public class BuildersClubAddonsLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("builders_club_addons");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -15,13 +15,6 @@ public class BuildersClubLoyaltyLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("builders_club_loyalty");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
}
|
||||
}
|
@ -14,13 +14,6 @@ public class ColorGroupingLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("default_3x3_color_grouping");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,6 @@ public class Default_3x3Layout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("default_3x3");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,6 @@ public class GuildForumLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("guild_forum");
|
||||
message.appendInt(2);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendGuildImagesAndText(message);
|
||||
}
|
||||
}
|
@ -14,12 +14,6 @@ public class GuildFrontpageLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("guild_frontpage");
|
||||
message.appendInt(2);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendGuildImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,6 @@ public class GuildFurnitureLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("guild_custom_furni");
|
||||
message.appendInt(2);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendGuildImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,6 @@ public class InfoMonkeyLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("monkey");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,6 @@ public class InfoNikoLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("monkey");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,6 @@ public class LoyaltyVipBuyLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("loyalty_vip_buy");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
}
|
||||
}
|
@ -14,13 +14,6 @@ public class PetCustomizationLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("petcustomization");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,6 @@ public class Pets2Layout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("pets2");
|
||||
message.appendInt(2);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendInt(4);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextTwo());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendPetImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,6 @@ public class Pets3Layout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("pets3");
|
||||
message.appendInt(2);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendInt(4);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextTwo());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendPetImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,6 @@ public class PetsLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("pets");
|
||||
message.appendInt(2);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendInt(4);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextTwo());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendPetImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,6 @@ public class ProductPage1Layout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("productpage1");
|
||||
message.appendInt(2);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendInt(4);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextTwo());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendPetImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,7 @@ public class RecentPurchasesLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("default_3x3");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,7 @@ public class RecyclerInfoLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("recycler_info");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,6 @@ public class RecyclerPrizesLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("recycler_prizes");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,6 @@ public class SpacesLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("spaces_new");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,6 @@ public class TrophiesLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("trophies");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,6 @@ public class VipBuyLayout extends CatalogPage {
|
||||
@Override
|
||||
public void serialize(ServerMessage message) {
|
||||
message.appendString("vip_buy");
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getHeaderImage());
|
||||
message.appendString(super.getTeaserImage());
|
||||
message.appendString(super.getSpecialImage());
|
||||
message.appendInt(3);
|
||||
message.appendString(super.getTextOne());
|
||||
message.appendString(super.getTextDetails());
|
||||
message.appendString(super.getTextTeaser());
|
||||
appendImagesAndText(message);
|
||||
}
|
||||
}
|
@ -13,9 +13,40 @@ public class AboutCommand extends Command {
|
||||
public AboutCommand() {
|
||||
super(null, new String[]{"about", "info", "online", "server"});
|
||||
}
|
||||
public static final String credits = "Arcturus Morningstar is an opensource project based on Arcturus By TheGeneral \n" +
|
||||
"The Following people have all contributed to this emulator:\n" +
|
||||
" TheGeneral\n Beny\n Alejandro\n Capheus\n Skeletor\n Harmonic\n Mike\n Remco\n zGrav \n Quadral \n Harmony\n Swirny\n ArpyAge\n Mikkel\n Rodolfo\n Rasmus\n Kitt Mustang\n Snaiker\n nttzx\n necmi\n Dome\n Jose Flores\n Cam\n Oliver\n Narzo\n Tenshie\n MartenM\n Ridge\n SenpaiDipper\n Snaiker\n Thijmen";
|
||||
public static final String credits = """
|
||||
Arcturus Morningstar is an opensource project based on Arcturus By TheGeneral\s
|
||||
The Following people have all contributed to this emulator:
|
||||
TheGeneral
|
||||
Beny
|
||||
Alejandro
|
||||
Capheus
|
||||
Skeletor
|
||||
Harmonic
|
||||
Mike
|
||||
Remco
|
||||
zGrav\s
|
||||
Quadral\s
|
||||
Harmony
|
||||
Swirny
|
||||
ArpyAge
|
||||
Mikkel
|
||||
Rodolfo
|
||||
Rasmus
|
||||
Kitt Mustang
|
||||
Snaiker
|
||||
nttzx
|
||||
necmi
|
||||
Dome
|
||||
Jose Flores
|
||||
Cam
|
||||
Oliver
|
||||
Narzo
|
||||
Tenshie
|
||||
MartenM
|
||||
Ridge
|
||||
SenpaiDipper
|
||||
Snaiker
|
||||
Thijmen""";
|
||||
@Override
|
||||
public boolean handle(GameClient gameClient, String[] params) {
|
||||
|
||||
@ -23,7 +54,7 @@ public class AboutCommand extends Command {
|
||||
|
||||
int seconds = Emulator.getIntUnixTimestamp() - Emulator.getTimeStarted();
|
||||
int day = (int) TimeUnit.SECONDS.toDays(seconds);
|
||||
long hours = TimeUnit.SECONDS.toHours(seconds) - (day * 24);
|
||||
long hours = TimeUnit.SECONDS.toHours(seconds) - (day * 24L);
|
||||
long minute = TimeUnit.SECONDS.toMinutes(seconds) - (TimeUnit.SECONDS.toHours(seconds) * 60);
|
||||
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) * 60);
|
||||
|
||||
|
@ -2,6 +2,17 @@ package com.eu.habbo.habbohotel.commands;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.core.CommandLog;
|
||||
import com.eu.habbo.habbohotel.commands.badge.BadgeCommand;
|
||||
import com.eu.habbo.habbohotel.commands.badge.MassBadgeCommand;
|
||||
import com.eu.habbo.habbohotel.commands.badge.RoomBadgeCommand;
|
||||
import com.eu.habbo.habbohotel.commands.bans.BanCommand;
|
||||
import com.eu.habbo.habbohotel.commands.bans.MachineBanCommand;
|
||||
import com.eu.habbo.habbohotel.commands.bans.SuperbanCommand;
|
||||
import com.eu.habbo.habbohotel.commands.gift.GiftCommand;
|
||||
import com.eu.habbo.habbohotel.commands.gift.MassGiftCommand;
|
||||
import com.eu.habbo.habbohotel.commands.points.MassPointsCommand;
|
||||
import com.eu.habbo.habbohotel.commands.points.PointsCommand;
|
||||
import com.eu.habbo.habbohotel.commands.points.RoomPointsCommand;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.permissions.PermissionSetting;
|
||||
|
@ -17,7 +17,6 @@ public class FreezeCommand extends Command {
|
||||
|
||||
if (habbo == null) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_freeze.not_found").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
} else {
|
||||
if (habbo.getRoomUnit().canWalk()) {
|
||||
habbo.getRoomUnit().setCanWalk(false);
|
||||
@ -28,8 +27,8 @@ public class FreezeCommand extends Command {
|
||||
habbo.whisper(Emulator.getTexts().getValue("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);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_freeze.not_found").replace("%user%", ""), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
|
@ -1,86 +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.items.Item;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
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.inventory.FurniListInvalidateComposer;
|
||||
import gnu.trove.map.hash.THashMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class MassGiftCommand extends Command {
|
||||
public MassGiftCommand() {
|
||||
super("cmd_massgift", Emulator.getTexts().getValue("commands.keys.cmd_massgift").split(";"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final GameClient gameClient, String[] params) {
|
||||
if (params.length >= 2) {
|
||||
int itemId;
|
||||
|
||||
try {
|
||||
itemId = Integer.parseInt(params[1]);
|
||||
} catch (Exception e) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (itemId <= 0) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
final Item baseItem = Emulator.getGameEnvironment().getItemManager().getItem(itemId);
|
||||
|
||||
if (baseItem == null) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_found").replace("%itemid%", itemId + ""), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
StringBuilder message = new StringBuilder();
|
||||
|
||||
if (params.length > 2) {
|
||||
for (int i = 2; i < params.length; i++) {
|
||||
message.append(params[i]).append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
final String finalMessage = message.toString();
|
||||
|
||||
THashMap<String, String> keys = new THashMap<>();
|
||||
keys.put("display", "BUBBLE");
|
||||
keys.put("image", "${image.library.url}notifications/gift.gif");
|
||||
keys.put("message", Emulator.getTexts().getValue("generic.gift.received.anonymous"));
|
||||
ServerMessage giftNotificiationMessage = new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.getKey(), keys).compose();
|
||||
|
||||
Emulator.getThreading().run(() -> {
|
||||
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
||||
Habbo habbo = set.getValue();
|
||||
|
||||
HabboItem item = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, 0, 0, "");
|
||||
|
||||
Item giftItem = Emulator.getGameEnvironment().getItemManager().getItem((Integer) Emulator.getGameEnvironment().getCatalogManager().giftFurnis.values().toArray()[Emulator.getRandom().nextInt(Emulator.getGameEnvironment().getCatalogManager().giftFurnis.size())]);
|
||||
|
||||
String extraData = "1\t" + item.getId();
|
||||
extraData += "\t0\t0\t0\t" + finalMessage + "\t0\t0";
|
||||
|
||||
Emulator.getGameEnvironment().getItemManager().createGift(habbo.getHabboInfo().getUsername(), giftItem, extraData, 0, 0);
|
||||
|
||||
habbo.getClient().sendResponse(new FurniListInvalidateComposer());
|
||||
habbo.getClient().sendResponse(giftNotificiationMessage);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,66 +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 PointsCommand extends Command {
|
||||
public PointsCommand() {
|
||||
super("cmd_points", Emulator.getTexts().getValue("commands.keys.cmd_points").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 {
|
||||
int type = Emulator.getConfig().getInt("seasonal.primary.type");
|
||||
|
||||
if (params.length == 4) {
|
||||
try {
|
||||
type = Integer.parseInt(params[3]);
|
||||
} catch (Exception e) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_type").replace("%types%", Emulator.getConfig().getValue("seasonal.types").replace(";", ", ")), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int amount;
|
||||
|
||||
try {
|
||||
amount = Integer.parseInt(params[2]);
|
||||
} catch (Exception e) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (amount != 0) {
|
||||
habbo.givePoints(type, amount);
|
||||
|
||||
if (habbo.getHabboInfo().getCurrentRoom() != null)
|
||||
habbo.whisper(Emulator.getTexts().getValue("commands.generic.cmd_points.received").replace("%amount%", amount + "").replace("%type%", Emulator.getTexts().getValue("seasonal.name." + type)), RoomChatMessageBubbles.ALERT);
|
||||
else
|
||||
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_points.received").replace("%amount%", amount + "").replace("%type%", Emulator.getTexts().getValue("seasonal.name." + type)));
|
||||
|
||||
// habbo.getClient().sendResponse(new UserPointsComposer(habbo.getHabboInfo().getCurrencyAmount(type), amount, type));
|
||||
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_points.send").replace("%amount%", amount + "").replace("%user%", params[1]).replace("%type%", Emulator.getTexts().getValue("seasonal.name." + type)), RoomChatMessageBubbles.ALERT);
|
||||
|
||||
} else {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||
}
|
||||
} else {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.user_offline").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
||||
}
|
||||
} else {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,71 +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.items.Item;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
||||
import com.eu.habbo.messages.outgoing.wired.WiredRewardResultMessageComposer;
|
||||
|
||||
public class RoomGiftCommand extends Command {
|
||||
public RoomGiftCommand() {
|
||||
super("cmd_roomgift", Emulator.getTexts().getValue("commands.keys.cmd_roomgift").split(";"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final GameClient gameClient, String[] params) {
|
||||
if (params.length >= 2) {
|
||||
int itemId;
|
||||
|
||||
try {
|
||||
itemId = Integer.parseInt(params[1]);
|
||||
} catch (Exception e) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (itemId <= 0) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
final Item baseItem = Emulator.getGameEnvironment().getItemManager().getItem(itemId);
|
||||
|
||||
if (baseItem == null) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_found").replace("%itemid%", itemId + ""), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
StringBuilder message = new StringBuilder();
|
||||
|
||||
if (params.length > 2) {
|
||||
for (int i = 2; i < params.length; i++) {
|
||||
message.append(params[i]).append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
final String finalMessage = message.toString();
|
||||
|
||||
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos()) {
|
||||
HabboItem item = Emulator.getGameEnvironment().getItemManager().createItem(0, baseItem, 0, 0, "");
|
||||
|
||||
Item giftItem = Emulator.getGameEnvironment().getItemManager().getItem((Integer) Emulator.getGameEnvironment().getCatalogManager().giftFurnis.values().toArray()[Emulator.getRandom().nextInt(Emulator.getGameEnvironment().getCatalogManager().giftFurnis.size())]);
|
||||
|
||||
String extraData = "1\t" + item.getId();
|
||||
extraData += "\t0\t0\t0\t" + finalMessage + "\t0\t0";
|
||||
|
||||
Emulator.getGameEnvironment().getItemManager().createGift(habbo.getHabboInfo().getUsername(), giftItem, extraData, 0, 0);
|
||||
|
||||
habbo.getClient().sendResponse(new FurniListInvalidateComposer());
|
||||
|
||||
habbo.getClient().sendResponse(new WiredRewardResultMessageComposer(WiredRewardResultMessageComposer.REWARD_RECEIVED_ITEM));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -25,10 +25,9 @@ public class SetMaxCommand extends Command {
|
||||
} else {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setmax.invalid_number"), RoomChatMessageBubbles.ALERT);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_setmax.forgot_number"), RoomChatMessageBubbles.ALERT);
|
||||
}
|
||||
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.habbohotel.commands.Command;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -14,7 +15,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
@Slf4j
|
||||
public class BadgeCommand extends Command {
|
||||
public class BadgeCommand extends BaseBadgeCommand {
|
||||
|
||||
public BadgeCommand() {
|
||||
super("cmd_badge", Emulator.getTexts().getValue("commands.keys.cmd_badge").split(";"));
|
@ -0,0 +1,37 @@
|
||||
package com.eu.habbo.habbohotel.commands.badge;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.commands.Command;
|
||||
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.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 abstract class BaseBadgeCommand extends Command {
|
||||
public BaseBadgeCommand(String permission, String[] keys) {
|
||||
super(permission, keys);
|
||||
}
|
||||
|
||||
protected ServerMessage createServerMessage(String badge) {
|
||||
THashMap<String, String> keys = new THashMap<>();
|
||||
keys.put("display", "BUBBLE");
|
||||
keys.put("image", "${image.library.url}album1584/" + badge + ".gif");
|
||||
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
|
||||
return new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.getKey(), keys).compose();
|
||||
}
|
||||
|
||||
protected void sendBadgeToClient(String badge, ServerMessage message, Habbo habbo) {
|
||||
if (habbo.isOnline()) {
|
||||
if (habbo.getInventory() != null && habbo.getInventory().getBadgesComponent() != null && !habbo.getInventory().getBadgesComponent().hasBadge(badge)) {
|
||||
HabboBadge b = BadgesComponent.createBadge(badge, habbo);
|
||||
|
||||
habbo.getClient().sendResponse(new BadgeReceivedComposer(b));
|
||||
habbo.getClient().sendResponse(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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.habbohotel.commands.Command;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -14,7 +15,7 @@ import gnu.trove.map.hash.THashMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class MassBadgeCommand extends Command {
|
||||
public class MassBadgeCommand extends BaseBadgeCommand {
|
||||
public MassBadgeCommand() {
|
||||
super("cmd_massbadge", Emulator.getTexts().getValue("commands.keys.cmd_massbadge").split(";"));
|
||||
}
|
||||
@ -27,23 +28,12 @@ public class MassBadgeCommand extends Command {
|
||||
badge = params[1];
|
||||
|
||||
if (!badge.isEmpty()) {
|
||||
THashMap<String, String> keys = new THashMap<>();
|
||||
keys.put("display", "BUBBLE");
|
||||
keys.put("image", "${image.library.url}album1584/" + badge + ".gif");
|
||||
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
|
||||
ServerMessage message = new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.getKey(), keys).compose();
|
||||
ServerMessage message = createServerMessage(badge);
|
||||
|
||||
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
||||
Habbo habbo = set.getValue();
|
||||
|
||||
if (habbo.isOnline()) {
|
||||
if (habbo.getInventory() != null && habbo.getInventory().getBadgesComponent() != null && !habbo.getInventory().getBadgesComponent().hasBadge(badge)) {
|
||||
HabboBadge b = BadgesComponent.createBadge(badge, habbo);
|
||||
|
||||
habbo.getClient().sendResponse(new BadgeReceivedComposer(b));
|
||||
habbo.getClient().sendResponse(message);
|
||||
}
|
||||
}
|
||||
sendBadgeToClient(badge, message, habbo);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -53,4 +43,6 @@ public class MassBadgeCommand extends Command {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -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.habbohotel.commands.Command;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
@ -12,7 +13,7 @@ import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageCo
|
||||
import com.eu.habbo.messages.outgoing.users.BadgeReceivedComposer;
|
||||
import gnu.trove.map.hash.THashMap;
|
||||
|
||||
public class RoomBadgeCommand extends Command {
|
||||
public class RoomBadgeCommand extends BaseBadgeCommand {
|
||||
public RoomBadgeCommand() {
|
||||
super("cmd_roombadge", Emulator.getTexts().getValue("commands.keys.cmd_roombadge").split(";"));
|
||||
}
|
||||
@ -28,21 +29,10 @@ public class RoomBadgeCommand extends Command {
|
||||
badge = params[1];
|
||||
|
||||
if (!badge.isEmpty()) {
|
||||
THashMap<String, String> keys = new THashMap<>();
|
||||
keys.put("display", "BUBBLE");
|
||||
keys.put("image", "${image.library.url}album1584/" + badge + ".gif");
|
||||
keys.put("message", Emulator.getTexts().getValue("commands.generic.cmd_badge.received"));
|
||||
ServerMessage message = new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.getKey(), keys).compose();
|
||||
ServerMessage message = createServerMessage(badge);
|
||||
|
||||
for (Habbo habbo : gameClient.getHabbo().getRoomUnit().getRoom().getHabbos()) {
|
||||
if (habbo.isOnline()) {
|
||||
if (habbo.getInventory() != null && habbo.getInventory().getBadgesComponent() != null && !habbo.getInventory().getBadgesComponent().hasBadge(badge)) {
|
||||
HabboBadge b = BadgesComponent.createBadge(badge, habbo);
|
||||
|
||||
habbo.getClient().sendResponse(new BadgeReceivedComposer(b));
|
||||
habbo.getClient().sendResponse(message);
|
||||
}
|
||||
}
|
||||
sendBadgeToClient(badge, message, habbo);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -51,4 +41,6 @@ public class RoomBadgeCommand extends Command {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_roombadge.no_badge"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.commands;
|
||||
package com.eu.habbo.habbohotel.commands.bans;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.commands.Command;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.modtool.ModToolBan;
|
||||
import com.eu.habbo.habbohotel.modtool.ModToolBanType;
|
@ -0,0 +1,53 @@
|
||||
package com.eu.habbo.habbohotel.commands.bans;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.commands.Command;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboInfo;
|
||||
import com.eu.habbo.habbohotel.users.HabboManager;
|
||||
|
||||
|
||||
public abstract class BaseBanCommand extends Command {
|
||||
protected HabboInfo habboInfo;
|
||||
protected String reason;
|
||||
protected int count;
|
||||
|
||||
public BaseBanCommand(String permission, String[] keys) {
|
||||
super(permission, keys);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||
this.reason = getReason(params);
|
||||
this.habboInfo = getHabboInfo(params);
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getReason(String[] params) {
|
||||
StringBuilder reason = new StringBuilder();
|
||||
|
||||
if (params.length > 2) {
|
||||
for (int i = 2; i < params.length; i++) {
|
||||
reason.append(params[i]);
|
||||
reason.append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
return reason.toString();
|
||||
}
|
||||
|
||||
protected HabboInfo getHabboInfo(String[] params) {
|
||||
if (params.length >= 2) {
|
||||
Habbo h = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
||||
|
||||
if (h != null) {
|
||||
return h.getHabboInfo();
|
||||
} else {
|
||||
return HabboManager.getOfflineHabboInfo(params[1]);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,54 +1,32 @@
|
||||
package com.eu.habbo.habbohotel.commands;
|
||||
package com.eu.habbo.habbohotel.commands.bans;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.commands.IPBanCommand;
|
||||
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 MachineBanCommand extends Command {
|
||||
public class MachineBanCommand extends BaseBanCommand {
|
||||
public MachineBanCommand() {
|
||||
super("cmd_machine_ban", Emulator.getTexts().getValue("commands.keys.cmd_machine_ban").split(";"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(GameClient gameClient, String[] params) {
|
||||
HabboInfo habbo = null;
|
||||
StringBuilder reason = new StringBuilder();
|
||||
if (params.length >= 2) {
|
||||
Habbo h = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||
super.handle(gameClient, params);
|
||||
|
||||
if (h != null) {
|
||||
habbo = h.getHabboInfo();
|
||||
} else {
|
||||
habbo = HabboManager.getOfflineHabboInfo(params[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (params.length > 2) {
|
||||
for (int i = 2; i < params.length; i++) {
|
||||
reason.append(params[i]);
|
||||
reason.append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
int count;
|
||||
if (habbo != null) {
|
||||
if (habbo == gameClient.getHabbo().getHabboInfo()) {
|
||||
if (habboInfo != null) {
|
||||
if (habboInfo == gameClient.getHabbo().getHabboInfo()) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_machine_ban.ban_self"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (habbo.getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) {
|
||||
if (habboInfo.getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ban.target_rank_higher"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
count = Emulator.getGameEnvironment().getModToolManager().ban(habbo.getId(), gameClient.getHabbo(), reason.toString(), IPBanCommand.TEN_YEARS, ModToolBanType.MACHINE, -1).size();
|
||||
|
||||
|
||||
count = Emulator.getGameEnvironment().getModToolManager().ban(habboInfo.getId(), gameClient.getHabbo(), reason, IPBanCommand.TEN_YEARS, ModToolBanType.MACHINE, -1).size();
|
||||
} else {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ban.user_offline"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
@ -1,52 +1,32 @@
|
||||
package com.eu.habbo.habbohotel.commands;
|
||||
package com.eu.habbo.habbohotel.commands.bans;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.commands.IPBanCommand;
|
||||
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 SuperbanCommand extends Command {
|
||||
public class SuperbanCommand extends BaseBanCommand {
|
||||
public SuperbanCommand() {
|
||||
super("cmd_super_ban", Emulator.getTexts().getValue("commands.keys.cmd_super_ban").split(";"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(GameClient gameClient, String[] params) {
|
||||
HabboInfo habbo = null;
|
||||
StringBuilder reason = new StringBuilder();
|
||||
if (params.length >= 2) {
|
||||
Habbo h = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||
super.handle(gameClient, params);
|
||||
|
||||
if (h != null) {
|
||||
habbo = h.getHabboInfo();
|
||||
} else {
|
||||
habbo = HabboManager.getOfflineHabboInfo(params[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if (params.length > 2) {
|
||||
for (int i = 2; i < params.length; i++) {
|
||||
reason.append(params[i]);
|
||||
reason.append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
int count;
|
||||
if (habbo != null) {
|
||||
if (habbo == gameClient.getHabbo().getHabboInfo()) {
|
||||
if (habboInfo != null) {
|
||||
if (habboInfo == gameClient.getHabbo().getHabboInfo()) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_super_ban.ban_self"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (habbo.getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) {
|
||||
if (habboInfo.getRank().getId() >= gameClient.getHabbo().getHabboInfo().getRank().getId()) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ban.target_rank_higher"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
count = Emulator.getGameEnvironment().getModToolManager().ban(habbo.getId(), gameClient.getHabbo(), reason.toString(), IPBanCommand.TEN_YEARS, ModToolBanType.SUPER, -1).size();
|
||||
count = Emulator.getGameEnvironment().getModToolManager().ban(habboInfo.getId(), gameClient.getHabbo(), reason, IPBanCommand.TEN_YEARS, ModToolBanType.SUPER, -1).size();
|
||||
} else {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_ban.user_offline"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
@ -0,0 +1,81 @@
|
||||
package com.eu.habbo.habbohotel.commands.gift;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.commands.Command;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public abstract class BaseGiftCommand extends Command {
|
||||
public BaseGiftCommand(String permission, String[] keys) {
|
||||
super(permission, keys);
|
||||
}
|
||||
|
||||
protected boolean validateGiftCommand(GameClient gameClient, String[] params) {
|
||||
Integer itemId = getItemId(params);
|
||||
if (itemId == null) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (itemId <= 0) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_a_number"), RoomChatMessageBubbles.ALERT);
|
||||
return false;
|
||||
}
|
||||
|
||||
final Item baseItem = getBaseItem(itemId);
|
||||
|
||||
if (baseItem == null) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_gift.not_found").replace("%itemid%", itemId + ""), RoomChatMessageBubbles.ALERT);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String getFinalMessage(String[] params) {
|
||||
String message = "";
|
||||
|
||||
if (params.length > 2) {
|
||||
message = IntStream.range(2, params.length).mapToObj(i -> params[i] + " ").collect(Collectors.joining());
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
protected void createGift(String finalMessage, Habbo habbo, String[] params) {
|
||||
HabboItem item = Emulator.getGameEnvironment().getItemManager().createItem(0, getBaseItem(params), 0, 0, "");
|
||||
|
||||
Item giftItem = Emulator.getGameEnvironment().getItemManager().getItem((Integer) Emulator.getGameEnvironment().getCatalogManager().giftFurnis.values().toArray()[Emulator.getRandom().nextInt(Emulator.getGameEnvironment().getCatalogManager().giftFurnis.size())]);
|
||||
|
||||
String extraData = "1\t" + item.getId();
|
||||
extraData += "\t0\t0\t0\t" + finalMessage + "\t0\t0";
|
||||
|
||||
Emulator.getGameEnvironment().getItemManager().createGift(habbo.getHabboInfo().getUsername(), giftItem, extraData, 0, 0);
|
||||
|
||||
habbo.getClient().sendResponse(new FurniListInvalidateComposer());
|
||||
}
|
||||
|
||||
|
||||
protected Item getBaseItem(String[] params) {
|
||||
return Emulator.getGameEnvironment().getItemManager().getItem(getItemId(params));
|
||||
}
|
||||
|
||||
protected Item getBaseItem(Integer itemId) {
|
||||
return Emulator.getGameEnvironment().getItemManager().getItem(itemId);
|
||||
}
|
||||
|
||||
protected Integer getItemId(String[] params) {
|
||||
try {
|
||||
return Integer.parseInt(params[1]);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.eu.habbo.habbohotel.commands;
|
||||
package com.eu.habbo.habbohotel.commands.gift;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.commands.Command;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
@ -13,7 +14,7 @@ import com.eu.habbo.messages.outgoing.generic.alerts.NotificationDialogMessageCo
|
||||
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
||||
import gnu.trove.map.hash.THashMap;
|
||||
|
||||
public class GiftCommand extends Command {
|
||||
public class GiftCommand extends BaseGiftCommand {
|
||||
public GiftCommand() {
|
||||
super("cmd_gift", Emulator.getTexts().getValue("commands.keys.cmd_gift").split(";"));
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.eu.habbo.habbohotel.commands.gift;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.commands.Command;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
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.inventory.FurniListInvalidateComposer;
|
||||
import gnu.trove.map.hash.THashMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class MassGiftCommand extends BaseGiftCommand {
|
||||
public MassGiftCommand() {
|
||||
super("cmd_massgift", Emulator.getTexts().getValue("commands.keys.cmd_massgift").split(";"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final GameClient gameClient, String[] params) {
|
||||
if (params.length >= 2) {
|
||||
if(!validateGiftCommand(gameClient, params)){
|
||||
return true;
|
||||
}
|
||||
|
||||
final String finalMessage = getFinalMessage(params);
|
||||
|
||||
THashMap<String, String> keys = new THashMap<>();
|
||||
keys.put("display", "BUBBLE");
|
||||
keys.put("image", "${image.library.url}notifications/gift.gif");
|
||||
keys.put("message", Emulator.getTexts().getValue("generic.gift.received.anonymous"));
|
||||
ServerMessage giftNotificationMessage = new NotificationDialogMessageComposer(BubbleAlertKeys.RECEIVED_BADGE.getKey(), keys).compose();
|
||||
|
||||
Emulator.getThreading().run(() -> {
|
||||
for (Map.Entry<Integer, Habbo> set : Emulator.getGameEnvironment().getHabboManager().getOnlineHabbos().entrySet()) {
|
||||
Habbo habbo = set.getValue();
|
||||
|
||||
createGift(finalMessage, habbo, params);
|
||||
habbo.getClient().sendResponse(giftNotificationMessage);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.eu.habbo.habbohotel.commands.gift;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.commands.Command;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.outgoing.inventory.FurniListInvalidateComposer;
|
||||
import com.eu.habbo.messages.outgoing.wired.WiredRewardResultMessageComposer;
|
||||
|
||||
public class RoomGiftCommand extends BaseGiftCommand {
|
||||
public RoomGiftCommand() {
|
||||
super("cmd_roomgift", Emulator.getTexts().getValue("commands.keys.cmd_roomgift").split(";"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final GameClient gameClient, String[] params) {
|
||||
if (params.length >= 2) {
|
||||
if (!validateGiftCommand(gameClient, params)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final String finalMessage = getFinalMessage(params);
|
||||
|
||||
for (Habbo habbo : gameClient.getHabbo().getHabboInfo().getCurrentRoom().getHabbos()) {
|
||||
createGift(finalMessage, habbo, params);
|
||||
|
||||
habbo.getClient().sendResponse(new WiredRewardResultMessageComposer(WiredRewardResultMessageComposer.REWARD_RECEIVED_ITEM));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.eu.habbo.habbohotel.commands.points;
|
||||
|
||||
import com.eu.habbo.habbohotel.commands.Command;
|
||||
|
||||
public abstract class BasePointsCommand extends Command {
|
||||
public BasePointsCommand(String permission, String[] keys) {
|
||||
super(permission, keys);
|
||||
}
|
||||
}
|
@ -1,13 +1,14 @@
|
||||
package com.eu.habbo.habbohotel.commands;
|
||||
package com.eu.habbo.habbohotel.commands.points;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.commands.Command;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class MassPointsCommand extends Command {
|
||||
public class MassPointsCommand extends BasePointsCommand {
|
||||
public MassPointsCommand() {
|
||||
super("cmd_masspoints", Emulator.getTexts().getValue("commands.keys.cmd_masspoints").split(";"));
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.eu.habbo.habbohotel.commands.points;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.commands.Command;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
|
||||
public class PointsCommand extends BasePointsCommand {
|
||||
public PointsCommand() {
|
||||
super("cmd_points", Emulator.getTexts().getValue("commands.keys.cmd_points").split(";"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(GameClient gameClient, String[] params) {
|
||||
if (params.length < 3) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
Habbo habbo = Emulator.getGameServer().getGameClientManager().getHabbo(params[1]);
|
||||
|
||||
if (habbo == null) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.user_offline").replace("%user%", params[1]), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
int type = Emulator.getConfig().getInt("seasonal.primary.type");
|
||||
int amount;
|
||||
if (params.length == 4) {
|
||||
try {
|
||||
type = Integer.parseInt(params[3]);
|
||||
} catch (NumberFormatException e) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_type").replace("%types%", Emulator.getConfig().getValue("seasonal.types").replace(";", ", ")), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
amount = Integer.parseInt(params[2]);
|
||||
} catch (NumberFormatException e) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (amount != 0) {
|
||||
habbo.givePoints(type, amount);
|
||||
|
||||
if (habbo.getHabboInfo().getCurrentRoom() != null)
|
||||
habbo.whisper(Emulator.getTexts().getValue("commands.generic.cmd_points.received").replace("%amount%", amount + "").replace("%type%", Emulator.getTexts().getValue("seasonal.name." + type)), RoomChatMessageBubbles.ALERT);
|
||||
else
|
||||
habbo.alert(Emulator.getTexts().getValue("commands.generic.cmd_points.received").replace("%amount%", amount + "").replace("%type%", Emulator.getTexts().getValue("seasonal.name." + type)));
|
||||
|
||||
// habbo.getClient().sendResponse(new UserPointsComposer(habbo.getHabboInfo().getCurrencyAmount(type), amount, type));
|
||||
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_points.send").replace("%amount%", amount + "").replace("%user%", params[1]).replace("%type%", Emulator.getTexts().getValue("seasonal.name." + type)), RoomChatMessageBubbles.ALERT);
|
||||
|
||||
} else {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_points.invalid_amount"), RoomChatMessageBubbles.ALERT);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
package com.eu.habbo.habbohotel.commands;
|
||||
package com.eu.habbo.habbohotel.commands.points;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.commands.Command;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomChatMessageBubbles;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
|
||||
public class RoomPointsCommand extends Command {
|
||||
public class RoomPointsCommand extends BasePointsCommand {
|
||||
public RoomPointsCommand() {
|
||||
super("cmd_roompoints", Emulator.getTexts().getValue("commands.keys.cmd_roompoints").split(";"));
|
||||
}
|
@ -39,7 +39,7 @@ public class CraftingRecipe {
|
||||
}
|
||||
|
||||
public boolean canBeCrafted() {
|
||||
return this.limited && this.remaining <= 0;
|
||||
return !this.limited || this.remaining > 0;
|
||||
}
|
||||
|
||||
public synchronized boolean decrease() {
|
||||
|
@ -98,7 +98,7 @@ public class ForumThread implements Runnable, ISerialize {
|
||||
this.commentIndex = 0;
|
||||
}
|
||||
|
||||
public static ForumThread create(Guild guild, Habbo opener, String subject, String message) throws Exception {
|
||||
public static ForumThread create(Guild guild, Habbo opener, String subject, String message) {
|
||||
ForumThread createdThread = null;
|
||||
|
||||
if (Emulator.getPluginManager().fireEvent(new GuildForumThreadBeforeCreated(guild, opener, subject, message)).isCancelled())
|
||||
|
@ -11,7 +11,7 @@ public enum ForumThreadState {
|
||||
HIDDEN_BY_GUILD_ADMIN(20);
|
||||
|
||||
@Getter
|
||||
private int stateId;
|
||||
private final int stateId;
|
||||
|
||||
|
||||
public static ForumThreadState fromValue(int value) {
|
||||
|
@ -24,7 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class InteractionBuildArea extends InteractionCustomValues {
|
||||
protected static final THashMap<String, String> defaultValues = new THashMap<String, String>();
|
||||
protected static final THashMap<String, String> defaultValues = new THashMap<>();
|
||||
|
||||
private final THashSet<RoomTile> tiles;
|
||||
|
||||
@ -110,7 +110,6 @@ public class InteractionBuildArea extends InteractionCustomValues {
|
||||
}
|
||||
}
|
||||
|
||||
THashSet<RoomTile> oldTiles = this.tiles;
|
||||
THashSet<RoomTile> newTiles = new THashSet<>();
|
||||
|
||||
int minX = Math.max(0, newLocation.getX() - Integer.parseInt(this.values.get("tilesBack")));
|
||||
@ -127,7 +126,7 @@ public class InteractionBuildArea extends InteractionCustomValues {
|
||||
}
|
||||
|
||||
if (!canBuild.isEmpty()) {
|
||||
for (RoomTile tile : oldTiles) {
|
||||
for (RoomTile tile : this.tiles) {
|
||||
THashSet<HabboItem> tileItems = room.getItemsAt(tile);
|
||||
if (newTiles.contains(tile)) continue;
|
||||
for (HabboItem tileItem : tileItems) {
|
||||
|
@ -48,7 +48,7 @@ public class InteractionDice extends HabboItem {
|
||||
if (client != null) {
|
||||
if (RoomLayout.tilesAdjecent(room.getLayout().getTile(this.getX(), this.getY()), client.getHabbo().getRoomUnit().getCurrentLocation())) {
|
||||
if (!this.getExtradata().equalsIgnoreCase("-1")) {
|
||||
FurnitureDiceRolledEvent event = (FurnitureDiceRolledEvent) Emulator.getPluginManager().fireEvent(new FurnitureDiceRolledEvent(this, client.getHabbo(), -1));
|
||||
FurnitureDiceRolledEvent event = Emulator.getPluginManager().fireEvent(new FurnitureDiceRolledEvent(this, client.getHabbo(), -1));
|
||||
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
@ -10,14 +10,13 @@ import gnu.trove.set.hash.THashSet;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
public class InteractionGuildFurni extends InteractionDefault {
|
||||
private int guildId;
|
||||
private static final THashSet<String> ROTATION_8_ITEMS = new THashSet<>() {
|
||||
{
|
||||
this.add("gld_wall_tall");
|
||||
}
|
||||
};
|
||||
private static final THashSet<String> ROTATION_8_ITEMS = new THashSet<>(
|
||||
List.of("gld_wall_tall")
|
||||
);
|
||||
|
||||
public InteractionGuildFurni(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
|
@ -9,13 +9,14 @@ import gnu.trove.map.hash.THashMap;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
|
||||
public class InteractionInformationTerminal extends InteractionCustomValues {
|
||||
public static final THashMap<String, String> defaultValues = new THashMap<>() {
|
||||
{
|
||||
this.put("internalLink", "habbopages/chat/commands");
|
||||
}
|
||||
};
|
||||
public static final THashMap<String, String> defaultValues = new THashMap<>(
|
||||
Map.of(
|
||||
"internalLink", "habbopages/chat/commands"
|
||||
)
|
||||
);
|
||||
|
||||
public InteractionInformationTerminal(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem, defaultValues);
|
||||
|
@ -19,29 +19,18 @@ import gnu.trove.set.hash.THashSet;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
|
||||
public class InteractionMuteArea extends InteractionCustomValues {
|
||||
public static final THashMap<String, String> defaultValues = new THashMap<>() {
|
||||
{
|
||||
this.put("tilesLeft", "0");
|
||||
}
|
||||
|
||||
{
|
||||
this.put("tilesRight", "0");
|
||||
}
|
||||
|
||||
{
|
||||
this.put("tilesFront", "0");
|
||||
}
|
||||
|
||||
{
|
||||
this.put("tilesBack", "0");
|
||||
}
|
||||
|
||||
{
|
||||
this.put("state", "0");
|
||||
}
|
||||
};
|
||||
public static final THashMap<String, String> defaultValues = new THashMap<>(
|
||||
Map.of(
|
||||
"tilesLeft", "0",
|
||||
"tilesRight", "0",
|
||||
"tilesFront", "0",
|
||||
"tilesBack", "0",
|
||||
"state", "0"
|
||||
)
|
||||
);
|
||||
|
||||
private final THashSet<RoomTile> tiles;
|
||||
|
||||
|
@ -7,29 +7,16 @@ import gnu.trove.map.hash.THashMap;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
|
||||
public class InteractionRoomAds extends InteractionCustomValues {
|
||||
public final static THashMap<String, String> defaultValues = new THashMap<>() {
|
||||
{
|
||||
this.put("imageUrl", "");
|
||||
}
|
||||
|
||||
{
|
||||
this.put("clickUrl", "");
|
||||
}
|
||||
|
||||
{
|
||||
this.put("offsetX", "0");
|
||||
}
|
||||
|
||||
{
|
||||
this.put("offsetY", "0");
|
||||
}
|
||||
|
||||
{
|
||||
this.put("offsetZ", "0");
|
||||
}
|
||||
};
|
||||
public final static THashMap<String, String> defaultValues = new THashMap<>(Map.of(
|
||||
"imageUrl", "" ,
|
||||
"clickUrl", "",
|
||||
"offsetX", "0",
|
||||
"offsetY", "0",
|
||||
"offsetZ", "0")
|
||||
);
|
||||
|
||||
public InteractionRoomAds(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem, defaultValues);
|
||||
|
@ -128,9 +128,7 @@ public class InteractionTeleport extends HabboItem {
|
||||
List<Runnable> onSuccess = new ArrayList<>();
|
||||
List<Runnable> onFail = new ArrayList<>();
|
||||
|
||||
onSuccess.add(() -> {
|
||||
tryTeleport(client, room);
|
||||
});
|
||||
onSuccess.add(() -> tryTeleport(client, room));
|
||||
|
||||
unit.setGoalLocation(infrontTile);
|
||||
Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, infrontTile, room, onSuccess, onFail));
|
||||
@ -202,10 +200,7 @@ public class InteractionTeleport extends HabboItem {
|
||||
if (unit == null)
|
||||
return false;
|
||||
|
||||
if (habbo.getHabboInfo().getRiding() != null)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return habbo.getHabboInfo().getRiding() == null;
|
||||
}
|
||||
|
||||
public void startTeleport(Room room, Habbo habbo) {
|
||||
|
@ -8,13 +8,12 @@ import gnu.trove.map.hash.THashMap;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
|
||||
public class InteractionTileEffectProvider extends InteractionCustomValues {
|
||||
public static final THashMap<String, String> defaultValues = new THashMap<>() {
|
||||
{
|
||||
this.put("effectId", "0");
|
||||
}
|
||||
};
|
||||
public static final THashMap<String, String> defaultValues = new THashMap<>(
|
||||
Map.of("effectId", "0")
|
||||
);
|
||||
|
||||
public InteractionTileEffectProvider(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem, defaultValues);
|
||||
|
@ -9,6 +9,7 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.outgoing.rooms.items.youtube.YoutubeDisplayVideoMessageComposer;
|
||||
import com.eu.habbo.threading.runnables.YoutubeAdvanceVideo;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
@ -4,5 +4,5 @@ import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
|
||||
public interface ConditionalGate {
|
||||
public void onRejected(RoomUnit roomUnit, Room room, Object[] objects);
|
||||
void onRejected(RoomUnit roomUnit, Room room, Object[] objects);
|
||||
}
|
||||
|
@ -50,9 +50,7 @@ public class InteractionPetDrink extends InteractionDefault {
|
||||
|
||||
if (closestTile != null && !closestTile.equals(client.getHabbo().getRoomUnit().getCurrentLocation())) {
|
||||
List<Runnable> onSuccess = new ArrayList<>();
|
||||
onSuccess.add(() -> {
|
||||
this.change(room, this.getBaseItem().getStateCount() - 1);
|
||||
});
|
||||
onSuccess.add(() -> this.change(room, this.getBaseItem().getStateCount() - 1));
|
||||
|
||||
client.getHabbo().getRoomUnit().setGoalLocation(closestTile);
|
||||
Emulator.getThreading().run(new RoomUnitWalkToLocation(client.getHabbo().getRoomUnit(), closestTile, room, onSuccess, new ArrayList<>()));
|
||||
|
@ -40,12 +40,12 @@ public class InteractionPetTree extends InteractionDefault {
|
||||
|
||||
Pet pet = room.getPet(roomUnit);
|
||||
if (pet != null && pet.getPetData().haveToyItem(this.getBaseItem()) && this.getOccupyingTiles(room.getLayout()).contains(pet.getRoomUnit().getGoal())) {
|
||||
RoomUnitStatus task = RoomUnitStatus.HANG;
|
||||
switch(pet.getTask()){
|
||||
case RING_OF_FIRE: task = RoomUnitStatus.RINGOFFIRE; break;
|
||||
case SWING: task = RoomUnitStatus.SWING; break;
|
||||
case ROLL: task = RoomUnitStatus.ROLL; break;
|
||||
}
|
||||
RoomUnitStatus task = switch (pet.getTask()) {
|
||||
case RING_OF_FIRE -> RoomUnitStatus.RINGOFFIRE;
|
||||
case SWING -> RoomUnitStatus.SWING;
|
||||
case ROLL -> RoomUnitStatus.ROLL;
|
||||
default -> RoomUnitStatus.HANG;
|
||||
};
|
||||
if (pet.getEnergy() >= 35 && task != RoomUnitStatus.HANG) {
|
||||
|
||||
pet.getRoomUnit().setCanWalk(false);
|
||||
|
@ -20,7 +20,7 @@ import java.util.stream.Collectors;
|
||||
public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
|
||||
public static final WiredConditionType type = WiredConditionType.STUFF_IS;
|
||||
|
||||
private THashSet<HabboItem> items = new THashSet<>();
|
||||
private final THashSet<HabboItem> items = new THashSet<>();
|
||||
|
||||
public WiredConditionFurniTypeMatch(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
@ -44,8 +44,7 @@ public class WiredConditionFurniTypeMatch extends InteractionWiredCondition {
|
||||
|
||||
if (stuff != null) {
|
||||
if (stuff.length >= 1) {
|
||||
if (stuff[0] instanceof HabboItem) {
|
||||
HabboItem triggeringItem = (HabboItem)stuff[0];
|
||||
if (stuff[0] instanceof HabboItem triggeringItem) {
|
||||
return this.items.stream().anyMatch(item -> item == triggeringItem);
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ public class WiredConditionLessTimeElapsed extends InteractionWiredCondition {
|
||||
if (!wiredData.equals(""))
|
||||
this.cycles = Integer.parseInt(wiredData);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class WiredConditionMoreTimeElapsed extends InteractionWiredCondition {
|
||||
if (!wiredData.equals(""))
|
||||
this.cycles = Integer.parseInt(wiredData);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class WiredConditionNotFurniHaveFurni extends InteractionWiredCondition {
|
||||
public static final WiredConditionType type = WiredConditionType.NOT_FURNI_HAVE_FURNI;
|
||||
|
||||
private boolean all;
|
||||
private THashSet<HabboItem> items;
|
||||
private final THashSet<HabboItem> items;
|
||||
|
||||
public WiredConditionNotFurniHaveFurni(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
|
@ -20,7 +20,7 @@ import java.util.stream.Collectors;
|
||||
public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
|
||||
public static final WiredConditionType type = WiredConditionType.NOT_STUFF_IS;
|
||||
|
||||
private THashSet<HabboItem> items = new THashSet<>();
|
||||
private final THashSet<HabboItem> items = new THashSet<>();
|
||||
|
||||
public WiredConditionNotFurniTypeMatch(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
@ -39,8 +39,7 @@ public class WiredConditionNotFurniTypeMatch extends InteractionWiredCondition {
|
||||
|
||||
if (stuff != null) {
|
||||
if (stuff.length >= 1) {
|
||||
if (stuff[0] instanceof HabboItem) {
|
||||
HabboItem triggeringItem = (HabboItem)stuff[0];
|
||||
if (stuff[0] instanceof HabboItem triggeringItem) {
|
||||
return this.items.stream().noneMatch(item -> item == triggeringItem);
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public class WiredEffectBotTeleport extends InteractionWiredEffect {
|
||||
}
|
||||
}
|
||||
|
||||
Emulator.getThreading().run(() -> { roomUnit.isWiredTeleporting = true; }, Math.max(0, WiredHandler.TELEPORT_DELAY - 500));
|
||||
Emulator.getThreading().run(() -> roomUnit.isWiredTeleporting = true, Math.max(0, WiredHandler.TELEPORT_DELAY - 500));
|
||||
Emulator.getThreading().run(new RoomUnitTeleport(roomUnit, room, tile.getX(), tile.getY(), tile.getStackHeight() + (tile.getState() == RoomTileState.SIT ? -0.5 : 0), roomUnit.getEffectId()), WiredHandler.TELEPORT_DELAY);
|
||||
}
|
||||
|
||||
|
@ -263,23 +263,16 @@ public class WiredEffectChangeFurniDirection extends InteractionWiredEffect {
|
||||
}
|
||||
|
||||
private RoomUserRotation nextRotation(RoomUserRotation currentRotation) {
|
||||
switch (this.blockedAction) {
|
||||
case ACTION_TURN_BACK:
|
||||
return RoomUserRotation.fromValue(currentRotation.getValue()).getOpposite();
|
||||
case ACTION_TURN_LEFT_45:
|
||||
return RoomUserRotation.counterClockwise(currentRotation);
|
||||
case ACTION_TURN_LEFT_90:
|
||||
return RoomUserRotation.counterClockwise(RoomUserRotation.counterClockwise(currentRotation));
|
||||
case ACTION_TURN_RIGHT_45:
|
||||
return RoomUserRotation.clockwise(currentRotation);
|
||||
case ACTION_TURN_RIGHT_90:
|
||||
return RoomUserRotation.clockwise(RoomUserRotation.clockwise(currentRotation));
|
||||
case ACTION_TURN_RANDOM:
|
||||
return RoomUserRotation.fromValue(Emulator.getRandom().nextInt(8));
|
||||
case ACTION_WAIT:
|
||||
default:
|
||||
return currentRotation;
|
||||
}
|
||||
return switch (this.blockedAction) {
|
||||
case ACTION_TURN_BACK -> RoomUserRotation.fromValue(currentRotation.getValue()).getOpposite();
|
||||
case ACTION_TURN_LEFT_45 -> RoomUserRotation.counterClockwise(currentRotation);
|
||||
case ACTION_TURN_LEFT_90 ->
|
||||
RoomUserRotation.counterClockwise(RoomUserRotation.counterClockwise(currentRotation));
|
||||
case ACTION_TURN_RIGHT_45 -> RoomUserRotation.clockwise(currentRotation);
|
||||
case ACTION_TURN_RIGHT_90 -> RoomUserRotation.clockwise(RoomUserRotation.clockwise(currentRotation));
|
||||
case ACTION_TURN_RANDOM -> RoomUserRotation.fromValue(Emulator.getRandom().nextInt(8));
|
||||
case ACTION_WAIT, default -> currentRotation;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,7 +27,7 @@ public class WiredEffectGiveHandItem extends WiredEffectWhisper {
|
||||
if (habbo != null) {
|
||||
room.giveHandItem(habbo, itemId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
@ -13,7 +12,6 @@ import com.eu.habbo.habbohotel.wired.WiredEffectType;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.outgoing.hotelview.BonusRareInfoMessageComposer;
|
||||
import gnu.trove.procedure.TObjectProcedure;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@ -48,14 +46,11 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
|
||||
|
||||
if (this.requiresTriggeringUser()) {
|
||||
List<Integer> invalidTriggers = new ArrayList<>();
|
||||
room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure<InteractionWiredTrigger>() {
|
||||
@Override
|
||||
public boolean execute(InteractionWiredTrigger object) {
|
||||
room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
|
||||
if (!object.isTriggeredByRoomUnit()) {
|
||||
invalidTriggers.add(object.getBaseItem().getSpriteId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
message.appendInt(invalidTriggers.size());
|
||||
for (Integer i : invalidTriggers) {
|
||||
@ -119,7 +114,7 @@ public class WiredEffectGiveHotelviewBonusRarePoints extends InteractionWiredEff
|
||||
|
||||
try {
|
||||
this.amount = Integer.parseInt(wiredData.split("\t")[1]);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class WiredEffectGiveRespect extends InteractionWiredEffect {
|
||||
|
||||
try {
|
||||
this.respects = Integer.parseInt(data[1]);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,6 @@ import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.permissions.Permission;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
@ -18,7 +17,6 @@ import com.eu.habbo.messages.ServerMessage;
|
||||
import com.eu.habbo.messages.incoming.wired.WiredSaveException;
|
||||
import com.eu.habbo.messages.outgoing.rooms.users.WhisperMessageComposer;
|
||||
import com.eu.habbo.threading.runnables.RoomUnitKick;
|
||||
import gnu.trove.procedure.TObjectProcedure;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@ -129,14 +127,11 @@ public class WiredEffectKickHabbo extends InteractionWiredEffect {
|
||||
|
||||
if (this.requiresTriggeringUser()) {
|
||||
List<Integer> invalidTriggers = new ArrayList<>();
|
||||
room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure<InteractionWiredTrigger>() {
|
||||
@Override
|
||||
public boolean execute(InteractionWiredTrigger object) {
|
||||
room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
|
||||
if (!object.isTriggeredByRoomUnit()) {
|
||||
invalidTriggers.add(object.getBaseItem().getSpriteId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
message.appendInt(invalidTriggers.size());
|
||||
for (Integer i : invalidTriggers) {
|
||||
|
@ -197,7 +197,7 @@ public class WiredEffectMoveFurniTo extends InteractionWiredEffect {
|
||||
this.direction = Integer.parseInt(data[0]);
|
||||
this.spacing = Integer.parseInt(data[1]);
|
||||
this.setDelay(Integer.parseInt(data[2]));
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
for (String s : data[3].split("\r")) {
|
||||
|
@ -106,7 +106,7 @@ public class WiredEffectMuteHabbo extends InteractionWiredEffect {
|
||||
this.setDelay(Integer.parseInt(data[0]));
|
||||
this.length = Integer.parseInt(data[1]);
|
||||
this.message = data[2];
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,14 +48,11 @@ public class WiredEffectResetTimers extends InteractionWiredEffect {
|
||||
|
||||
if (this.requiresTriggeringUser()) {
|
||||
List<Integer> invalidTriggers = new ArrayList<>();
|
||||
room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure<InteractionWiredTrigger>() {
|
||||
@Override
|
||||
public boolean execute(InteractionWiredTrigger object) {
|
||||
room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
|
||||
if (!object.isTriggeredByRoomUnit()) {
|
||||
invalidTriggers.add(object.getBaseItem().getSpriteId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
message.appendInt(invalidTriggers.size());
|
||||
for (Integer i : invalidTriggers) {
|
||||
@ -98,7 +95,7 @@ public class WiredEffectResetTimers extends InteractionWiredEffect {
|
||||
if (!wiredData.equals("")) {
|
||||
this.delay = Integer.parseInt(wiredData);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,14 +53,11 @@ public class WiredEffectWhisper extends InteractionWiredEffect {
|
||||
|
||||
if (this.requiresTriggeringUser()) {
|
||||
List<Integer> invalidTriggers = new ArrayList<>();
|
||||
room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(new TObjectProcedure<InteractionWiredTrigger>() {
|
||||
@Override
|
||||
public boolean execute(InteractionWiredTrigger object) {
|
||||
room.getRoomSpecialTypes().getTriggers(this.getX(), this.getY()).forEach(object -> {
|
||||
if (!object.isTriggeredByRoomUnit()) {
|
||||
invalidTriggers.add(object.getBaseItem().getSpriteId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
message.appendInt(invalidTriggers.size());
|
||||
for (Integer i : invalidTriggers) {
|
||||
|
@ -4,8 +4,8 @@ import com.eu.habbo.habbohotel.wired.WiredMatchFurniSetting;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
|
||||
public interface InteractionWiredMatchFurniSettings {
|
||||
public THashSet<WiredMatchFurniSetting> getMatchFurniSettings();
|
||||
public boolean shouldMatchState();
|
||||
public boolean shouldMatchRotation();
|
||||
public boolean shouldMatchPosition();
|
||||
THashSet<WiredMatchFurniSetting> getMatchFurniSettings();
|
||||
boolean shouldMatchState();
|
||||
boolean shouldMatchRotation();
|
||||
boolean shouldMatchPosition();
|
||||
}
|
||||
|
@ -1,14 +1,12 @@
|
||||
package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import gnu.trove.procedure.TObjectProcedure;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@ -60,18 +58,15 @@ public class WiredTriggerGameStarts extends InteractionWiredTrigger {
|
||||
message.appendString("");
|
||||
message.appendInt(0);
|
||||
message.appendInt(0);
|
||||
message.appendInt(this.type.getCode());
|
||||
message.appendInt(type.getCode());
|
||||
|
||||
if (!this.isTriggeredByRoomUnit()) {
|
||||
List<Integer> invalidTriggers = new ArrayList<>();
|
||||
room.getRoomSpecialTypes().getEffects(this.getX(), this.getY()).forEach(new TObjectProcedure<InteractionWiredEffect>() {
|
||||
@Override
|
||||
public boolean execute(InteractionWiredEffect object) {
|
||||
room.getRoomSpecialTypes().getEffects(this.getX(), this.getY()).forEach(object -> {
|
||||
if (object.requiresTriggeringUser()) {
|
||||
invalidTriggers.add(object.getBaseItem().getSpriteId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
message.appendInt(invalidTriggers.size());
|
||||
for (Integer i : invalidTriggers) {
|
||||
|
@ -20,7 +20,7 @@ import java.util.stream.Collectors;
|
||||
public class WiredTriggerHabboWalkOffFurni extends InteractionWiredTrigger {
|
||||
public static final WiredTriggerType type = WiredTriggerType.WALKS_OFF_FURNI;
|
||||
|
||||
private THashSet<HabboItem> items;
|
||||
private final THashSet<HabboItem> items;
|
||||
|
||||
public WiredTriggerHabboWalkOffFurni(ResultSet set, Item baseItem) throws SQLException {
|
||||
super(set, baseItem);
|
||||
@ -76,7 +76,7 @@ public class WiredTriggerHabboWalkOffFurni extends InteractionWiredTrigger {
|
||||
|
||||
if (item != null)
|
||||
this.items.add(item);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class WiredTriggerHabboWalkOnFurni extends InteractionWiredTrigger {
|
||||
|
||||
if (item != null)
|
||||
this.items.add(item);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ package com.eu.habbo.habbohotel.items.interactions.wired.triggers;
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.items.ICycleable;
|
||||
import com.eu.habbo.habbohotel.items.Item;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredEffect;
|
||||
import com.eu.habbo.habbohotel.items.interactions.InteractionWiredTrigger;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredSettings;
|
||||
import com.eu.habbo.habbohotel.items.interactions.wired.WiredTriggerReset;
|
||||
@ -12,7 +11,6 @@ import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.messages.ServerMessage;
|
||||
import gnu.trove.procedure.TObjectProcedure;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
@ -88,14 +86,11 @@ public class WiredTriggerRepeaterLong extends InteractionWiredTrigger implements
|
||||
|
||||
if (!this.isTriggeredByRoomUnit()) {
|
||||
List<Integer> invalidTriggers = new ArrayList<>();
|
||||
room.getRoomSpecialTypes().getEffects(this.getX(), this.getY()).forEach(new TObjectProcedure<InteractionWiredEffect>() {
|
||||
@Override
|
||||
public boolean execute(InteractionWiredEffect object) {
|
||||
room.getRoomSpecialTypes().getEffects(this.getX(), this.getY()).forEach(object -> {
|
||||
if (object.requiresTriggeringUser()) {
|
||||
invalidTriggers.add(object.getBaseItem().getSpriteId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
message.appendInt(invalidTriggers.size());
|
||||
for (Integer i : invalidTriggers) {
|
||||
|
@ -53,7 +53,7 @@ public class WiredTriggerScoreAchieved extends InteractionWiredTrigger {
|
||||
} else {
|
||||
try {
|
||||
this.score = Integer.parseInt(wiredData);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,6 @@ public class PetCommand implements Comparable<PetCommand> {
|
||||
}
|
||||
|
||||
pet.say(pet.petData.randomVocal(PetVocalsType.DISOBEY));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.threading.runnables.PetClearPosture;
|
||||
|
||||
public class ActionCroak extends PetAction {
|
||||
public class ActionCroak extends ActionVocals {
|
||||
public ActionCroak() {
|
||||
super(PetTasks.SPEAK, false);
|
||||
this.minimumActionDuration = 2000;
|
||||
@ -21,19 +21,10 @@ public class ActionCroak extends PetAction {
|
||||
|
||||
Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.CROAK, null, false), this.minimumActionDuration);
|
||||
|
||||
if (pet.getHappiness() > 70)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_HAPPY));
|
||||
else if (pet.getHappiness() < 30)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_SAD));
|
||||
else if (pet.getLevelHunger() > 65)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.HUNGRY));
|
||||
else if (pet.getLevelThirst() > 65)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.THIRSTY));
|
||||
else if (pet.getEnergy() < 25)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.TIRED));
|
||||
else if (pet.getTask() == PetTasks.NEST || pet.getTask() == PetTasks.DOWN)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.SLEEPING));
|
||||
petSay(pet);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import com.eu.habbo.habbohotel.rooms.RoomUnitStatus;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.threading.runnables.PetClearPosture;
|
||||
|
||||
public class ActionSpeak extends PetAction {
|
||||
public class ActionSpeak extends ActionVocals {
|
||||
public ActionSpeak() {
|
||||
super(PetTasks.SPEAK, false);
|
||||
|
||||
@ -21,18 +21,7 @@ public class ActionSpeak extends PetAction {
|
||||
pet.setMuted(false);
|
||||
Emulator.getThreading().run(new PetClearPosture(pet, RoomUnitStatus.SPEAK, null, false), 2000);
|
||||
|
||||
if (pet.getHappiness() > 70)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_HAPPY));
|
||||
else if (pet.getHappiness() < 30)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_SAD));
|
||||
else if (pet.getLevelHunger() > 65)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.HUNGRY));
|
||||
else if (pet.getLevelThirst() > 65)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.THIRSTY));
|
||||
else if (pet.getEnergy() < 25)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.TIRED));
|
||||
else if (pet.getTask() == PetTasks.NEST || pet.getTask() == PetTasks.DOWN)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.SLEEPING));
|
||||
petSay(pet);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
package com.eu.habbo.habbohotel.pets.actions;
|
||||
|
||||
import com.eu.habbo.habbohotel.pets.Pet;
|
||||
import com.eu.habbo.habbohotel.pets.PetAction;
|
||||
import com.eu.habbo.habbohotel.pets.PetTasks;
|
||||
import com.eu.habbo.habbohotel.pets.PetVocalsType;
|
||||
|
||||
public abstract class ActionVocals extends PetAction {
|
||||
|
||||
protected ActionVocals(PetTasks petTask, boolean stopsPetWalking) {
|
||||
super(petTask, stopsPetWalking);
|
||||
}
|
||||
|
||||
protected void petSay(Pet pet) {
|
||||
if (pet.getHappiness() > 70)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_HAPPY));
|
||||
else if (pet.getHappiness() < 30)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.GENERIC_SAD));
|
||||
else if (pet.getLevelHunger() > 65)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.HUNGRY));
|
||||
else if (pet.getLevelThirst() > 65)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.THIRSTY));
|
||||
else if (pet.getEnergy() < 25)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.TIRED));
|
||||
else if (pet.getTask() == PetTasks.NEST || pet.getTask() == PetTasks.DOWN)
|
||||
pet.say(pet.getPetData().randomVocal(PetVocalsType.SLEEPING));
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ public class Poll {
|
||||
@Setter
|
||||
private int lastQuestionId;
|
||||
|
||||
private ArrayList<PollQuestion> questions;
|
||||
private final ArrayList<PollQuestion> questions;
|
||||
|
||||
public Poll(ResultSet set) throws SQLException {
|
||||
this.id = set.getInt("id");
|
||||
|
@ -14,7 +14,7 @@ public class CustomRoomLayout extends RoomLayout implements Runnable {
|
||||
private final int roomId;
|
||||
private boolean needsUpdate;
|
||||
|
||||
public CustomRoomLayout(ResultSet set, Room room) throws SQLException {
|
||||
public CustomRoomLayout(ResultSet set, Room room) {
|
||||
super(set, room);
|
||||
|
||||
this.roomId = room.getId();
|
||||
|
@ -85,7 +85,7 @@ public class RoomChatMessage implements Runnable, ISerialize, DatabaseLoggable {
|
||||
this.targetHabbo = chatMessage.getTargetHabbo();
|
||||
this.bubble = chatMessage.getBubble();
|
||||
this.roomUnitId = chatMessage.roomUnitId;
|
||||
this.emotion = (byte) chatMessage.getEmotion();
|
||||
this.emotion = chatMessage.getEmotion();
|
||||
}
|
||||
|
||||
public RoomChatMessage(String message, RoomUnit roomUnit, RoomChatMessageBubbles bubble) {
|
||||
|
@ -331,6 +331,7 @@ public class HabboInfo implements Runnable {
|
||||
roomUnit.stopWalking();
|
||||
if (room != null)
|
||||
room.sendComposer(new UserUpdateComposer(roomUnit).compose());
|
||||
|
||||
List<RoomTile> availableTiles = isRemoving ? new ArrayList<>() : this.getCurrentRoom().getLayout().getWalkableTilesAround(roomUnit.getCurrentLocation());
|
||||
|
||||
RoomTile tile = availableTiles.isEmpty() ? roomUnit.getCurrentLocation() : availableTiles.get(0);
|
||||
|
@ -37,6 +37,7 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public abstract class HabboItem implements Runnable, IEventTriggers {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final Class[] TOGGLING_INTERACTIONS = new Class[]{
|
||||
InteractionGameTimer.class,
|
||||
InteractionWired.class,
|
||||
|
@ -176,7 +176,7 @@ public class PacketManager {
|
||||
return;
|
||||
}
|
||||
|
||||
final MessageHandler handler = handlerClass.newInstance();
|
||||
final MessageHandler handler = handlerClass.getDeclaredConstructor().newInstance();
|
||||
|
||||
if (handler.getRatelimit() > 0) {
|
||||
if (client.messageTimestamps.containsKey(handlerClass) && System.currentTimeMillis() - client.messageTimestamps.get(handlerClass) < handler.getRatelimit()) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user