aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/Main.hx
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2025-02-12 11:33:18 +0300
committerRblSb <msrblsb@gmail.com>2025-02-13 06:42:50 +0300
commit74244ebef3e3e4cbd9af50ca19af2affb39ba0f1 (patch)
treebcb763cc38a7c69c748a5523f3e1db7aa8f05d32 /src/client/Main.hx
parent82a6c65d46e2583883b1b01d706145386308d19e (diff)
Add /volume command
Diffstat (limited to 'src/client/Main.hx')
-rw-r--r--src/client/Main.hx17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/client/Main.hx b/src/client/Main.hx
index 72a619a..660693b 100644
--- a/src/client/Main.hx
+++ b/src/client/Main.hx
@@ -824,7 +824,7 @@ class Main {
public function userLogin(name:String, password:String):Void {
if (config.salt == null) return;
if (password.length == 0) return;
- if (name.length == 0) return;
+ if (name.length == 0) name = settings.name;
final hash = Sha256.encode(password + config.salt);
loginRequest(name, hash);
settings.hash = hash;
@@ -1277,6 +1277,21 @@ class Main {
case "ad":
player.skipAd();
return false;
+ case "volume":
+ var v = Std.parseFloat(args[0]);
+ if (Math.isNaN(v)) v = 1;
+ v = v.clamp(0, 3);
+ final wasNotFull = player.getVolume() < 1;
+ player.setVolume(v.clamp(0, 1));
+
+ if (player.getPlayerType() != RawType) return true;
+ if (wasNotFull && v > 1) {
+ serverMessage("Volume was not maxed yet to be boosted, you can send command again.");
+ return true;
+ }
+ final rawPlayer = @:privateAccess player.rawPlayer;
+ rawPlayer.boostVolume(v);
+ return true;
case "dump":
send({type: Dump});
return true;
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage