mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-03 14:38:53 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
3 files changed
+31
-7
No files matched your search
@@ -24,11 +24,22 @@ public final class BukkitAdapter {
|
|||||||
if (world == null) {
|
if (world == null) {
|
||||||
world = Bukkit.getWorld(location.getWorld().getUuid());
|
world = Bukkit.getWorld(location.getWorld().getUuid());
|
||||||
}
|
}
|
||||||
|
if (world == null) {
|
||||||
|
world = Bukkit.getWorlds().stream()
|
||||||
|
.filter(w -> w.getEnvironment().name().equalsIgnoreCase(location.getWorld().getEnvironment().name()))
|
||||||
|
.findFirst().orElse(null);
|
||||||
|
}
|
||||||
if (world == null) {
|
if (world == null) {
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
return Optional.of(new org.bukkit.Location(world, location.getX(), location.getY(), location.getZ(),
|
return Optional.of(new org.bukkit.Location(
|
||||||
location.getYaw(), location.getPitch()));
|
world,
|
||||||
|
location.getX(),
|
||||||
|
location.getY(),
|
||||||
|
location.getZ(),
|
||||||
|
location.getYaw(),
|
||||||
|
location.getPitch()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -96,19 +96,31 @@ public class EventListener {
|
|||||||
}
|
}
|
||||||
}, 40L);
|
}, 40L);
|
||||||
} else {
|
} else {
|
||||||
teleporter.teleportLocally(spawn, plugin.getSettings().doAsynchronousTeleports());
|
try {
|
||||||
|
teleporter.teleportLocally(spawn, plugin.getSettings().doAsynchronousTeleports());
|
||||||
|
} catch (TeleportationException e) {
|
||||||
|
e.displayMessage(teleporter, plugin, new String[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
teleporter.sendTranslatableMessage("block.minecraft.spawn.not_valid");
|
teleporter.sendTranslatableMessage("block.minecraft.spawn.not_valid");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
teleporter.teleportLocally(bedPosition.get(), plugin.getSettings().doAsynchronousTeleports());
|
try {
|
||||||
|
teleporter.teleportLocally(bedPosition.get(), plugin.getSettings().doAsynchronousTeleports());
|
||||||
|
} catch (TeleportationException e) {
|
||||||
|
e.displayMessage(teleporter, plugin, new String[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
plugin.getDatabase().setCurrentTeleport(teleporter, null);
|
plugin.getDatabase().setCurrentTeleport(teleporter, null);
|
||||||
plugin.getDatabase().setRespawnPosition(teleporter, bedPosition.orElse(null));
|
plugin.getDatabase().setRespawnPosition(teleporter, bedPosition.orElse(null));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
teleporter.teleportLocally((Position) teleport.getTarget(), plugin.getSettings().doAsynchronousTeleports());
|
try {
|
||||||
|
teleporter.teleportLocally((Position) teleport.getTarget(), plugin.getSettings().doAsynchronousTeleports());
|
||||||
|
} catch (TeleportationException e) {
|
||||||
|
e.displayMessage(teleporter, plugin, new String[0]);
|
||||||
|
}
|
||||||
plugin.getDatabase().setCurrentTeleport(teleporter, null);
|
plugin.getDatabase().setCurrentTeleport(teleporter, null);
|
||||||
teleport.displayTeleportingComplete(teleporter);
|
teleport.displayTeleportingComplete(teleporter);
|
||||||
});
|
});
|
||||||
@@ -187,7 +199,7 @@ public class EventListener {
|
|||||||
// Display the return by death via /back notification
|
// Display the return by death via /back notification
|
||||||
final boolean canReturnByDeath = plugin.getCommand(BackCommand.class)
|
final boolean canReturnByDeath = plugin.getCommand(BackCommand.class)
|
||||||
.map(command -> onlineUser.hasPermission(command.getPermission())
|
.map(command -> onlineUser.hasPermission(command.getPermission())
|
||||||
&& onlineUser.hasPermission(command.getPermission("death")))
|
&& onlineUser.hasPermission(command.getPermission("death")))
|
||||||
.orElse(false);
|
.orElse(false);
|
||||||
if (plugin.getSettings().doBackCommandReturnByDeath() && canReturnByDeath) {
|
if (plugin.getSettings().doBackCommandReturnByDeath() && canReturnByDeath) {
|
||||||
plugin.getLocales().getLocale("return_by_death_notification")
|
plugin.getLocales().getLocale("return_by_death_notification")
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import net.william278.huskhomes.config.Locales;
|
|||||||
import net.william278.huskhomes.position.Location;
|
import net.william278.huskhomes.position.Location;
|
||||||
import net.william278.huskhomes.position.Position;
|
import net.william278.huskhomes.position.Position;
|
||||||
import net.william278.huskhomes.teleport.Teleportable;
|
import net.william278.huskhomes.teleport.Teleportable;
|
||||||
|
import net.william278.huskhomes.teleport.TeleportationException;
|
||||||
import org.intellij.lang.annotations.Subst;
|
import org.intellij.lang.annotations.Subst;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -159,7 +160,7 @@ public abstract class OnlineUser extends User implements Teleportable, CommandUs
|
|||||||
* @param location the {@link Location} to teleport the player to
|
* @param location the {@link Location} to teleport the player to
|
||||||
* @param asynchronous if the teleport should be asynchronous
|
* @param asynchronous if the teleport should be asynchronous
|
||||||
*/
|
*/
|
||||||
public abstract void teleportLocally(@NotNull Location location, boolean asynchronous);
|
public abstract void teleportLocally(@NotNull Location location, boolean asynchronous) throws TeleportationException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a plugin message to the user
|
* Send a plugin message to the user
|
||||||
|
|||||||
Reference in new issue
Block a user