Search in sources :

Example 1 with LanternSelectorFactory

use of org.lanternpowered.server.text.selector.LanternSelectorFactory in project LanternServer by LanternPowered.

the class ArgumentTypeRegistryModule method registerDefaults.

@Override
public void registerDefaults() {
    @SuppressWarnings("deprecation") final LanternSelectorFactory factory = Lantern.getGame().getRegistry().getSelectorFactory();
    // POSITION
    ArgumentType<Integer> x = factory.createArgumentType("x", Integer.class);
    ArgumentType<Integer> y = factory.createArgumentType("y", Integer.class);
    ArgumentType<Integer> z = factory.createArgumentType("z", Integer.class);
    ArgumentHolder.Vector3<Vector3i, Integer> position = new LanternArgumentHolder.LanternVector3<>(x, y, z, Vector3i.class);
    this.argumentTypeMap.put("position", position);
    // RADIUS
    ArgumentType<Integer> rmin = factory.createArgumentType("rm", Integer.class);
    ArgumentType<Integer> rmax = factory.createArgumentType("r", Integer.class);
    ArgumentHolder.Limit<ArgumentType<Integer>> radius = new LanternArgumentHolder.LanternLimit<>(rmin, rmax);
    this.argumentTypeMap.put("radius", radius);
    // GAME_MODE
    this.argumentTypeMap.put("game_mode", factory.createArgumentType("m", GameMode.class));
    // COUNT
    this.argumentTypeMap.put("count", factory.createArgumentType("c", Integer.class));
    // LEVEL
    ArgumentType<Integer> lmin = factory.createArgumentType("lm", Integer.class);
    ArgumentType<Integer> lmax = factory.createArgumentType("l", Integer.class);
    ArgumentHolder.Limit<ArgumentType<Integer>> level = new LanternArgumentHolder.LanternLimit<>(lmin, lmax);
    this.argumentTypeMap.put("level", level);
    // TEAM
    this.argumentTypeMap.put("team", factory.createInvertibleArgumentType("team", Integer.class, org.spongepowered.api.scoreboard.Team.class.getName()));
    // NAME
    this.argumentTypeMap.put("name", factory.createInvertibleArgumentType("name", String.class));
    // DIMENSION
    ArgumentType<Integer> dx = factory.createArgumentType("dx", Integer.class);
    ArgumentType<Integer> dy = factory.createArgumentType("dy", Integer.class);
    ArgumentType<Integer> dz = factory.createArgumentType("dz", Integer.class);
    ArgumentHolder.Vector3<Vector3i, Integer> dimension = new LanternArgumentHolder.LanternVector3<>(dx, dy, dz, Vector3i.class);
    this.argumentTypeMap.put("dimension", dimension);
    // ROTATION
    ArgumentType<Double> rotxmin = factory.createArgumentType("rxm", Double.class);
    ArgumentType<Double> rotymin = factory.createArgumentType("rym", Double.class);
    ArgumentType<Double> rotzmin = factory.createArgumentType("rzm", Double.class);
    ArgumentHolder.Vector3<Vector3d, Double> rotmin = new LanternArgumentHolder.LanternVector3<>(rotxmin, rotymin, rotzmin, Vector3d.class);
    ArgumentType<Double> rotxmax = factory.createArgumentType("rx", Double.class);
    ArgumentType<Double> rotymax = factory.createArgumentType("ry", Double.class);
    ArgumentType<Double> rotzmax = factory.createArgumentType("rz", Double.class);
    ArgumentHolder.Vector3<Vector3d, Double> rotmax = new LanternArgumentHolder.LanternVector3<>(rotxmax, rotymax, rotzmax, Vector3d.class);
    ArgumentHolder.Limit<ArgumentHolder.Vector3<Vector3d, Double>> rot = new LanternArgumentHolder.LanternLimit<>(rotmin, rotmax);
    this.argumentTypeMap.put("rotation", rot);
    // ENTITY_TYPE
    this.argumentTypeMap.put("entity_type", factory.createInvertibleArgumentType("type", EntityType.class));
}
Also used : LanternArgumentHolder(org.lanternpowered.server.text.selector.LanternArgumentHolder) ArgumentHolder(org.spongepowered.api.text.selector.ArgumentHolder) ArgumentType(org.spongepowered.api.text.selector.ArgumentType) EntityType(org.spongepowered.api.entity.EntityType) GameMode(org.spongepowered.api.entity.living.player.gamemode.GameMode) LanternSelectorFactory(org.lanternpowered.server.text.selector.LanternSelectorFactory) Vector3d(com.flowpowered.math.vector.Vector3d) Vector3i(com.flowpowered.math.vector.Vector3i)

Aggregations

Vector3d (com.flowpowered.math.vector.Vector3d)1 Vector3i (com.flowpowered.math.vector.Vector3i)1 LanternArgumentHolder (org.lanternpowered.server.text.selector.LanternArgumentHolder)1 LanternSelectorFactory (org.lanternpowered.server.text.selector.LanternSelectorFactory)1 EntityType (org.spongepowered.api.entity.EntityType)1 GameMode (org.spongepowered.api.entity.living.player.gamemode.GameMode)1 ArgumentHolder (org.spongepowered.api.text.selector.ArgumentHolder)1 ArgumentType (org.spongepowered.api.text.selector.ArgumentType)1