Ejemplo n.º 1
0
 public static PerkWorldSpawn getSpawn(World world) {
   Iterator<PerkWorldSpawn> itr = spawns.iterator();
   while (itr.hasNext()) {
     PerkWorldSpawn current = itr.next();
     if (current.getWorld().equals(world)) return current;
   }
   return null;
 }
Ejemplo n.º 2
0
  public static void setSpawn(PerkWorldSpawn spawn) {

    String query =
        "INSERT INTO `perks_spawn` ("
            + "`world`, `x`, `y`, `z`, `yaw`, `pitch`) VALUES ("
            + "'"
            + spawn.getSpawn().getWorld().getName()
            + "',"
            + "'"
            + spawn.getSpawn().getX()
            + "',"
            + "'"
            + spawn.getSpawn().getY()
            + "',"
            + "'"
            + spawn.getSpawn().getZ()
            + "',"
            + "'"
            + spawn.getSpawn().getYaw()
            + "',"
            + "'"
            + spawn.getSpawn().getPitch()
            + "'"
            + ");";

    for (int i = 0; i < spawns.size(); ++i) {
      if (spawns.get(i).getWorld().getName().equalsIgnoreCase(spawn.getWorld().getName())) {
        query =
            "UPDATE `perks_spawn` SET "
                + "x='"
                + spawn.getSpawn().getX()
                + "', "
                + "y='"
                + spawn.getSpawn().getY()
                + "', "
                + "z='"
                + spawn.getSpawn().getZ()
                + "', "
                + "yaw='"
                + spawn.getSpawn().getYaw()
                + "', "
                + "pitch='"
                + spawn.getSpawn().getPitch()
                + "' "
                + "WHERE world='"
                + spawn.getWorld().getName()
                + "'"
                + ";";
        spawns.remove(i);
        break;
      }
    }

    m_perksDB.query(query, true);
    spawns.add(spawn);
    PerkUtils.DebugConsole("Adding spawn for " + spawn.getWorld().getName());
  }