This repository has been archived by the owner on Feb 24, 2024. It is now read-only.
forked from Minestom/Minestom
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into patch/oop-api
- Loading branch information
Showing
11 changed files
with
111 additions
and
40 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
29 changes: 29 additions & 0 deletions
29
demo/src/main/java/net/minestom/demo/commands/SetEntityType.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 net.minestom.demo.commands; | ||
|
||
import net.minestom.server.command.CommandSender; | ||
import net.minestom.server.command.builder.Command; | ||
import net.minestom.server.command.builder.CommandContext; | ||
import net.minestom.server.command.builder.arguments.ArgumentType; | ||
import net.minestom.server.command.builder.arguments.minecraft.registry.ArgumentEntityType; | ||
import net.minestom.server.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class SetEntityType extends Command { | ||
private final ArgumentEntityType entityTypeArg = ArgumentType.EntityType("type"); | ||
|
||
public SetEntityType() { | ||
super("setentitytype"); | ||
|
||
addSyntax(this::execute, entityTypeArg); | ||
} | ||
|
||
private void execute(@NotNull CommandSender sender, @NotNull CommandContext context) { | ||
if (!(sender instanceof Player player)) { | ||
return; | ||
} | ||
|
||
var entityType = context.get(entityTypeArg); | ||
player.switchEntityType(entityType); | ||
player.sendMessage("set entity type to " + entityType); | ||
} | ||
} |
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
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
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