Skip to content

Commit 2e1c950

Browse files
authored
GH-995 Add /fireball command (#1103)
1 parent 50669a6 commit 2e1c950

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.eternalcode.core.feature.fireball;
2+
3+
import com.eternalcode.annotations.scan.command.DescriptionDocs;
4+
import dev.rollczi.litecommands.annotations.argument.Arg;
5+
import dev.rollczi.litecommands.annotations.command.Command;
6+
import dev.rollczi.litecommands.annotations.context.Sender;
7+
import dev.rollczi.litecommands.annotations.execute.Execute;
8+
import dev.rollczi.litecommands.annotations.permission.Permission;
9+
import org.bukkit.entity.Fireball;
10+
import org.bukkit.entity.Player;
11+
12+
import java.util.Optional;
13+
14+
@Command(name = "fireball")
15+
@Permission("eternalcore.fireball")
16+
public class FireballCommand {
17+
18+
private static final double DEFAULT_SPEED = 2.0D;
19+
20+
@Execute
21+
@DescriptionDocs(description = "Launch a fireball in the direction you are looking", arguments = "[speed]")
22+
void execute(@Sender Player sender, @Arg Optional<Double> speed) {
23+
double fireballSpeed = speed.orElse(DEFAULT_SPEED);
24+
sender.launchProjectile(Fireball.class, sender.getLocation().getDirection().multiply(fireballSpeed));
25+
}
26+
}

0 commit comments

Comments
 (0)