From 1cb56f93fb84ed034fdeab55cab22603c5ab2585 Mon Sep 17 00:00:00 2001 From: Preva1l <149850944+ProdPreva1l@users.noreply.github.com> Date: Mon, 26 Feb 2024 03:47:16 +1100 Subject: [PATCH] feat: add tp invulerability option, show privacy in `/homelist` (#577) * Renamed PrivateHomeListCommand.java to HomeListCommand.java as it shows all homes not just private homes * Implemented https://github.com/WiIIiam278/HuskHomes/issues/543 * Implemented https://github.com/WiIIiam278/HuskHomes/issues/515 * added changes to all lang files, removed un used imports, fix error where it would not remove invulnerability from player on sponge --- .../huskhomes/command/BukkitCommand.java | 2 +- .../net/william278/huskhomes/user/BukkitUser.java | 14 ++++++++++++++ ...eHomeListCommand.java => HomeListCommand.java} | 8 ++++++-- .../huskhomes/command/PrivateHomeCommand.java | 2 +- .../net/william278/huskhomes/config/Settings.java | 3 +++ .../huskhomes/listener/EventListener.java | 1 + .../william278/huskhomes/teleport/Teleport.java | 3 ++- .../net/william278/huskhomes/user/OnlineUser.java | 5 +++++ common/src/main/resources/locales/bg-bg.yml | 2 ++ common/src/main/resources/locales/de-de.yml | 4 +++- common/src/main/resources/locales/en-gb.yml | 4 +++- common/src/main/resources/locales/es-es.yml | 4 +++- common/src/main/resources/locales/fr-fr.yml | 4 +++- common/src/main/resources/locales/it-it.yml | 4 +++- common/src/main/resources/locales/ja-jp.yml | 4 +++- common/src/main/resources/locales/ko-kr.yml | 4 +++- common/src/main/resources/locales/pl-pl.yml | 4 +++- common/src/main/resources/locales/pt-br.yml | 4 +++- common/src/main/resources/locales/ru-ru.yml | 4 +++- common/src/main/resources/locales/tr-tr.yml | 4 +++- common/src/main/resources/locales/uk-ua.yml | 4 +++- common/src/main/resources/locales/zh-cn.yml | 4 +++- common/src/main/resources/locales/zh-tw.yml | 4 +++- .../huskhomes/command/FabricCommand.java | 2 +- .../net/william278/huskhomes/user/FabricUser.java | 15 +++++++++++++++ .../huskhomes/command/SpongeCommand.java | 2 +- .../net/william278/huskhomes/user/SpongeUser.java | 14 ++++++++++++++ 27 files changed, 108 insertions(+), 21 deletions(-) rename common/src/main/java/net/william278/huskhomes/command/{PrivateHomeListCommand.java => HomeListCommand.java} (92%) diff --git a/bukkit/src/main/java/net/william278/huskhomes/command/BukkitCommand.java b/bukkit/src/main/java/net/william278/huskhomes/command/BukkitCommand.java index cabfaac7..5946df4c 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/command/BukkitCommand.java +++ b/bukkit/src/main/java/net/william278/huskhomes/command/BukkitCommand.java @@ -136,7 +136,7 @@ public class BukkitCommand extends org.bukkit.command.Command { public enum Type { HOME_COMMAND(PrivateHomeCommand::new), SET_HOME_COMMAND(SetHomeCommand::new), - HOME_LIST_COMMAND(PrivateHomeListCommand::new), + HOME_LIST_COMMAND(HomeListCommand::new), DEL_HOME_COMMAND(DelHomeCommand::new), EDIT_HOME_COMMAND(EditHomeCommand::new), PUBLIC_HOME_COMMAND(PublicHomeCommand::new), diff --git a/bukkit/src/main/java/net/william278/huskhomes/user/BukkitUser.java b/bukkit/src/main/java/net/william278/huskhomes/user/BukkitUser.java index ed1f3b99..3725a381 100644 --- a/bukkit/src/main/java/net/william278/huskhomes/user/BukkitUser.java +++ b/bukkit/src/main/java/net/william278/huskhomes/user/BukkitUser.java @@ -160,6 +160,20 @@ public class BukkitUser extends OnlineUser { .orElse(false); } + /** + * Handles player invulnerability after teleporting + */ + @Override + public void handleInvulnerability() { + if (plugin.getSettings().getGeneral().getTeleportInvulnerabilityTime() <= 0) { + return; + } + long invulnerabilityTimeInTicks = 20L * plugin.getSettings().getGeneral().getTeleportInvulnerabilityTime(); + player.setInvulnerable(true); + // Remove the invulnerability + plugin.runSyncDelayed(() -> player.setInvulnerable(false), invulnerabilityTimeInTicks); + } + /** * Send a Bukkit plugin message to the player. */ diff --git a/common/src/main/java/net/william278/huskhomes/command/PrivateHomeListCommand.java b/common/src/main/java/net/william278/huskhomes/command/HomeListCommand.java similarity index 92% rename from common/src/main/java/net/william278/huskhomes/command/PrivateHomeListCommand.java rename to common/src/main/java/net/william278/huskhomes/command/HomeListCommand.java index 87f352c2..b1e2b37d 100644 --- a/common/src/main/java/net/william278/huskhomes/command/PrivateHomeListCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/HomeListCommand.java @@ -19,6 +19,8 @@ package net.william278.huskhomes.command; +import de.themoep.minedown.adventure.MineDown; +import de.themoep.minedown.adventure.MineDownParser; import net.william278.huskhomes.HuskHomes; import net.william278.huskhomes.config.Locales; import net.william278.huskhomes.position.Home; @@ -34,9 +36,9 @@ import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; -public class PrivateHomeListCommand extends ListCommand { +public class HomeListCommand extends ListCommand { - protected PrivateHomeListCommand(@NotNull HuskHomes plugin) { + protected HomeListCommand(@NotNull HuskHomes plugin) { super("homelist", List.of("homes"), "[player] [page]", plugin); addAdditionalPermissions(Map.of("other", true)); } @@ -110,6 +112,8 @@ public class PrivateHomeListCommand extends ListCommand { plugin.getLocales() .getRawLocale("home_list_item", Locales.escapeText(home.getName()), home.getSafeIdentifier(), + home.isPublic() ? plugin.getLocales().getRawLocale("home_is_public").orElse("�fb9a&Public"): + plugin.getLocales().getRawLocale("home_is_private").orElse("ïe6f&Private"), Locales.escapeText(home.getMeta().getDescription())) .orElse(home.getName())).sorted().collect(Collectors.toList()), plugin.getLocales() diff --git a/common/src/main/java/net/william278/huskhomes/command/PrivateHomeCommand.java b/common/src/main/java/net/william278/huskhomes/command/PrivateHomeCommand.java index bc1c32f6..3d2ccbd7 100644 --- a/common/src/main/java/net/william278/huskhomes/command/PrivateHomeCommand.java +++ b/common/src/main/java/net/william278/huskhomes/command/PrivateHomeCommand.java @@ -48,7 +48,7 @@ public class PrivateHomeCommand extends HomeCommand { super.execute(executor, homes.get(0), args); return; } - plugin.getCommand(PrivateHomeListCommand.class) + plugin.getCommand(HomeListCommand.class) .ifPresent(command -> command.showHomeList(executor, user.getUsername(), 1)); return; } diff --git a/common/src/main/java/net/william278/huskhomes/config/Settings.java b/common/src/main/java/net/william278/huskhomes/config/Settings.java index f1eec1de..52b5c257 100644 --- a/common/src/main/java/net/william278/huskhomes/config/Settings.java +++ b/common/src/main/java/net/william278/huskhomes/config/Settings.java @@ -140,6 +140,9 @@ public final class Settings { @Comment("Where the teleport warmup timer should display (CHAT, ACTION_BAR, TITLE, SUBTITLE or NONE)") private Locales.DisplaySlot teleportWarmupDisplay = Locales.DisplaySlot.ACTION_BAR; + @Comment("How long the player should be invulnerable for after teleporting (in seconds)") + private int teleportInvulnerabilityTime = 0; + @Comment("How long before received teleport requests expire (in seconds)") private int teleportRequestExpiryTime = 60; diff --git a/common/src/main/java/net/william278/huskhomes/listener/EventListener.java b/common/src/main/java/net/william278/huskhomes/listener/EventListener.java index 1a43b8b9..a369162e 100644 --- a/common/src/main/java/net/william278/huskhomes/listener/EventListener.java +++ b/common/src/main/java/net/william278/huskhomes/listener/EventListener.java @@ -148,6 +148,7 @@ public class EventListener { } plugin.getDatabase().clearCurrentTeleport(teleporter); teleport.displayTeleportingComplete(teleporter); + teleporter.handleInvulnerability(); }); } diff --git a/common/src/main/java/net/william278/huskhomes/teleport/Teleport.java b/common/src/main/java/net/william278/huskhomes/teleport/Teleport.java index 18fbfab2..9f383baf 100644 --- a/common/src/main/java/net/william278/huskhomes/teleport/Teleport.java +++ b/common/src/main/java/net/william278/huskhomes/teleport/Teleport.java @@ -95,9 +95,9 @@ public class Teleport implements Completable { if (updateLastPosition) { plugin.getDatabase().setLastPosition(teleporter, teleporter.getPosition()); } - teleporter.teleportLocally(localTarget.get().getPosition(), async); this.displayTeleportingComplete(teleporter); + teleporter.handleInvulnerability(); }); return; } @@ -127,6 +127,7 @@ public class Teleport implements Completable { || target.getServer().equals(plugin.getServerName())) { teleporter.teleportLocally(target, async); this.displayTeleportingComplete(teleporter); + teleporter.handleInvulnerability(); return; } diff --git a/common/src/main/java/net/william278/huskhomes/user/OnlineUser.java b/common/src/main/java/net/william278/huskhomes/user/OnlineUser.java index b22164fa..fce5559d 100644 --- a/common/src/main/java/net/william278/huskhomes/user/OnlineUser.java +++ b/common/src/main/java/net/william278/huskhomes/user/OnlineUser.java @@ -211,6 +211,11 @@ public abstract class OnlineUser extends User implements Teleportable, CommandUs */ public abstract boolean isVanished(); + /** + * Handles player invulnerability after teleporting + */ + public abstract void handleInvulnerability(); + /** * Get the maximum number of homes this user may set. * diff --git a/common/src/main/resources/locales/bg-bg.yml b/common/src/main/resources/locales/bg-bg.yml index 46f4147f..099cc121 100644 --- a/common/src/main/resources/locales/bg-bg.yml +++ b/common/src/main/resources/locales/bg-bg.yml @@ -66,6 +66,8 @@ locales: command_list_title: '[HuskHomes](#00fb9a bold) [| Command List](#00fb9a)\n' home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&Обществен' + home_is_private: 'ïe6f&Частно' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7Click to suggest command suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/common/src/main/resources/locales/de-de.yml b/common/src/main/resources/locales/de-de.yml index f66cc472..b1e5aa6f 100644 --- a/common/src/main/resources/locales/de-de.yml +++ b/common/src/main/resources/locales/de-de.yml @@ -64,8 +64,10 @@ locales: public_home_list_page_title: '[☀ Öffentliche Homes:](#00fb9a) [(%1%-%2% von](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' warp_list_page_title: '[Warps:](#00fb9a) [(%1%-%2% von](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' command_list_title: '[HuskHomes](#00fb9a bold) [| Befehlsliste](#00fb9a)\n' - home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' + home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7Status: %3%\n&7ℹ %4% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&Öffentlich' + home_is_private: 'ïe6f&Privat' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7Klicke, um den Befehl im Chat einzufügen command suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/common/src/main/resources/locales/en-gb.yml b/common/src/main/resources/locales/en-gb.yml index f9ae5b54..08264427 100644 --- a/common/src/main/resources/locales/en-gb.yml +++ b/common/src/main/resources/locales/en-gb.yml @@ -64,8 +64,10 @@ locales: public_home_list_page_title: '[☀ Public Homes:](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' warp_list_page_title: '[Warps:](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' command_list_title: '[HuskHomes](#00fb9a bold) [| Command List](#00fb9a)\n' - home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' + home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7Status: %3%\n&7ℹ %4% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&Public' + home_is_private: 'ïe6f&Private' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7Click to suggest command suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/common/src/main/resources/locales/es-es.yml b/common/src/main/resources/locales/es-es.yml index e57b357b..ccb4ff38 100644 --- a/common/src/main/resources/locales/es-es.yml +++ b/common/src/main/resources/locales/es-es.yml @@ -66,7 +66,9 @@ locales: command_list_title: '[GreenShield](#green bold) [| lista de comandos](#00fb9a)\n' home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' - warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' + home_is_public: '�fb9a&Pública' + home_is_private: 'ïe6f&Privada' + warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7Estado: %3%\n&7ℹ %4% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7Clic para sugerir el comando suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' list_footer: '\n%1%[Página](#00fb9a) [%2%](#00fb9a)/[%3%](#00fb9a)%4% %5%' diff --git a/common/src/main/resources/locales/fr-fr.yml b/common/src/main/resources/locales/fr-fr.yml index f5bffabf..04e08f10 100644 --- a/common/src/main/resources/locales/fr-fr.yml +++ b/common/src/main/resources/locales/fr-fr.yml @@ -64,8 +64,10 @@ locales: public_home_list_page_title: '[☀ Homes Publiques :](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' warp_list_page_title: '[Warps:](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' command_list_title: '[HuskHomes](#00fb9a bold) [| Liste des commandes](#00fb9a)\n' - home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' + home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7Statut: %3%\n&7ℹ %4% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&Publique' + home_is_private: 'ïe6f&Privée' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7Cliquez pour suggérer la commande command suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/common/src/main/resources/locales/it-it.yml b/common/src/main/resources/locales/it-it.yml index 88d2c553..96759081 100644 --- a/common/src/main/resources/locales/it-it.yml +++ b/common/src/main/resources/locales/it-it.yml @@ -64,8 +64,10 @@ locales: public_home_list_page_title: '[☀ Home pubbliche:](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' warp_list_page_title: '[Lista Warp:](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' command_list_title: '[HuskHomes](#00fb9a bold) [| Lista comandi](#00fb9a)\n' - home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' + home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7Stato: %3%\n&7ℹ %4% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&Pubblica' + home_is_private: 'ïe6f&Privato' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7Clicca per usare il comando suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/common/src/main/resources/locales/ja-jp.yml b/common/src/main/resources/locales/ja-jp.yml index 7e9ecb14..6b2dc70d 100644 --- a/common/src/main/resources/locales/ja-jp.yml +++ b/common/src/main/resources/locales/ja-jp.yml @@ -64,8 +64,10 @@ locales: public_home_list_page_title: '[☀ 公開ホーム一覧:](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' warp_list_page_title: '[ワープ一覧:](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' command_list_title: '[HuskHomes](#00fb9a bold) [| コマンドリスト](#00fb9a)\n' - home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' + home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7状態: %3%\n&7ℹ %4% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&公共' + home_is_private: 'ïe6f&プライベート' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7Click to suggest command suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/common/src/main/resources/locales/ko-kr.yml b/common/src/main/resources/locales/ko-kr.yml index be5e442b..e452c4e2 100644 --- a/common/src/main/resources/locales/ko-kr.yml +++ b/common/src/main/resources/locales/ko-kr.yml @@ -64,8 +64,10 @@ locales: public_home_list_page_title: '[☀ 공용 집:](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' warp_list_page_title: '[워프:](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' command_list_title: '[HuskHomes](#00fb9a bold) [| 명령어 목록](#00fb9a)\n' - home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' + home_list_item: '[[%1%]](show_text=�fb9a&%1%\n\n&7상태: %3%\n&7ℹ %4% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&공공의' + home_is_private: 'ïe6f&사적인' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7클릭하여 명령어를 입력할 수 있습니다 suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/common/src/main/resources/locales/pl-pl.yml b/common/src/main/resources/locales/pl-pl.yml index b70c2fe7..657aa89e 100644 --- a/common/src/main/resources/locales/pl-pl.yml +++ b/common/src/main/resources/locales/pl-pl.yml @@ -64,8 +64,10 @@ locales: public_home_list_page_title: '[☀ Domy Publiczne:](#00fb9a) [(%1%-%2% z](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' warp_list_page_title: '[Warp:](#00fb9a) [(%1%-%2% z](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' command_list_title: '[HuskHomes](#00fb9a bold) [| Lista Komend](#00fb9a)\n' - home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' + home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7Status: %3%\n&7ℹ %4% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&Publiczny' + home_is_private: 'ïe6f&Prywatny' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7Kliknij, aby sugerować komendę suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/common/src/main/resources/locales/pt-br.yml b/common/src/main/resources/locales/pt-br.yml index 7dd49bf4..6dcc2c6f 100644 --- a/common/src/main/resources/locales/pt-br.yml +++ b/common/src/main/resources/locales/pt-br.yml @@ -64,8 +64,10 @@ locales: public_home_list_page_title: '[☀ Casas Públicas:](#00fb9a) [(%1%-%2% de](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' warp_list_page_title: '[Warps:](#00fb9a) [(%1%-%2% de](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' command_list_title: '[HuskHomes](#00fb9a bold) [| Lista de Comandos](#00fb9a)\n' - home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' + home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7Status: %3%\n&7ℹ %4% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&Pública' + home_is_private: 'ïe6f&Privada' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7Clique para sugerir comando suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/common/src/main/resources/locales/ru-ru.yml b/common/src/main/resources/locales/ru-ru.yml index 42a4f9c4..7441d4ad 100644 --- a/common/src/main/resources/locales/ru-ru.yml +++ b/common/src/main/resources/locales/ru-ru.yml @@ -64,8 +64,10 @@ locales: public_home_list_page_title: '[☀ Публичные дома:](#00fb9a) [(%1%-%2% из](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' warp_list_page_title: '[Телепортации:](#00fb9a) [(%1%-%2% из](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' command_list_title: '[HuskHomes](#00fb9a bold) [| Список команд](#00fb9a)\n' - home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' + home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7Положение дел: %3%\n&7ℹ %4% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&Общественный' + home_is_private: 'ïe6f&Частный' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7Нажмите, чтобы предложить команду suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/common/src/main/resources/locales/tr-tr.yml b/common/src/main/resources/locales/tr-tr.yml index d39824da..b66daa01 100644 --- a/common/src/main/resources/locales/tr-tr.yml +++ b/common/src/main/resources/locales/tr-tr.yml @@ -64,8 +64,10 @@ locales: public_home_list_page_title: '[☀ Herkese Açık Evler:](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' warp_list_page_title: '[Warplar:](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' command_list_title: '[HuskHomes](#00fb9a bold) [| Komut Listesi](#00fb9a)\n' - home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' + home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7Durum: %3%\n&7ℹ %4% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&Halk' + home_is_private: 'ïe6f&Özel' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7Komut önermek için tıklayın suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/common/src/main/resources/locales/uk-ua.yml b/common/src/main/resources/locales/uk-ua.yml index 564cf0ab..918332a9 100644 --- a/common/src/main/resources/locales/uk-ua.yml +++ b/common/src/main/resources/locales/uk-ua.yml @@ -64,8 +64,10 @@ locales: public_home_list_page_title: '[☀ Public Homes:](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' warp_list_page_title: '[Warps:](#00fb9a) [(%1%-%2% of](#00fb9a) [%3%](#00fb9a bold)[)](#00fb9a)\n' command_list_title: '[HuskHomes](#00fb9a bold) [| Command List](#00fb9a)\n' - home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' + home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7Статус: %3%\n&7ℹ %4% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&Громадський' + home_is_private: 'ïe6f&Приватний' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7Click to suggest command suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/common/src/main/resources/locales/zh-cn.yml b/common/src/main/resources/locales/zh-cn.yml index eb021194..9995a34d 100644 --- a/common/src/main/resources/locales/zh-cn.yml +++ b/common/src/main/resources/locales/zh-cn.yml @@ -64,8 +64,10 @@ locales: public_home_list_page_title: '[☀ 公共家:](#00fb9a) [(%1%-%2% 共](#00fb9a)[%3%](#00fb9a bold)[个)](#00fb9a)\n' warp_list_page_title: '[地标:](#00fb9a) [(%1%-%2% 共](#00fb9a)[%3%](#00fb9a bold)[个)](#00fb9a)\n' command_list_title: '[HuskHomes](#00fb9a bold) [| 命令列表](#00fb9a)\n' - home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' + home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7地位: %3%\n&7ℹ %4% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&民众' + home_is_private: 'ïe6f&私人的' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7点击使用命令 suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/common/src/main/resources/locales/zh-tw.yml b/common/src/main/resources/locales/zh-tw.yml index 9ded46e7..f5482eee 100644 --- a/common/src/main/resources/locales/zh-tw.yml +++ b/common/src/main/resources/locales/zh-tw.yml @@ -64,8 +64,10 @@ public_home_list_page_title: '[☀ 公共家:](#00fb9a) [(%1%-%2% 共](#00fb9a) [%3%](#00fb9a bold)[ 個)](#00fb9a)\n' warp_list_page_title: '[地標:](#00fb9a) [(%1%-%2% 共](#00fb9a) [%3%](#00fb9a bold)[ 個)](#00fb9a)\n' command_list_title: '[HuskHomes](#00fb9a bold) [| 指令列表](#00fb9a)\n' - home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:edithome %2%)' + home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7地位: %3%\n&7ℹ %4% run_command=/huskhomes:edithome %2%)' public_home_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7☻ %3%\n&7ℹ %4% run_command=/huskhomes:phome %2%)' + home_is_public: '�fb9a&民众' + home_is_private: 'ïe6f&私人的' warp_list_item: '[[%1%]](show_text=�fb9a&%1%\n&7ℹ %3% run_command=/huskhomes:warp %2%)' command_list_item: '[/%1%](#00fb9a show_text=&7點擊使用指令 suggest_command=/%1%) [%2%](gray show_text=�fb9a&/%1%\n&7%3%)' list_item_divider: ' [•](gray) ' diff --git a/fabric/src/main/java/net/william278/huskhomes/command/FabricCommand.java b/fabric/src/main/java/net/william278/huskhomes/command/FabricCommand.java index 8773a3e4..9628d369 100644 --- a/fabric/src/main/java/net/william278/huskhomes/command/FabricCommand.java +++ b/fabric/src/main/java/net/william278/huskhomes/command/FabricCommand.java @@ -130,7 +130,7 @@ public class FabricCommand { public enum Type { HOME_COMMAND(PrivateHomeCommand::new), SET_HOME_COMMAND(SetHomeCommand::new), - HOME_LIST_COMMAND(PrivateHomeListCommand::new), + HOME_LIST_COMMAND(HomeListCommand::new), DEL_HOME_COMMAND(DelHomeCommand::new), EDIT_HOME_COMMAND(EditHomeCommand::new), PUBLIC_HOME_COMMAND(PublicHomeCommand::new), diff --git a/fabric/src/main/java/net/william278/huskhomes/user/FabricUser.java b/fabric/src/main/java/net/william278/huskhomes/user/FabricUser.java index 8a696e6e..d757a6aa 100644 --- a/fabric/src/main/java/net/william278/huskhomes/user/FabricUser.java +++ b/fabric/src/main/java/net/william278/huskhomes/user/FabricUser.java @@ -164,6 +164,21 @@ public class FabricUser extends OnlineUser { return false; } + /** + * Handles player invulnerability after teleporting + */ + @Override + public void handleInvulnerability() { + if (plugin.getSettings().getGeneral().getTeleportInvulnerabilityTime() <= 0) { + return; + } + long invulnerabilityTimeInTicks = 20L * plugin.getSettings().getGeneral().getTeleportInvulnerabilityTime(); + player.setInvulnerable(true); + // Remove the invulnerability + plugin.runSyncDelayed(() -> player.setInvulnerable(false), invulnerabilityTimeInTicks); + } + + @NotNull private static Identifier parseIdentifier(@NotNull String channel) { if (channel.equals("BungeeCord")) { diff --git a/sponge/src/main/java/net/william278/huskhomes/command/SpongeCommand.java b/sponge/src/main/java/net/william278/huskhomes/command/SpongeCommand.java index cf533796..a0177369 100644 --- a/sponge/src/main/java/net/william278/huskhomes/command/SpongeCommand.java +++ b/sponge/src/main/java/net/william278/huskhomes/command/SpongeCommand.java @@ -157,7 +157,7 @@ public class SpongeCommand implements Raw { public enum Type { HOME_COMMAND(PrivateHomeCommand::new), SET_HOME_COMMAND(SetHomeCommand::new), - HOME_LIST_COMMAND(PrivateHomeListCommand::new), + HOME_LIST_COMMAND(HomeListCommand::new), DEL_HOME_COMMAND(DelHomeCommand::new), EDIT_HOME_COMMAND(EditHomeCommand::new), PUBLIC_HOME_COMMAND(PublicHomeCommand::new), diff --git a/sponge/src/main/java/net/william278/huskhomes/user/SpongeUser.java b/sponge/src/main/java/net/william278/huskhomes/user/SpongeUser.java index f4a9cea1..c4d317b7 100644 --- a/sponge/src/main/java/net/william278/huskhomes/user/SpongeUser.java +++ b/sponge/src/main/java/net/william278/huskhomes/user/SpongeUser.java @@ -131,4 +131,18 @@ public class SpongeUser extends OnlineUser { return false; } + /** + * Handles player invulnerability after teleporting + */ + @Override + public void handleInvulnerability() { + if (plugin.getSettings().getGeneral().getTeleportInvulnerabilityTime() <= 0) { + return; + } + long invulnerabilityTimeInTicks = 20L * plugin.getSettings().getGeneral().getTeleportInvulnerabilityTime(); + player.invulnerable().set(false); + // Remove the invulnerability + plugin.runSyncDelayed(() -> player.invulnerable().set(true), invulnerabilityTimeInTicks); + } + }