TeleportAllCommand class
Пакет: com.hypixel.hytale.builtin.teleport.commands.teleport
Файл: com/hypixel/hytale/builtin/teleport/commands/teleport/TeleportAllCommand.java
extends: CommandBase
Поля (44)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
return |
|
|
return |
|
double |
var11 |
|
|
var11 |
|
Ref |
var13 |
|
Store |
var14 |
|
World |
var15 |
|
TransformComponent |
var16 |
|
Vector3d |
var17 |
|
boolean |
var19 |
|
Coord |
var2 |
|
Ref |
var23 |
|
TransformComponent |
var24 |
|
HeadRotation |
var25 |
|
Vector3d |
var26 |
|
Rotation3f |
var27 |
|
Rotation3f |
var28 |
|
float |
var29 |
|
Coord |
var3 |
|
float |
var30 |
|
float |
var31 |
|
Teleport |
var32 |
|
Player |
var33 |
|
PlayerRef |
var34 |
|
TeleportHistory |
var35 |
|
float |
var36 |
|
float |
var37 |
|
float |
var38 |
|
double |
var39 |
|
Coord |
var4 |
|
double |
var40 |
|
double |
var41 |
|
float |
var42 |
|
float |
var43 |
|
float |
var44 |
|
World |
var5 |
|
|
var5 |
|
|
var5 |
|
Ref |
var6 |
|
Store |
var6 |
|
double |
var7 |
|
|
var7 |
|
double |
var9 |
|
|
var9 |
Методы (6)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(var16 != null) |
|
|
if if(var24 != null && var25 != null) |
|
|
if if(var33 != null) |
|
|
if if(var19) |
|
|
if if(var19) |
abstract |
|
super super("all", "server.commands.tpall.desc") |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.builtin.teleport.commands.teleport;
class="kw">import com.hypixel.hytale.builtin.teleport.components.TeleportHistory;
class="kw">import com.hypixel.hytale.component.Ref;
class="kw">import com.hypixel.hytale.component.Store;
class="kw">import com.hypixel.hytale.math.vector.Rotation3f;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.command.system.CommandContext;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.system.OptionalArg;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.system.RequiredArg;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.types.Coord;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.types.RelativeFloat;
class="kw">import com.hypixel.hytale.server.core.command.system.basecommands.CommandBase;
class="kw">import com.hypixel.hytale.server.core.entity.entities.Player;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.HeadRotation;
class="kw">import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
class="kw">import com.hypixel.hytale.server.core.modules.entity.teleport.Teleport;
class="kw">import com.hypixel.hytale.server.core.permissions.HytalePermissions;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
class="kw">import com.hypixel.hytale.server.core.universe.world.World;
class="kw">import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
class="kw">import com.hypixel.hytale.server.core.util.NotificationUtil;
class="kw">import javax.annotation.Nonnull;
class="kw">import org.joml.Vector3d;
class="kw">public class TeleportAllCommand class="kw">extends CommandBase {
@Nonnull
class="kw">private class="kw">static class="kw">final Message MESSAGE_COMMANDS_ERRORS_PLAYER_NOT_IN_WORLD = Message.translation("server.commands.errors.playerNotInWorld");
@Nonnull
class="kw">private class="kw">final RequiredArg<Coord> xArg = this.withRequiredArg("x", "server.commands.teleport.x.desc", ArgTypes.RELATIVE_DOUBLE_COORD);
@Nonnull
class="kw">private class="kw">final RequiredArg<Coord> yArg = this.withRequiredArg("y", "server.commands.teleport.y.desc", ArgTypes.RELATIVE_DOUBLE_COORD);
@Nonnull
class="kw">private class="kw">final RequiredArg<Coord> zArg = this.withRequiredArg("z", "server.commands.teleport.z.desc", ArgTypes.RELATIVE_DOUBLE_COORD);
@Nonnull
class="kw">private class="kw">final OptionalArg<RelativeFloat> yawArg = this.withOptionalArg("yaw", "server.commands.teleport.yaw.desc", ArgTypes.RELATIVE_FLOAT);
@Nonnull
class="kw">private class="kw">final OptionalArg<RelativeFloat> pitchArg = this.withOptionalArg("pitch", "server.commands.teleport.pitch.desc", ArgTypes.RELATIVE_FLOAT);
@Nonnull
class="kw">private class="kw">final OptionalArg<RelativeFloat> rollArg = this.withOptionalArg("roll", "server.commands.teleport.roll.desc", ArgTypes.RELATIVE_FLOAT);
@Nonnull
class="kw">private class="kw">final OptionalArg<World> worldArg = this.withOptionalArg("world", "server.commands.worldthread.arg.desc", ArgTypes.WORLD);
class="kw">public TeleportAllCommand() {
super("all", "server.commands.tpall.desc");
this.setPermissionGroups("hytale:Admin");
this.requirePermission(HytalePermissions.fromCommand("teleport.all"));
}
@Override
class="kw">protected void executeSync(@Nonnull CommandContext var1) {
Coord var2 = this.xArg.get(var1);
Coord var3 = this.yArg.get(var1);
Coord var4 = this.zArg.get(var1);
World var5;
if (this.worldArg.provided(var1)) {
var5 = this.worldArg.get(var1);
} else {
if (!var1.isPlayer()) {
var1.sendMessage(Message.translation("server.commands.errors.playerOrArg").param("option", "world"));
class="kw">return;
}
Ref var6 = var1.senderAsPlayerRef();
if (var6 == null || !var6.isValid()) {
var1.sendMessage(MESSAGE_COMMANDS_ERRORS_PLAYER_NOT_IN_WORLD);
class="kw">return;
}
var5 = var6.getStore().getExternalData().getWorld();
}
var5.execute(
() -> {
Store var6 = var5.getEntityStore().getStore();
double var7 = 0.0;
double var9 = 0.0;
double var11 = 0.0;
if (var1.isPlayer()) {
Ref var13 = var1.senderAsPlayerRef();
if (var13 != null && var13.isValid()) {
Store var14 = var13.getStore();
World var15 = var14.getExternalData().getWorld();
if (var5.equals(var15)) {
TransformComponent var16 = var14.getComponent(var13, TransformComponent.getComponentType());
if (var16 != null) {
Vector3d var17 = var16.getPosition();
var7 = var17.x();
var9 = var17.y();
var11 = var17.z();
}
}
}
}
double var39 = var2.resolveXZ(var7);
double var40 = var4.resolveXZ(var11);
double var41 = var3.resolveYAtWorldCoords(var9, var5, var39, var40);
boolean var19 = this.yawArg.provided(var1) || this.pitchArg.provided(var1) || this.rollArg.provided(var1);
for (PlayerRef var22 : var5.getPlayerRefs()) {
Ref var23 = var22.getReference();
if (var23 != null && var23.isValid()) {
TransformComponent var24 = var6.getComponent(var23, TransformComponent.getComponentType());
HeadRotation var25 = var6.getComponent(var23, HeadRotation.getComponentType());
if (var24 != null && var25 != null) {
Vector3d var26 = new Vector3d(var24.getPosition());
Rotation3f var27 = new Rotation3f(var25.getRotation());
Rotation3f var28 = new Rotation3f(var24.getRotation());
float var29 = this.yawArg.provided(var1)
? this.yawArg.get(var1).resolve(var27.yaw() * (180.0F / (float)Math.PI)) * (float) (Math.PI / 180.0)
: Float.NaN;
float var30 = this.pitchArg.provided(var1)
? this.pitchArg.get(var1).resolve(var27.pitch() * (180.0F / (float)Math.PI)) * (float) (Math.PI / 180.0)
: Float.NaN;
float var31 = this.rollArg.provided(var1)
? this.rollArg.get(var1).resolve(var27.roll() * (180.0F / (float)Math.PI)) * (float) (Math.PI / 180.0)
: Float.NaN;
Teleport var32 = Teleport.createExact(
new Vector3d(var39, var41, var40), new Rotation3f(var28.pitch(), var29, var28.roll()), new Rotation3f(var30, var29, var31)
);
var6.addComponent(var23, Teleport.getComponentType(), var32);
Player var33 = var6.getComponent(var23, Player.getComponentType());
if (var33 != null) {
PlayerRef var34 = var6.getComponent(var23, PlayerRef.getComponentType());
assert var34 != null;
TeleportHistory var35 = var6.ensureAndGetComponent(var23, TeleportHistory.getComponentType());
var35.append(var5, var26, var27, String.format("Teleport to (%s, %s, %s) by %s", var39, var41, var40, var1.sender().getUsername()));
if (var19) {
float var36 = Float.isNaN(var29) ? var27.yaw() * (180.0F / (float)Math.PI) : var29 * (180.0F / (float)Math.PI);
float var37 = Float.isNaN(var30) ? var27.pitch() * (180.0F / (float)Math.PI) : var30 * (180.0F / (float)Math.PI);
float var38 = Float.isNaN(var31) ? var27.roll() * (180.0F / (float)Math.PI) : var31 * (180.0F / (float)Math.PI);
NotificationUtil.sendNotification(
var34.getPacketHandler(),
Message.translation("server.commands.teleport.teleportedWithLookNotification")
.param("x", var39)
.param("y", var41)
.param("z", var40)
.param("yaw", var36)
.param("pitch", var37)
.param("roll", var38)
.param("sender", var1.sender().getUsername()),
null,
"teleportation"
);
} else {
NotificationUtil.sendNotification(
var34.getPacketHandler(),
Message.translation("server.commands.teleport.teleportedToCoordinatesNotification")
.param("x", var39)
.param("y", var41)
.param("z", var40)
.param("sender", var1.sender().getUsername()),
null,
"teleportation"
);
}
}
}
}
}
if (var19) {
float var42 = this.yawArg.provided(var1) ? this.yawArg.get(var1).getRawValue() : 0.0F;
float var43 = this.pitchArg.provided(var1) ? this.pitchArg.get(var1).getRawValue() : 0.0F;
float var44 = this.rollArg.provided(var1) ? this.rollArg.get(var1).getRawValue() : 0.0F;
var1.sendMessage(
Message.translation("server.commands.teleport.teleportEveryoneWithLook")
.param("world", var5.getName())
.param("x", var39)
.param("y", var41)
.param("z", var40)
.param("yaw", var42)
.param("pitch", var43)
.param("roll", var44)
);
} else {
var1.sendMessage(
Message.translation("server.commands.teleport.teleportEveryone")
.param("world", var5.getName())
.param("x", var39)
.param("y", var41)
.param("z", var40)
);
}
}
);
}
}