Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
import com.eternalcode.core.feature.afk.AfkService;
import dev.rollczi.litecommands.annotations.argument.Arg;
import dev.rollczi.litecommands.annotations.command.Command;
import dev.rollczi.litecommands.annotations.context.Context;
import dev.rollczi.litecommands.annotations.context.Sender;
import dev.rollczi.litecommands.annotations.execute.Execute;
import org.bukkit.entity.Player;

import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.UUID;
import org.bukkit.entity.Player;

@Command(name = "api afk")
public class ApiAfkCommand {
Expand All @@ -28,14 +27,14 @@ public ApiAfkCommand(AfkService afkService) {
}

@Execute(name = "isafk")
void execute(@Context Player player, @Arg Player target) {
void execute(@Sender Player player, @Arg Player target) {
boolean afk = this.afkService.isAfk(target.getUniqueId());
String message = "Player %s is %s afk, used via eternalcore api bridge!";
player.sendMessage(String.format(message, target.getName(), afk ? "now" : "not"));
}

@Execute(name = "setafk")
void executeSetAfk(@Context Player player, @Arg Player target) {
void executeSetAfk(@Sender Player player, @Arg Player target) {
Afk afk = this.afkService.markAfk(target.getUniqueId(), AfkReason.COMMAND);

AfkReason afkReason = afk.getAfkReason();
Expand All @@ -53,14 +52,14 @@ void executeSetAfk(@Context Player player, @Arg Player target) {
}

@Execute(name = "removeafk")
void executeRemoveAfk(@Context Player player, @Arg Player target) {
void executeRemoveAfk(@Sender Player player, @Arg Player target) {
this.afkService.clearAfk(target.getUniqueId());
String message = "You have removed %s from afk via eternalcore api bridge!";
player.sendMessage(String.format(message, target.getName()));
}

@Execute(name = "addinteraction")
void executeMarkInteraction(@Context Player player, @Arg Player target, @Arg int interactions) {
void executeMarkInteraction(@Sender Player player, @Arg Player target, @Arg int interactions) {
for (int i = 0; i < interactions; i++) {
this.afkService.markInteraction(target.getUniqueId());
}
Expand All @@ -71,7 +70,7 @@ void executeMarkInteraction(@Context Player player, @Arg Player target, @Arg int
}

@Execute(name = "demo")
void executeDemo(@Context Player player) {
void executeDemo(@Sender Player player) {
player.showDemoScreen();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.eternalcode.core.feature.home.HomeService;
import dev.rollczi.litecommands.annotations.argument.Arg;
import dev.rollczi.litecommands.annotations.command.Command;
import dev.rollczi.litecommands.annotations.context.Context;
import dev.rollczi.litecommands.annotations.context.Sender;
import dev.rollczi.litecommands.annotations.execute.Execute;
import org.bukkit.Location;
import org.bukkit.entity.Player;
Expand All @@ -18,13 +18,13 @@ public ApiHomeCommand(HomeService homeService) {
}

@Execute(name = "set")
void executeSet(@Context Player player, @Arg("homeName") String homeName) {
void executeSet(@Sender Player player, @Arg("homeName") String homeName) {
this.homeService.createHome(player.getUniqueId(), homeName, player.getLocation());
player.sendMessage("Home set!");
}

@Execute(name = "teleport")
void executeTeleport(@Context Player player, @Arg("homeName") String homeName) {
void executeTeleport(@Sender Player player, @Arg("homeName") String homeName) {
Location location = this.homeService.getHome(player.getUniqueId(), homeName)
.map(home -> home.getLocation())
.orElse(null);
Expand All @@ -39,13 +39,13 @@ void executeTeleport(@Context Player player, @Arg("homeName") String homeName) {
}

@Execute(name = "delete")
void executeDelete(@Context Player player, @Arg("homeName") String homeName) {
void executeDelete(@Sender Player player, @Arg("homeName") String homeName) {
this.homeService.deleteHome(player.getUniqueId(), homeName);
player.sendMessage("Home deleted!");
}

@Execute(name = "list")
void executeList(@Context Player player) {
void executeList(@Sender Player player) {
player.sendMessage("Your homes:");
this.homeService.getHomes(player.getUniqueId())
.forEach(home -> player.sendMessage(home.getName()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.eternalcode.core.feature.ignore.IgnoreService;
import dev.rollczi.litecommands.annotations.argument.Arg;
import dev.rollczi.litecommands.annotations.command.Command;
import dev.rollczi.litecommands.annotations.context.Context;
import dev.rollczi.litecommands.annotations.context.Sender;
import dev.rollczi.litecommands.annotations.execute.Execute;
import org.bukkit.entity.Player;

Expand All @@ -17,27 +17,27 @@ public ApiIgnoreCommand(IgnoreService ignoreService) {
}

@Execute(name = "ignore")
void executeIgnore(@Context Player player, @Arg Player target) {
void executeIgnore(@Sender Player player, @Arg Player target) {
this.ignoreService.ignore(player.getUniqueId(), target.getUniqueId());
String message = "You have ignored %s via eternalcore api bridge!";
player.sendMessage(String.format(message, target.getName()));
}

@Execute(name = "unignore")
void executeUnignore(@Context Player player, @Arg Player target) {
void executeUnignore(@Sender Player player, @Arg Player target) {
this.ignoreService.unIgnore(player.getUniqueId(), target.getUniqueId());
String message = "You have unignored %s via eternalcore api bridge!";
player.sendMessage(String.format(message, target.getName()));
}

@Execute(name = "ignoreall")
void executeIgnoreAll(@Context Player player) {
void executeIgnoreAll(@Sender Player player) {
this.ignoreService.ignoreAll(player.getUniqueId());
player.sendMessage("You have ignored all players via eternalcore api bridge!");
}

@Execute(name = "unignoreall")
void executeUnignoreAll(@Context Player player) {
void executeUnignoreAll(@Sender Player player) {
this.ignoreService.unIgnoreAll(player.getUniqueId());
player.sendMessage("You have unignored all players via eternalcore api bridge!");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.eternalcode.core.feature.jail.JailService;
import dev.rollczi.litecommands.annotations.command.Command;
import dev.rollczi.litecommands.annotations.context.Context;
import dev.rollczi.litecommands.annotations.context.Sender;
import dev.rollczi.litecommands.annotations.execute.Execute;
import org.bukkit.entity.Player;

Expand All @@ -19,7 +19,7 @@ public ApiJailCommand(JailService jailService) {
* This method allows jailed player to buy freedom for 1 exp.
*/
@Execute(name = "buy freedom")
void executeBuyFreedom(@Context Player player) {
void executeBuyFreedom(@Sender Player player) {
if (!this.jailService.isPlayerJailed(player.getUniqueId())) {
player.sendMessage("You are not jailed!");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.eternalcode.core.feature.randomteleport.RandomTeleportService;
import dev.rollczi.litecommands.annotations.argument.Arg;
import dev.rollczi.litecommands.annotations.command.Command;
import dev.rollczi.litecommands.annotations.context.Context;
import dev.rollczi.litecommands.annotations.context.Sender;
import dev.rollczi.litecommands.annotations.execute.Execute;
import java.util.concurrent.CompletableFuture;
import org.bukkit.Location;
Expand All @@ -20,7 +20,7 @@ public ApiRandomTeleportCommand(RandomTeleportService randomTeleportService) {
}

@Execute(name = "safe-random-location")
void execute(@Context Player player, @Arg int attempts) {
void execute(@Sender Player player, @Arg int attempts) {
World world = player.getWorld();

CompletableFuture<Location> safeRandomLocation =
Expand All @@ -30,7 +30,7 @@ void execute(@Context Player player, @Arg int attempts) {
}

@Execute(name = "safe-random-location-with-radius")
void execute(@Context Player player, @Arg int radius, @Arg int attempts) {
void execute(@Sender Player player, @Arg int radius, @Arg int attempts) {
World world = player.getWorld();

CompletableFuture<Location> safeRandomLocation =
Expand All @@ -40,12 +40,12 @@ void execute(@Context Player player, @Arg int radius, @Arg int attempts) {
}

@Execute(name = "teleport")
void execute(@Context Player player, @Arg Player target) {
void execute(@Sender Player player, @Arg Player target) {
this.randomTeleportService.teleport(target);
}

@Execute(name = "teleport")
void execute(@Context Player player, @Arg Player target, @Arg World world) {
void execute(@Sender Player player, @Arg Player target, @Arg World world) {
this.randomTeleportService.teleport(target, world);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.eternalcode.core.feature.spawn.SpawnService;
import dev.rollczi.litecommands.annotations.argument.Arg;
import dev.rollczi.litecommands.annotations.command.Command;
import dev.rollczi.litecommands.annotations.context.Context;
import dev.rollczi.litecommands.annotations.context.Sender;
import dev.rollczi.litecommands.annotations.execute.Execute;
import org.bukkit.entity.Player;

Expand All @@ -17,20 +17,20 @@ public ApiSpawnCommand(SpawnService spawnService) {
}

@Execute(name = "set")
void execute(@Context Player player) {
void execute(@Sender Player player) {
this.spawnService.setSpawnLocation(player.getLocation());
player.sendMessage("You have set the spawn location via EternalCore developer api bridge, congratulations!");
}

@Execute(name = "teleport")
void executeTeleport(@Context Player player, @Arg Player target) {
void executeTeleport(@Sender Player player, @Arg Player target) {
this.spawnService.teleportToSpawn(target);
String message = "You have teleported %s to the spawn location via EternalCore developer api bridge, congratulations!";
player.sendMessage(String.format(message, target.getName()));
}

@Execute(name = "spawnlocation")
void executeSpawnLocation(@Context Player player) {
void executeSpawnLocation(@Sender Player player) {
player.sendMessage("The spawn location is set at: " + this.spawnService.getSpawnLocation());
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
package com.eternalcode.core;

import com.eternalcode.annotations.scan.command.DescriptionDocs;
import com.eternalcode.commons.scheduler.Scheduler;
import com.eternalcode.core.configuration.ConfigurationManager;
import com.eternalcode.core.injector.annotations.Inject;
import com.eternalcode.core.publish.Publisher;
import com.eternalcode.core.publish.event.EternalReloadEvent;
import com.google.common.base.Stopwatch;
import dev.rollczi.litecommands.annotations.async.Async;
import dev.rollczi.litecommands.annotations.context.Context;
import dev.rollczi.litecommands.annotations.command.Command;
import dev.rollczi.litecommands.annotations.context.Sender;
import dev.rollczi.litecommands.annotations.execute.Execute;
import dev.rollczi.litecommands.annotations.permission.Permission;
import dev.rollczi.litecommands.annotations.command.Command;
import java.util.concurrent.TimeUnit;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;

import java.time.Duration;
import java.util.concurrent.TimeUnit;

@Command(name = "eternalcore")
@Permission("eternalcore.eternalcore")
class EternalCoreCommand {
Expand All @@ -39,7 +36,7 @@ class EternalCoreCommand {
@Async
@Execute(name = "reload")
@DescriptionDocs(description = "Reloads EternalCore configuration")
void reload(@Context Audience audience) {
void reload(@Sender Audience audience) {
long millis = this.reload();
Component message = this.miniMessage.deserialize(RELOAD_MESSAGE.formatted(millis));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.eternalcode.core.notice.NoticeService;
import com.eternalcode.core.util.DurationUtil;
import dev.rollczi.litecommands.annotations.command.Command;
import dev.rollczi.litecommands.annotations.context.Context;
import dev.rollczi.litecommands.annotations.context.Sender;
import dev.rollczi.litecommands.annotations.execute.Execute;
import dev.rollczi.litecommands.annotations.permission.Permission;
import java.time.Duration;
Expand Down Expand Up @@ -42,7 +42,7 @@ class AfkCommand {

@Execute
@DescriptionDocs(description = "Toggles AFK status for the player.")
void execute(@Context Player player) {
void execute(@Sender Player player) {
UUID uuid = player.getUniqueId();

if (player.hasPermission(AFK_BYPASS_PERMISSION)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.eternalcode.core.injector.annotations.Inject;
import com.eternalcode.core.notice.NoticeService;
import dev.rollczi.litecommands.annotations.command.Command;
import dev.rollczi.litecommands.annotations.context.Context;
import dev.rollczi.litecommands.annotations.context.Sender;
import dev.rollczi.litecommands.annotations.execute.Execute;
import dev.rollczi.litecommands.annotations.permission.Permission;
import org.bukkit.entity.Player;
Expand All @@ -24,7 +24,7 @@ class AutoMessageCommand {

@Execute
@DescriptionDocs(description = "Toggles the display of automatic messages.")
void execute(@Context Player player) {
void execute(@Sender Player player) {
this.autoMessageService.switchReceiving(player.getUniqueId()).thenAccept(receiving -> {
if (receiving) {
this.noticeService.player(player.getUniqueId(), messages -> messages.autoMessage().enabled());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
import com.eternalcode.core.notice.NoticeService;
import dev.rollczi.litecommands.annotations.argument.Arg;
import dev.rollczi.litecommands.annotations.command.Command;
import dev.rollczi.litecommands.annotations.context.Context;
import dev.rollczi.litecommands.annotations.context.Sender;
import dev.rollczi.litecommands.annotations.execute.Execute;
import dev.rollczi.litecommands.annotations.permission.Permission;
import org.bukkit.entity.Player;

import java.util.Optional;
import org.bukkit.entity.Player;

@Command(name = "burn", aliases = {"ignite"})
@Permission("eternalcore.burn")
Expand All @@ -26,14 +25,14 @@ public BurnCommand(NoticeService noticeService) {

@Execute
@DescriptionDocs(description = "Burns yourself for a specified amount of ticks.", arguments = "[ticks]")
void self(@Context Player sender, @Arg Optional<Integer> ticks) {
void self(@Sender Player sender, @Arg Optional<Integer> ticks) {
this.burn(sender, sender, ticks);
}

@Execute
@Permission("eternalcore.burn.other")
@DescriptionDocs(description = "Burns target for a specified amount of ticks.", arguments = "<target> [ticks]")
void other(@Context Player sender, @Arg Player target, @Arg Optional<Integer> ticks) {
void other(@Sender Player sender, @Arg Player target, @Arg Optional<Integer> ticks) {
this.burn(sender, target, ticks);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@
import com.eternalcode.core.notice.NoticeService;
import dev.rollczi.litecommands.annotations.argument.Arg;
import dev.rollczi.litecommands.annotations.command.Command;
import dev.rollczi.litecommands.annotations.context.Context;
import dev.rollczi.litecommands.annotations.context.Sender;
import dev.rollczi.litecommands.annotations.execute.Execute;
import dev.rollczi.litecommands.annotations.permission.Permission;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

@SuppressWarnings("SameParameterValue")
@Command(name = "butcher", aliases = { "killmob" })
@Permission("eternalcore.butcher")
Expand All @@ -35,19 +34,19 @@ class ButcherCommand {

@Execute
@DescriptionDocs(description = "Kills all mobs in 2 chunks around you")
void execute(@Context Player player) {
void execute(@Sender Player player) {
this.execute(player, 2);
}

@Execute
@DescriptionDocs(description = "Kills all mobs in specified chunks around you", arguments = "<chunks>")
void execute(@Context Player player, @Arg(ButcherArgument.KEY) int chunks) {
void execute(@Sender Player player, @Arg(ButcherArgument.KEY) int chunks) {
this.execute(player, chunks, new MobEntity(MobType.ALL));
}

@Execute
@DescriptionDocs(description = "Kills specified mob in specified chunks around you", arguments = "<chunks> <mobType>")
void execute(@Context Player player, @Arg(ButcherArgument.KEY) int chunks, @Arg(MobEntityArgument.KEY) MobEntity mobEntity) {
void execute(@Sender Player player, @Arg(ButcherArgument.KEY) int chunks, @Arg(MobEntityArgument.KEY) MobEntity mobEntity) {
this.killMobs(player, chunks, mobEntity::isMatch);
}

Expand Down
Loading