Package com.bergerkiller.bukkit.tc

Examples of com.bergerkiller.bukkit.tc.CollisionMode


  @Override
  public boolean onEntityCollision(Entity e) {
    if (!this.isInteractable()) {
      return false;
    }
    CollisionMode mode = this.getGroup().getProperties().getCollisionMode(e);
    if (!mode.execute(this, e)) {
      return false;
    }
    // Collision occurred, collided head-on? Stop the entire train
    if (this.isHeadingTo(e)) {
      this.getGroup().stop();
View Full Code Here


    } else if (key.equals("pushplayers")) {
      this.playerCollision = CollisionMode.fromPushing(ParseUtil.parseBool(arg));
    } else if (key.equals("pushmisc")) {
      this.miscCollision = CollisionMode.fromPushing(ParseUtil.parseBool(arg));
    } else if (LogicUtil.contains(key, "push", "pushing")) {
      CollisionMode mode = CollisionMode.fromPushing(ParseUtil.parseBool(arg));
      this.playerCollision = this.mobCollision = this.miscCollision = mode;
    } else if (LogicUtil.contains(key, "speedlimit", "maxspeed")) {
      this.setSpeedLimit(ParseUtil.parseDouble(arg, 0.4));
    } else if (LogicUtil.contains(key, "allowmanual", "manualmove", "manual")) {
      this.allowManualMovement = ParseUtil.parseBool(arg);
View Full Code Here

        p.sendMessage(ChatColor.RED + "You failed to set any owners: you don't own any carts!");
      }
    } else if (cmd.equals("pushmobs") || cmd.equals("pushplayers") || cmd.equals("pushmisc")) {
      Permission.COMMAND_PUSHING.handle(p);
      // Parse a new collision mode to set to
      CollisionMode newState = null;
      if (args.length == 1) {
        newState = CollisionMode.fromPushing(ParseUtil.parseBool(args[0]));
      }
      String msg = ChatColor.YELLOW + "Pushes away ";
      if (cmd.equals("pushmobs")) {
        if (newState != null) {
          prop.mobCollision = newState;
        }
        msg += "mobs: " + ChatColor.WHITE + " " + (prop.mobCollision == CollisionMode.PUSH);
      }
      if (cmd.equals("pushplayers")) {
        if (newState != null) {
          prop.playerCollision = newState;
        }
        msg += "players: " + ChatColor.WHITE + " " + (prop.playerCollision == CollisionMode.PUSH);
      }
      if (cmd.equals("pushmisc")) {
        if (newState != null) {
          prop.miscCollision = newState;
        }
        msg += "misc. entities: " + ChatColor.WHITE + " " + (prop.miscCollision == CollisionMode.PUSH);
      }
      p.sendMessage(msg);
    } else if (cmd.equals("slowdown") || cmd.equals("slow") || cmd.equals("setslow") || cmd.equals("setslowdown")) {
      Permission.COMMAND_SLOWDOWN.handle(p);
      if (args.length == 1) {
        prop.setSlowingDown(ParseUtil.parseBool(args[0]));
      }
      p.sendMessage(ChatColor.YELLOW + "Slow down: " + ChatColor.WHITE + prop.isSlowingDown());
    } else if (cmd.equals("setcollide") || cmd.equals("setcollision") || cmd.equals("collision") || cmd.equals("collide")) {
      Permission.COMMAND_SETCOLLIDE.handle(p);
      if (args.length == 2) {
        CollisionMode mode = CollisionMode.parse(args[1]);
        if (mode != null) {
          String typeName = args[0].toLowerCase();
          if (typeName.contains("mob")) {
            prop.mobCollision = mode;
            p.sendMessage(ChatColor.YELLOW + "When colliding this train " + prop.mobCollision.getOperationName() + " mobs");
View Full Code Here

TOP

Related Classes of com.bergerkiller.bukkit.tc.CollisionMode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.