From 4b01e1bdec1b26600cbac9017647485d13ced397 Mon Sep 17 00:00:00 2001 From: William Date: Thu, 18 Aug 2022 23:20:20 +0100 Subject: [PATCH] Add /tpa, /tpahere, /tpaccept, /tpdeny, strict teleporting (Closes #139) --- .../huskhomes/command/BukkitCommandType.java | 4 ++ bukkit/src/main/resources/plugin.yml | 10 ++++ .../huskhomes/command/HomeListCommand.java | 2 +- .../huskhomes/command/TpRespondCommand.java | 48 +++++++++++++++ .../huskhomes/command/TpaCommand.java | 41 +++++++++++++ .../huskhomes/command/TpaHereCommand.java | 41 +++++++++++++ .../huskhomes/request/RequestManager.java | 40 +++++++++---- .../huskhomes/request/TeleportRequest.java | 7 ++- .../huskhomes/teleport/TeleportManager.java | 59 +++++++++++++------ .../huskhomes/util/MatcherUtil.java | 35 ----------- .../william278/huskhomes/util/Permission.java | 2 +- common/src/main/resources/locales/en-gb.yml | 1 - .../huskhomes/messenger/MessageTests.java | 3 +- 13 files changed, 221 insertions(+), 72 deletions(-) create mode 100644 common/src/main/java/net/william278/huskhomes/command/TpRespondCommand.java create mode 100644 common/src/main/java/net/william278/huskhomes/command/TpaCommand.java create mode 100644 common/src/main/java/net/william278/huskhomes/command/TpaHereCommand.java delete mode 100644 common/src/main/java/net/william278/huskhomes/util/MatcherUtil.java diff --git a/bukkit/src/main/java/net/william278/huskhomes/command/BukkitCommandType.java b/bukkit/src/main/java/net/william278/huskhomes/command/BukkitCommandType.java index 38c5894a..5042747e 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/command/BukkitCommandType.java +++ b/bukkit/src/main/java/net/william278/huskhomes/command/BukkitCommandType.java @@ -22,6 +22,10 @@ public enum BukkitCommandType { EDIT_WARP_COMMAND(new EditWarpCommand(BukkitHuskHomes.getInstance())), TP_COMMAND(new TpCommand(BukkitHuskHomes.getInstance())), TP_HERE_COMMAND(new TpHereCommand(BukkitHuskHomes.getInstance())), + TPA_COMMAND(new TpaCommand(BukkitHuskHomes.getInstance())), + TPA_HERE_COMMAND(new TpaHereCommand(BukkitHuskHomes.getInstance())), + TPACCEPT_COMMAND(new TpRespondCommand(BukkitHuskHomes.getInstance(), true)), + TPDECLINE_COMMAND(new TpRespondCommand(BukkitHuskHomes.getInstance(), false)), BACK_COMMAND(new BackCommand(BukkitHuskHomes.getInstance())); public final CommandBase commandBase; diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index b318c28c..7ce8067f 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -45,5 +45,15 @@ commands: tphere: usage: /tphere aliases: [tpohere] + tpa: + usage: /tpa + tpahere: + usage: /tpahere + tpaccept: + usage: /tpaccept + aliases: [tpyes] + tpdecline: + usage: /tpdecline + aliases: [tpdeny, tpno] back: usage: /back \ No newline at end of file diff --git a/common/src/main/java/net/william278/huskhomes/command/HomeListCommand.java b/common/src/main/java/net/william278/huskhomes/command/HomeListCommand.java index ff3ebefa..e68702da 100644 --- a/common/src/main/java/net/william278/huskhomes/command/HomeListCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/HomeListCommand.java @@ -64,7 +64,7 @@ public class HomeListCommand extends CommandBase implements ConsoleExecutable { onlineUser.sendMessage(plugin.getCache().getHomeList(onlineUser, userData.user(), plugin.getLocales(), homes, plugin.getSettings().listItemsPerPage, pageNumber)); }); - }, () -> plugin.getLocales().getLocale("error_invalid_player").ifPresent(onlineUser::sendMessage))); + }, () -> plugin.getLocales().getLocale("error_player_not_found", homeOwner).ifPresent(onlineUser::sendMessage))); } diff --git a/common/src/main/java/net/william278/huskhomes/command/TpRespondCommand.java b/common/src/main/java/net/william278/huskhomes/command/TpRespondCommand.java new file mode 100644 index 00000000..83f90757 --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/command/TpRespondCommand.java @@ -0,0 +1,48 @@ +package net.william278.huskhomes.command; + +import net.william278.huskhomes.HuskHomes; +import net.william278.huskhomes.player.OnlineUser; +import net.william278.huskhomes.util.Permission; +import org.jetbrains.annotations.NotNull; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * A command used for responding to tp requests - can either be a /tpaccept or /tpdecline command, controlled by the + * acceptRequestCommand flag + */ +public class TpRespondCommand extends CommandBase implements TabCompletable { + + private final boolean acceptRequestCommand; + + protected TpRespondCommand(@NotNull HuskHomes implementor, boolean acceptRequestCommand) { + super(acceptRequestCommand ? "tpaccept" : "tpdecline", acceptRequestCommand ? Permission.COMMAND_TPACCEPT : Permission.COMMAND_TPDECLINE, implementor); + this.acceptRequestCommand = acceptRequestCommand; + } + + @Override + public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) { + if (args.length > 1) { + plugin.getLocales().getLocale("error_invalid_syntax", "/" + command + " [player]") + .ifPresent(onlineUser::sendMessage); + return; + } + + if (args.length == 1) { + // Respond to the request from specified sender name + plugin.getRequestManager().respondToTeleportRequestBySenderName(onlineUser, args[0], acceptRequestCommand); + return; + } + + plugin.getRequestManager().respondToTeleportRequest(onlineUser, acceptRequestCommand); + } + + @Override + public @NotNull List onTabComplete(@NotNull OnlineUser onlineUser, @NotNull String[] args) { + return args.length <= 1 ? plugin.getCache().players.stream() + .filter(s -> s.toLowerCase().startsWith(args.length == 1 ? args[0].toLowerCase() : "")) + .sorted().collect(Collectors.toList()) : Collections.emptyList(); + } +} diff --git a/common/src/main/java/net/william278/huskhomes/command/TpaCommand.java b/common/src/main/java/net/william278/huskhomes/command/TpaCommand.java new file mode 100644 index 00000000..3083d944 --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/command/TpaCommand.java @@ -0,0 +1,41 @@ +package net.william278.huskhomes.command; + +import net.william278.huskhomes.HuskHomes; +import net.william278.huskhomes.player.OnlineUser; +import net.william278.huskhomes.request.TeleportRequest; +import net.william278.huskhomes.util.Permission; +import org.jetbrains.annotations.NotNull; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class TpaCommand extends CommandBase implements TabCompletable { + + protected TpaCommand(@NotNull HuskHomes implementor) { + super("tpa", Permission.COMMAND_TPA, implementor); + } + + @Override + public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) { + if (args.length == 1) { + plugin.getRequestManager().sendTeleportRequest(onlineUser, args[0], TeleportRequest.RequestType.TPA).thenAccept(sent -> { + if (!sent) { + plugin.getLocales().getLocale("error_player_not_found", args[0]).ifPresent(onlineUser::sendMessage); + return; + } + plugin.getLocales().getLocale("tpa_request_sent", args[0]).ifPresent(onlineUser::sendMessage); + }); + } else { + plugin.getLocales().getLocale("error_invalid_syntax", "/tpa ") + .ifPresent(onlineUser::sendMessage); + } + } + + @Override + public @NotNull List onTabComplete(@NotNull OnlineUser onlineUser, @NotNull String[] args) { + return args.length <= 1 ? plugin.getCache().players.stream() + .filter(s -> s.toLowerCase().startsWith(args.length == 1 ? args[0].toLowerCase() : "")) + .sorted().collect(Collectors.toList()) : Collections.emptyList(); + } +} diff --git a/common/src/main/java/net/william278/huskhomes/command/TpaHereCommand.java b/common/src/main/java/net/william278/huskhomes/command/TpaHereCommand.java new file mode 100644 index 00000000..724708c6 --- /dev/null +++ b/common/src/main/java/net/william278/huskhomes/command/TpaHereCommand.java @@ -0,0 +1,41 @@ +package net.william278.huskhomes.command; + +import net.william278.huskhomes.HuskHomes; +import net.william278.huskhomes.player.OnlineUser; +import net.william278.huskhomes.request.TeleportRequest; +import net.william278.huskhomes.util.Permission; +import org.jetbrains.annotations.NotNull; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public class TpaHereCommand extends CommandBase implements TabCompletable { + + protected TpaHereCommand(@NotNull HuskHomes implementor) { + super("tpahere", Permission.COMMAND_TPAHERE, implementor); + } + + @Override + public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) { + if (args.length == 1) { + plugin.getRequestManager().sendTeleportRequest(onlineUser, args[0], TeleportRequest.RequestType.TPA_HERE).thenAccept(sent -> { + if (!sent) { + plugin.getLocales().getLocale("error_player_not_found", args[0]).ifPresent(onlineUser::sendMessage); + return; + } + plugin.getLocales().getLocale("tpahere_request_sent", args[0]).ifPresent(onlineUser::sendMessage); + }); + } else { + plugin.getLocales().getLocale("error_invalid_syntax", "/tpahere ") + .ifPresent(onlineUser::sendMessage); + } + } + + @Override + public @NotNull List onTabComplete(@NotNull OnlineUser onlineUser, @NotNull String[] args) { + return args.length <= 1 ? plugin.getCache().players.stream() + .filter(s -> s.toLowerCase().startsWith(args.length == 1 ? args[0].toLowerCase() : "")) + .sorted().collect(Collectors.toList()) : Collections.emptyList(); + } +} diff --git a/common/src/main/java/net/william278/huskhomes/request/RequestManager.java b/common/src/main/java/net/william278/huskhomes/request/RequestManager.java index 45a93157..047b6232 100644 --- a/common/src/main/java/net/william278/huskhomes/request/RequestManager.java +++ b/common/src/main/java/net/william278/huskhomes/request/RequestManager.java @@ -36,6 +36,18 @@ public class RequestManager { this.ignoringRequests = new HashSet<>(); } + public void setIgnoringRequests(@NotNull User user) { + this.ignoringRequests.add(user.uuid); + } + + public void removeIgnoringRequests(@NotNull User user) { + this.ignoringRequests.remove(user.uuid); + } + + public boolean isIgnoringRequests(@NotNull User user) { + return this.ignoringRequests.contains(user.uuid); + } + public void addTeleportRequest(@NotNull TeleportRequest request, @NotNull User recipient) { this.requests.computeIfAbsent(recipient.uuid, uuid -> new ArrayList<>()).add(request); } @@ -53,7 +65,7 @@ public class RequestManager { public Optional getTeleportRequest(@NotNull String requesterName, @NotNull User recipient) { return this.requests.getOrDefault(recipient.uuid, Collections.emptyList()).stream().filter(request -> - request.requester.username.equals(requesterName)).findFirst(); + request.requesterName.equals(requesterName)).findFirst(); } /** @@ -117,17 +129,22 @@ public class RequestManager { * @return {@code true} if the request was sent, {@code false} if it was not sent because the recipient is ignoring requests */ public boolean sendLocalTeleportRequest(@NotNull TeleportRequest request, @NotNull OnlineUser recipient) { - if (ignoringRequests.contains(recipient.uuid)) { + if (isIgnoringRequests(recipient)) { request.status = TeleportRequest.RequestStatus.IGNORED; return false; } + // If the person already has a request from the sender by name, don't bother sending another one + if (getTeleportRequest(request.requesterName, recipient).isPresent()) { + return true; + } + // Add the request and display a message to the recipient addTeleportRequest(request, recipient); plugin.getLocales().getLocale((request.type == TeleportRequest.RequestType.TPA ? "tpa" : "tpahere") - + "_request_received", request.requester.username) + + "_request_received", request.requesterName) .ifPresent(recipient::sendMessage); - plugin.getLocales().getLocale("teleport_request_buttons", request.requester.username) + plugin.getLocales().getLocale("teleport_request_buttons", request.requesterName) .ifPresent(recipient::sendMessage); return true; } @@ -135,7 +152,7 @@ public class RequestManager { public void respondToTeleportRequestBySenderName(@NotNull OnlineUser recipient, @NotNull String senderName, boolean accepted) { // Check the recipient is not ignoring teleport requests - if (ignoringRequests.contains(recipient.uuid)) { + if (isIgnoringRequests(recipient)) { plugin.getLocales().getLocale("error_ignoring_teleport_requests").ifPresent(recipient::sendMessage); return; } @@ -152,7 +169,7 @@ public class RequestManager { public void respondToTeleportRequest(@NotNull OnlineUser recipient, boolean accepted) { // Check the recipient is not ignoring teleport requests - if (ignoringRequests.contains(recipient.uuid)) { + if (isIgnoringRequests(recipient)) { plugin.getLocales().getLocale("error_ignoring_teleport_requests").ifPresent(recipient::sendMessage); return; } @@ -178,19 +195,19 @@ public class RequestManager { // Send request response confirmation to the recipient plugin.getLocales().getLocale("teleport_request_" + (accepted ? "accepted" : "declined") + "_confirmation", - request.requester.username) + request.requesterName) .ifPresent(recipient::sendMessage); request.status = accepted ? TeleportRequest.RequestStatus.ACCEPTED : TeleportRequest.RequestStatus.DECLINED; // Send request response to the sender CompletableFuture.runAsync(() -> { - final Optional localSender = plugin.findPlayer(request.requester.username); + final Optional localSender = plugin.findPlayer(request.requesterName); if (localSender.isPresent()) { handleLocalRequestResponse(localSender.get(), request); } else if (plugin.getSettings().crossServer) { assert plugin.getNetworkMessenger() != null; // Ensure the sender is still online - if (!plugin.getNetworkMessenger().findPlayer(recipient, request.requester.username).thenApply(networkedTarget -> { + if (!plugin.getNetworkMessenger().findPlayer(recipient, request.requesterName).thenApply(networkedTarget -> { if (networkedTarget.isEmpty()) { plugin.getLocales().getLocale("error_teleport_request_sender_not_online") .ifPresent(recipient::sendMessage); @@ -222,9 +239,10 @@ public class RequestManager { if (accepted && request.type == TeleportRequest.RequestType.TPA_HERE) { // Strict /tpahere requests will teleport to where the sender was when typing the command if (plugin.getSettings().strictTpaHereRequests) { - plugin.getTeleportManager().teleport(recipient, request.requesterPosition); + plugin.getTeleportManager().timedTeleport(recipient, request.requesterPosition).thenAccept( + teleportResult -> plugin.getTeleportManager().finishTeleport(recipient, teleportResult)); } else { - plugin.getTeleportManager().teleportToPlayerByName(recipient, request.requester.username); + plugin.getTeleportManager().teleportToPlayerByName(recipient, request.requesterName); } } }); diff --git a/common/src/main/java/net/william278/huskhomes/request/TeleportRequest.java b/common/src/main/java/net/william278/huskhomes/request/TeleportRequest.java index 1e159967..8b848418 100644 --- a/common/src/main/java/net/william278/huskhomes/request/TeleportRequest.java +++ b/common/src/main/java/net/william278/huskhomes/request/TeleportRequest.java @@ -2,7 +2,6 @@ package net.william278.huskhomes.request; import com.google.gson.annotations.SerializedName; import net.william278.huskhomes.player.OnlineUser; -import net.william278.huskhomes.player.User; import net.william278.huskhomes.position.Position; import org.jetbrains.annotations.NotNull; @@ -16,7 +15,8 @@ public class TeleportRequest { /** * The user making the request */ - protected User requester; + @SerializedName("requester_name") + protected String requesterName; /** * The position of the requester, relevant in the case of a {@link RequestType#TPA_HERE} request @@ -53,13 +53,14 @@ public class TeleportRequest { */ protected TeleportRequest(@NotNull OnlineUser requester, @NotNull RequestType requestType, final long expiryTime) { - this.requester = requester; + this.requesterName = requester.username; this.requesterPosition = requester.getPosition().join(); this.type = requestType; this.status = RequestStatus.PENDING; this.expiryTime = expiryTime; } + @SuppressWarnings("unused") private TeleportRequest() { } diff --git a/common/src/main/java/net/william278/huskhomes/teleport/TeleportManager.java b/common/src/main/java/net/william278/huskhomes/teleport/TeleportManager.java index 05d6aaaf..57e7c12e 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/TeleportManager.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/TeleportManager.java @@ -8,7 +8,6 @@ import net.william278.huskhomes.player.User; import net.william278.huskhomes.position.Home; import net.william278.huskhomes.position.Position; import net.william278.huskhomes.position.Warp; -import net.william278.huskhomes.util.MatcherUtil; import net.william278.huskhomes.util.Permission; import org.jetbrains.annotations.NotNull; @@ -107,14 +106,30 @@ public class TeleportManager { * @param targetPlayer the name of the target player */ public void teleportToPlayerByName(@NotNull OnlineUser onlineUser, @NotNull String targetPlayer) { - MatcherUtil.matchPlayerName(targetPlayer, plugin).ifPresentOrElse(playerName -> - getPlayerPositionByName(onlineUser, playerName).thenAccept(optionalPosition -> - optionalPosition.ifPresentOrElse(targetPosition -> - timedTeleport(onlineUser, targetPosition).thenAccept(result -> - finishTeleport(onlineUser, result)), - () -> plugin.getLocales().getLocale("error_invalid_player"). - ifPresent(onlineUser::sendMessage))), - () -> plugin.getLocales().getLocale("error_invalid_player").ifPresent(onlineUser::sendMessage)); + CompletableFuture.runAsync(() -> { + Optional localPlayer = plugin.findPlayer(targetPlayer); + + if (localPlayer.isPresent()) { + timedTeleport(onlineUser, localPlayer.get().getPosition().join()) + .thenAccept(result -> finishTeleport(onlineUser, result)); + } else { + if (plugin.getSettings().crossServer) { + assert plugin.getNetworkMessenger() != null; + getPlayerPositionByName(onlineUser, targetPlayer).thenAccept(optionalPosition -> { + if (optionalPosition.isPresent()) { + timedTeleport(onlineUser, optionalPosition.get()) + .thenAccept(teleportResult -> finishTeleport(onlineUser, teleportResult)); + return; + } + plugin.getLocales().getLocale("error_player_not_found", targetPlayer) + .ifPresent(onlineUser::sendMessage); + }); + } + return; + } + plugin.getLocales().getLocale("error_player_not_found", targetPlayer) + .ifPresent(onlineUser::sendMessage); + }); } /** @@ -183,7 +198,8 @@ public class TeleportManager { * @param playerName the username of the player being requested * @return future optionally supplying the player's position, if the player could be found */ - private CompletableFuture> getPlayerPositionByName(@NotNull OnlineUser requester, @NotNull String playerName) { + private CompletableFuture> getPlayerPositionByName(@NotNull OnlineUser requester, + @NotNull String playerName) { final Optional localPlayer = plugin.getOnlinePlayers().stream().filter(player -> player.username.equalsIgnoreCase(playerName)).findFirst(); if (localPlayer.isPresent()) { @@ -191,14 +207,21 @@ public class TeleportManager { } if (plugin.getSettings().crossServer) { assert plugin.getNetworkMessenger() != null; - return plugin.getNetworkMessenger().sendMessage(requester, - new Message(Message.MessageType.POSITION_REQUEST, - requester.username, - playerName, - MessagePayload.empty(), - Message.RelayType.MESSAGE, - plugin.getSettings().clusterId)) - .thenApply(reply -> Optional.ofNullable(reply.payload.position)); + return plugin.getNetworkMessenger().findPlayer(requester, playerName).thenApply(foundPlayer -> { + if (foundPlayer.isEmpty()) { + return Optional.empty(); + } + return plugin.getNetworkMessenger().sendMessage(requester, + new Message(Message.MessageType.POSITION_REQUEST, + requester.username, + playerName, + MessagePayload.empty(), + Message.RelayType.MESSAGE, + plugin.getSettings().clusterId)) + .orTimeout(3, TimeUnit.SECONDS) + .exceptionally(throwable -> null) + .thenApply(reply -> Optional.ofNullable(reply.payload.position)).join(); + }); } return CompletableFuture.supplyAsync(Optional::empty); } diff --git a/common/src/main/java/net/william278/huskhomes/util/MatcherUtil.java b/common/src/main/java/net/william278/huskhomes/util/MatcherUtil.java deleted file mode 100644 index 0eccd44e..00000000 --- a/common/src/main/java/net/william278/huskhomes/util/MatcherUtil.java +++ /dev/null @@ -1,35 +0,0 @@ -package net.william278.huskhomes.util; - -import net.william278.huskhomes.HuskHomes; -import org.jetbrains.annotations.NotNull; - -import java.util.Comparator; -import java.util.Optional; - -/** - * Utility for matching a username based on an input name - */ -public final class MatcherUtil { - - /** - * Match a player's username from a user-supplied input name - * - * @param inputName the user input name - * @param plugin the implementing plugin - * @return an optional, containing a matched username if one was found - */ - public static Optional matchPlayerName(@NotNull String inputName, @NotNull HuskHomes plugin) { - // Return an exact match if there is one present - final Optional exactPlayer = plugin.getCache().players.stream().filter(username -> - username.equalsIgnoreCase(inputName)).findFirst(); - if (exactPlayer.isPresent()) { - return exactPlayer; - } - - // Return most likely match, if present - return plugin.getCache().players.stream().filter(username -> username.toLowerCase() - .startsWith(inputName.toLowerCase())).min(Comparator.comparingInt(username -> - username.length() - inputName.toLowerCase().length())); - } - -} diff --git a/common/src/main/java/net/william278/huskhomes/util/Permission.java b/common/src/main/java/net/william278/huskhomes/util/Permission.java index 2433ef54..1ca34161 100644 --- a/common/src/main/java/net/william278/huskhomes/util/Permission.java +++ b/common/src/main/java/net/william278/huskhomes/util/Permission.java @@ -103,7 +103,7 @@ public enum Permission { /** * Lets the user deny a tp request ({@code /tpdeny}) */ - COMMAND_TPDENY("huskhomes.command.tpdeny", DefaultAccess.EVERYONE), + COMMAND_TPDECLINE("huskhomes.command.tpdecline", DefaultAccess.EVERYONE), /** * Lets the user ignore incoming tp requests ({@code /tpignore}) */ diff --git a/common/src/main/resources/locales/en-gb.yml b/common/src/main/resources/locales/en-gb.yml index cc7214ad..79b540b4 100644 --- a/common/src/main/resources/locales/en-gb.yml +++ b/common/src/main/resources/locales/en-gb.yml @@ -148,7 +148,6 @@ error_permission_restricted_warp: '[Error:](#ff3300) [You do not have permission error_invalid_page_number: '[Error:](#ff3300) [Please specify a valid page number.](#ff7e5e)' error_invalid_on_arrival: '[Error:](#ff3300) [Failed to finish teleportation as the target world could not be found.](#ff7e5e)' error_no_offline_position: '[Error:](#ff3300) [Could not find where %1% last logged out.](#ff7e5e)' -error_invalid_player: '[Error:](#ff3300) [Please specify the name of a valid player!](#ff7e5e)' error_no_homes_set_other: '[Error:](#ff3300) [%1% has not set any homes!](#ff7e5e)' error_home_invalid_other: '[Error:](#ff3300) [%1% does not have a home set named "%2%"](#ff7e5e)' error_edit_home_maximum_public_homes: '[Error:](#ff3300) [You can only make a maximum of %1% homes public.](#ff7e5e)' diff --git a/common/src/test/java/net/william278/huskhomes/messenger/MessageTests.java b/common/src/test/java/net/william278/huskhomes/messenger/MessageTests.java index 7106dafa..aaaee713 100644 --- a/common/src/test/java/net/william278/huskhomes/messenger/MessageTests.java +++ b/common/src/test/java/net/william278/huskhomes/messenger/MessageTests.java @@ -13,7 +13,7 @@ public class MessageTests { @Test public void testMessageSerializationWithEmptyPayload() { final Message message = new Message( - Message.MessageType.TP_REQUEST, + Message.MessageType.TELEPORT_REQUEST, "TestSender", "TestTarget", MessagePayload.empty(), @@ -49,5 +49,4 @@ public class MessageTests { Assertions.assertEquals(message.payload.position.y, readMessage.payload.position.y); Assertions.assertEquals(message.payload.position.z, readMessage.payload.position.z); } - }