コード例 #1
0
 public Position.Public getRelativePosition(Position.Player playerPos) {
   Public answer = this;
   if (!answer.equals(MID)) {
     switch (playerPos) {
       case TOP:
         {
           answer =
               Public.values()[
                   ((this.ordinal() + TOPDEVIATION) % ELEMENTSINCYCLE)
                       + (ELEMENTSINCYCLE * (int) (this.ordinal() / ROWS))];
           break;
         }
       case RIGHT:
         {
           answer =
               Public.values()[
                   ((this.ordinal() + RIGHTDEVIATION) % ELEMENTSINCYCLE)
                       + (ELEMENTSINCYCLE * (int) (this.ordinal() / ROWS))];
           break;
         }
       case LEFT:
         {
           answer =
               Public.values()[
                   ((this.ordinal() + LEFTDEVIATION) % ELEMENTSINCYCLE)
                       + (ELEMENTSINCYCLE * (int) (this.ordinal() / ROWS))];
           break;
         }
       default:
         {
         }
     }
   }
   return answer;
 }
コード例 #2
0
    public Position reArrangeRelativePosition(Player oldPlayerPos, Player newPlayerPos) {
      Public answer = this;
      if (!this.equals(Position.Public.MID)) {
        int diff = oldPlayerPos.ordinal() - newPlayerPos.ordinal();
        if (diff < 0) {
          diff = 4 + diff;
        }
        answer =
            Public.values()[
                ((this.ordinal() + diff) % ELEMENTSINCYCLE)
                    + (ELEMENTSINCYCLE * (int) (this.ordinal() / ROWS))];
      }

      return answer;
    }
コード例 #3
0
 public static void logout() {
   Session.current().clear();
   Public.index();
 }
コード例 #4
0
 @Before
 static void checkAuthentification() {
   if (session.get("user") == null) Public.login(null, null);
 }