Search in sources :

Example 56 with Command

use of org.terasology.logic.console.commandSystem.annotations.Command in project Terasology by MovingBlocks.

the class ServerCommands method kickUserByID.

@Command(shortDescription = "Kick user by ID", runOnServer = true, requiredPermission = PermissionManager.USER_MANAGEMENT_PERMISSION)
public String kickUserByID(@CommandParam("userId") int userId) {
    for (EntityRef clientEntity : entityManager.getEntitiesWith(ClientComponent.class)) {
        EntityRef clientInfo = clientEntity.getComponent(ClientComponent.class).clientInfo;
        NetworkComponent nc = clientInfo.getComponent(NetworkComponent.class);
        if (userId == nc.getNetworkId()) {
            return kick(clientEntity);
        }
    }
    throw new IllegalArgumentException("No such user with ID " + userId);
}
Also used : NetworkComponent(org.terasology.network.NetworkComponent) EntityRef(org.terasology.entitySystem.entity.EntityRef) ClientComponent(org.terasology.network.ClientComponent) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 57 with Command

use of org.terasology.logic.console.commandSystem.annotations.Command in project Terasology by MovingBlocks.

the class MovementDebugCommands method sleigh.

@Command(shortDescription = "Toggles the maximum slope the player can walk up", runOnServer = true, requiredPermission = PermissionManager.CHEAT_PERMISSION)
public String sleigh(@Sender EntityRef client) {
    ClientComponent clientComp = client.getComponent(ClientComponent.class);
    CharacterMovementComponent move = clientComp.character.getComponent(CharacterMovementComponent.class);
    if (move != null) {
        float oldFactor = move.slopeFactor;
        if (move.slopeFactor > 0.7f) {
            move.slopeFactor = 0.6f;
        } else {
            move.slopeFactor = 0.9f;
        }
        clientComp.character.saveComponent(move);
        return "Slope factor is now " + move.slopeFactor + " (was " + oldFactor + ")";
    }
    return "";
}
Also used : CharacterMovementComponent(org.terasology.logic.characters.CharacterMovementComponent) ClientComponent(org.terasology.network.ClientComponent) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 58 with Command

use of org.terasology.logic.console.commandSystem.annotations.Command in project Terasology by MovingBlocks.

the class MovementDebugCommands method pushCharacterCommand.

@Command(value = "pushCharacter", shortDescription = "Pushes you in the direction (x, y, z)", runOnServer = true)
public String pushCharacterCommand(@Sender EntityRef sender, @CommandParam("x") float x, @CommandParam("y") float y, @CommandParam("z") float z) {
    ClientComponent clientComponent = sender.getComponent(ClientComponent.class);
    clientComponent.character.send(new CharacterImpulseEvent(new Vector3f(x, y, z)));
    return "Pushing character with " + x + " " + y + " " + z;
}
Also used : Vector3f(org.terasology.math.geom.Vector3f) ClientComponent(org.terasology.network.ClientComponent) CharacterImpulseEvent(org.terasology.logic.characters.CharacterImpulseEvent) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 59 with Command

use of org.terasology.logic.console.commandSystem.annotations.Command in project Terasology by MovingBlocks.

the class MovementDebugCommands method flight.

@Command(shortDescription = "Grants flight", runOnServer = true, requiredPermission = PermissionManager.CHEAT_PERMISSION)
public String flight(@Sender EntityRef client) {
    ClientComponent clientComp = client.getComponent(ClientComponent.class);
    clientComp.character.send(new SetMovementModeEvent(MovementMode.FLYING));
    return "Flight mode toggled";
}
Also used : SetMovementModeEvent(org.terasology.logic.characters.events.SetMovementModeEvent) ClientComponent(org.terasology.network.ClientComponent) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Example 60 with Command

use of org.terasology.logic.console.commandSystem.annotations.Command in project Terasology by MovingBlocks.

the class MovementDebugCommands method hjump.

@Command(shortDescription = "Jump really high", runOnServer = true, requiredPermission = PermissionManager.CHEAT_PERMISSION)
public String hjump(@Sender EntityRef client) {
    ClientComponent clientComp = client.getComponent(ClientComponent.class);
    CharacterMovementComponent move = clientComp.character.getComponent(CharacterMovementComponent.class);
    if (move != null) {
        move.jumpSpeed = 75f;
        clientComp.character.saveComponent(move);
        return "High-jump mode activated";
    }
    return "";
}
Also used : CharacterMovementComponent(org.terasology.logic.characters.CharacterMovementComponent) ClientComponent(org.terasology.network.ClientComponent) Command(org.terasology.logic.console.commandSystem.annotations.Command)

Aggregations

Command (org.terasology.logic.console.commandSystem.annotations.Command)76 ClientComponent (org.terasology.network.ClientComponent)48 EntityRef (org.terasology.entitySystem.entity.EntityRef)28 ConsoleCommand (org.terasology.logic.console.commandSystem.ConsoleCommand)16 Vector3f (org.terasology.math.geom.Vector3f)14 CharacterMovementComponent (org.terasology.logic.characters.CharacterMovementComponent)11 LocationComponent (org.terasology.logic.location.LocationComponent)10 DisplayNameComponent (org.terasology.logic.common.DisplayNameComponent)9 ResourceUrn (org.terasology.assets.ResourceUrn)8 Prefab (org.terasology.entitySystem.prefab.Prefab)6 CharacterTeleportEvent (org.terasology.logic.characters.CharacterTeleportEvent)6 SimpleUri (org.terasology.engine.SimpleUri)5 BlockFamily (org.terasology.world.block.family.BlockFamily)4 Map (java.util.Map)3 AnatomyComponent (org.terasology.anatomy.component.AnatomyComponent)3 SetMovementModeEvent (org.terasology.logic.characters.events.SetMovementModeEvent)3 DropItemEvent (org.terasology.logic.inventory.events.DropItemEvent)3 Method (java.lang.reflect.Method)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2