コード例 #1
0
ファイル: Sniper.java プロジェクト: GunfighterJ/VoxelSniper
 /** @param undo */
 public final void storeUndo(final Undo undo) {
   if (Sniper.undoCacheSize <= 0) {
     return;
   }
   if (undo != null && undo.getSize() > 0) {
     while (this.undoList.size() > Sniper.undoCacheSize) {
       this.undoList.pop();
     }
     this.undoList.add(undo);
   }
 }
コード例 #2
0
ファイル: Sniper.java プロジェクト: GunfighterJ/VoxelSniper
 /** @param num */
 public final void doUndo(final int num) {
   int _sum = 0;
   if (this.undoList.isEmpty()) {
     this.player.sendMessage(ChatColor.GREEN + "Nothing to undo");
   } else {
     for (int _x = 0; _x < num; _x++) {
       final Undo _undo = this.undoList.pollLast();
       if (_undo != null) {
         _undo.undo();
         _sum += _undo.getSize();
       } else {
         break;
       }
     }
     this.player.sendMessage(
         ChatColor.GREEN
             + "Undo succesfull!  "
             + ChatColor.RED
             + _sum
             + ChatColor.GREEN
             + "  Blocks have been replaced.");
   }
 }