コード例 #1
0
ファイル: Test.java プロジェクト: Co0sh/BetonTest
 /** Handles the correct answer for this player. */
 public void correct(Player player) {
   Category current = players.get(player.getUniqueId());
   current.removePlayer(player);
   int index = categories.indexOf(current);
   if (index + 1 == categories.size()) {
     players.remove(player.getUniqueId());
     chances.remove(player.getUniqueId());
     pass(player);
   } else {
     Category next = categories.get(index + 1);
     players.put(player.getUniqueId(), next);
     next.addPlayer(player);
   }
   new Saver(plugin);
 }
コード例 #2
0
ファイル: Test.java プロジェクト: Co0sh/BetonTest
 /** Handles the correct answer for this player. */
 public void incorrect(Player player) {
   Category current = players.get(player.getUniqueId());
   current.removePlayer(player);
   int index = categories.indexOf(current);
   Integer chance = chances.get(player.getUniqueId());
   chance--;
   plugin.getData().set(player.getUniqueId() + ".current.chances", chance);
   if (chance <= 0) {
     players.remove(player.getUniqueId());
     chances.remove(player.getUniqueId());
     fail(player);
   } else {
     chances.put(player.getUniqueId(), chance);
     switch (onMistake) {
       case NEXT:
         Category next = categories.get(index + 1);
         players.put(player.getUniqueId(), next);
         next.addPlayer(player);
         break;
       case NOTHING:
         current.addPlayer(player);
         break;
       case RESTART:
         Category first = categories.get(0);
         players.put(player.getUniqueId(), first);
         first.addPlayer(player);
         break;
       case PAUSE:
         players.remove(player.getUniqueId());
         paused.add(player.getUniqueId());
         pause(player);
         break;
     }
   }
   new Saver(plugin);
 }