mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-01 22:16:08 +00:00
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
This commit is contained in:
1 parent
2f2ae6f0d2
commit
1cb56f93fb
27 files changed
+108
-21
No files matched your search
+6
-2
@@ -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()
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -148,6 +148,7 @@ public class EventListener {
|
||||
}
|
||||
plugin.getDatabase().clearCurrentTeleport(teleporter);
|
||||
teleport.displayTeleportingComplete(teleporter);
|
||||
teleporter.handleInvulnerability();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
Reference in new issue
Block a user