forked from Grasscutters/Grasscutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Grasscutters:development' into development
- Loading branch information
Showing
52 changed files
with
5,463 additions
and
173 deletions.
There are no files selected for viewing
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
Submodule Grasscutter-Protos
updated
from 0537e9 to dd1741
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
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
Binary file not shown.
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
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
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
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
29 changes: 29 additions & 0 deletions
29
src/main/java/emu/grasscutter/command/commands/ClearWeaponsCommand.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,29 @@ | ||
package emu.grasscutter.command.commands; | ||
|
||
import emu.grasscutter.command.Command; | ||
import emu.grasscutter.command.CommandHandler; | ||
import emu.grasscutter.game.GenshinPlayer; | ||
import emu.grasscutter.game.inventory.Inventory; | ||
import emu.grasscutter.game.inventory.ItemType; | ||
|
||
import java.util.List; | ||
|
||
@Command(label = "clearweapons", usage = "clearweapons", | ||
description = "Deletes all unequipped and unlocked weapons, including yellow rarity ones from your inventory", | ||
aliases = {"clearwpns"}, permission = "player.clearweapons") | ||
public final class ClearWeaponsCommand implements CommandHandler { | ||
|
||
@Override | ||
public void execute(GenshinPlayer sender, List<String> args) { | ||
if (sender == null) { | ||
CommandHandler.sendMessage(null, "Run this command in-game."); | ||
return; // TODO: clear player's weapons from console or other players | ||
} | ||
|
||
Inventory playerInventory = sender.getInventory(); | ||
playerInventory.getItems().values().stream() | ||
.filter(item -> item.getItemType() == ItemType.ITEM_WEAPON) | ||
.filter(item -> !item.isLocked() && !item.isEquipped()) | ||
.forEach(item -> playerInventory.removeItem(item, item.getCount())); | ||
} | ||
} |
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
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
43 changes: 43 additions & 0 deletions
43
src/main/java/emu/grasscutter/command/commands/TelePortCommand.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,43 @@ | ||
package emu.grasscutter.command.commands; | ||
|
||
import emu.grasscutter.command.Command; | ||
import emu.grasscutter.command.CommandHandler; | ||
import emu.grasscutter.game.GenshinPlayer; | ||
import emu.grasscutter.utils.Position; | ||
|
||
import java.util.List; | ||
|
||
@Command(label = "teleport", usage = "teleport <x> <y> <z>", aliases = {"tp"}, | ||
description = "Change the player's position.", permission = "player.teleport") | ||
public class TelePortCommand implements CommandHandler { | ||
|
||
@Override | ||
public void execute(GenshinPlayer sender, List<String> args) { | ||
if (sender == null) { | ||
CommandHandler.sendMessage(null, "Run this command in-game."); | ||
return; | ||
} | ||
|
||
if (args.size() < 3){ | ||
CommandHandler.sendMessage(sender, "Usage: /tp <x> <y> <z> [scene id]"); | ||
return; | ||
} | ||
|
||
try { | ||
float x = Float.parseFloat(args.get(0)); | ||
float y = Float.parseFloat(args.get(1)); | ||
float z = Float.parseFloat(args.get(2)); | ||
int sceneId = sender.getSceneId(); | ||
if (args.size() == 4){ | ||
sceneId = Integer.parseInt(args.get(3)); | ||
} | ||
Position target = new Position(x, y, z); | ||
boolean result = sender.getWorld().transferPlayerToScene(sender, sceneId, target); | ||
if (!result) { | ||
CommandHandler.sendMessage(sender, "Invalid position."); | ||
} | ||
} catch (NumberFormatException ignored) { | ||
CommandHandler.sendMessage(sender, "Invalid position."); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.