forked from Grasscutters/Grasscutter
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
亡灵暴龙大帝
committed
Jul 1, 2024
1 parent
afc41ab
commit 7fc56e6
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/main/java/emu/grasscutter/command/commands/WindyCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// From https://github.com/XeonSucksLAB/UnknownAnimeGamePS | ||
package emu.grasscutter.command.commands; | ||
|
||
import emu.grasscutter.command.Command; | ||
import emu.grasscutter.command.CommandHandler; | ||
import emu.grasscutter.game.player.Player; | ||
import emu.grasscutter.server.packet.send.PacketWindSeedClientNotify; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Paths; | ||
import java.util.List; | ||
|
||
@Command( | ||
label = "windy", | ||
usage = {"[<lua>]"}, | ||
permission = "server.windy", | ||
targetRequirement = Command.TargetRequirement.PLAYER) | ||
public final class WindyCommand implements CommandHandler { | ||
|
||
@Override | ||
public void execute(Player sender, Player targetPlayer, List<String> args) { | ||
// Send windy packet | ||
var fullpath = Paths.get(".").toAbsolutePath().normalize().resolve("lua").resolve(args.get(0)); | ||
|
||
try { | ||
byte[] bytecode = Files.readAllBytes(fullpath); | ||
targetPlayer.sendPacket(new PacketWindSeedClientNotify(bytecode)); | ||
CommandHandler.sendMessage(sender, "Read BYTECODE from Lua script: " + fullpath); | ||
} catch (IOException e) { | ||
CommandHandler.sendMessage(sender, "Error reading Lua script: " + e.getMessage()); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters