コード例 #1
0
 @Override
 public boolean parseSet(String key, String arg) {
   if (key.equals("exitoffset")) {
     Vector vec = Util.parseVector(arg, null);
     if (vec != null) {
       for (CartProperties prop : this) {
         prop.exitOffset = vec;
       }
     }
   } else if (key.equals("exityaw")) {
     float yaw = ParseUtil.parseFloat(arg, 0.0f);
     for (CartProperties prop : this) {
       prop.exitYaw = yaw;
     }
   } else if (key.equals("exitpitch")) {
     float pitch = ParseUtil.parseFloat(arg, 0.0f);
     for (CartProperties prop : this) {
       prop.exitPitch = pitch;
     }
   } else if (LogicUtil.contains(key, "exitrot", "exitrotation")) {
     String[] angletext = Util.splitBySeparator(arg);
     float yaw = 0.0f;
     float pitch = 0.0f;
     if (angletext.length == 2) {
       yaw = ParseUtil.parseFloat(angletext[0], 0.0f);
       pitch = ParseUtil.parseFloat(angletext[1], 0.0f);
     } else if (angletext.length == 1) {
       yaw = ParseUtil.parseFloat(angletext[0], 0.0f);
     }
     for (CartProperties prop : this) {
       prop.exitYaw = yaw;
       prop.exitPitch = pitch;
     }
   } else if (key.equals("sound") || key.equals("minecartsound")) {
     this.soundEnabled = ParseUtil.parseBool(arg);
   } else if (key.equals("mobcollision")) {
     this.mobCollision = CollisionMode.parse(arg);
   } else if (key.equals("playercollision")) {
     this.playerCollision = CollisionMode.parse(arg);
   } else if (key.equals("misccollision")) {
     this.miscCollision = CollisionMode.parse(arg);
   } else if (key.equals("traincollision")) {
     this.trainCollision = CollisionMode.parse(arg);
   } else if (LogicUtil.contains(key, "collision", "collide")) {
     this.setColliding(ParseUtil.parseBool(arg));
   } else if (LogicUtil.contains(key, "linking", "link")) {
     this.trainCollision = CollisionMode.fromLinking(ParseUtil.parseBool(arg));
   } else if (LogicUtil.contains(key, "slow", "slowdown")) {
     this.setSlowingDown(ParseUtil.parseBool(arg));
   } else if (LogicUtil.contains(key, "setdefault", "default")) {
     this.setDefault(arg);
   } else if (key.equals("pushmobs")) {
     this.mobCollision = CollisionMode.fromPushing(ParseUtil.parseBool(arg));
   } 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);
   } else if (LogicUtil.contains(key, "keepcloaded", "loadchunks", "keeploaded")) {
     this.keepChunksLoaded = ParseUtil.parseBool(arg);
   } else if (key.equals("addtag")) {
     this.addTags(arg);
   } else if (key.equals("settag")) {
     this.setTags(arg);
   } else if (key.equals("destination")) {
     this.setDestination(arg);
   } else if (key.equals("remtag")) {
     this.removeTags(arg);
   } else if (LogicUtil.contains(key, "name", "rename", "setname")) {
     this.setName(generateTrainName(arg));
   } else if (LogicUtil.contains(key, "dname", "displayname", "setdisplayname", "setdname")) {
     this.setDisplayName(arg);
   } else if (LogicUtil.contains(key, "mobenter", "mobsenter")) {
     this.mobCollision = CollisionMode.fromEntering(ParseUtil.parseBool(arg));
   } else if (key.equals("playerenter")) {
     this.setPlayersEnter(ParseUtil.parseBool(arg));
   } else if (key.equals("playerexit")) {
     this.setPlayersExit(ParseUtil.parseBool(arg));
   } else if (LogicUtil.contains(key, "invincible", "godmode")) {
     this.setInvincible(ParseUtil.parseBool(arg));
   } else if (key.equals("setownerperm")) {
     for (CartProperties prop : this) {
       prop.clearOwnerPermissions();
       prop.getOwnerPermissions().add(arg);
     }
   } else if (key.equals("addownerperm")) {
     for (CartProperties prop : this) {
       prop.getOwnerPermissions().add(arg);
     }
   } else if (key.equals("remownerperm")) {
     for (CartProperties prop : this) {
       prop.getOwnerPermissions().remove(arg);
     }
   } else if (key.equals("setowner")) {
     arg = arg.toLowerCase();
     for (CartProperties cprop : this) {
       cprop.clearOwners();
       cprop.getOwners().add(arg);
     }
   } else if (key.equals("addowner")) {
     arg = arg.toLowerCase();
     for (CartProperties cprop : this) {
       cprop.getOwners().add(arg);
     }
   } else if (key.equals("remowner")) {
     arg = arg.toLowerCase();
     for (CartProperties cprop : this) {
       cprop.getOwners().remove(arg);
     }
   } else if (LogicUtil.contains(key, "spawnitemdrops", "spawndrops", "killdrops")) {
     this.setSpawnItemDrops(ParseUtil.parseBool(arg));
   } else {
     return false;
   }
   return true;
 }
コード例 #2
0
 @Override
 public void clearOwners() {
   for (CartProperties prop : this) {
     prop.clearOwners();
   }
 }