mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-31 12:22:36 +01:00
Fix merge request
This commit is contained in:
parent
418bc882fa
commit
a20dc373d7
@ -18,3 +18,6 @@ INSERT INTO `emulator_settings`(`key`, `value`) VALUES ('hotel.allow.ignore.staf
|
|||||||
INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('error.bots.max.inventory', 'You can\'t buy or pickup anymore bots until you place some, the maximum amount of bots you are allowed is %amount%.');
|
INSERT INTO `emulator_texts`(`key`, `value`) VALUES ('error.bots.max.inventory', 'You can\'t buy or pickup anymore bots until you place some, the maximum amount of bots you are allowed is %amount%.');
|
||||||
|
|
||||||
UPDATE `emulator_texts` SET `value` = 'You\'ve reached the maximum amount of pets in your inventory! The Limit is %amount%!' WHERE `key` = 'error.pets.max.inventory';
|
UPDATE `emulator_texts` SET `value` = 'You\'ve reached the maximum amount of pets in your inventory! The Limit is %amount%!' WHERE `key` = 'error.pets.max.inventory';
|
||||||
|
|
||||||
|
-- Tradelock counter
|
||||||
|
ALTER TABLE `users_settings` ADD `tradelock_amount` INT(11) NOT NULL DEFAULT '0' AFTER `helper_level`;
|
@ -25,29 +25,31 @@ public class AllowTradingCommand extends Command {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params[2].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes")) || params[2].equalsIgnoreCase(Emulator.getTexts().getValue("generic.no"))) {
|
final String username = params[1];
|
||||||
String username = params[1];
|
final String option = params[2];
|
||||||
boolean enabled = params[2].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"));
|
|
||||||
|
|
||||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(username);
|
if (option.equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes")) || option.equalsIgnoreCase(Emulator.getTexts().getValue("generic.no"))) {
|
||||||
|
final boolean enabled = option.equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"));
|
||||||
|
final Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(username);
|
||||||
|
|
||||||
if (habbo != null) {
|
if (habbo != null) {
|
||||||
|
if (!enabled) {
|
||||||
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
|
||||||
|
PreparedStatement statement = connection.prepareStatement("UPDATE users_settings SET tradelock_amount = tradelock_amount + 1 WHERE user_id = ?")) {
|
||||||
|
statement.setInt(1, habbo.getHabboInfo().getId());
|
||||||
|
statement.executeUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
habbo.getHabboStats().setAllowTrade(enabled);
|
habbo.getHabboStats().setAllowTrade(enabled);
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")).replace("%username%", params[1]));
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")).replace("%username%", params[1]));
|
||||||
habbo.getClient().sendResponse(new UserPerksComposer(habbo));
|
habbo.getClient().sendResponse(new UserPerksComposer(habbo));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
boolean found;
|
boolean found;
|
||||||
if (enabled == params[2].equalsIgnoreCase(Emulator.getTexts().getValue("generic.yes"))) {
|
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection();
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings INNER JOIN users ON users.id = users_settings.id SET can_trade = ? WHERE users.username LIKE ?")) {
|
PreparedStatement statement = connection.prepareStatement("UPDATE users_settings INNER JOIN users ON users.id = users_settings.user_id SET can_trade = ?, tradelock_amount = tradelock_amount + ? WHERE users.username LIKE ?")) {
|
||||||
statement.setString(1, "1");
|
statement.setString(1, enabled ? "1" : "0");
|
||||||
statement.setString(2, username);
|
statement.setInt(2, enabled ? 0 : 1);
|
||||||
found = statement.executeUpdate() > 0;
|
|
||||||
}
|
|
||||||
} else if (enabled == params[2].equalsIgnoreCase(Emulator.getTexts().getValue("generic.no"))) {
|
|
||||||
try (Connection connection = Emulator.getDatabase().getDataSource().getConnection(); PreparedStatement statement = connection.prepareStatement("UPDATE users_settings INNER JOIN users ON users.id = users_settings.id SET can_trade = ?, tradelock_amount = tradelock_amount + ? WHERE users.username LIKE ?")) {
|
|
||||||
statement.setString(1, "0");
|
|
||||||
statement.setInt(2, 1);
|
|
||||||
statement.setString(3, username);
|
statement.setString(3, username);
|
||||||
found = statement.executeUpdate() > 0;
|
found = statement.executeUpdate() > 0;
|
||||||
}
|
}
|
||||||
@ -59,9 +61,7 @@ public class AllowTradingCommand extends Command {
|
|||||||
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")).replace("%username%", params[1]));
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_allow_trading." + (enabled ? "enabled" : "disabled")).replace("%username%", params[1]));
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_allow_trading.incorrect_setting").replace("%enabled%", Emulator.getTexts().getValue("generic.yes")).replace("%disabled%", Emulator.getTexts().getValue("generic.no")));
|
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_allow_trading.incorrect_setting").replace("%enabled%", Emulator.getTexts().getValue("generic.yes")).replace("%disabled%", Emulator.getTexts().getValue("generic.no")));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user