List commands, more refactoring work

This commit is contained in:
William278 committed 2023-03-17 17:00:44 +00:00
1 parent 9903503f03
commit f746d67339
23 files changed
+361 -450

No files matched your search

@@ -65,7 +65,7 @@ public class BukkitCommand implements CommandExecutor, TabCompleter {
public enum Type {
HOME_COMMAND(new PrivateHomeCommand(BukkitHuskHomes.getInstance())),
SET_HOME_COMMAND(new SetHomeCommand(BukkitHuskHomes.getInstance())),
HOME_LIST_COMMAND(new HomeListCommand(BukkitHuskHomes.getInstance())),
HOME_LIST_COMMAND(new PrivateHomeListCommand(BukkitHuskHomes.getInstance())),
DEL_HOME_COMMAND(new DelHomeCommand(BukkitHuskHomes.getInstance())),
EDIT_HOME_COMMAND(new EditHomeCommand(BukkitHuskHomes.getInstance())),
PUBLIC_HOME_COMMAND(new PublicHomeCommand(BukkitHuskHomes.getInstance())),
@@ -1,5 +1,6 @@
package net.william278.huskhomes.event;
import net.william278.huskhomes.user.CommandUser;
import net.william278.huskhomes.user.OnlineUser;
import net.william278.huskhomes.user.User;
import net.william278.huskhomes.position.Home;
@@ -53,13 +54,13 @@ public interface BukkitEventDispatcher extends EventDispatcher {
}
@Override
default IHomeListEvent getViewHomeListEvent(@NotNull List<Home> homes, @NotNull OnlineUser user, boolean publicHomeList) {
return new HomeListEvent(homes, user, publicHomeList);
default IHomeListEvent getViewHomeListEvent(@NotNull List<Home> homes, @NotNull CommandUser listViewer, boolean publicHomeList) {
return new HomeListEvent(homes, listViewer, publicHomeList);
}
@Override
default IWarpListEvent getViewWarpListEvent(@NotNull List<Warp> warps, @NotNull OnlineUser user) {
return new WarpListEvent(warps, user);
default IWarpListEvent getViewWarpListEvent(@NotNull List<Warp> warps, @NotNull CommandUser listViewer) {
return new WarpListEvent(warps, listViewer);
}
@Override
@@ -1,5 +1,6 @@
package net.william278.huskhomes.event;
import net.william278.huskhomes.user.CommandUser;
import net.william278.huskhomes.user.OnlineUser;
import net.william278.huskhomes.position.Home;
import org.bukkit.event.Cancellable;
@@ -15,11 +16,11 @@ public class HomeListEvent extends Event implements IHomeListEvent, Cancellable
@NotNull
private final List<Home> homes;
@NotNull
private final OnlineUser onlineUser;
private final CommandUser onlineUser;
private final boolean isPublicHomeList;
private boolean cancelled;
public HomeListEvent(@NotNull List<Home> homes, @NotNull OnlineUser onlineUser, boolean isPublicHomeList) {
public HomeListEvent(@NotNull List<Home> homes, @NotNull CommandUser onlineUser, boolean isPublicHomeList) {
this.homes = homes;
this.onlineUser = onlineUser;
this.isPublicHomeList = isPublicHomeList;
@@ -44,7 +45,7 @@ public class HomeListEvent extends Event implements IHomeListEvent, Cancellable
@Override
@NotNull
public OnlineUser getOnlineUser() {
public CommandUser getListViewer() {
return onlineUser;
}
@@ -1,5 +1,6 @@
package net.william278.huskhomes.event;
import net.william278.huskhomes.user.CommandUser;
import net.william278.huskhomes.user.OnlineUser;
import net.william278.huskhomes.position.Warp;
import org.bukkit.event.Cancellable;
@@ -15,12 +16,12 @@ public class WarpListEvent extends Event implements IWarpListEvent, Cancellable
@NotNull
private final List<Warp> warps;
@NotNull
private final OnlineUser onlineUser;
private final CommandUser listViewer;
private boolean cancelled;
public WarpListEvent(@NotNull List<Warp> warps, @NotNull OnlineUser onlineUser) {
public WarpListEvent(@NotNull List<Warp> warps, @NotNull CommandUser listViewer) {
this.warps = warps;
this.onlineUser = onlineUser;
this.listViewer = listViewer;
}
@NotNull
@@ -42,8 +43,8 @@ public class WarpListEvent extends Event implements IWarpListEvent, Cancellable
@Override
@NotNull
public OnlineUser getOnlineUser() {
return onlineUser;
public CommandUser getListViewer() {
return listViewer;
}
@Override