Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Beny 2019-05-15 17:36:51 +01:00
commit 577530ffe5
5 changed files with 48 additions and 6 deletions

View File

@ -0,0 +1,9 @@
#DATABASE UPDATE: 2.0.0 RC-2 -> 2.0.0 RC-3
INSERT INTO `emulator_settings` (`key`, `value`) VALUES ('commands.plugins.oldstyle', '0');
ALTER TABLE `emulator_errors`
ADD COLUMN `version` varchar(64) NOT NULL AFTER `timestamp`,
ADD COLUMN `build_hash` varchar(64) NOT NULL AFTER `version`;
#END DATABASE UPDATE: 2.0.0 RC-2 -> 2.0.0 RC-3

View File

@ -11,13 +11,20 @@ import java.sql.SQLException;
public class ErrorLog implements Loggable
{
public final static String insertQuery = "INSERT INTO emulator_errors (timestamp, type, stacktrace) VALUES (?, ?, ?)";
public final static String insertQuery = "INSERT INTO emulator_errors (timestamp, version, build_hash, type, stacktrace) VALUES (?, ?, ?, ?, ?)";
public final String version;
public final String buildHash;
public final int timeStamp;
public final String type;
public final String stackTrace;
public ErrorLog(String type, Throwable e)
{
this.version = Emulator.version;
this.buildHash = Emulator.version;
this.timeStamp = Emulator.getIntUnixTimestamp();
this.type = type;
@ -38,6 +45,9 @@ public class ErrorLog implements Loggable
public ErrorLog(String type, String message)
{
this.version = Emulator.version;
this.buildHash = Emulator.build;
this.timeStamp = Emulator.getIntUnixTimestamp();
this.type = type;
this.stackTrace = message;
@ -47,8 +57,10 @@ public class ErrorLog implements Loggable
public void log(PreparedStatement statement) throws SQLException
{
statement.setInt(1, this.timeStamp);
statement.setString(2, this.type);
statement.setString(3, this.stackTrace);
statement.setString(2, this.version);
statement.setString(3, this.buildHash);
statement.setString(4, this.type);
statement.setString(5, this.stackTrace);
statement.addBatch();
}
}

View File

@ -22,6 +22,10 @@ public class ConsoleInfoCommand extends ConsoleCommand
long second = TimeUnit.SECONDS.toSeconds(seconds) - (TimeUnit.SECONDS.toMinutes(seconds) *60);
System.out.println("Emulator version: " + Emulator.version);
System.out.println("Emulator build: " + Emulator.build);
System.out.println("");
System.out.println("Hotel Statistics");
System.out.println("- Users: " + Emulator.getGameEnvironment().getHabboManager().getOnlineCount());
System.out.println("- Rooms: " + Emulator.getGameEnvironment().getRoomManager().getActiveRooms().size());

View File

@ -2,9 +2,11 @@ package com.eu.habbo.habbohotel.commands;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.messages.outgoing.generic.alerts.GenericAlertComposer;
import com.eu.habbo.messages.outgoing.generic.alerts.MessagesForYouComposer;
import com.eu.habbo.plugin.HabboPlugin;
import java.util.Collections;
public class PluginsCommand extends Command
{
public PluginsCommand()
@ -22,7 +24,14 @@ public class PluginsCommand extends Command
message.append("\r").append(plugin.configuration.name).append(" By ").append(plugin.configuration.author);
}
if (Emulator.getConfig().getBoolean("commands.plugins.oldstyle"))
{
gameClient.sendResponse(new MessagesForYouComposer(Collections.singletonList(message.toString())));
} else
{
gameClient.getHabbo().alert(message.toString());
}
return true;
}

View File

@ -146,7 +146,15 @@ public class WiredEffectToggleFurni extends InteractionWiredEffect
{
if (item.getBaseItem().getStateCount() > 1 || item instanceof InteractionGameTimer)
{
item.onClick(habbo != null && !(item instanceof InteractionGameTimer) ? habbo.getClient() : null, room, new Object[]{item.getExtradata().length() == 0 ? 0 : Integer.valueOf(item.getExtradata()), this.getType()});
int state = 0;
if (!item.getExtradata().isEmpty()) {
try {
state = Integer.valueOf(item.getExtradata()); // assumes that extradata is state, could be something else for trophies etc.
} catch (NumberFormatException ignored) {
}
}
item.onClick(habbo != null && !(item instanceof InteractionGameTimer) ? habbo.getClient() : null, room, new Object[]{state, this.getType()});
}
}
catch (Exception e)