Backport to 1.18.2
This commit is contained in:
parent
ed20b4f5fb
commit
8eb93ff176
32 changed files with 276 additions and 242 deletions
|
@ -7,6 +7,7 @@ import java.sql.SQLException;
|
|||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import dev.zontreck.essentials.Messages;
|
||||
import dev.zontreck.essentials.commands.teleport.TeleportDestination;
|
||||
import dev.zontreck.essentials.events.CommandExecutionEvent;
|
||||
|
@ -40,7 +41,12 @@ public class RTPWarpCommand {
|
|||
|
||||
private static int setWarp(CommandSourceStack source, String string) {
|
||||
|
||||
var exec = new CommandExecutionEvent(source.getPlayer(), "setwarp");
|
||||
CommandExecutionEvent exec = null;
|
||||
try {
|
||||
exec = new CommandExecutionEvent(source.getPlayerOrException(), "setwarp");
|
||||
} catch (CommandSyntaxException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if(MinecraftForge.EVENT_BUS.post(exec))
|
||||
{
|
||||
return 0;
|
||||
|
@ -50,8 +56,8 @@ public class RTPWarpCommand {
|
|||
Vec3 position = p.position();
|
||||
Vec2 rot = p.getRotationVector();
|
||||
|
||||
TeleportDestination dest = new TeleportDestination(new Vector3(position), new Vector2(rot), p.serverLevel());
|
||||
Warp warp = new Warp(p.getUUID(), string, true, true, dest, new ItemStack(p.getBlockStateOn().getBlock().asItem()));
|
||||
TeleportDestination dest = new TeleportDestination(new Vector3(position), new Vector2(rot), p.getLevel());
|
||||
Warp warp = new Warp(p.getUUID(), string, true, true, dest, new ItemStack(p.getFeetBlockState().getBlock().asItem()));
|
||||
WarpCreatedEvent event = new WarpCreatedEvent(warp);
|
||||
if(MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue