示例#1
0
        public static void Cut(User user)
        {
            try
            {
                UserSession userSession = WorldEditManager.GetUserSession(user);
                WorldRange  region      = userSession.Selection;

                WorldEditCommand command = new CopyCommand(user);
                if (command.Invoke(region))
                {
                    user.Player.MsgLoc($"Copy done in {command.ElapsedMilliseconds}ms.");
                    command = new SetCommand(user, "Empty");
                    if (command.Invoke(region))
                    {
                        user.Player.MsgLoc($"{command.BlocksChanged} blocks cleared in {command.ElapsedMilliseconds}ms.");
                    }
                }
            }
            catch (WorldEditCommandException e)
            {
                user.Player.ErrorLocStr(e.Message);
            }
            catch (Exception e)
            {
                Log.WriteError(Localizer.Do($"{e}"));
            }
        }
示例#2
0
 public static void Copy(User user)
 {
     try
     {
         WorldEditCommand command = new CopyCommand(user);
         if (command.Invoke())
         {
             user.Player.MsgLoc($"Copy done in {command.ElapsedMilliseconds}ms.");
         }
     }
     catch (WorldEditCommandException e)
     {
         user.Player.ErrorLocStr(e.Message);
     }
     catch (Exception e)
     {
         Log.WriteError(Localizer.Do($"{e}"));
     }
 }
示例#3
0
 private void copyToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CopyCommand?.Invoke(sender, e);
 }