Skip to content
Merged
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
@@ -1,6 +1,7 @@
package com.eternalcode.core.feature.home.homeadmin;

import com.eternalcode.annotations.scan.command.DescriptionDocs;
import com.eternalcode.core.configuration.implementation.PluginConfiguration;
import com.eternalcode.core.feature.home.Home;
import com.eternalcode.core.feature.home.HomeManager;
import com.eternalcode.core.injector.annotations.Inject;
Expand All @@ -24,11 +25,17 @@ class HomeAdminCommand {

private final HomeManager homeManager;
private final NoticeService noticeService;
private final PluginConfiguration pluginConfiguration;

@Inject
public HomeAdminCommand(HomeManager homeManager, NoticeService noticeService) {
public HomeAdminCommand(
HomeManager homeManager,
NoticeService noticeService,
PluginConfiguration pluginConfiguration
) {
this.homeManager = homeManager;
this.noticeService = noticeService;
this.pluginConfiguration = pluginConfiguration;
}

@Execute(name = "sethome")
Expand All @@ -48,6 +55,7 @@ void setHome(@Context Player sender, @Arg PlayerHomeEntry playerHomeEntry, @Arg
this.noticeService.create()
.notice(translate -> translate.home().overrideHomeLocationAsAdmin())
.placeholder("{HOME}", name)
.placeholder("{PLAYER}", player.getName())
.player(player.getUniqueId())
.send();

Expand All @@ -58,6 +66,7 @@ void setHome(@Context Player sender, @Arg PlayerHomeEntry playerHomeEntry, @Arg
this.noticeService.create()
.notice(translate -> translate.home().createAsAdmin())
.placeholder("{HOME}", name)
.placeholder("{PLAYER}", player.getName())
.player(player.getUniqueId())
.send();
}
Expand All @@ -77,6 +86,7 @@ void deleteHome(@Context Player sender, @Arg PlayerHomeEntry playerHomeEntry) {
this.noticeService.create()
.notice(translate -> translate.home().homeList())
.placeholder("{HOMES}", homes)
.placeholder("{PLAYER}", player.getName())
.player(sender.getUniqueId())
.send();

Expand Down Expand Up @@ -104,6 +114,7 @@ void home(@Context Player player, @Arg PlayerHomeEntry playerHomeEntry) {
this.noticeService.create()
.notice(translate -> translate.home().playerNoOwnedHomes())
.placeholder("{HOME}", home.getName())
.placeholder("{PLAYER}", user.getName())
.player(player.getUniqueId())
.send();

Expand All @@ -121,14 +132,15 @@ void list(@Context Viewer viewer, @Arg User user) {
this.noticeService.create()
.notice(translate -> translate.home().homeListAsAdmin())
.placeholder("{HOMES}", homes)
.placeholder("{PLAYER}", user.getName())
.viewer(viewer)
.send();
}

private String formattedListUserHomes(UUID uniqueId) {
return this.homeManager.getHomes(uniqueId).stream()
.map(home -> home.getName())
.collect(Collectors.joining(", "));
.collect(Collectors.joining(this.pluginConfiguration.format.separator));
}
}

Loading