mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-04 06:28:49 +00:00
New API methods, refactor position object to use static creators
This commit is contained in:
1 parent
42adc13425
commit
6b8c515b61
42 files changed
+587
-232
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package net.william278.huskhomes.teleport;
|
||||
|
||||
import net.william278.huskhomes.HuskHomes;
|
||||
import net.william278.huskhomes.config.Settings;
|
||||
import net.william278.huskhomes.event.ITeleportEvent;
|
||||
import net.william278.huskhomes.hook.EconomyHook;
|
||||
import net.william278.huskhomes.network.Message;
|
||||
@@ -85,8 +86,7 @@ public class Teleport {
|
||||
fireEvent((event) -> {
|
||||
executeEconomyActions();
|
||||
teleporter.teleportLocally(localTarget.get().getPosition(), async);
|
||||
plugin.getLocales().getLocale("teleporting_complete")
|
||||
.ifPresent(teleporter::sendMessage);
|
||||
this.displayTeleportingComplete(teleporter);
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -98,8 +98,7 @@ public class Teleport {
|
||||
.type(Message.Type.TELEPORT_TO_NETWORKED_POSITION)
|
||||
.target(username.name())
|
||||
.build().send(plugin.getMessenger(), executor);
|
||||
plugin.getLocales().getLocale("teleporting_complete")
|
||||
.ifPresent(teleporter::sendMessage);
|
||||
this.displayTeleportingComplete(teleporter);
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -113,8 +112,7 @@ public class Teleport {
|
||||
final Position target = (Position) this.target;
|
||||
if (!plugin.getSettings().isCrossServer() || target.getServer().equals(plugin.getServerName())) {
|
||||
teleporter.teleportLocally(target, async);
|
||||
plugin.getLocales().getLocale("teleporting_complete")
|
||||
.ifPresent(teleporter::sendMessage);
|
||||
this.displayTeleportingComplete(teleporter);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -131,6 +129,13 @@ public class Teleport {
|
||||
return Optional.of((OnlineUser) this.teleporter);
|
||||
}
|
||||
|
||||
public void displayTeleportingComplete(@NotNull OnlineUser teleporter) {
|
||||
plugin.getLocales().getLocale("teleporting_complete")
|
||||
.ifPresent(teleporter::sendMessage);
|
||||
plugin.getSettings().getSoundEffect(Settings.SoundEffectAction.TELEPORTATION_CANCELLED)
|
||||
.ifPresent(teleporter::playSound);
|
||||
}
|
||||
|
||||
// Fire the teleport event
|
||||
private void fireEvent(@NotNull Consumer<ITeleportEvent> afterFired) {
|
||||
plugin.fireEvent(plugin.getTeleportEvent(this), afterFired);
|
||||
|
||||
@@ -132,12 +132,7 @@ public class TimedTeleport extends Teleport {
|
||||
}
|
||||
|
||||
private void sendStatusMessage(@NotNull MineDown message) {
|
||||
switch (plugin.getSettings().getTeleportWarmupDisplay()) {
|
||||
case ACTION_BAR -> teleporter.sendActionBar(message);
|
||||
case SUBTITLE -> teleporter.sendTitle(message, true);
|
||||
case TITLE -> teleporter.sendTitle(message, false);
|
||||
case MESSAGE -> teleporter.sendMessage(message);
|
||||
}
|
||||
teleporter.sendMessage(message, plugin.getSettings().getTeleportWarmupDisplay());
|
||||
}
|
||||
|
||||
private boolean hasTeleporterMoved() {
|
||||
|
||||
Reference in new issue
Block a user