예제 #1
0
  public boolean isInSpawnTime() {
    GameTime gameTime = GameTimeManager.getGameTime();
    Integer spawnHour = geSpawnHour();
    Integer spawnDay = geSpawnDay();
    Integer spawnMonth = getSpawnMonth();
    Integer despawnHour = geDespawnHour();
    Integer despawnDay = geDespawnDay();
    Integer despawnMonth = getDespawnMonth();
    int curentHour = gameTime.getHour();
    int curentDay = gameTime.getDay();
    int curentMonth = gameTime.getMonth();

    if (spawnMonth != null) {
      if (!checkTime(curentMonth, spawnMonth, despawnMonth)) {
        return false;
      }
    }
    if (spawnDay != null) {
      if (!checkTime(curentDay, spawnDay, despawnDay)) {
        return false;
      }
    }
    if (spawnMonth == null && spawnDay == null && !checkHour(curentHour, spawnHour, despawnHour)) {
      return false;
    }
    return true;
  }
예제 #2
0
 private boolean isTime(Integer hour, Integer day, Integer month) {
   GameTime gameTime = GameTimeManager.getGameTime();
   if (hour != null && hour == gameTime.getHour()) {
     if (day == null) {
       return true;
     }
     if (day == gameTime.getDay()) {
       return month == null || month == gameTime.getMonth();
     }
   }
   return false;
 }