mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-13 05:44:36 +01:00
(a bit broken) level command
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package emu.lunarcore.command.commands;
|
||||
|
||||
import emu.lunarcore.util.Utils;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.command.Command;
|
||||
import emu.lunarcore.command.CommandArgs;
|
||||
import emu.lunarcore.command.CommandHandler;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
|
||||
@Command(label = "setlevel", aliases = {"level"}, permission = "player.setlevel", desc = "/setlevel - Set your Equilibrium level.")
|
||||
public class SetLevelCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
public void execute(Player sender, CommandArgs args) {
|
||||
int targetLevel = Utils.parseSafeInt(args.get(0));
|
||||
sender.setLevel(targetLevel);
|
||||
|
||||
this.sendMessage(sender, "Set level to "+args.get(0));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -188,6 +188,16 @@ public class Player {
|
||||
public Account getAccount() {
|
||||
return session.getAccount();
|
||||
}
|
||||
|
||||
public void setLevel(int newLevel) {
|
||||
if (newLevel >= 71) {
|
||||
newLevel = 70;
|
||||
}
|
||||
this.level = (newLevel);
|
||||
this.exp = 0;
|
||||
this.sendPacket(new PacketPlayerSyncScNotify(this));
|
||||
this.save();
|
||||
}
|
||||
|
||||
public boolean isOnline() {
|
||||
return this.getSession() != null && this.loggedIn;
|
||||
|
||||
Reference in New Issue
Block a user