mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-18 23:46:28 +01:00
Merge branch 'ms4-unstable' into 'ms4-unstable'
ChangeNameCommand now allows you to Name Change others. See merge request morningstar/Arcturus-Community!558
This commit is contained in:
commit
eb6bf8f6c6
3
sqlupdates/3_5_0 to 4_0_0.sql
Normal file
3
sqlupdates/3_5_0 to 4_0_0.sql
Normal file
@ -0,0 +1,3 @@
|
||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.error.cmd_changename.user_not_found', 'The Habbo %user% does not exist or is not online.');
|
||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.succes.cmd_changename.done', 'Successfully toggled the name change for the Habbo %user%.');
|
||||
INSERT INTO `emulator_texts` (`key`, `value`) VALUES ('commands.succes.cmd_changename.received', 'Hotel staff requests for you to change your name.\n Please click on your Habbo then click on the "Change Your Name" button.');
|
@ -2,6 +2,7 @@ package com.eu.habbo.habbohotel.commands;
|
||||
|
||||
import com.eu.habbo.Emulator;
|
||||
import com.eu.habbo.habbohotel.gameclients.GameClient;
|
||||
import com.eu.habbo.habbohotel.users.Habbo;
|
||||
import com.eu.habbo.messages.outgoing.users.UserObjectComposer;
|
||||
|
||||
public class ChangeNameCommand extends Command {
|
||||
@ -11,8 +12,27 @@ public class ChangeNameCommand extends Command {
|
||||
|
||||
@Override
|
||||
public boolean handle(GameClient gameClient, String[] params) throws Exception {
|
||||
gameClient.getHabbo().getHabboStats().allowNameChange = !gameClient.getHabbo().getHabboStats().allowNameChange;
|
||||
gameClient.sendResponse(new UserObjectComposer(gameClient.getHabbo()));
|
||||
|
||||
// check if there are no params
|
||||
if (params.length < 2) {
|
||||
gameClient.getHabbo().getHabboStats().allowNameChange = !gameClient.getHabbo().getHabboStats().allowNameChange;
|
||||
gameClient.sendResponse(new UserObjectComposer(gameClient.getHabbo()));
|
||||
return true;
|
||||
}
|
||||
|
||||
// check if the habbo exists or is online
|
||||
Habbo habbo = Emulator.getGameEnvironment().getHabboManager().getHabbo(params[1]);
|
||||
|
||||
if ( habbo == null) {
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.error.cmd_changename.user_not_found").replace("%user%", params[1]));
|
||||
return true;
|
||||
}
|
||||
|
||||
// this runs if params[1] is a valid habbo
|
||||
gameClient.getHabbo().whisper(Emulator.getTexts().getValue("commands.succes.cmd_changename.done").replace("%user%", params[1]));
|
||||
habbo.alert(Emulator.getTexts().getValue("commands.succes.cmd_changename.received"));
|
||||
habbo.getHabboStats().allowNameChange = !habbo.getHabboStats().allowNameChange;
|
||||
habbo.getClient().sendResponse(new UserObjectComposer(habbo));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user