Пример #1
0
 @SuppressWarnings("unchecked")
 protected LockedBlock(ResultSet r, String typeId)
     throws SQLException, ClassNotFoundException, IOException {
   this.lockId = r.getLong("ID");
   this.l =
       new Location(
           Bukkit.getWorld(r.getString("World")), r.getLong("X"), r.getLong("Y"), r.getLong("Z"));
   this.ownerId = r.getLong("Owner");
   this.guests = (ArrayList<Long>) Serializer.deserialize(r.getString("Guests"));
   this.level = LockLevel.getLevel(r.getInt("AccessLevel"));
   this.typeId = typeId;
 }
 @Override
 public WritableScope changeLockLevel(LockLevel lockLevel) {
   if (lockLevel.ordinal() < this.lockLevel.ordinal()) {
     throw new IllegalStateException(
         "cannot lower lock level from "
             + this.lockLevel
             + " to "
             + lockLevel
             + " at "
             + debugName);
   }
   this.lockLevel = lockLevel;
   return this;
 }
Пример #3
0
 /**
  * Gets the access level corresponding to a specific level ID from the SQL database.
  *
  * @param levelId The level ID of the access level to find.
  * @return If the level was found, it is returned, otherwise LockLevel.UNKNOWN is returned.
  */
 public static LockLevel getLevel(int levelId) {
   for (LockLevel l : LockLevel.values()) {
     if (l.levelId == levelId) return l;
   }
   return LockLevel.UNKNOWN;
 }